15 */ |
15 */ |
16 package bootstrap.liftweb |
16 package bootstrap.liftweb |
17 |
17 |
18 import net.liftweb.common._ |
18 import net.liftweb.common._ |
19 import net.liftweb.http._ |
19 import net.liftweb.http._ |
|
20 import net.liftweb.http.js.JsObj |
|
21 import net.liftweb.http.js.JE.JsObj |
20 import net.liftweb.mapper._ |
22 import net.liftweb.mapper._ |
21 import net.liftweb.sitemap._ |
23 import net.liftweb.sitemap._ |
22 import net.liftweb.sitemap.Loc._ |
24 import net.liftweb.sitemap.Loc._ |
|
25 import net.liftweb.widgets.menu.MenuStyle |
|
26 import net.liftweb.widgets.menu.{MenuWidget => LiftMenuWidget} |
23 import net.liftweb.util._ |
27 import net.liftweb.util._ |
24 import net.liftweb.widgets.menu.MenuWidget |
|
25 import net.tz.lift.snippet.ActionLinks |
28 import net.tz.lift.snippet.ActionLinks |
26 import net.tz.lift.util.YmdDateTimeConverter |
29 import net.tz.lift.util.YmdDateTimeConverter |
27 import radview.model._ |
30 import radview.model._ |
28 import radview.snippet._ |
31 import radview.snippet._ |
29 import scala.xml.NodeSeq |
32 import scala.xml.NodeSeq |
55 |
58 |
56 /* Snippet dispatch */ |
59 /* Snippet dispatch */ |
57 LiftRules.snippetDispatch.append { |
60 LiftRules.snippetDispatch.append { |
58 case "Menubar" => new AnyRef with DispatchSnippet { |
61 case "Menubar" => new AnyRef with DispatchSnippet { |
59 def dispatch: DispatchIt = { |
62 def dispatch: DispatchIt = { |
60 case _ => { xhtml => MenuWidget() } |
63 case _ => { xhtml => |
|
64 new MenuWidget(MenuStyle.HORIZONTAL, JsObj(), Nil) render |
|
65 } |
61 } |
66 } |
62 } |
67 } |
63 case "action-links" => ActionLinks |
68 case "action-links" => ActionLinks |
64 } |
69 } |
65 |
70 |
70 Menu.i("Home") / "index" >> Hidden, |
75 Menu.i("Home") / "index" >> Hidden, |
71 Menu(CellSnippet), |
76 Menu(CellSnippet), |
72 Menu.i("Cells") / "cell", |
77 Menu.i("Cells") / "cell", |
73 Menu(SessionSnippet), |
78 Menu(SessionSnippet), |
74 Menu(AccountSnippet), |
79 Menu(AccountSnippet), |
75 Menu.i("Accounts") / "account" |
80 Menu.i("Accounts") / "account", |
|
81 DynIpSnippet.menu |
76 )) |
82 )) |
77 |
83 |
78 /* Menu widget */ |
84 /* Menu widget */ |
79 MenuWidget.init() |
85 LiftMenuWidget.init() |
80 |
86 |
81 /* Http conf */ |
87 /* Http conf */ |
82 LiftRules.logServiceRequestTiming = false |
88 LiftRules.logServiceRequestTiming = false |
83 LiftRules.early.append(_.setCharacterEncoding("UTF-8")) |
89 LiftRules.early.append(_.setCharacterEncoding("UTF-8")) |
84 } |
90 } |
92 DB.defineConnectionManager(connId, vendor) |
98 DB.defineConnectionManager(connId, vendor) |
93 vendor.newConnection(connId) |
99 vendor.newConnection(connId) |
94 } |
100 } |
95 } |
101 } |
96 |
102 |
|
103 class MenuWidget(style: MenuStyle.Value, jsObj: JsObj, groups : List[String]) |
|
104 extends LiftMenuWidget(style, jsObj, groups) { |
|
105 |
|
106 override def render: NodeSeq = { |
|
107 head ++ <div>{groups match { |
|
108 case Nil => |
|
109 <lift:Menu.builder expandAll="true" linkToSelf="true" top:class={style.toString} /> |
|
110 case xs => groups.flatMap(group => |
|
111 <lift:Menu.builder expandAll="true" linkToSelf="true" top:class={style.toString} group={group} />) |
|
112 }}</div> |
|
113 } |
|
114 } |
|
115 |
|
116 |
97 // vim: set ts=2 sw=2 et: |
117 // vim: set ts=2 sw=2 et: |