liquid_feedback_frontend
changeset 241:6725c13b6ce0
Add initial unit support
author | bsw |
---|---|
date | Fri Dec 30 02:59:43 2011 +0100 (2011-12-30) |
parents | 910bbf6bc6b1 |
children | 2dc13655afca |
files | app/main/_filter/20_session.lua app/main/_filter_view/30_navigation.lua app/main/area/list.lua app/main/index/_action/set_current_units.lua app/main/issue/_show_head.lua app/main/member/_profile.lua model/area.lua model/unit.lua |
line diff
1.1 --- a/app/main/_filter/20_session.lua Tue Dec 27 03:34:35 2011 +0100 1.2 +++ b/app/main/_filter/20_session.lua Fri Dec 30 02:59:43 2011 +0100 1.3 @@ -13,4 +13,6 @@ 1.4 1.5 locale.set{lang = app.session.lang or config.default_lang or "en"} 1.6 1.7 +request.set_perm_param("units", param.get("units")) 1.8 + 1.9 execute.inner()
2.1 --- a/app/main/_filter_view/30_navigation.lua Tue Dec 27 03:34:35 2011 +0100 2.2 +++ b/app/main/_filter_view/30_navigation.lua Fri Dec 30 02:59:43 2011 +0100 2.3 @@ -12,6 +12,34 @@ 2.4 end 2.5 2.6 if app.session.member or config.public_access then 2.7 + 2.8 + local units = Unit:get_flattened_tree() 2.9 + 2.10 + ui.form{ 2.11 + module = "index", action = "set_current_units", 2.12 + routing = { default = { mode = "redirect", module = "area", view = "list" } }, 2.13 + content = function() 2.14 + ui.tag{ 2.15 + tag = "select", 2.16 + attr = { name = "unit_ids", onchange = "this.form.submit();" }, 2.17 + content = function () 2.18 + for i, unit in ipairs(units) do 2.19 + local selected 2.20 + -- TODO support multiple units 2.21 + if unit.id == param.get("units", atom.integer) then 2.22 + selected = "selected" 2.23 + end 2.24 + ui.tag{ 2.25 + tag = "option", 2.26 + attr = { value = unit.id, selected = selected }, 2.27 + content = unit.name 2.28 + } 2.29 + end 2.30 + end 2.31 + } 2.32 + end 2.33 + } 2.34 + 2.35 ui.link{ 2.36 image = { static = "icons/16/package.png" }, 2.37 text = _"Areas",
3.1 --- a/app/main/area/list.lua Tue Dec 27 03:34:35 2011 +0100 3.2 +++ b/app/main/area/list.lua Fri Dec 30 02:59:43 2011 +0100 3.3 @@ -1,4 +1,6 @@ 3.4 -local areas_selector = Area:build_selector{ active = true } 3.5 +-- TODO support multiple units 3.6 +local unit_id = param.get("units", atom.integer) 3.7 +local areas_selector = Area:build_selector{ active = true, unit_id = unit_id } 3.8 3.9 3.10 if app.session.member_id then
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/app/main/index/_action/set_current_units.lua Fri Dec 30 02:59:43 2011 +0100 4.3 @@ -0,0 +1,6 @@ 4.4 +-- TODO support multiple units 4.5 +local current_unit_id = param.get("unit_ids", atom.integer) 4.6 + 4.7 +request.set_perm_param("units", current_unit_id) 4.8 + 4.9 +
5.1 --- a/app/main/issue/_show_head.lua Tue Dec 27 03:34:35 2011 +0100 5.2 +++ b/app/main/issue/_show_head.lua Fri Dec 30 02:59:43 2011 +0100 5.3 @@ -194,12 +194,6 @@ 5.4 } 5.5 end 5.6 5.7 - execute.view{ 5.8 - module = "issue", 5.9 - view = "_show_vote_later_box", 5.10 - params = { issue = issue } 5.11 - } 5.12 - 5.13 end 5.14 5.15 if config.issue_discussion_url_func then
6.1 --- a/app/main/member/_profile.lua Tue Dec 27 03:34:35 2011 +0100 6.2 +++ b/app/main/member/_profile.lua Fri Dec 30 02:59:43 2011 +0100 6.3 @@ -111,7 +111,7 @@ 6.4 } 6.5 end 6.6 6.7 - ui.field.text{ label = _"Last login (updated daily)", value = format.date(member.last_login_public) or _"not yet" } 6.8 + ui.field.text{ label = _"Last activity (updated daily)", value = format.date(member.last_activity) or _"not yet" } 6.9 6.10 end 6.11 }
7.1 --- a/model/area.lua Tue Dec 27 03:34:35 2011 +0100 7.2 +++ b/model/area.lua Fri Dec 30 02:59:43 2011 +0100 7.3 @@ -63,5 +63,8 @@ 7.4 if args.active ~= nil then 7.5 selector:add_where{ "active = ?", args.active } 7.6 end 7.7 + if args.unit_id ~= nil then 7.8 + selector:add_where{ "unit_id = ?", args.unit_id } 7.9 + end 7.10 return selector 7.11 end
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/model/unit.lua Fri Dec 30 02:59:43 2011 +0100 8.3 @@ -0,0 +1,17 @@ 8.4 +Unit = mondelefant.new_class() 8.5 +Unit.table = 'unit' 8.6 + 8.7 +Unit:add_reference{ 8.8 + mode = '1m', 8.9 + to = "Area", 8.10 + this_key = 'id', 8.11 + that_key = 'unit_id', 8.12 + ref = 'areas', 8.13 + back_ref = 'unit' 8.14 +} 8.15 + 8.16 +function Unit:get_flattened_tree() 8.17 + -- TODO implement 8.18 + 8.19 + return Unit:new_selector():exec() 8.20 +end