liquid_feedback_frontend
diff app/main/area/show.lua @ 197:c0835d707465
Area module refactored
author | bsw |
---|---|
date | Mon Nov 08 15:30:59 2010 +0100 (2010-11-08) |
parents | 7d0f4721d2f3 |
children | 7ef1e03e4057 |
line diff
1.1 --- a/app/main/area/show.lua Mon Nov 08 15:11:56 2010 +0100 1.2 +++ b/app/main/area/show.lua Mon Nov 08 15:30:59 2010 +0100 1.3 @@ -1,14 +1,20 @@ 1.4 -local area = Area:new_selector():add_where{ "id = ?", param.get_id() }:single_object_mode():exec() 1.5 +local area = Area:by_id(param.get_id()) 1.6 + 1.7 1.8 app.html_title.title = area.name 1.9 app.html_title.subtitle = _("Area") 1.10 1.11 +util.help("area.show") 1.12 + 1.13 + 1.14 if config.feature_rss_enabled then 1.15 util.html_rss_head{ title = _"Initiatives in this area (last created first)", module = "initiative", view = "list_rss", params = { area_id = area.id } } 1.16 util.html_rss_head{ title = _"Initiatives in this area (last updated first)", module = "initiative", view = "list_rss", params = { area_id = area.id } } 1.17 end 1.18 1.19 -slot.put_into("title", encode.html(_"Area '#{name}'":gsub("#{name}", area.name))) 1.20 + 1.21 +slot.put_into("title", encode.html(_("Area '#{name}'", { name = area.name }))) 1.22 + 1.23 1.24 ui.container{ 1.25 attr = { class = "vertical"}, 1.26 @@ -17,7 +23,9 @@ 1.27 end 1.28 } 1.29 1.30 + 1.31 if app.session.member_id then 1.32 + 1.33 slot.select("actions", function() 1.34 ui.link{ 1.35 content = function() 1.36 @@ -29,11 +37,7 @@ 1.37 params = { area_id = area.id } 1.38 } 1.39 end) 1.40 -end 1.41 1.42 -util.help("area.show") 1.43 - 1.44 -if app.session.member_id then 1.45 execute.view{ 1.46 module = "membership", 1.47 view = "_show_box", 1.48 @@ -48,100 +52,6 @@ 1.49 1.50 end 1.51 1.52 ---[[ 1.53 -for i, issue in ipairs(area.issues) do 1.54 - local head_name = "issue_head_content_" .. tostring(issue.id) 1.55 - local name = "issue_content_" .. tostring(issue.id) 1.56 - local icon_name = "issue_icon_" .. tostring(issue.id) 1.57 - ui.container{ 1.58 - attr = { class = "ui_tabs" }, 1.59 - content = function() 1.60 - local onclick = 1.61 - 'if (ui_tabs_active["' .. name .. '"]) {' .. 1.62 - 'el=document.getElementById("' .. name .. '");' .. 1.63 - 'el.innerHTML="";' .. 1.64 - 'el.style.display="none";' .. 1.65 - 'ui_tabs_active["' .. name .. '"]=false' .. 1.66 - '} else {' .. 1.67 - 'ui_tabs_active["' .. name .. '"]=true;' .. 1.68 - 'document.getElementById("' .. name .. '").style.display="block"; ' .. 1.69 - 'var hourglass_el = document.getElementById("' .. icon_name .. '");' .. 1.70 - 'var hourglass_src = hourglass_el.src;' .. 1.71 - 'hourglass_el.src = "' .. encode.url{ static = "icons/16/connect.png" } .. '";' .. 1.72 - 'partialMultiLoad(' .. 1.73 - '{ trace: "trace", system_error: "system_error", ' .. name .. '_title: "title", ' .. name .. '_actions: "actions", ' .. name .. '_content: "default" },' .. 1.74 - '{},' .. 1.75 - '"error",' .. 1.76 - '"' .. request.get_relative_baseurl() .. 'issue/show/' .. tostring(issue.id) .. '.html?&_webmcp_json_slots[]=title&_webmcp_json_slots[]=actions&_webmcp_json_slots[]=default&_webmcp_json_slots[]=trace&_webmcp_json_slots[]=system_error&dyn=1",' .. 1.77 - '{},' .. 1.78 - '{},' .. 1.79 - 'function() {' .. 1.80 - 'hourglass_el.src = hourglass_src;' .. 1.81 - '},' .. 1.82 - 'function() {' .. 1.83 - 'hourglass_el.src = hourglass_src;' .. 1.84 - '}' .. 1.85 - '); ' .. 1.86 - '}' .. 1.87 - 'return(false);' 1.88 - ui.link{ 1.89 - attr = { 1.90 - name = name, 1.91 - class = "ui_tabs_accordeon_head", 1.92 - id = head_name, 1.93 - onclick = onclick, 1.94 - }, 1.95 - module = "issue", 1.96 - view = "show", 1.97 - id = issue.id, 1.98 - params = params, 1.99 - anchor = name, 1.100 - content = function() 1.101 - ui.image{ 1.102 - attr = { id = icon_name }, 1.103 - static = "icons/16/script.png" 1.104 - } 1.105 - ui.container{ 1.106 - attr = { style = "float: right;" }, 1.107 - content = function() 1.108 - 1.109 - end 1.110 - } 1.111 - slot.put(tostring(issue.id)) 1.112 - end 1.113 - } 1.114 - end 1.115 - } 1.116 - 1.117 - ui.container{ 1.118 - attr = { 1.119 - id = name, 1.120 - class = "ui_tabs_accordeon_content", 1.121 - }, 1.122 - content = function() 1.123 - ui.container{ attr = { id = name .. "_title", }, content = function() slot.put(" ") end } 1.124 - ui.container{ attr = { id = name .. "_actions", }, content = function() slot.put(" ") end } 1.125 - ui.container{ attr = { id = name .. "_content", }, content = function() 1.126 - execute.view{ 1.127 - module = "initiative", 1.128 - view = "_list", 1.129 - params = { 1.130 - issue = issue, 1.131 - initiatives_selector = issue:get_reference_selector("initiatives"), 1.132 - limit = 3, 1.133 - per_page = 3, 1.134 - no_sort = true, 1.135 - } 1.136 - } 1.137 - end } 1.138 - end 1.139 - } 1.140 - 1.141 - if config.user_tab_mode == "accordeon_all_expanded" then 1.142 - ui.script{ script = 'document.getElementById("' .. head_name .. '").onclick();' } 1.143 - end 1.144 -end 1.145 ---]] 1.146 1.147 execute.view{ 1.148 module = "area",