scaladget
Scaladget provides a scala facades of some famous javascript libraries. It relies on the scala-js project. Among them:
##Usage## Just add this to your dependencies:
libraryDependencies += "fr.iscpif" %%% "scaladget" % "0.7.0"
All the facades are intensively used in the OpenMOLE project.
##D3 wrapper## An example using the scaladget D3 wrapper can be found in the ScalaWUI project: FlowChart. It reproduces this D3 flowchart.
##Bootstrap library## The boostrap facade can be used directly or by means of a higher level library, which render transparent the use of simple elements such div, span, button, etc...
Here are 3 examples:
import fr.iscpif.scaladget.api.{ BootstrapTags ⇒ bs}
import bs._
// Build a 12 columm a Boostrap div composed of 3 column divs
bs.div("myClass")(
bs.div(col_md_8)("Something long to write on 8 colomuns"),
bs.div(col_md_2)("Something smaller on 2 colomuns"),
bs.div(col_md_2)("Something smaller on 2 colomuns")
)
// A button with the Primary style, doing the action todo on click.
bs.button(
"Save",
btn_primary + key("otherClass"),
() ⇒ {todo}
)
// Build the famous Bootstrap dialog
modalDialog(
"DialogID",
headerDialog("My nice header"),
bodyDialog("My body content"),
footerDialog("My footer content")
)
Scaladget also provides a higher level API for the Bootstrap use: BootstrapTags
##Tooltipster## Here is an example for adding a tooltip on a div dynamically, using scalatags.
import org.scalajs.jquery
import scalatags.JsDom._
import fr.iscpif.scaladget.mapping.tooltipster._
import fr.iscpif.scaladget.tooltipster._
val ttdiv = div(
title := "My message"
).render
ttdiv.appendChild(h)
val options = TooltipsterOptions.
position("left)".
delay(400)
jquery.jQuery(ttdiv).tooltipster(options)
ttdiv