YC.Web


Adding new algorithm

To create new algorithm page add to project two files: AlgorithmNameClient.fs and AlgorithmNameServer.fs

Then edit next type adding link for new page:

1: 
2: 
3: 
4: 
type EndPoint =
    | [<EndPoint "/">] Home
    | [<EndPoint "/BioGraph">] BioGraph
    | [<EndPoint "/NewPageLink">] NewPageLink

Next, create function that will generate empty page:

1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
let NewPageLink ctx =
    Templating.Main ctx EndPoint.NewPageLink "NewPageLink" [
        Div [
                H1 [Text "Your app"] -< [Attr.Align "center"]
                ] -< [Attr.Class "jumbotron"]
        Div [
            ClientSide <@ NewPageLinkClient.MainFormRun () @>
            ]   -< [Attr.Align "center"]

Where NewPage.MainFormRun () is a form that you have to run from NewPageClient.fs file using WebComponents module.

This is the example of empty page:

2

To add descriptional form for you algorithm on main page add next code:

1: 
2: 
3: 
4: 
5: 
6: 
let NewPageForm = {
            Name = "NewPage"; 
            Description =  "Small algorithm description"; 
            Link = (ctx.Link EndPoint.NewPageLink)
        }
yield (NewPage.CreateForm())
1
Fork me on GitHub