All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hyperscala.jquery.ui.jQueryUI.scala Maven / Gradle / Ivy

The newest version!
package org.hyperscala.jquery.ui

import com.outr.net.http.session.Session
import org.hyperscala.html._
import org.hyperscala.jquery.jQuery
import org.hyperscala.jquery.dsl._
import org.hyperscala.module.Module
import org.hyperscala.web._
import org.powerscala.Version
import org.powerscala.property.Property

/**
 * @author Matt Hicks 
 */
object jQueryUI extends Module {
  val name = "jquery-ui"
  val version = Version(1, 11, 2)
  val theme = Property[Theme](default = Option(Theme.Redmond))

  override def dependencies = List(jQuery)

  override def init(website: Website) = {}

  private def v = version.general

  override def load(webpage: Webpage) = {
    webpage.head.contents += new tag.Link(href = themeCSS, rel = "stylesheet")
    //    webpage.head.contents += new tag.Link(href = "/jquery-ui-1.10.4/css/jquery-ui-fixes.css", rel = "stylesheet")
    webpage.head.contents += new tag.Script(src = s"//code.jquery.com/ui/$v/jquery-ui.min.js")
  }

  def themeCSS = {
    val t = theme()
    if (t.cssPath != null) {
      t.cssPath
    } else {
      s"//code.jquery.com/ui/$v/themes/${t.directory}/jquery-ui.min.css"
    }
  }

  def tabs(t: HTMLTag) = {
    t.require(this)
    t.connected[Webpage] {
      case webpage => webpage.eval($(t).call("tabs()"))
    }
  }

  def menu(t: HTMLTag) = {
    t.require(this)
    t.connected[Webpage] {
      case webpage => webpage.eval($(t).call("menu()"))
    }
  }

  def datepicker(t: HTMLTag) = {
    t.require(this)
    t.connected[Webpage] {
      case webpage => webpage.eval($(t).call("datepicker()"))
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy