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