base/src/sqwl/cms/layout/Navbar.scala
author Tomas Zeman <tzeman@volny.cz>
Thu, 06 Dec 2018 13:35:32 +0100
changeset 8 8e0809dad9f7
parent 7 50a354e5bda4
child 12 e7512f9dc903
permissions -rw-r--r--
Fixed links to category, article

package sqwl.cms.layout

import scalatags.Text.TypedTag
import scalatags.Text.all._
import sqwl.cms.{ViewState, config, iContent}

object Navbar extends config {

  def apply(cnt: iContent, st: ViewState): TypedTag[String] = {

    /*
    val navMenu = ul(cls:="nav navbar-nav navbar-right",
      li(a(href:="#about", "O aplikaci"))
    )
    */

    val navSections = ul(cls:="nav navbar-nav navbar-section", width:="100%",
      cnt.categories map(c =>
        li(cls:="text-center", a(href:=s"/${http.prefix}/${c.pathSegment}", c.name))
      )
    )

    header(cls:="navbar navbar-default navbar-fixed-top",
      div(cls:="navbar-inner",
        div(cls:="container",
          div(cls:="navbar-header",
            button(`type`:="button", cls:="navbar-toggle collapsed",
              attr("data-toggle"):="collapse",
              attr("data-target"):="#navbar1",
              span(cls:="sr-only", "Navigation"),
              span(cls:="icon-bar"),
              span(cls:="icon-bar"),
              span(cls:="icon-bar")
            ),
            a(href:="#", cls:="navbar-brand", paddingTop:=4, paddingBottom:=4,
              img(src:=s"/${http.prefix}/public/${cnt.icon._1}",
                alt:=cnt.appTitleShort, width:=40, height:=40)),
            a(href:="#", cls:="navbar-brand visible-xs",
              span(cnt.appTitleShort)),
            a(href:="#", cls:="navbar-brand hidden-xs",
              span(cnt.appTitle))
          )
          //tag("nav")(cls:="hidden-xs", navMenu)
        )
      ),
      div(cls:="collapse navbar-collapse", id:="navbar1",
        div(cls:="container", navSections))
    )
  }

}