liquid_feedback_frontend
view app/main/area/show.lua @ 61:f77ca23f9ebd
merge
| author | jbe | 
|---|---|
| date | Thu Apr 22 16:03:53 2010 +0200 (2010-04-22) | 
| parents | 88ac7798b562 | 
| children | 7d0f4721d2f3 | 
 line source
     1 local area = Area:new_selector():add_where{ "id = ?", param.get_id() }:single_object_mode():exec()
     3 if config.feature_rss_enabled then
     4   util.html_rss_head{ title = _"Initiatives in this area (last created first)", module = "initiative", view = "list_rss", params = { area_id = area.id } }
     5   util.html_rss_head{ title = _"Initiatives in this area (last updated first)", module = "initiative", view = "list_rss", params = { area_id = area.id } }
     6 end
     8 slot.put_into("title", encode.html(_"Area '#{name}'":gsub("#{name}", area.name)))
    10 ui.container{
    11   attr = { class = "vertical"},
    12   content = function()
    13     ui.field.text{ value = area.description }
    14   end
    15 }
    17 if app.session.member_id then
    18   slot.select("actions", function()
    19     ui.link{
    20       content = function()
    21         ui.image{ static = "icons/16/folder_add.png" }
    22         slot.put(_"Create new issue")
    23       end,
    24       module = "initiative",
    25       view = "new",
    26       params = { area_id = area.id }
    27     }
    28   end)
    29 end
    31 util.help("area.show")
    33 if app.session.member_id then
    34   execute.view{
    35     module = "membership",
    36     view = "_show_box",
    37     params = { area = area }
    38   }
    40   execute.view{
    41     module = "delegation",
    42     view = "_show_box",
    43     params = { area_id = area.id }
    44   }
    46 end
    48 --[[
    49 for i, issue in ipairs(area.issues) do
    50   local head_name = "issue_head_content_" .. tostring(issue.id)
    51   local name = "issue_content_" .. tostring(issue.id)
    52   local icon_name = "issue_icon_" .. tostring(issue.id)
    53   ui.container{
    54     attr = { class = "ui_tabs" },
    55     content = function()
    56       local onclick = 
    57         'if (ui_tabs_active["' .. name .. '"]) {' ..
    58           'el=document.getElementById("' .. name .. '");' ..
    59           'el.innerHTML="";' ..
    60           'el.style.display="none";' ..
    61           'ui_tabs_active["' .. name .. '"]=false' ..
    62         '} else {' ..
    63           'ui_tabs_active["' .. name .. '"]=true;' ..
    64           'document.getElementById("' .. name .. '").style.display="block"; ' ..
    65           'var hourglass_el = document.getElementById("' .. icon_name .. '");' ..
    66           'var hourglass_src = hourglass_el.src;' ..
    67           'hourglass_el.src = "' .. encode.url{ static = "icons/16/connect.png" } .. '";' ..
    68           'partialMultiLoad(' ..
    69             '{ trace: "trace", system_error: "system_error", ' .. name .. '_title: "title", ' .. name .. '_actions: "actions", ' .. name .. '_content: "default" },' ..
    70             '{},' ..
    71             '"error",' ..
    72             '"' .. 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",' ..
    73             '{},' ..
    74             '{},' ..
    75             'function() {' ..
    76               'hourglass_el.src = hourglass_src;' ..
    77             '},' ..
    78             'function() {' ..
    79               'hourglass_el.src = hourglass_src;' ..
    80             '}' ..
    81           '); ' ..
    82         '}' ..
    83         'return(false);'
    84       ui.link{
    85         attr = {
    86           name = name,
    87           class = "ui_tabs_accordeon_head",
    88           id = head_name,
    89           onclick = onclick,
    90         },
    91         module  = "issue",
    92         view    = "show",
    93         id      = issue.id,
    94         params  = params,
    95         anchor  = name,
    96         content = function()
    97           ui.image{
    98             attr = { id = icon_name },
    99             static = "icons/16/script.png"
   100           }
   101           ui.container{
   102             attr = { style = "float: right;" },
   103             content = function()
   105             end
   106           }
   107           slot.put(tostring(issue.id))
   108         end
   109       }
   110     end
   111   }
   113   ui.container{
   114     attr = {
   115       id = name,
   116       class = "ui_tabs_accordeon_content",
   117     },
   118     content = function()
   119       ui.container{ attr = { id = name .. "_title",   }, content = function() slot.put(" ") end }
   120       ui.container{ attr = { id = name .. "_actions", }, content = function() slot.put(" ") end }
   121       ui.container{ attr = { id = name .. "_content", }, content = function() 
   122         execute.view{
   123           module = "initiative",
   124           view = "_list",
   125           params = {
   126             issue = issue,
   127             initiatives_selector = issue:get_reference_selector("initiatives"),
   128             limit = 3,
   129             per_page = 3,
   130             no_sort = true,
   131           }
   132         }
   133       end }
   134     end
   135   }
   137   if config.user_tab_mode == "accordeon_all_expanded" then
   138     ui.script{ script = 'document.getElementById("' .. head_name .. '").onclick();' }
   139   end
   140 end
   141 --]]
   143 execute.view{
   144   module = "area",
   145   view = "show_tab",
   146   params = { area = area }
   147 }
