Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make HTML generation configurable #120

Closed
jmvanel opened this issue Jan 1, 2017 · 1 comment
Closed

Make HTML generation configurable #120

jmvanel opened this issue Jan 1, 2017 · 1 comment

Comments

@jmvanel
Copy link
Owner

jmvanel commented Jan 1, 2017

For a Scala developper to change or rewrite the HTML generator , possibly with another technology like Mustache or Scala.JS, the code must be made modular, in the spirit of
Chapter 29 Modular Programming Using Objects
http://www.artima.com/pins1ed/modular-programming-using-objects.html#27.3

The situation

The Configuration is modular thanks to filed abstract field config.
So the Configuration could hold a field for the HTML generation implementation.

Currently the HTML generator is a private [html] trait Form2HTML .
It is used by traits TableViewModule and CreationFormAlgo, that instanciate Form2HTMLBanana.

Then TableViewModule and CreationFormAlgo are added by inheritance in the generic application.

There is an attempt at an HTML Form API for front end developer,
trait HTMLFormAPI ,
but it is not used.

jmvanel added a commit that referenced this issue Feb 3, 2017
TODO
- rename trait Form2HTMLBanana to HTMLGenerator, polish API
- FIX TestCreationForm2Jena
jmvanel added a commit that referenced this issue Feb 4, 2017
jmvanel added a commit that referenced this issue Feb 5, 2017
…ion configurable API Scala #120"

remove some PASTED code
jmvanel added a commit that referenced this issue Feb 5, 2017
…ation configurable API Scala" #120

- Selenium suite passes (small trouble unrelated to this commit, probably related to the redirection to /history from /index)
- SBT tests pass
@jmvanel
Copy link
Owner Author

jmvanel commented Feb 5, 2017

Here is an example of overriding a function implementing the form:

    override  def makeBackLinkButton(uri: String, title: String = "") = {
    val tit = if (title == "") s" Reverse links for <$uri>" else title
    <button type="button" 
    		class="btn btn-info" readonly="yes" title={ tit } data-value={s"$uri"}
                onclick={ s"backlinks( '$uri' )" } id={ s"BACK-$uri" }>
    		bla    
    </button>

Just paste this in makeDefaultForm2HTML in Form2HTMLBanana.scala, and the Back Link Button will change its aspect.

The same customization can also be made in Application.scala .

@jmvanel jmvanel closed this as completed Feb 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant