base/src/sqwl/cms/layout/Navbar.scala
changeset 31 5c4364d6e726
parent 12 e7512f9dc903
equal deleted inserted replaced
30:12cda49d6c84 31:5c4364d6e726
       
     1 /*
       
     2  * Copyright 2018-2020 Tomas Zeman <tomas@functionals.cz>
       
     3  *
       
     4  * Licensed under the Apache License, Version 2.0 (the "License");
       
     5  * you may not use this file except in compliance with the License.
       
     6  * You may obtain a copy of the License at
       
     7  *
       
     8  *     http://www.apache.org/licenses/LICENSE-2.0
       
     9  *
       
    10  * Unless required by applicable law or agreed to in writing, software
       
    11  * distributed under the License is distributed on an "AS IS" BASIS,
       
    12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       
    13  * See the License for the specific language governing permissions and
       
    14  * limitations under the License.
       
    15  */
     1 package sqwl.cms.layout
    16 package sqwl.cms.layout
     2 
    17 
     3 import scalatags.Text.TypedTag
    18 import scalatags.Text.TypedTag
     4 import scalatags.Text.all._
    19 import scalatags.Text.all._
     5 import sqwl.cms._
    20 import sqwl.cms._
     6 
    21 
     7 object Navbar extends config {
    22 object Navbar extends config {
     8 
    23 
     9   def apply(cnt: iContent, st: ViewState): TypedTag[String] = {
    24   def apply(cnt: iContent, st: ViewState): TypedTag[String] = {
    10 
    25 
    11     /*
       
    12     val navMenu = ul(cls:="nav navbar-nav navbar-right",
       
    13       li(a(href:="#about", "O aplikaci"))
       
    14     )
       
    15     */
       
    16 
       
    17     def activeCls(c: iCategory): String = {
    26     def activeCls(c: iCategory): String = {
    18       st match {
    27       st match {
    19         case ViewCategory(v) if v == c => "active"
    28         case ViewCategory(v) if v == c => "active"
    20         case ViewArticle(v) if v.category contains(c) => "active"
    29         case ViewArticle(v) if v.category contains c => "active"
    21         case _ => ""
    30         case _ => ""
    22       }
    31       }
    23     }
    32     }
    24 
    33 
    25     val navSections = ul(cls:="nav navbar-nav navbar-section", width:="100%",
    34     val navSections = ul(cls:="nav navbar-nav navbar-section", width:="100%",