liquid_feedback_frontend
changeset 278:fecd4c13054a
Code/css clean up and minor enhancements
author | bsw |
---|---|
date | Mon Feb 13 01:53:41 2012 +0100 (2012-02-13) |
parents | bde068b37608 |
children | 23c98752e697 |
files | app/main/area/_list.lua app/main/area/list.lua app/main/delegation/_action/update.lua app/main/initiative/_list.lua app/main/initiative/_list_element.lua app/main/initiative/_show.lua app/main/initiative/list_rss.lua app/main/initiative/new.lua app/main/initiative/show.lua app/main/initiative/show.rss.lua app/main/initiative/show_partial.lua app/main/initiative/show_static.lua app/main/initiative/show_support.lua app/main/issue/_show_head.lua app/main/member/_area_list.lua app/main/member/show_tab.lua app/main/supporter/_show_box.lua env/ui/tabs.lua static/style.css |
line diff
1.1 --- a/app/main/area/_list.lua Mon Feb 13 00:16:42 2012 +0100 1.2 +++ b/app/main/area/_list.lua Mon Feb 13 01:53:41 2012 +0100 1.3 @@ -1,4 +1,5 @@ 1.4 local areas_selector = param.get("areas_selector", "table") 1.5 +local title = param.get("title", "function") 1.6 1.7 areas_selector 1.8 :reset_fields() 1.9 @@ -36,6 +37,7 @@ 1.10 records = areas_selector:exec(), 1.11 columns = { 1.12 { 1.13 + label = title, 1.14 content = function(record) 1.15 if record.is_member then 1.16 local text = _"Member of area"
2.1 --- a/app/main/area/list.lua Mon Feb 13 00:16:42 2012 +0100 2.2 +++ b/app/main/area/list.lua Mon Feb 13 01:53:41 2012 +0100 2.3 @@ -1,4 +1,5 @@ 2.4 local unit_id = config.single_unit_id or param.get("unit_id", atom.integer) 2.5 +local title = param.get("title", "function") 2.6 2.7 local areas_selector = Area:build_selector{ active = true, unit_id = unit_id } 2.8 areas_selector:add_order_by("member_weight DESC") 2.9 @@ -37,5 +38,5 @@ 2.10 execute.view{ 2.11 module = "area", 2.12 view = "_list", 2.13 - params = { areas_selector = areas_selector } 2.14 + params = { areas_selector = areas_selector, title = title } 2.15 }
3.1 --- a/app/main/delegation/_action/update.lua Mon Feb 13 00:16:42 2012 +0100 3.2 +++ b/app/main/delegation/_action/update.lua Mon Feb 13 01:53:41 2012 +0100 3.3 @@ -20,6 +20,7 @@ 3.4 3.5 delegation:destroy() 3.6 3.7 +--[[ 3.8 if issue_id then 3.9 slot.put_into("notice", _"Your delegation for this issue has been deleted.") 3.10 elseif area_id then 3.11 @@ -27,7 +28,7 @@ 3.12 else 3.13 slot.put_into("notice", _"Your delegation for this unit has been deleted.") 3.14 end 3.15 - 3.16 +--]] 3.17 end 3.18 3.19 else 3.20 @@ -53,7 +54,7 @@ 3.21 end 3.22 3.23 delegation:save() 3.24 - 3.25 +--[[ 3.26 if issue_id then 3.27 slot.put_into("notice", _"Your delegation for this issue has been updated.") 3.28 elseif area_id then 3.29 @@ -61,6 +62,6 @@ 3.30 else 3.31 slot.put_into("notice", _"Your delegation for this unit has been updated.") 3.32 end 3.33 - 3.34 +--]] 3.35 end 3.36
4.1 --- a/app/main/initiative/_list.lua Mon Feb 13 00:16:42 2012 +0100 4.2 +++ b/app/main/initiative/_list.lua Mon Feb 13 01:53:41 2012 +0100 4.3 @@ -1,5 +1,3 @@ 4.4 -ui.script{ script = "lf_initiative_expanded = {};" } 4.5 - 4.6 local issue = param.get("issue", "table") 4.7 4.8 local initiatives_selector = param.get("initiatives_selector", "table") 4.9 @@ -55,7 +53,6 @@ 4.10 4.11 4.12 if show_for_initiative then 4.13 - ui.script{ script = "lf_initiative_expanded['initiative_content_" .. tostring(show_for_initiative.id) .. "'] = true;" } 4.14 initiatives_selector:add_where{ "initiative.id != ?", show_for_initiative.id } 4.15 4.16 execute.view{ 4.17 @@ -63,8 +60,6 @@ 4.18 view = "_list_element", 4.19 params = { 4.20 initiative = show_for_initiative, 4.21 - expanded = true, 4.22 - expandable = true 4.23 } 4.24 } 4.25 if show_for_issue then 4.26 @@ -97,8 +92,6 @@ 4.27 initiatives_selector:limit(limit) 4.28 end 4.29 4.30 - local expandable = param.get("expandable", atom.boolean) 4.31 - 4.32 local issue = param.get("issue", "table") 4.33 4.34 local name = "initiative_list" 4.35 @@ -182,19 +175,12 @@ 4.36 end 4.37 end 4.38 for i, initiative in ipairs(initiatives) do 4.39 - local expanded = config.user_tab_mode == "accordeon_all_expanded" and expandable or 4.40 - show_for_initiative and initiative.id == show_for_initiative.id 4.41 - if expanded then 4.42 - ui.script{ script = "lf_initiative_expanded['initiative_content_" .. tostring(initiative.id) .. "'] = true;" } 4.43 - end 4.44 execute.view{ 4.45 module = "initiative", 4.46 view = "_list_element", 4.47 params = { 4.48 initiative = initiative, 4.49 selected = highlight_initiative and highlight_initiative.id == initiative.id or nil, 4.50 - expanded = expanded, 4.51 - expandable = expandable 4.52 } 4.53 } 4.54 end
5.1 --- a/app/main/initiative/_list_element.lua Mon Feb 13 00:16:42 2012 +0100 5.2 +++ b/app/main/initiative/_list_element.lua Mon Feb 13 01:53:41 2012 +0100 5.3 @@ -1,7 +1,5 @@ 5.4 local initiative = param.get("initiative", "table") 5.5 local selected = param.get("selected", atom.boolean) 5.6 -local expanded = param.get("expanded", atom.boolean) 5.7 -local expandable = param.get("expandable", atom.boolean) 5.8 5.9 local head_name = "initiative_head_" .. tostring(initiative.id) 5.10 local link_name = "initiative_link_" .. tostring(initiative.id) 5.11 @@ -11,43 +9,6 @@ 5.12 ui.container{ 5.13 attr = { class = "ui_tabs" .. (initiative.id == for_initiative_id and " active" or "") }, 5.14 content = function() 5.15 - local web20 = config.user_tab_mode == "accordeon" 5.16 - or config.user_tab_mode == "accordeon_first_expanded" 5.17 - or config.user_tab_mode == "accordeon_all_expanded" 5.18 - local onclick 5.19 - if web20 then 5.20 - if expandable then 5.21 - onclick = 5.22 - 'if (lf_initiative_expanded["' .. name .. '"]) {' .. 5.23 - 'lf_initiative_expanded["' .. name .. '"]=false;' .. 5.24 - 'document.getElementById("' .. name .. '_content").innerHTML=" ";' .. 5.25 - 'document.getElementById("' .. name .. '").style.display="none";' .. 5.26 - '} else {' .. 5.27 - 'lf_initiative_expanded["' .. name .. '"] = true;' .. 5.28 - 'document.getElementById("' .. name .. '").style.display="block"; ' .. 5.29 - 'var hourglass_el = document.getElementById("' .. icon_name .. '");' .. 5.30 - 'var hourglass_src = hourglass_el.src;' .. 5.31 - 'hourglass_el.src = "' .. encode.url{ static = "icons/16/connect.png" } .. '";' .. 5.32 - 'partialMultiLoad(' .. 5.33 - '{ trace: "trace", system_error: "system_error", ' .. name .. '_content: "default" },' .. 5.34 - '{},' .. 5.35 - '"error",' .. 5.36 - '"' .. request.get_relative_baseurl() .. 'initiative/show_partial/' .. tostring(initiative.id) .. '.html?&_webmcp_json_slots[]=default&_webmcp_json_slots[]=support&_webmcp_json_slots[]=trace&_webmcp_json_slots[]=system_error",' .. 5.37 - '{},' .. 5.38 - '{},' .. 5.39 - 'function() {' .. 5.40 - 'hourglass_el.src = hourglass_src;' .. 5.41 - '},' .. 5.42 - 'function() {' .. 5.43 - 'hourglass_el.src = hourglass_src;' .. 5.44 - '}' .. 5.45 - '); ' .. 5.46 - '}' .. 5.47 - 'return(false);' 5.48 - else 5.49 - onclick = "document.location.href = document.getElementById('" .. link_name .. "').href;" 5.50 - end 5.51 - end 5.52 local module = "initiative" 5.53 local view = "show" 5.54 local id = initiative.id 5.55 @@ -57,7 +18,6 @@ 5.56 name = name, 5.57 class = "ui_tabs_accordeon_head", 5.58 id = head_name, 5.59 - onclick = onclick, 5.60 }, 5.61 content = function() 5.62 5.63 @@ -70,16 +30,6 @@ 5.64 content = function() 5.65 if initiative.issue.accepted and initiative.issue.closed and initiative.issue.ranks_available or initiative.admitted == false then 5.66 ui.field.rank{ image_attr = { id = icon_name }, attr = { class = "rank" }, value = initiative.rank } 5.67 - elseif web20 then 5.68 - ui.image{ 5.69 - attr = { 5.70 - width = 16, 5.71 - height = 16, 5.72 - id = icon_name, 5.73 - style = "float: left;" 5.74 - }, 5.75 - static = "icons/16/script.png" 5.76 - } 5.77 else 5.78 slot.put(" ") 5.79 end 5.80 @@ -182,7 +132,6 @@ 5.81 attr = { 5.82 id = name, 5.83 class = "ui_tabs_accordeon_content", 5.84 - style = not expanded and "display: none;" or nil 5.85 }, 5.86 content = function() 5.87 ui.container{ 5.88 @@ -193,7 +142,6 @@ 5.89 view = "show_partial", 5.90 params = { 5.91 initiative = initiative, 5.92 - expanded = expanded 5.93 } 5.94 } 5.95 end
6.1 --- a/app/main/initiative/_show.lua Mon Feb 13 00:16:42 2012 +0100 6.2 +++ b/app/main/initiative/_show.lua Mon Feb 13 01:53:41 2012 +0100 6.3 @@ -142,11 +142,7 @@ 6.4 } 6.5 end 6.6 6.7 -local web20 = config.user_tab_mode == "accordeon" 6.8 - or config.user_tab_mode == "accordeon_first_expanded" 6.9 - or config.user_tab_mode == "accordeon_all_expanded" 6.10 - 6.11 -if not web20 and initiative.issue.state == "cancelled" then 6.12 +if initiative.issue.state == "cancelled" then 6.13 local policy = initiative.issue.policy 6.14 ui.container{ 6.15 attr = { class = "not_admitted_info" }, 6.16 @@ -274,23 +270,15 @@ 6.17 6.18 6.19 if app.session.member_id then 6.20 - ui.container{ 6.21 - attr = { 6.22 - id = "initiative_" .. tostring(initiative.id) .. "_support" 6.23 - }, 6.24 - content = function() 6.25 - execute.view{ 6.26 - module = "initiative", 6.27 - view = "show_support", 6.28 - params = { 6.29 - initiative = initiative 6.30 - } 6.31 - } 6.32 - end 6.33 + execute.view{ 6.34 + module = "supporter", 6.35 + view = "_show_box", 6.36 + params = { 6.37 + initiative = initiative 6.38 + } 6.39 } 6.40 end 6.41 6.42 - 6.43 execute.view{ 6.44 module = "initiative", 6.45 view = "show_tab",
7.1 --- a/app/main/initiative/list_rss.lua Mon Feb 13 00:16:42 2012 +0100 7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 7.3 @@ -1,120 +0,0 @@ 7.4 -if not config.feature_rss_enabled then 7.5 - error("feature not enabled") 7.6 -end 7.7 - 7.8 -local area_id = param.get("area_id", atom.integer) 7.9 -local issue_id = param.get("issue_id", atom.integer) 7.10 -local order = param.get("order") or "last_created" 7.11 - 7.12 -local initiatives_selector = Initiative:new_selector() 7.13 - 7.14 -local issue 7.15 -local area 7.16 - 7.17 -if issue_id then 7.18 - issue = Issue:by_id(issue_id) 7.19 - initiatives_selector:add_where{ "initiative.issue_id = ?", issue_id } 7.20 -elseif area_id then 7.21 - area = Area:by_id(area_id) 7.22 - initiatives_selector:join("issue", nil, "issue.id = initiative.issue_id") 7.23 - initiatives_selector:add_where{ "issue.area_id = ?", area_id } 7.24 -end 7.25 - 7.26 - 7.27 -if order == "last_created" then 7.28 - initiatives_selector:add_order_by("initiative.created DESC") 7.29 - initiatives_selector:add_field("initiative.created", "created_or_updated") 7.30 -elseif order == "last_updated" then 7.31 - initiatives_selector:add_field("(SELECT MAX(created) FROM draft WHERE initiative_id = initiative.id GROUP BY initiative_id)", "created_or_updated") 7.32 - initiatives_selector:add_order_by("(SELECT MAX(created) FROM draft WHERE initiative_id = initiative.id GROUP BY initiative_id) DESC") 7.33 -else 7.34 - error("Invalid order") 7.35 -end 7.36 - 7.37 -initiatives_selector:add_order_by("id DESC") 7.38 - 7.39 -initiatives_selector:limit(25) 7.40 - 7.41 -local initiatives = initiatives_selector:exec() 7.42 - 7.43 -slot.set_layout("atom") 7.44 -request.force_absolute_baseurl() 7.45 - 7.46 -ui.tag{ 7.47 - tag = "author", 7.48 - content = function() 7.49 - ui.tag{ 7.50 - tag = "name", 7.51 - content = "LiquidFeedback" 7.52 - } 7.53 - end 7.54 -} 7.55 - 7.56 -local title 7.57 - 7.58 -if issue then 7.59 - title = "#" .. tostring(issue.id) .. " " .. issue.area.name 7.60 -elseif area then 7.61 - title = area.name 7.62 -else 7.63 - title = config.app_title 7.64 -end 7.65 - 7.66 -ui.tag{ 7.67 - tag = "title", 7.68 - content = title 7.69 -} 7.70 - 7.71 -local subtitle 7.72 -if order == "last_created" then 7.73 - subtitle = "Initiatives (last created first)" 7.74 -elseif order == "last_updated" then 7.75 - subtitle = "Initiatives (last updated first)" 7.76 -end 7.77 - 7.78 -ui.tag{ 7.79 - tag = "subtitle", 7.80 - content = subtitle 7.81 -} 7.82 - 7.83 -ui.tag{ 7.84 - tag = "id", 7.85 --- content = "urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6" 7.86 -} 7.87 - 7.88 ---[[ 7.89 -ui.tag{ 7.90 - tag = "updated", 7.91 - content = "2003-12-14T10:20:09Z" 7.92 -} 7.93 ---]] 7.94 - 7.95 -for i, initiative in ipairs(initiatives) do 7.96 - ui.tag{ 7.97 - tag = "entry", 7.98 - content = function() 7.99 - slot.put("\n") 7.100 - ui.tag{ tag = "category", attr = { term = encode.html(initiative.issue.area.name) } } 7.101 - slot.put("\n") 7.102 - ui.tag{ tag = "author", content = encode.html(initiative.current_draft.author.name) } 7.103 - slot.put("\n") 7.104 - ui.tag{ tag = "title", content = encode.html(initiative.shortened_name) } 7.105 - slot.put("\n") 7.106 - ui.tag{ tag = "link", attr = { 7.107 - href = encode.url{ 7.108 - module = "initiative", 7.109 - view = "show", 7.110 - id = initiative.id 7.111 - } 7.112 - } } 7.113 - slot.put("\n") 7.114 - ui.tag{ tag = "id", content = "initiative_" .. tostring(initiative.id) } 7.115 - slot.put("\n") 7.116 - ui.tag{ tag = "updated", content = tostring(initiative.created_or_updated) } 7.117 - slot.put("\n") 7.118 - ui.tag{ tag = "content", content = encode.html(initiative.current_draft.content or "") } 7.119 - slot.put("\n") 7.120 - end 7.121 - } 7.122 - slot.put("\n") 7.123 -end
8.1 --- a/app/main/initiative/new.lua Mon Feb 13 00:16:42 2012 +0100 8.2 +++ b/app/main/initiative/new.lua Mon Feb 13 01:53:41 2012 +0100 8.3 @@ -26,6 +26,7 @@ 8.4 }, 8.5 attr = { class = "vertical" }, 8.6 content = function() 8.7 + ui.field.text{ label = _"Unit", value = area.unit.name } 8.8 ui.field.text{ label = _"Area", value = area.name } 8.9 slot.put("<br />") 8.10 if issue_id then
9.1 --- a/app/main/initiative/show.lua Mon Feb 13 00:16:42 2012 +0100 9.2 +++ b/app/main/initiative/show.lua Mon Feb 13 01:53:41 2012 +0100 9.3 @@ -8,33 +8,29 @@ 9.4 app.html_title.subtitle = _("Initiative ##{id}", { id = initiative.id }) 9.5 9.6 9.7 -if request.get_json_request_slots() then 9.8 - execute.view{ 9.9 - module = "initiative", 9.10 - view = "show_partial", 9.11 - params = { 9.12 - initiative = initiative 9.13 - } 9.14 +execute.view{ 9.15 + module = "issue", 9.16 + view = "_show_head", 9.17 + params = { issue = initiative.issue, 9.18 + initiative = initiative } 9.19 +} 9.20 + 9.21 +if not initiative then 9.22 + initiative = Initiative:by_id(param.get_id()) 9.23 + expanded = true 9.24 +end 9.25 + 9.26 +-- TODO performance 9.27 +local initiator 9.28 +if app.session.member_id then 9.29 + initiator = Initiator:by_pk(initiative.id, app.session.member.id) 9.30 +end 9.31 + 9.32 +execute.view{ 9.33 + module = "initiative", 9.34 + view = "_show", 9.35 + params = { 9.36 + initiative = initiative, 9.37 + initiator = initiator 9.38 } 9.39 -elseif 9.40 - config.user_tab_mode == "accordeon" or 9.41 - config.user_tab_mode == "accordeon_first_expanded" or 9.42 - config.user_tab_mode == "accordeon_all_expanded" 9.43 -then 9.44 - execute.view{ 9.45 - module = "issue", 9.46 - view = "show", 9.47 - id = initiative.issue_id, 9.48 - params = { 9.49 - for_initiative_id = initiative.id 9.50 - } 9.51 - } 9.52 -else 9.53 - execute.view{ 9.54 - module = "initiative", 9.55 - view = "show_static", 9.56 - params = { 9.57 - initiative = initiative 9.58 - } 9.59 - } 9.60 -end 9.61 +}
10.1 --- a/app/main/initiative/show.rss.lua Mon Feb 13 00:16:42 2012 +0100 10.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 10.3 @@ -1,43 +0,0 @@ 10.4 -slot.set_layout("rss") 10.5 - 10.6 -local function rss_channel(channel) 10.7 - for key, val in pairs(channel) do 10.8 - slot.put("<", key, ">", val, "</", key, ">") 10.9 - end 10.10 -end 10.11 - 10.12 -local function rss_item(item) 10.13 - slot.put("<item>") 10.14 - for key, val in pairs(item) do 10.15 - slot.put("<", key, ">", val, "</", key, ">") 10.16 - end 10.17 - slot.put("</item>") 10.18 -end 10.19 - 10.20 -local initiative = Initiative:by_id(param.get_id()) 10.21 - 10.22 -rss_channel{ 10.23 - title = initiative.name, 10.24 - description = initiative.current_draft.content, 10.25 - language = "de", 10.26 -} 10.27 - 10.28 -for i, suggestion in ipairs(initiative.suggestions) do 10.29 - 10.30 - local text = suggestion.name 10.31 - 10.32 - text = text .. " (" 10.33 - text = text .. tostring(suggestion.plus2_unfulfilled_count + suggestion.plus2_unfulfilled_count) .. "++ " 10.34 - text = text .. tostring(suggestion.plus1_unfulfilled_count + suggestion.plus1_unfulfilled_count) .. "+ " 10.35 - text = text .. tostring(suggestion.minus1_unfulfilled_count + suggestion.minus1_unfulfilled_count) .. "- " 10.36 - text = text .. tostring(suggestion.minus2_unfulfilled_count + suggestion.minus2_unfulfilled_count) .. "--" 10.37 - 10.38 - text = text .. ")" 10.39 - 10.40 - rss_item{ 10.41 - title = text, 10.42 - description = suggestion.content, 10.43 - link = request.get_base_url() .. "/lf/suggestion/show/" .. tostring(suggestion.id) .. ".html", 10.44 - } 10.45 - 10.46 -end 10.47 \ No newline at end of file
11.1 --- a/app/main/initiative/show_partial.lua Mon Feb 13 00:16:42 2012 +0100 11.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 11.3 @@ -1,34 +0,0 @@ 11.4 -local initiative = param.get("initiative", "table") 11.5 -local expanded = param.get("expanded", atom.boolean) 11.6 - 11.7 -if not initiative then 11.8 - initiative = Initiative:by_id(param.get_id()) 11.9 - expanded = true 11.10 -end 11.11 - 11.12 --- TODO performance 11.13 -local initiator 11.14 -if app.session.member_id then 11.15 - initiator = Initiator:by_pk(initiative.id, app.session.member.id) 11.16 -end 11.17 - 11.18 -ui.partial{ 11.19 - module = "initiative", 11.20 - view = "show", 11.21 - id = initiative.id, 11.22 - target = "initiative_content_" .. tostring(initiative.id) .. "_content", 11.23 - content = function() 11.24 - if expanded then 11.25 - execute.view{ 11.26 - module = "initiative", 11.27 - view = "_show", 11.28 - params = { 11.29 - initiative = initiative, 11.30 - initiator = initiator 11.31 - } 11.32 - } 11.33 - else 11.34 - slot.put(" ") 11.35 - end 11.36 - end 11.37 -}
12.1 --- a/app/main/initiative/show_static.lua Mon Feb 13 00:16:42 2012 +0100 12.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 12.3 @@ -1,22 +0,0 @@ 12.4 -local initiative = param.get("initiative", "table") 12.5 - 12.6 -if not initiative then 12.7 - initiative = Initiative:new_selector():add_where{ "id = ?", param.get_id()}:single_object_mode():exec() 12.8 -end 12.9 - 12.10 -execute.view{ 12.11 - module = "issue", 12.12 - view = "_show_head", 12.13 - params = { issue = initiative.issue, 12.14 - initiative = initiative } 12.15 -} 12.16 - 12.17 - 12.18 -execute.view{ 12.19 - module = "initiative", 12.20 - view = "show_partial", 12.21 - params = { 12.22 - initiative = initiative, 12.23 - expanded = true 12.24 - } 12.25 -}
13.1 --- a/app/main/initiative/show_support.lua Mon Feb 13 00:16:42 2012 +0100 13.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 13.3 @@ -1,116 +0,0 @@ 13.4 -local initiative = param.get("initiative", "table") or Initiative:by_id(param.get_id()) 13.5 - 13.6 --- TODO performance 13.7 -local initiator = Initiator:by_pk(initiative.id, app.session.member.id) 13.8 - 13.9 -ui.partial{ 13.10 - module = "initiative", 13.11 - view = "show_support", 13.12 - id = initiative.id, 13.13 - target = "initiative_" .. tostring(initiative.id) .. "_support", 13.14 - content = function() 13.15 - 13.16 - ui.container{ 13.17 - attr = { class = "actions" }, 13.18 - content = function() 13.19 - 13.20 - local initiative = param.get("initiative", "table") 13.21 - local supporter = Supporter:by_pk(initiative.id, app.session.member.id) 13.22 - 13.23 - local partial = { 13.24 - routing = { 13.25 - default = { 13.26 - mode = "redirect", 13.27 - module = "initiative", 13.28 - view = "show_support", 13.29 - id = initiative.id 13.30 - } 13.31 - } 13.32 - } 13.33 - 13.34 - local routing = { 13.35 - default = { 13.36 - mode = "redirect", 13.37 - module = request.get_module(), 13.38 - view = request.get_view(), 13.39 - id = param.get_id_cgi(), 13.40 - params = param.get_all_cgi() 13.41 - } 13.42 - } 13.43 - 13.44 - if not initiative.issue.fully_frozen and not initiative.issue.closed then 13.45 - if supporter then 13.46 - if not supporter:has_critical_opinion() then 13.47 - ui.container{ attr = { class = "supporter" }, content = function() 13.48 - ui.image{ 13.49 - static = "icons/16/thumb_up_green.png" 13.50 - } 13.51 - slot.put(_"Your are supporter") 13.52 - end } 13.53 - else 13.54 - ui.tag{ attr = { class = "potential_supporter" }, content = function() 13.55 - ui.image{ 13.56 - static = "icons/16/thumb_up.png" 13.57 - } 13.58 - slot.put(_"Your are potential supporter") 13.59 - end } 13.60 - end 13.61 - ui.link{ 13.62 - image = { static = "icons/16/cross.png" }, 13.63 - text = _"Withdraw support", 13.64 - module = "initiative", 13.65 - action = "remove_support", 13.66 - id = initiative.id, 13.67 - routing = routing, 13.68 - partial = partial 13.69 - } 13.70 - else 13.71 - 13.72 - if not initiative.revoked then 13.73 - local params = param.get_all_cgi() 13.74 - params.dyn = nil 13.75 - ui.link{ 13.76 - image = { static = "icons/16/thumb_up_green.png" }, 13.77 - text = _"Support this initiative", 13.78 - module = "initiative", 13.79 - action = "add_support", 13.80 - id = initiative.id, 13.81 - routing = routing, 13.82 - partial = partial 13.83 - } 13.84 - end 13.85 - end 13.86 - end 13.87 - 13.88 - 13.89 - if (initiative.discussion_url and #initiative.discussion_url > 0) then 13.90 - if initiative.discussion_url:find("^https?://") then 13.91 - if initiative.discussion_url and #initiative.discussion_url > 0 then 13.92 - ui.link{ 13.93 - attr = { 13.94 - target = "_blank", 13.95 - title = _"Discussion with initiators" 13.96 - }, 13.97 - image = { static = "icons/16/comments.png" }, 13.98 - text = _"Discuss with initiators", 13.99 - external = initiative.discussion_url 13.100 - } 13.101 - end 13.102 - else 13.103 - slot.put(encode.html(initiative.discussion_url)) 13.104 - end 13.105 - end 13.106 - if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then 13.107 - ui.link{ 13.108 - image = { static = "icons/16/comments.png" }, 13.109 - text = _"change discussion URL", 13.110 - module = "initiative", 13.111 - view = "edit", 13.112 - id = initiative.id 13.113 - } 13.114 - end 13.115 - end 13.116 - } 13.117 - slot.put("<div style='clear: left;'></div>") 13.118 - end 13.119 -}
14.1 --- a/app/main/issue/_show_head.lua Mon Feb 13 00:16:42 2012 +0100 14.2 +++ b/app/main/issue/_show_head.lua Mon Feb 13 01:53:41 2012 +0100 14.3 @@ -64,129 +64,6 @@ 14.4 14.5 end) 14.6 14.7 - 14.8 - --[[ 14.9 -slot.select("content_navigation", function() 14.10 - 14.11 - if app.session.member_id then 14.12 - local records 14.13 - local this = 0 14.14 - local issues_selector = Issue:new_selector() 14.15 - 14.16 - -- FIXME: !DRY 14.17 - local issue_filter_map = { 14.18 - new = "new.png", 14.19 - accepted = "comments.png", 14.20 - half_frozen = "lock.png", 14.21 - frozen ="email_open.png", 14.22 - finished = "tick.png", 14.23 - cancelled = "cross.png", 14.24 - } 14.25 - 14.26 - 14.27 - local mk_link = function(index, text, icon, module) 14.28 - content = function() 14.29 - if index > 0 then 14.30 - slot.put(text) 14.31 - ui.image{ static = "icons/16/"..icon } 14.32 - else 14.33 - ui.image{ static = "icons/16/"..icon } 14.34 - slot.put(text) 14.35 - end 14.36 - end 14.37 - if records[this+index] then 14.38 - ui.link{ 14.39 - content = content, 14.40 - module = module, 14.41 - view = "show", 14.42 - id = records[this+index].id, 14.43 - } 14.44 - else 14.45 - ui.container{ 14.46 - content = content, 14.47 - } 14.48 - end 14.49 - end 14.50 - 14.51 - issues_selector 14.52 - :add_where{"issue.area_id = ?", issue.area.id} 14.53 - 14.54 - local filters = execute.load_chunk{module="issue", chunk="_filters.lua", params = {filter = "frozen"}} 14.55 - 14.56 - local state = issue.state 14.57 - 14.58 - -- FIXME: fix filter names to reflect issue.state values 14.59 - if state == "voting" then 14.60 - state = "frozen" 14.61 - elseif state == "frozen" then 14.62 - state = "half_frozen" 14.63 - end 14.64 - 14.65 - filter = filters:get_filter("filter", state) 14.66 - if filter then 14.67 - filter.selector_modifier(issues_selector) 14.68 - 14.69 - -- add subfilter to voting pager, so only not voted entries will be shown 14.70 - -- as this seems the most usefull exception 14.71 - if filter.name == "frozen" then 14.72 - filter_voting_name = "not_voted" 14.73 - local vfilter = filters:get_filter("filter_voting", "not_voted") 14.74 - if vfilter then 14.75 - vfilter.selector_modifier(issues_selector) 14.76 - end 14.77 - end 14.78 - end 14.79 - 14.80 - records = issues_selector:exec() 14.81 - 14.82 - for i,cissue in ipairs(records) do 14.83 - if cissue.id == issue.id then 14.84 - this = i 14.85 - break 14.86 - end 14.87 - end 14.88 - 14.89 - mk_link(-1, _("Previous issue"), "resultset_previous.png", "issue") 14.90 - if issue.area then 14.91 - ui.link{ 14.92 - content = function() 14.93 - if issue_filter_map[state] then 14.94 - ui.image{ static = "icons/16/"..issue_filter_map[state] } 14.95 - end 14.96 - slot.put(issue.area.name) 14.97 - end, 14.98 - module = "area", 14.99 - view = "show", 14.100 - id = issue.area.id, 14.101 - params = { 14.102 - filter = filter and filter.name or nil, 14.103 - filter_voting = filter_voting_name, 14.104 - tab = "issues" 14.105 - } 14.106 - } 14.107 - end 14.108 - mk_link(1, _("Next issue"), "resultset_next.png", "issue") 14.109 - 14.110 - -- show pager for initiatives if available 14.111 - if initiative then 14.112 - ui.container{ content = function() end, attr = {class = "content_navigation_seperator"}} 14.113 - 14.114 - records = issue:get_reference_selector("initiatives"):exec() 14.115 - for i,cissue in ipairs(records) do 14.116 - if cissue.id == initiative.id then 14.117 - this = i 14.118 - break 14.119 - end 14.120 - end 14.121 - mk_link(-1, _("Previous initiative"), "resultset_previous.png", "initiative") 14.122 - mk_link(1, _("Next initiative"), "resultset_next.png", "initiative") 14.123 - end 14.124 - end 14.125 -end 14.126 - 14.127 -) 14.128 - --]] 14.129 - 14.130 slot.select("actions", function() 14.131 14.132 if app.session.member_id then 14.133 @@ -256,10 +133,6 @@ 14.134 14.135 local issue = param.get("issue", "table") 14.136 14.137 - 14.138 - 14.139 --- ui.twitter("http://example.com/t" .. tostring(issue.id)) 14.140 - 14.141 if config.public_access_issue_head and not app.session.member_id then 14.142 config.public_access_issue_head(issue) 14.143 end
15.1 --- a/app/main/member/_area_list.lua Mon Feb 13 00:16:42 2012 +0100 15.2 +++ b/app/main/member/_area_list.lua Mon Feb 13 01:53:41 2012 +0100 15.3 @@ -5,18 +5,24 @@ 15.4 :join("membership", nil, { "membership.area_id = area.id AND membership.member_id = ?", member.id }) 15.5 :add_where{ "area.unit_id = ?", unit.id } 15.6 :add_order_by("area.member_weight DESC") 15.7 - ui.link{ 15.8 - attr = { class = "heading" }, 15.9 - text = unit.name, 15.10 - module = "area", view = "list", params = { unit_id = unit.id } 15.11 - } 15.12 15.13 if areas_selector:count() > 0 then 15.14 execute.view{ 15.15 module = "area", view = "_list", 15.16 - params = { areas_selector = areas_selector }, 15.17 + params = { areas_selector = areas_selector, title = function() 15.18 + ui.link{ 15.19 + attr = { class = "heading" }, 15.20 + text = unit.name, 15.21 + module = "area", view = "list", params = { unit_id = unit.id } 15.22 + } 15.23 + end}, 15.24 } 15.25 else 15.26 + ui.link{ 15.27 + attr = { class = "heading" }, 15.28 + text = unit.name, 15.29 + module = "area", view = "list", params = { unit_id = unit.id } 15.30 + } 15.31 ui.tag{ content = _"You have voting privileges for this unit, but you are not member of any of its areas." } 15.32 slot.put(" ") 15.33 ui.link{ 15.34 @@ -25,6 +31,7 @@ 15.35 } 15.36 end 15.37 slot.put("<br />") 15.38 + slot.put("<br />") 15.39 15.40 end 15.41
16.1 --- a/app/main/member/show_tab.lua Mon Feb 13 00:16:42 2012 +0100 16.2 +++ b/app/main/member/show_tab.lua Mon Feb 13 01:53:41 2012 +0100 16.3 @@ -154,7 +154,7 @@ 16.4 local areas_selector = member:get_reference_selector("areas") 16.5 tabs[#tabs+1] = { 16.6 name = "areas", 16.7 - label = _"Areas" .. " (" .. tostring(areas_selector:count()) .. ")", 16.8 + label = _"Areas", 16.9 icon = { static = "icons/16/package.png" }, 16.10 module = "member", 16.11 view = "_area_list", 16.12 @@ -164,7 +164,7 @@ 16.13 local issues_selector = Issue:new_selector() 16.14 tabs[#tabs+1] = { 16.15 name = "issues", 16.16 - label = _"Issues" .. " (" .. tostring(issues_selector:count()) .. ")", 16.17 + label = _"Issues", 16.18 icon = { static = "icons/16/folder.png" }, 16.19 module = "issue", 16.20 view = "_list",
17.1 --- a/app/main/supporter/_show_box.lua Mon Feb 13 00:16:42 2012 +0100 17.2 +++ b/app/main/supporter/_show_box.lua Mon Feb 13 01:53:41 2012 +0100 17.3 @@ -1,142 +1,116 @@ 17.4 +local initiative = param.get("initiative", "table") or Initiative:by_id(param.get_id()) 17.5 17.6 -local initiative = param.get("initiative", "table") 17.7 -local supporter = Supporter:by_pk(initiative.id, app.session.member.id) 17.8 +-- TODO performance 17.9 +local initiator = Initiator:by_pk(initiative.id, app.session.member.id) 17.10 17.11 -local unique_string = multirand.string(16, '0123456789abcdef') 17.12 - 17.13 +ui.partial{ 17.14 + module = "initiative", 17.15 + view = "show_support", 17.16 + id = initiative.id, 17.17 + target = "initiative_" .. tostring(initiative.id) .. "_support", 17.18 + content = function() 17.19 17.20 -local partial = { 17.21 - routing = { 17.22 - default = { 17.23 - mode = "redirect", 17.24 - module = "initiative", 17.25 - view = "show_support", 17.26 - id = initiative.id 17.27 - } 17.28 - } 17.29 -} 17.30 + ui.container{ 17.31 + attr = { class = "actions" }, 17.32 + content = function() 17.33 + 17.34 + local initiative = param.get("initiative", "table") 17.35 + local supporter = Supporter:by_pk(initiative.id, app.session.member.id) 17.36 + 17.37 + local partial = { 17.38 + routing = { 17.39 + default = { 17.40 + mode = "redirect", 17.41 + module = "initiative", 17.42 + view = "show_support", 17.43 + id = initiative.id 17.44 + } 17.45 + } 17.46 + } 17.47 17.48 -local routing = { 17.49 - default = { 17.50 - mode = "redirect", 17.51 - module = request.get_module(), 17.52 - view = request.get_view(), 17.53 - id = param.get_id_cgi(), 17.54 - params = param.get_all_cgi() 17.55 - } 17.56 -} 17.57 + local routing = { 17.58 + default = { 17.59 + mode = "redirect", 17.60 + module = request.get_module(), 17.61 + view = request.get_view(), 17.62 + id = param.get_id_cgi(), 17.63 + params = param.get_all_cgi() 17.64 + } 17.65 + } 17.66 17.67 -if not initiative.issue.fully_frozen and not initiative.issue.closed then 17.68 - if supporter then 17.69 - if not supporter:has_critical_opinion() then 17.70 - ui.container{ 17.71 - attr = { 17.72 - class = "head head_supporter", 17.73 - style = "cursor: pointer;", 17.74 - onclick = "document.getElementById('support_content_" .. unique_string .. "').style.display = 'block';" 17.75 - }, 17.76 - content = function() 17.77 - ui.image{ 17.78 - static = "icons/16/thumb_up_green.png" 17.79 - } 17.80 - if supporter.auto_support then 17.81 - slot.put(_"Your are supporter (Autosupport enabled)") 17.82 + if not initiative.issue.fully_frozen and not initiative.issue.closed then 17.83 + if supporter then 17.84 + if not supporter:has_critical_opinion() then 17.85 + ui.container{ attr = { class = "supporter" }, content = function() 17.86 + ui.image{ 17.87 + static = "icons/16/thumb_up_green.png" 17.88 + } 17.89 + slot.put(_"Your are supporter") 17.90 + end } 17.91 + else 17.92 + ui.tag{ attr = { class = "potential_supporter" }, content = function() 17.93 + ui.image{ 17.94 + static = "icons/16/thumb_up.png" 17.95 + } 17.96 + slot.put(_"Your are potential supporter") 17.97 + end } 17.98 + end 17.99 + ui.link{ 17.100 + image = { static = "icons/16/cross.png" }, 17.101 + text = _"Withdraw support", 17.102 + module = "initiative", 17.103 + action = "remove_support", 17.104 + id = initiative.id, 17.105 + routing = routing, 17.106 + partial = partial 17.107 + } 17.108 else 17.109 - slot.put(_"Your are supporter") 17.110 - end 17.111 - ui.image{ 17.112 - static = "icons/16/dropdown.png" 17.113 - } 17.114 - end 17.115 - } 17.116 - else 17.117 - ui.container{ 17.118 - attr = { 17.119 - class = "head head_potential_supporter", 17.120 - style = "cursor: pointer;", 17.121 - onclick = "document.getElementById('support_content_" .. unique_string .. "').style.display = 'block';" 17.122 - }, 17.123 - content = function() 17.124 - ui.image{ 17.125 - static = "icons/16/thumb_up.png" 17.126 - } 17.127 - if supporter.auto_support then 17.128 - slot.put(_"Your are potential supporter (WARNING: Autosupport enabled)") 17.129 - else 17.130 - slot.put(_"Your are potential supporter") 17.131 - end 17.132 - ui.image{ 17.133 - static = "icons/16/dropdown.png" 17.134 - } 17.135 - end 17.136 - } 17.137 - end 17.138 - ui.container{ 17.139 - attr = { class = "content", id = "support_content_" .. unique_string .. "" }, 17.140 - content = function() 17.141 - ui.container{ 17.142 - attr = { 17.143 - class = "close", 17.144 - style = "cursor: pointer;", 17.145 - onclick = "document.getElementById('support_content_" .. unique_string .. "').style.display = 'none';" 17.146 - }, 17.147 - content = function() 17.148 - ui.image{ static = "icons/16/cross.png" } 17.149 - end 17.150 - } 17.151 - if supporter then 17.152 - if config.auto_support then 17.153 - if supporter.auto_support then 17.154 + 17.155 + if not initiative.revoked then 17.156 + local params = param.get_all_cgi() 17.157 + params.dyn = nil 17.158 ui.link{ 17.159 - image = { static = "icons/16/cancel.png" }, 17.160 - text = _"Disable autosupport for this initiative", 17.161 + image = { static = "icons/16/thumb_up_green.png" }, 17.162 + text = _"Support this initiative", 17.163 module = "initiative", 17.164 action = "add_support", 17.165 id = initiative.id, 17.166 routing = routing, 17.167 - partial = partial, 17.168 - params = { auto_support = false } 17.169 - } 17.170 - else 17.171 - ui.link{ 17.172 - image = { static = "icons/16/arrow_refresh.png" }, 17.173 - text = _"Enable autosupport for this initiative", 17.174 - module = "initiative", 17.175 - action = "add_support", 17.176 - id = initiative.id, 17.177 - routing = routing, 17.178 - partial = partial, 17.179 - params = { auto_support = true } 17.180 + partial = partial 17.181 } 17.182 end 17.183 end 17.184 + end 17.185 + 17.186 + 17.187 + if (initiative.discussion_url and #initiative.discussion_url > 0) then 17.188 + if initiative.discussion_url:find("^https?://") then 17.189 + if initiative.discussion_url and #initiative.discussion_url > 0 then 17.190 + ui.link{ 17.191 + attr = { 17.192 + target = "_blank", 17.193 + title = _"Discussion with initiators" 17.194 + }, 17.195 + image = { static = "icons/16/comments.png" }, 17.196 + text = _"Discuss with initiators", 17.197 + external = initiative.discussion_url 17.198 + } 17.199 + end 17.200 + else 17.201 + slot.put(encode.html(initiative.discussion_url)) 17.202 + end 17.203 + end 17.204 + if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then 17.205 ui.link{ 17.206 - image = { static = "icons/16/thumb_down_red.png" }, 17.207 - text = _"Remove my support from this initiative", 17.208 - module = "initiative", 17.209 - action = "remove_support", 17.210 - id = initiative.id, 17.211 - routing = routing, 17.212 - partial = partial 17.213 + image = { static = "icons/16/comments.png" }, 17.214 + text = _"change discussion URL", 17.215 + module = "initiative", 17.216 + view = "edit", 17.217 + id = initiative.id 17.218 } 17.219 - else 17.220 end 17.221 end 17.222 } 17.223 - else 17.224 - if not initiative.revoked then 17.225 - local params = param.get_all_cgi() 17.226 - params.dyn = nil 17.227 - ui.link{ 17.228 - image = { static = "icons/16/thumb_up_green.png" }, 17.229 - text = _"Support this initiative", 17.230 - module = "initiative", 17.231 - action = "add_support", 17.232 - id = initiative.id, 17.233 - routing = routing, 17.234 - partial = partial 17.235 - } 17.236 - end 17.237 + slot.put("<div style='clear: left;'></div>") 17.238 end 17.239 -end 17.240 - 17.241 +}
18.1 --- a/env/ui/tabs.lua Mon Feb 13 00:16:42 2012 +0100 18.2 +++ b/env/ui/tabs.lua Mon Feb 13 01:53:41 2012 +0100 18.3 @@ -1,241 +1,54 @@ 18.4 -if config.user_tab_mode == "accordeon" or config.user_tab_mode == "accordeon_first_expanded" or config.user_tab_mode == "accordeon_all_expanded" then 18.5 - 18.6 - function ui.tabs(tabs) 18.7 - local params = param.get_all_cgi() 18.8 - local current_tabs_string = params["tab"] 18.9 - local current_tabs = {} 18.10 - if current_tabs_string then 18.11 - for current_tab in current_tabs_string:gmatch("([^%|]+)") do 18.12 - current_tabs[current_tab] = current_tab 18.13 - end 18.14 - end 18.15 - 18.16 - local unique_string = param.get("tab_id") or multirand.string(16, '0123456789abcdef') 18.17 - 18.18 - function render_tab(tab, first) 18.19 +function ui.tabs(tabs) 18.20 + ui.container{ 18.21 + attr = { class = "ui_tabs" }, 18.22 + content = function() 18.23 local params = param.get_all_cgi() 18.24 - local active = false 18.25 - for current_tab in pairs(current_tabs) do 18.26 - if tab.name == current_tab then 18.27 - active = true 18.28 - end 18.29 - end 18.30 - if config.user_tab_mode == "accordeon_first_expanded" then 18.31 - if first and current_tabs_string == nil then 18.32 - active = true 18.33 - end 18.34 - end 18.35 - 18.36 - if active and not first then 18.37 - app.html_title.prefix = tab.label 18.38 - end 18.39 - 18.40 - local link_tabs = {} 18.41 - if config.user_tab_mode == "accordeon" 18.42 - or config.user_tab_mode == "accordeon_first_expanded" 18.43 - or config.user_tab_mode == "accordeon_all_expanded" and current_tabs_string 18.44 - then 18.45 - if not current_tabs_string and not first then 18.46 - link_tabs[tabs[1].name] = true 18.47 - end 18.48 - for current_tab in pairs(current_tabs) do 18.49 - if current_tab ~= tab.name then 18.50 - link_tabs[current_tab] = true 18.51 - end 18.52 - end 18.53 - elseif config.user_tab_mode == "accordeon_all_expanded" and not current_tabs_string then 18.54 - for i, current_tab in ipairs(tabs) do 18.55 - if current_tab.name ~= tab.name then 18.56 - link_tabs[current_tab.name] = true 18.57 - end 18.58 - end 18.59 - end 18.60 - if not active then 18.61 - link_tabs[tab.name] = true 18.62 - end 18.63 - 18.64 - params["tab"] = tab.name 18.65 - local onclick 18.66 - if not tab.content then 18.67 - onclick = 18.68 - 'if (ui_tabs_active["' .. unique_string .. '"]["' .. tab.name .. '"]) {' .. 18.69 - 'el=document.getElementById("tab' .. unique_string .. '_content_' .. tab.name .. '");' .. 18.70 - 'el.innerHTML="";' .. 18.71 - 'el.style.display="none";' .. 18.72 - 'ui_tabs_active["' .. unique_string .. '"]["' .. tab.name .. '"]=false' .. 18.73 - '} else {' .. 18.74 - 'ui_tabs_active["' .. unique_string .. '"]["' .. tab.name .. '"]=true;' .. 18.75 - 'document.getElementById("tab' .. unique_string .. '_content_' .. tab.name .. '").style.display="block"; ' .. 18.76 - ui._partial_load_js{ 18.77 - params = { tab = tab.name } 18.78 - } .. 18.79 - '};' .. 18.80 - 'return(false);' 18.81 - end 18.82 - ui.link{ 18.83 - attr = { 18.84 - name = "tab_" .. tab.name, 18.85 - class = ( 18.86 - tab.name == current_tab and "ui_tabs_accordeon_head selected" .. (tab.class and (" " .. tab.class) or "") or 18.87 - not current_tab and i == 1 and "ui_tabs_accordeon_head selected" .. (tab.class and (" " .. tab.class) or "") or 18.88 - "ui_tabs_accordeon_head" .. (tab.class and (" " .. tab.class) or "") 18.89 - ), 18.90 - id = "tab" .. unique_string .. "_head_" .. tab.name, 18.91 - onclick = onclick, 18.92 - }, 18.93 - module = request.get_module(), 18.94 - view = request.get_view(), 18.95 - id = param.get_id_cgi(), 18.96 - params = params, 18.97 - anchor = "tab" .. unique_string .. "_" .. tab.name, 18.98 + local current_tab = params["tab"] 18.99 + ui.container{ 18.100 + attr = { class = "ui_tabs_links" }, 18.101 content = function() 18.102 - if tab.icon then 18.103 - if not tab.icon.attr then 18.104 - tab.icon.attr = {} 18.105 - end 18.106 - tab.icon.attr.id = "tab" .. unique_string .. "_icon_" .. tab.name 18.107 - tab.icon.attr.width = 16 18.108 - tab.icon.attr.height = 16 18.109 - ui.image(tab.icon) 18.110 - end 18.111 - slot.put(tab.label) 18.112 - end 18.113 - } 18.114 - local expanded = active or not request.get_json_request_slots() and config.user_tab_mode == "accordeon_all_expanded" and not current_tabs_string 18.115 - ui.container{ 18.116 - attr = { 18.117 - class = "ui_tabs_accordeon_content" .. (tab.class and (" " .. tab.class) or ""), 18.118 - style = not expanded and "display: none;" or nil, 18.119 - id = "tab" .. unique_string .. "_content_" .. tab.name 18.120 - }, 18.121 - content = function() 18.122 - if expanded then 18.123 - ui.script{ script = 'ui_tabs_active["' .. unique_string .. '"]["' .. tab.name .. '"] = true;' } 18.124 - execute.view{ 18.125 - module = tab.module, 18.126 - view = tab.view, 18.127 - id = tab.id, 18.128 - params = tab.params 18.129 + for i, tab in ipairs(tabs) do 18.130 + params["tab"] = i > 1 and tab.name or nil 18.131 + ui.link{ 18.132 + attr = { 18.133 + class = ( 18.134 + tab.name == current_tab and "selected" .. (tab.class and (" " .. tab.class) or "") or 18.135 + not current_tab and i == 1 and "selected" .. (tab.class and (" " .. tab.class) or "") or 18.136 + "" .. (tab.class and (" " .. tab.class) or "") 18.137 + ) 18.138 + }, 18.139 + module = request.get_module(), 18.140 + view = request.get_view(), 18.141 + id = param.get_id_cgi(), 18.142 + content = tab.label, 18.143 + params = params 18.144 } 18.145 - else 18.146 - slot.put(" ") 18.147 + slot.put(" ") 18.148 end 18.149 end 18.150 } 18.151 - end 18.152 - 18.153 - if not request.get_json_request_slots() or not current_tabs_string then 18.154 - ui.script{ script = "ui_tabs_active['" .. unique_string .. "'] = {};" } 18.155 - ui.container{ 18.156 - attr = { class = "ui_tabs" }, 18.157 - content = function() 18.158 - for i, tab in ipairs(tabs) do 18.159 - local static_params = tabs.static_params or {} 18.160 - static_params.tab = tab.name 18.161 - static_params.tab_id = unique_string 18.162 - ui.partial{ 18.163 - module = tabs.module, 18.164 - view = tabs.view, 18.165 - id = tabs.id, 18.166 - params = static_params, 18.167 - param_names = { "page" }, 18.168 - hourglass_target = "tab" .. unique_string .. "_icon_" .. tab.name, 18.169 - target = "tab" .. unique_string .. "_content_" .. tab.name, 18.170 - content = function() 18.171 - render_tab(tab, i == 1) 18.172 + for i, tab in ipairs(tabs) do 18.173 + if tab.name == current_tab and i > 1 then 18.174 + app.html_title.prefix = tab.label 18.175 end 18.176 - } 18.177 - end 18.178 + if tab.name == current_tab or not current_tab and i == 1 then 18.179 + ui.container{ 18.180 + attr = { class = "ui_tabs_content" }, 18.181 + content = function() 18.182 + if tab.content then 18.183 + tab.content() 18.184 + else 18.185 + execute.view{ 18.186 + module = tab.module, 18.187 + view = tab.view, 18.188 + id = tab.id, 18.189 + params = tab.params, 18.190 + } 18.191 + end 18.192 + end 18.193 + } 18.194 end 18.195 - } 18.196 - else 18.197 - local dyntab 18.198 - for i, tab in ipairs(tabs) do 18.199 - if tab.name == current_tabs_string then 18.200 - dyntab = tab 18.201 - end 18.202 - end 18.203 - if dyntab then 18.204 - local static_params = tabs.static_params or {} 18.205 - static_params.tab = dyntab.name 18.206 - static_params.tab_id = unique_string 18.207 - dyntab.params.tab_id = unique_string 18.208 - ui.partial{ 18.209 - module = tabs.module, 18.210 - view = tabs.view, 18.211 - id = tabs.id, 18.212 - params = static_params, 18.213 - param_names = { "page" }, 18.214 - hourglass_target = "tab" .. unique_string .. "_icon_" .. dyntab.name, 18.215 - target = "tab" .. unique_string .. "_content_" .. dyntab.name, 18.216 - content = function() 18.217 - execute.view{ 18.218 - module = dyntab.module, 18.219 - view = dyntab.view, 18.220 - id = dyntab.id, 18.221 - params = dyntab.params, 18.222 - } 18.223 - end 18.224 - } 18.225 end 18.226 end 18.227 - end 18.228 - 18.229 -else -- 'classic tab' 18.230 - 18.231 - function ui.tabs(tabs) 18.232 - ui.container{ 18.233 - attr = { class = "ui_tabs" }, 18.234 - content = function() 18.235 - local params = param.get_all_cgi() 18.236 - local current_tab = params["tab"] 18.237 - ui.container{ 18.238 - attr = { class = "ui_tabs_links" }, 18.239 - content = function() 18.240 - for i, tab in ipairs(tabs) do 18.241 - params["tab"] = i > 1 and tab.name or nil 18.242 - ui.link{ 18.243 - attr = { 18.244 - class = ( 18.245 - tab.name == current_tab and "selected" .. (tab.class and (" " .. tab.class) or "") or 18.246 - not current_tab and i == 1 and "selected" .. (tab.class and (" " .. tab.class) or "") or 18.247 - "" .. (tab.class and (" " .. tab.class) or "") 18.248 - ) 18.249 - }, 18.250 - module = request.get_module(), 18.251 - view = request.get_view(), 18.252 - id = param.get_id_cgi(), 18.253 - content = tab.label, 18.254 - params = params 18.255 - } 18.256 - slot.put(" ") 18.257 - end 18.258 - end 18.259 - } 18.260 - for i, tab in ipairs(tabs) do 18.261 - if tab.name == current_tab and i > 1 then 18.262 - app.html_title.prefix = tab.label 18.263 - end 18.264 - if tab.name == current_tab or not current_tab and i == 1 then 18.265 - ui.container{ 18.266 - attr = { class = "ui_tabs_content" }, 18.267 - content = function() 18.268 - if tab.content then 18.269 - tab.content() 18.270 - else 18.271 - execute.view{ 18.272 - module = tab.module, 18.273 - view = tab.view, 18.274 - id = tab.id, 18.275 - params = tab.params, 18.276 - } 18.277 - end 18.278 - end 18.279 - } 18.280 - end 18.281 - end 18.282 - end 18.283 - } 18.284 - end 18.285 - 18.286 + } 18.287 end
19.1 --- a/static/style.css Mon Feb 13 00:16:42 2012 +0100 19.2 +++ b/static/style.css Mon Feb 13 01:53:41 2012 +0100 19.3 @@ -32,7 +32,7 @@ 19.4 } 19.5 19.6 td, th { 19.7 - padding: 0.5ex 0.5em 0.5ex 0.5em; 19.8 + padding: 0.5ex 0.5em 0.5ex 0em; 19.9 } 19.10 19.11 td { 19.12 @@ -41,7 +41,6 @@ 19.13 19.14 th { 19.15 vertical-align: bottom; 19.16 - font-size: 75%; 19.17 font-weight: bold; 19.18 } 19.19 19.20 @@ -113,7 +112,10 @@ 19.21 */ 19.22 19.23 .topbar { 19.24 - background-color: #444; 19.25 + background-color: #000; 19.26 + background: -webkit-gradient(linear, left top, left bottom, 19.27 + color-stop(0%, #888), color-stop(25%,#333) 19.28 + ); 19.29 color: #fff; 19.30 font-size: 90%; 19.31 line-height: 100%; 19.32 @@ -199,7 +201,7 @@ 19.33 .title { 19.34 background-color: #ddd; 19.35 background: -webkit-gradient(linear, left top, left bottom, 19.36 - color-stop(0%,#ddd), color-stop(100%,#fff) 19.37 + color-stop(15%,#ddd), color-stop(100%,#fff) 19.38 ); 19.39 text-shadow: #fff 0px 0px 3px; 19.40 color: #000; 19.41 @@ -261,10 +263,10 @@ 19.42 .slot_initiative_head { 19.43 background: -webkit-gradient(linear, left top, left bottom, 19.44 /*color-stop(0%,#AFEFB9), color-stop(100%,#ffffff) */ 19.45 - color-stop(0%,#e7e7e7), color-stop(100%,#fff) 19.46 + color-stop(0%, #fff), color-stop(15%,#e7e7e7), color-stop(100%,#fff) 19.47 ); 19.48 padding-left: 1em; 19.49 - padding-top: 2ex; 19.50 + padding-top: 1ex; 19.51 text-shadow: #fff 0px 0px 3px; 19.52 } 19.53 19.54 @@ -339,12 +341,14 @@ 19.55 padding-right: 0.2em; 19.56 } 19.57 .actions .supporter, 19.58 +.actions .potential_supporter, 19.59 .vote_info .head { 19.60 float: left; 19.61 margin-right: 1em; 19.62 } 19.63 19.64 .actions .supporter, 19.65 +.actions .potential_supporter, 19.66 .actions .interest .head { 19.67 padding-right: 0.3em; 19.68 } 19.69 @@ -798,18 +802,14 @@ 19.70 */ 19.71 19.72 .issues .issue { 19.73 - xborder: 1px solid #ccc; 19.74 overflow: hidden; 19.75 margin-bottom: 2ex; 19.76 border-radius: 8px; 19.77 } 19.78 19.79 .issues .issue .issue_info { 19.80 - xfloat: left; 19.81 - xwidth: 25%; 19.82 padding: 1ex; 19.83 line-height: 140%; 19.84 - xoverflow: hidden; 19.85 background: -webkit-gradient(linear, left top, left bottom, 19.86 color-stop(0%,#e7e7e7), color-stop(33%, #f7f7f7), color-stop(66%,#fff)); 19.87 } 19.88 @@ -1128,8 +1128,6 @@ 19.89 display: block; 19.90 font-size: 120%; 19.91 font-weight: bold; 19.92 - margin-top: 2ex; 19.93 - margin-bottom: 1ex; 19.94 } 19.95 19.96 .heading.first {