liquid_feedback_frontend

changeset 197:c0835d707465

Area module refactored
author bsw
date Mon Nov 08 15:30:59 2010 +0100 (2010-11-08)
parents 86931dcee1fd
children a9c6c11dd86c
files app/main/area/list.lua app/main/area/show.lua app/main/area/show_tab.lua
line diff
     1.1 --- a/app/main/area/list.lua	Mon Nov 08 15:11:56 2010 +0100
     1.2 +++ b/app/main/area/list.lua	Mon Nov 08 15:30:59 2010 +0100
     1.3 @@ -1,9 +1,13 @@
     1.4 +local areas_selector = Area:build_selector{ active = true }
     1.5 +
     1.6 +
     1.7  if app.session.member_id then
     1.8    slot.put_into("title", _'Area list')
     1.9  else
    1.10    slot.put_into("title", encode.html(config.app_title))
    1.11  end
    1.12  
    1.13 +
    1.14  if not app.session.member_id and config.motd_public then
    1.15    local help_text = config.motd_public
    1.16    ui.container{
    1.17 @@ -16,17 +20,9 @@
    1.18  
    1.19  util.help("area.list", _"Area list")
    1.20  
    1.21 -local areas_selector = Area:new_selector():add_where("active")
    1.22  
    1.23  execute.view{
    1.24    module = "area",
    1.25    view = "_list",
    1.26    params = { areas_selector = areas_selector }
    1.27  }
    1.28 -
    1.29 ---[[
    1.30 -execute.view{
    1.31 -  module = "delegation",
    1.32 -  view = "_show_box"
    1.33 -}
    1.34 ---]]
     2.1 --- a/app/main/area/show.lua	Mon Nov 08 15:11:56 2010 +0100
     2.2 +++ b/app/main/area/show.lua	Mon Nov 08 15:30:59 2010 +0100
     2.3 @@ -1,14 +1,20 @@
     2.4 -local area = Area:new_selector():add_where{ "id = ?", param.get_id() }:single_object_mode():exec()
     2.5 +local area = Area:by_id(param.get_id())
     2.6 +
     2.7  
     2.8  app.html_title.title = area.name
     2.9  app.html_title.subtitle = _("Area")
    2.10  
    2.11 +util.help("area.show")
    2.12 +
    2.13 +
    2.14  if config.feature_rss_enabled then
    2.15    util.html_rss_head{ title = _"Initiatives in this area (last created first)", module = "initiative", view = "list_rss", params = { area_id = area.id } }
    2.16    util.html_rss_head{ title = _"Initiatives in this area (last updated first)", module = "initiative", view = "list_rss", params = { area_id = area.id } }
    2.17  end
    2.18  
    2.19 -slot.put_into("title", encode.html(_"Area '#{name}'":gsub("#{name}", area.name)))
    2.20 +
    2.21 +slot.put_into("title", encode.html(_("Area '#{name}'", { name = area.name })))
    2.22 +
    2.23  
    2.24  ui.container{
    2.25    attr = { class = "vertical"},
    2.26 @@ -17,7 +23,9 @@
    2.27    end
    2.28  }
    2.29  
    2.30 +
    2.31  if app.session.member_id then
    2.32 +
    2.33    slot.select("actions", function()
    2.34      ui.link{
    2.35        content = function()
    2.36 @@ -29,11 +37,7 @@
    2.37        params = { area_id = area.id }
    2.38      }
    2.39    end)
    2.40 -end
    2.41  
    2.42 -util.help("area.show")
    2.43 -
    2.44 -if app.session.member_id then
    2.45    execute.view{
    2.46      module = "membership",
    2.47      view = "_show_box",
    2.48 @@ -48,100 +52,6 @@
    2.49  
    2.50  end
    2.51  
    2.52 ---[[
    2.53 -for i, issue in ipairs(area.issues) do
    2.54 -  local head_name = "issue_head_content_" .. tostring(issue.id)
    2.55 -  local name = "issue_content_" .. tostring(issue.id)
    2.56 -  local icon_name = "issue_icon_" .. tostring(issue.id)
    2.57 -  ui.container{
    2.58 -    attr = { class = "ui_tabs" },
    2.59 -    content = function()
    2.60 -      local onclick = 
    2.61 -        'if (ui_tabs_active["' .. name .. '"]) {' ..
    2.62 -          'el=document.getElementById("' .. name .. '");' ..
    2.63 -          'el.innerHTML="";' ..
    2.64 -          'el.style.display="none";' ..
    2.65 -          'ui_tabs_active["' .. name .. '"]=false' ..
    2.66 -        '} else {' ..
    2.67 -          'ui_tabs_active["' .. name .. '"]=true;' ..
    2.68 -          'document.getElementById("' .. name .. '").style.display="block"; ' ..
    2.69 -          'var hourglass_el = document.getElementById("' .. icon_name .. '");' ..
    2.70 -          'var hourglass_src = hourglass_el.src;' ..
    2.71 -          'hourglass_el.src = "' .. encode.url{ static = "icons/16/connect.png" } .. '";' ..
    2.72 -          'partialMultiLoad(' ..
    2.73 -            '{ trace: "trace", system_error: "system_error", ' .. name .. '_title: "title", ' .. name .. '_actions: "actions", ' .. name .. '_content: "default" },' ..
    2.74 -            '{},' ..
    2.75 -            '"error",' ..
    2.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",' ..
    2.77 -            '{},' ..
    2.78 -            '{},' ..
    2.79 -            'function() {' ..
    2.80 -              'hourglass_el.src = hourglass_src;' ..
    2.81 -            '},' ..
    2.82 -            'function() {' ..
    2.83 -              'hourglass_el.src = hourglass_src;' ..
    2.84 -            '}' ..
    2.85 -          '); ' ..
    2.86 -        '}' ..
    2.87 -        'return(false);'
    2.88 -      ui.link{
    2.89 -        attr = {
    2.90 -          name = name,
    2.91 -          class = "ui_tabs_accordeon_head",
    2.92 -          id = head_name,
    2.93 -          onclick = onclick,
    2.94 -        },
    2.95 -        module  = "issue",
    2.96 -        view    = "show",
    2.97 -        id      = issue.id,
    2.98 -        params  = params,
    2.99 -        anchor  = name,
   2.100 -        content = function()
   2.101 -          ui.image{
   2.102 -            attr = { id = icon_name },
   2.103 -            static = "icons/16/script.png"
   2.104 -          }
   2.105 -          ui.container{
   2.106 -            attr = { style = "float: right;" },
   2.107 -            content = function()
   2.108 -              
   2.109 -            end
   2.110 -          }
   2.111 -          slot.put(tostring(issue.id))
   2.112 -        end
   2.113 -      }
   2.114 -    end
   2.115 -  }
   2.116 -
   2.117 -  ui.container{
   2.118 -    attr = {
   2.119 -      id = name,
   2.120 -      class = "ui_tabs_accordeon_content",
   2.121 -    },
   2.122 -    content = function()
   2.123 -      ui.container{ attr = { id = name .. "_title",   }, content = function() slot.put(" ") end }
   2.124 -      ui.container{ attr = { id = name .. "_actions", }, content = function() slot.put(" ") end }
   2.125 -      ui.container{ attr = { id = name .. "_content", }, content = function() 
   2.126 -        execute.view{
   2.127 -          module = "initiative",
   2.128 -          view = "_list",
   2.129 -          params = {
   2.130 -            issue = issue,
   2.131 -            initiatives_selector = issue:get_reference_selector("initiatives"),
   2.132 -            limit = 3,
   2.133 -            per_page = 3,
   2.134 -            no_sort = true,
   2.135 -          }
   2.136 -        }
   2.137 -      end }
   2.138 -    end
   2.139 -  }
   2.140 -
   2.141 -  if config.user_tab_mode == "accordeon_all_expanded" then
   2.142 -    ui.script{ script = 'document.getElementById("' .. head_name .. '").onclick();' }
   2.143 -  end
   2.144 -end
   2.145 ---]]
   2.146  
   2.147  execute.view{
   2.148    module = "area",
     3.1 --- a/app/main/area/show_tab.lua	Mon Nov 08 15:11:56 2010 +0100
     3.2 +++ b/app/main/area/show_tab.lua	Mon Nov 08 15:30:59 2010 +0100
     3.3 @@ -1,4 +1,4 @@
     3.4 -local area = param.get("area", "table") or Area:by_id(param.get("area_id", atom.integer))
     3.5 +local area = param.get("area", "table") or Area:by_id(param.get_id())
     3.6  
     3.7  local issues_selector = area:get_reference_selector("issues")
     3.8  local members_selector = area:get_reference_selector("members")

Impressum / About Us