I just retired the handlebars templates that I have been using to render 
static content - they have now been replaced with Elm views which are 
rendered server side. The result is not very fast running under 
Java8+Nashorn, but I am not overly concerned with that; its relatively 
static content so I'll put in a caching layer at some point to take care of 
the performance issue.

Here is my plan: I will use the same view logic on client and server side. 
In server mode, the result is Html Never. In client mode, when logged in, 
the user will be able to select and edit content directly on the page; the 
result will be some Html msg type. Markdown is the principal format in 
which my content is written, so when selecting some content to edit, it 
will be replaced with a markdown editor and a tool bar for other functions 
needed for the edit. I don't need anything too fancy to begin with - a text 
box and a set of save/cancel buttons should be good enough.

I have been thinking about how to do this, whether I should use some fancy 
markdown editor written in javascript or as a webcomponent or what. But I 
think a view built with higher order functions will really take advantage 
of what can be done with functional languages and leverage Elm to its 
advantages.

The way I will share the same view logic to handle both situations, is to 
pass a function into the view. In server mode, the function will render 
content as Html Never. In client mode it will inject all the editor 
functionality into the same view. This means breaking out the view code 
into lots of little functions to render different pieces of content, then 
building up the editor function to use them OR flip to an editable mode.

The content model I am using is fairly rich and extensible. The editor will 
also need functions to navigate and manipulate the content tree, add 
completely new content, or add new pieces of child content within a content 
type that is more structured and consists of many pieces of content 
combined together to form a page. Its somewhat inspired by work I did on 
the mygov.scot site, but more carefully re-designed.

Should keep me busy for the first quarter of 2017. Happy coding :-)


-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to