liquid_feedback_frontend
diff app/main/admin/area_list.lua @ 193:46351752814f
Admin module refactored
| author | bsw |
|---|---|
| date | Mon Nov 08 15:04:44 2010 +0100 (2010-11-08) |
| parents | 3bfb2fcf7ab9 |
| children | f42d16567c5d |
line diff
1.1 --- a/app/main/admin/area_list.lua Mon Nov 08 02:39:30 2010 +0100 1.2 +++ b/app/main/admin/area_list.lua Mon Nov 08 15:04:44 2010 +0100 1.3 @@ -1,52 +1,47 @@ 1.4 -local show_not_in_use = param.get("show_not_in_use", atom.boolean) 1.5 +local show_not_in_use = param.get("show_not_in_use", atom.boolean) or false 1.6 1.7 -local selector = Area:new_selector() 1.8 -if show_not_in_use then 1.9 - selector:add_where("NOT active") 1.10 -else 1.11 - selector:add_where("active") 1.12 -end 1.13 +local areas = Area:build_selector{ active = not show_not_in_use }:exec() 1.14 1.15 -local areas = selector:exec() 1.16 1.17 slot.put_into("title", _"Area list") 1.18 1.19 -if app.session.member.admin then 1.20 - slot.select("actions", function() 1.21 - if show_not_in_use then 1.22 - ui.link{ 1.23 - attr = { class = { "admin_only" } }, 1.24 - text = _"Show areas in use", 1.25 - module = "admin", 1.26 - view = "area_list" 1.27 - } 1.28 - else 1.29 - ui.link{ 1.30 - attr = { class = { "admin_only" } }, 1.31 - text = _"Create new area", 1.32 - module = "admin", 1.33 - view = "area_show" 1.34 - } 1.35 - ui.link{ 1.36 - attr = { class = { "admin_only" } }, 1.37 - text = _"Show areas not in use", 1.38 - module = "admin", 1.39 - view = "area_list", 1.40 - params = { show_not_in_use = true } 1.41 - } 1.42 - end 1.43 - end) 1.44 -end 1.45 + 1.46 +slot.select("actions", function() 1.47 + 1.48 + if show_not_in_use then 1.49 + ui.link{ 1.50 + attr = { class = { "admin_only" } }, 1.51 + text = _"Show areas in use", 1.52 + module = "admin", 1.53 + view = "area_list" 1.54 + } 1.55 + 1.56 + else 1.57 + ui.link{ 1.58 + attr = { class = { "admin_only" } }, 1.59 + text = _"Create new area", 1.60 + module = "admin", 1.61 + view = "area_show" 1.62 + } 1.63 + ui.link{ 1.64 + attr = { class = { "admin_only" } }, 1.65 + text = _"Show areas not in use", 1.66 + module = "admin", 1.67 + view = "area_list", 1.68 + params = { show_not_in_use = true } 1.69 + } 1.70 + end 1.71 + 1.72 +end) 1.73 + 1.74 1.75 ui.list{ 1.76 records = areas, 1.77 columns = { 1.78 - { 1.79 - label = _"Area", 1.80 - name = "name" 1.81 - }, 1.82 - { 1.83 - content = function(record) 1.84 + 1.85 + { label = _"Area", name = "name" }, 1.86 + 1.87 + { content = function(record) 1.88 if app.session.member.admin then 1.89 ui.link{ 1.90 attr = { class = { "action admin_only" } }, 1.91 @@ -58,5 +53,6 @@ 1.92 end 1.93 end 1.94 } 1.95 + 1.96 } 1.97 } 1.98 \ No newline at end of file