Permalink
Browse files

Creation of Modal trait for Bootstrap integration

  • Loading branch information...
darkfrog26 committed Jan 26, 2019
1 parent 3eb0fda commit 3341741431aaa27222d270c4b48c251585ac1cb1
Showing with 21 additions and 1 deletion.
  1. +1 −1 build.sbt
  2. +20 −0 ui/js/src/main/scala/io/youi/component/bootstrap/Modal.scala
@@ -3,7 +3,7 @@ import sbtcrossproject.CrossPlugin.autoImport.crossProject

name := "youi"
organization in ThisBuild := "io.youi"
version in ThisBuild := "0.9.12"
version in ThisBuild := "0.9.13-SNAPSHOT"
scalaVersion in ThisBuild := "2.12.8"
crossScalaVersions in ThisBuild := List("2.12.8", "2.11.12")
resolvers in ThisBuild += Resolver.sonatypeRepo("releases")
@@ -0,0 +1,20 @@
package io.youi.component.bootstrap

import org.scalajs.dom.html

import scala.scalajs.js

trait Modal {
protected val div: html.Div

protected def call(content: String): Unit = {
js.eval(s"$$('#${div.getAttribute("id")}').modal($content)")
()
}

def show(): Unit = call("'show'")
def hide(): Unit = call("'hide'")
def toggle(): Unit = call("'toggle'")
def handleUpdate(): Unit = call("'handleUpdate'")
def dispose(): Unit = call("'dispose'")
}

0 comments on commit 3341741

Please sign in to comment.