liquid_feedback_frontend

view app/main/_filter_view/30_navigation.lua @ 250:272193cc190e

Visually polish unit selector
author bsw
date Fri Dec 30 03:15:54 2011 +0100 (2011-12-30)
parents 6725c13b6ce0
children 743194cbdd89
line source
1 slot.put_into("app_name", config.app_title)
3 slot.select('navigation', function()
5 if app.session.member then
6 ui.link{
7 image = { static = "icons/16/house.png" },
8 text = _"Home",
9 module = 'index',
10 view = 'index'
11 }
12 end
14 if app.session.member or config.public_access then
16 local units = Unit:get_flattened_tree()
18 ui.form{
19 attr = { class = "unit_selector" },
20 module = "index", action = "set_current_units",
21 routing = { default = { mode = "redirect", module = "area", view = "list" } },
22 content = function()
23 ui.tag{
24 tag = "select",
25 attr = { name = "unit_ids", onchange = "this.form.submit();" },
26 content = function ()
27 for i, unit in ipairs(units) do
28 local selected
29 -- TODO support multiple units
30 if unit.id == param.get("units", atom.integer) then
31 selected = "selected"
32 end
33 ui.tag{
34 tag = "option",
35 attr = { value = unit.id, selected = selected },
36 content = unit.name
37 }
38 end
39 end
40 }
41 end
42 }
44 ui.link{
45 image = { static = "icons/16/package.png" },
46 text = _"Areas",
47 module = 'area',
48 view = 'list'
49 }
51 end
53 if app.session.member == nil then
54 ui.link{
55 image = { static = "icons/16/key.png" },
56 text = _"Login",
57 module = 'index',
58 view = 'login',
59 params = {
60 redirect_module = request.get_module(),
61 redirect_view = request.get_view(),
62 redirect_id = param.get_id()
63 }
64 }
65 ui.link{
66 image = { static = "icons/16/book_edit.png" },
67 text = _"Registration",
68 module = 'index',
69 view = 'register'
70 }
71 ui.link{
72 image = { static = "icons/16/key_forgot.png" },
73 text = _"Reset password",
74 module = 'index',
75 view = 'reset_password'
76 }
77 ui.link{
78 image = { static = "icons/16/information.png" },
79 text = _"About / Impressum",
80 module = 'index',
81 view = 'about'
82 }
83 else
85 ui.link{
86 image = { static = "icons/16/time.png" },
87 text = _"Timeline",
88 module = "timeline",
89 view = "index"
90 }
92 ui.link{
93 image = { static = "icons/16/group.png" },
94 text = _"Members",
95 module = 'member',
96 view = 'list',
97 params = { member_list = "newest" }
98 }
100 ui.link{
101 image = { static = "icons/16/book_edit.png" },
102 text = _"Contacts",
103 module = 'contact',
104 view = 'list'
105 }
107 ui.link{
108 image = { static = "icons/16/information.png" },
109 text = _"About",
110 module = 'index',
111 view = 'about'
112 }
114 if app.session.member.admin then
116 slot.put(" ")
118 ui.link{
119 attr = { class = { "admin_only" } },
120 image = { static = "icons/16/cog.png" },
121 text = _"Admin",
122 module = 'admin',
123 view = 'index'
124 }
126 end
127 end
129 end)
131 if config.app_logo then
132 slot.select("logo", function()
133 ui.image{ static = config.app_logo }
134 end)
135 end
137 execute.inner()

Impressum / About Us