# HG changeset patch
# User bsw
# Date 1329094421 -3600
# Node ID fecd4c13054a6273521ccc986470891efc00bdd9
# Parent bde068b37608a8727e9ae54abcb565e97142d6fa
Code/css clean up and minor enhancements
diff -r bde068b37608 -r fecd4c13054a app/main/area/_list.lua
--- a/app/main/area/_list.lua Mon Feb 13 00:16:42 2012 +0100
+++ b/app/main/area/_list.lua Mon Feb 13 01:53:41 2012 +0100
@@ -1,4 +1,5 @@
local areas_selector = param.get("areas_selector", "table")
+local title = param.get("title", "function")
areas_selector
:reset_fields()
@@ -36,6 +37,7 @@
records = areas_selector:exec(),
columns = {
{
+ label = title,
content = function(record)
if record.is_member then
local text = _"Member of area"
diff -r bde068b37608 -r fecd4c13054a app/main/area/list.lua
--- a/app/main/area/list.lua Mon Feb 13 00:16:42 2012 +0100
+++ b/app/main/area/list.lua Mon Feb 13 01:53:41 2012 +0100
@@ -1,4 +1,5 @@
local unit_id = config.single_unit_id or param.get("unit_id", atom.integer)
+local title = param.get("title", "function")
local areas_selector = Area:build_selector{ active = true, unit_id = unit_id }
areas_selector:add_order_by("member_weight DESC")
@@ -37,5 +38,5 @@
execute.view{
module = "area",
view = "_list",
- params = { areas_selector = areas_selector }
+ params = { areas_selector = areas_selector, title = title }
}
diff -r bde068b37608 -r fecd4c13054a app/main/delegation/_action/update.lua
--- a/app/main/delegation/_action/update.lua Mon Feb 13 00:16:42 2012 +0100
+++ b/app/main/delegation/_action/update.lua Mon Feb 13 01:53:41 2012 +0100
@@ -20,6 +20,7 @@
delegation:destroy()
+--[[
if issue_id then
slot.put_into("notice", _"Your delegation for this issue has been deleted.")
elseif area_id then
@@ -27,7 +28,7 @@
else
slot.put_into("notice", _"Your delegation for this unit has been deleted.")
end
-
+--]]
end
else
@@ -53,7 +54,7 @@
end
delegation:save()
-
+--[[
if issue_id then
slot.put_into("notice", _"Your delegation for this issue has been updated.")
elseif area_id then
@@ -61,6 +62,6 @@
else
slot.put_into("notice", _"Your delegation for this unit has been updated.")
end
-
+--]]
end
diff -r bde068b37608 -r fecd4c13054a app/main/initiative/_list.lua
--- a/app/main/initiative/_list.lua Mon Feb 13 00:16:42 2012 +0100
+++ b/app/main/initiative/_list.lua Mon Feb 13 01:53:41 2012 +0100
@@ -1,5 +1,3 @@
-ui.script{ script = "lf_initiative_expanded = {};" }
-
local issue = param.get("issue", "table")
local initiatives_selector = param.get("initiatives_selector", "table")
@@ -55,7 +53,6 @@
if show_for_initiative then
- ui.script{ script = "lf_initiative_expanded['initiative_content_" .. tostring(show_for_initiative.id) .. "'] = true;" }
initiatives_selector:add_where{ "initiative.id != ?", show_for_initiative.id }
execute.view{
@@ -63,8 +60,6 @@
view = "_list_element",
params = {
initiative = show_for_initiative,
- expanded = true,
- expandable = true
}
}
if show_for_issue then
@@ -97,8 +92,6 @@
initiatives_selector:limit(limit)
end
- local expandable = param.get("expandable", atom.boolean)
-
local issue = param.get("issue", "table")
local name = "initiative_list"
@@ -182,19 +175,12 @@
end
end
for i, initiative in ipairs(initiatives) do
- local expanded = config.user_tab_mode == "accordeon_all_expanded" and expandable or
- show_for_initiative and initiative.id == show_for_initiative.id
- if expanded then
- ui.script{ script = "lf_initiative_expanded['initiative_content_" .. tostring(initiative.id) .. "'] = true;" }
- end
execute.view{
module = "initiative",
view = "_list_element",
params = {
initiative = initiative,
selected = highlight_initiative and highlight_initiative.id == initiative.id or nil,
- expanded = expanded,
- expandable = expandable
}
}
end
diff -r bde068b37608 -r fecd4c13054a app/main/initiative/_list_element.lua
--- a/app/main/initiative/_list_element.lua Mon Feb 13 00:16:42 2012 +0100
+++ b/app/main/initiative/_list_element.lua Mon Feb 13 01:53:41 2012 +0100
@@ -1,7 +1,5 @@
local initiative = param.get("initiative", "table")
local selected = param.get("selected", atom.boolean)
-local expanded = param.get("expanded", atom.boolean)
-local expandable = param.get("expandable", atom.boolean)
local head_name = "initiative_head_" .. tostring(initiative.id)
local link_name = "initiative_link_" .. tostring(initiative.id)
@@ -11,43 +9,6 @@
ui.container{
attr = { class = "ui_tabs" .. (initiative.id == for_initiative_id and " active" or "") },
content = function()
- local web20 = config.user_tab_mode == "accordeon"
- or config.user_tab_mode == "accordeon_first_expanded"
- or config.user_tab_mode == "accordeon_all_expanded"
- local onclick
- if web20 then
- if expandable then
- onclick =
- 'if (lf_initiative_expanded["' .. name .. '"]) {' ..
- 'lf_initiative_expanded["' .. name .. '"]=false;' ..
- 'document.getElementById("' .. name .. '_content").innerHTML=" ";' ..
- 'document.getElementById("' .. name .. '").style.display="none";' ..
- '} else {' ..
- 'lf_initiative_expanded["' .. name .. '"] = true;' ..
- 'document.getElementById("' .. name .. '").style.display="block"; ' ..
- 'var hourglass_el = document.getElementById("' .. icon_name .. '");' ..
- 'var hourglass_src = hourglass_el.src;' ..
- 'hourglass_el.src = "' .. encode.url{ static = "icons/16/connect.png" } .. '";' ..
- 'partialMultiLoad(' ..
- '{ trace: "trace", system_error: "system_error", ' .. name .. '_content: "default" },' ..
- '{},' ..
- '"error",' ..
- '"' .. 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",' ..
- '{},' ..
- '{},' ..
- 'function() {' ..
- 'hourglass_el.src = hourglass_src;' ..
- '},' ..
- 'function() {' ..
- 'hourglass_el.src = hourglass_src;' ..
- '}' ..
- '); ' ..
- '}' ..
- 'return(false);'
- else
- onclick = "document.location.href = document.getElementById('" .. link_name .. "').href;"
- end
- end
local module = "initiative"
local view = "show"
local id = initiative.id
@@ -57,7 +18,6 @@
name = name,
class = "ui_tabs_accordeon_head",
id = head_name,
- onclick = onclick,
},
content = function()
@@ -70,16 +30,6 @@
content = function()
if initiative.issue.accepted and initiative.issue.closed and initiative.issue.ranks_available or initiative.admitted == false then
ui.field.rank{ image_attr = { id = icon_name }, attr = { class = "rank" }, value = initiative.rank }
- elseif web20 then
- ui.image{
- attr = {
- width = 16,
- height = 16,
- id = icon_name,
- style = "float: left;"
- },
- static = "icons/16/script.png"
- }
else
slot.put(" ")
end
@@ -182,7 +132,6 @@
attr = {
id = name,
class = "ui_tabs_accordeon_content",
- style = not expanded and "display: none;" or nil
},
content = function()
ui.container{
@@ -193,7 +142,6 @@
view = "show_partial",
params = {
initiative = initiative,
- expanded = expanded
}
}
end
diff -r bde068b37608 -r fecd4c13054a app/main/initiative/_show.lua
--- a/app/main/initiative/_show.lua Mon Feb 13 00:16:42 2012 +0100
+++ b/app/main/initiative/_show.lua Mon Feb 13 01:53:41 2012 +0100
@@ -142,11 +142,7 @@
}
end
-local web20 = config.user_tab_mode == "accordeon"
- or config.user_tab_mode == "accordeon_first_expanded"
- or config.user_tab_mode == "accordeon_all_expanded"
-
-if not web20 and initiative.issue.state == "cancelled" then
+if initiative.issue.state == "cancelled" then
local policy = initiative.issue.policy
ui.container{
attr = { class = "not_admitted_info" },
@@ -274,23 +270,15 @@
if app.session.member_id then
- ui.container{
- attr = {
- id = "initiative_" .. tostring(initiative.id) .. "_support"
- },
- content = function()
- execute.view{
- module = "initiative",
- view = "show_support",
- params = {
- initiative = initiative
- }
- }
- end
+ execute.view{
+ module = "supporter",
+ view = "_show_box",
+ params = {
+ initiative = initiative
+ }
}
end
-
execute.view{
module = "initiative",
view = "show_tab",
diff -r bde068b37608 -r fecd4c13054a app/main/initiative/list_rss.lua
--- a/app/main/initiative/list_rss.lua Mon Feb 13 00:16:42 2012 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-if not config.feature_rss_enabled then
- error("feature not enabled")
-end
-
-local area_id = param.get("area_id", atom.integer)
-local issue_id = param.get("issue_id", atom.integer)
-local order = param.get("order") or "last_created"
-
-local initiatives_selector = Initiative:new_selector()
-
-local issue
-local area
-
-if issue_id then
- issue = Issue:by_id(issue_id)
- initiatives_selector:add_where{ "initiative.issue_id = ?", issue_id }
-elseif area_id then
- area = Area:by_id(area_id)
- initiatives_selector:join("issue", nil, "issue.id = initiative.issue_id")
- initiatives_selector:add_where{ "issue.area_id = ?", area_id }
-end
-
-
-if order == "last_created" then
- initiatives_selector:add_order_by("initiative.created DESC")
- initiatives_selector:add_field("initiative.created", "created_or_updated")
-elseif order == "last_updated" then
- initiatives_selector:add_field("(SELECT MAX(created) FROM draft WHERE initiative_id = initiative.id GROUP BY initiative_id)", "created_or_updated")
- initiatives_selector:add_order_by("(SELECT MAX(created) FROM draft WHERE initiative_id = initiative.id GROUP BY initiative_id) DESC")
-else
- error("Invalid order")
-end
-
-initiatives_selector:add_order_by("id DESC")
-
-initiatives_selector:limit(25)
-
-local initiatives = initiatives_selector:exec()
-
-slot.set_layout("atom")
-request.force_absolute_baseurl()
-
-ui.tag{
- tag = "author",
- content = function()
- ui.tag{
- tag = "name",
- content = "LiquidFeedback"
- }
- end
-}
-
-local title
-
-if issue then
- title = "#" .. tostring(issue.id) .. " " .. issue.area.name
-elseif area then
- title = area.name
-else
- title = config.app_title
-end
-
-ui.tag{
- tag = "title",
- content = title
-}
-
-local subtitle
-if order == "last_created" then
- subtitle = "Initiatives (last created first)"
-elseif order == "last_updated" then
- subtitle = "Initiatives (last updated first)"
-end
-
-ui.tag{
- tag = "subtitle",
- content = subtitle
-}
-
-ui.tag{
- tag = "id",
--- content = "urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6"
-}
-
---[[
-ui.tag{
- tag = "updated",
- content = "2003-12-14T10:20:09Z"
-}
---]]
-
-for i, initiative in ipairs(initiatives) do
- ui.tag{
- tag = "entry",
- content = function()
- slot.put("\n")
- ui.tag{ tag = "category", attr = { term = encode.html(initiative.issue.area.name) } }
- slot.put("\n")
- ui.tag{ tag = "author", content = encode.html(initiative.current_draft.author.name) }
- slot.put("\n")
- ui.tag{ tag = "title", content = encode.html(initiative.shortened_name) }
- slot.put("\n")
- ui.tag{ tag = "link", attr = {
- href = encode.url{
- module = "initiative",
- view = "show",
- id = initiative.id
- }
- } }
- slot.put("\n")
- ui.tag{ tag = "id", content = "initiative_" .. tostring(initiative.id) }
- slot.put("\n")
- ui.tag{ tag = "updated", content = tostring(initiative.created_or_updated) }
- slot.put("\n")
- ui.tag{ tag = "content", content = encode.html(initiative.current_draft.content or "") }
- slot.put("\n")
- end
- }
- slot.put("\n")
-end
diff -r bde068b37608 -r fecd4c13054a app/main/initiative/new.lua
--- a/app/main/initiative/new.lua Mon Feb 13 00:16:42 2012 +0100
+++ b/app/main/initiative/new.lua Mon Feb 13 01:53:41 2012 +0100
@@ -26,6 +26,7 @@
},
attr = { class = "vertical" },
content = function()
+ ui.field.text{ label = _"Unit", value = area.unit.name }
ui.field.text{ label = _"Area", value = area.name }
slot.put("
")
if issue_id then
diff -r bde068b37608 -r fecd4c13054a app/main/initiative/show.lua
--- a/app/main/initiative/show.lua Mon Feb 13 00:16:42 2012 +0100
+++ b/app/main/initiative/show.lua Mon Feb 13 01:53:41 2012 +0100
@@ -8,33 +8,29 @@
app.html_title.subtitle = _("Initiative ##{id}", { id = initiative.id })
-if request.get_json_request_slots() then
- execute.view{
- module = "initiative",
- view = "show_partial",
- params = {
- initiative = initiative
- }
+execute.view{
+ module = "issue",
+ view = "_show_head",
+ params = { issue = initiative.issue,
+ initiative = initiative }
+}
+
+if not initiative then
+ initiative = Initiative:by_id(param.get_id())
+ expanded = true
+end
+
+-- TODO performance
+local initiator
+if app.session.member_id then
+ initiator = Initiator:by_pk(initiative.id, app.session.member.id)
+end
+
+execute.view{
+ module = "initiative",
+ view = "_show",
+ params = {
+ initiative = initiative,
+ initiator = initiator
}
-elseif
- config.user_tab_mode == "accordeon" or
- config.user_tab_mode == "accordeon_first_expanded" or
- config.user_tab_mode == "accordeon_all_expanded"
-then
- execute.view{
- module = "issue",
- view = "show",
- id = initiative.issue_id,
- params = {
- for_initiative_id = initiative.id
- }
- }
-else
- execute.view{
- module = "initiative",
- view = "show_static",
- params = {
- initiative = initiative
- }
- }
-end
+}
diff -r bde068b37608 -r fecd4c13054a app/main/initiative/show.rss.lua
--- a/app/main/initiative/show.rss.lua Mon Feb 13 00:16:42 2012 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-slot.set_layout("rss")
-
-local function rss_channel(channel)
- for key, val in pairs(channel) do
- slot.put("<", key, ">", val, "", key, ">")
- end
-end
-
-local function rss_item(item)
- slot.put("- ")
- for key, val in pairs(item) do
- slot.put("<", key, ">", val, "", key, ">")
- end
- slot.put("
")
-end
-
-local initiative = Initiative:by_id(param.get_id())
-
-rss_channel{
- title = initiative.name,
- description = initiative.current_draft.content,
- language = "de",
-}
-
-for i, suggestion in ipairs(initiative.suggestions) do
-
- local text = suggestion.name
-
- text = text .. " ("
- text = text .. tostring(suggestion.plus2_unfulfilled_count + suggestion.plus2_unfulfilled_count) .. "++ "
- text = text .. tostring(suggestion.plus1_unfulfilled_count + suggestion.plus1_unfulfilled_count) .. "+ "
- text = text .. tostring(suggestion.minus1_unfulfilled_count + suggestion.minus1_unfulfilled_count) .. "- "
- text = text .. tostring(suggestion.minus2_unfulfilled_count + suggestion.minus2_unfulfilled_count) .. "--"
-
- text = text .. ")"
-
- rss_item{
- title = text,
- description = suggestion.content,
- link = request.get_base_url() .. "/lf/suggestion/show/" .. tostring(suggestion.id) .. ".html",
- }
-
-end
\ No newline at end of file
diff -r bde068b37608 -r fecd4c13054a app/main/initiative/show_partial.lua
--- a/app/main/initiative/show_partial.lua Mon Feb 13 00:16:42 2012 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-local initiative = param.get("initiative", "table")
-local expanded = param.get("expanded", atom.boolean)
-
-if not initiative then
- initiative = Initiative:by_id(param.get_id())
- expanded = true
-end
-
--- TODO performance
-local initiator
-if app.session.member_id then
- initiator = Initiator:by_pk(initiative.id, app.session.member.id)
-end
-
-ui.partial{
- module = "initiative",
- view = "show",
- id = initiative.id,
- target = "initiative_content_" .. tostring(initiative.id) .. "_content",
- content = function()
- if expanded then
- execute.view{
- module = "initiative",
- view = "_show",
- params = {
- initiative = initiative,
- initiator = initiator
- }
- }
- else
- slot.put(" ")
- end
- end
-}
diff -r bde068b37608 -r fecd4c13054a app/main/initiative/show_static.lua
--- a/app/main/initiative/show_static.lua Mon Feb 13 00:16:42 2012 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-local initiative = param.get("initiative", "table")
-
-if not initiative then
- initiative = Initiative:new_selector():add_where{ "id = ?", param.get_id()}:single_object_mode():exec()
-end
-
-execute.view{
- module = "issue",
- view = "_show_head",
- params = { issue = initiative.issue,
- initiative = initiative }
-}
-
-
-execute.view{
- module = "initiative",
- view = "show_partial",
- params = {
- initiative = initiative,
- expanded = true
- }
-}
diff -r bde068b37608 -r fecd4c13054a app/main/initiative/show_support.lua
--- a/app/main/initiative/show_support.lua Mon Feb 13 00:16:42 2012 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-local initiative = param.get("initiative", "table") or Initiative:by_id(param.get_id())
-
--- TODO performance
-local initiator = Initiator:by_pk(initiative.id, app.session.member.id)
-
-ui.partial{
- module = "initiative",
- view = "show_support",
- id = initiative.id,
- target = "initiative_" .. tostring(initiative.id) .. "_support",
- content = function()
-
- ui.container{
- attr = { class = "actions" },
- content = function()
-
- local initiative = param.get("initiative", "table")
- local supporter = Supporter:by_pk(initiative.id, app.session.member.id)
-
- local partial = {
- routing = {
- default = {
- mode = "redirect",
- module = "initiative",
- view = "show_support",
- id = initiative.id
- }
- }
- }
-
- local routing = {
- default = {
- mode = "redirect",
- module = request.get_module(),
- view = request.get_view(),
- id = param.get_id_cgi(),
- params = param.get_all_cgi()
- }
- }
-
- if not initiative.issue.fully_frozen and not initiative.issue.closed then
- if supporter then
- if not supporter:has_critical_opinion() then
- ui.container{ attr = { class = "supporter" }, content = function()
- ui.image{
- static = "icons/16/thumb_up_green.png"
- }
- slot.put(_"Your are supporter")
- end }
- else
- ui.tag{ attr = { class = "potential_supporter" }, content = function()
- ui.image{
- static = "icons/16/thumb_up.png"
- }
- slot.put(_"Your are potential supporter")
- end }
- end
- ui.link{
- image = { static = "icons/16/cross.png" },
- text = _"Withdraw support",
- module = "initiative",
- action = "remove_support",
- id = initiative.id,
- routing = routing,
- partial = partial
- }
- else
-
- if not initiative.revoked then
- local params = param.get_all_cgi()
- params.dyn = nil
- ui.link{
- image = { static = "icons/16/thumb_up_green.png" },
- text = _"Support this initiative",
- module = "initiative",
- action = "add_support",
- id = initiative.id,
- routing = routing,
- partial = partial
- }
- end
- end
- end
-
-
- if (initiative.discussion_url and #initiative.discussion_url > 0) then
- if initiative.discussion_url:find("^https?://") then
- if initiative.discussion_url and #initiative.discussion_url > 0 then
- ui.link{
- attr = {
- target = "_blank",
- title = _"Discussion with initiators"
- },
- image = { static = "icons/16/comments.png" },
- text = _"Discuss with initiators",
- external = initiative.discussion_url
- }
- end
- else
- slot.put(encode.html(initiative.discussion_url))
- end
- end
- if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then
- ui.link{
- image = { static = "icons/16/comments.png" },
- text = _"change discussion URL",
- module = "initiative",
- view = "edit",
- id = initiative.id
- }
- end
- end
- }
- slot.put("
")
- end
-}
diff -r bde068b37608 -r fecd4c13054a app/main/issue/_show_head.lua
--- a/app/main/issue/_show_head.lua Mon Feb 13 00:16:42 2012 +0100
+++ b/app/main/issue/_show_head.lua Mon Feb 13 01:53:41 2012 +0100
@@ -64,129 +64,6 @@
end)
-
- --[[
-slot.select("content_navigation", function()
-
- if app.session.member_id then
- local records
- local this = 0
- local issues_selector = Issue:new_selector()
-
- -- FIXME: !DRY
- local issue_filter_map = {
- new = "new.png",
- accepted = "comments.png",
- half_frozen = "lock.png",
- frozen ="email_open.png",
- finished = "tick.png",
- cancelled = "cross.png",
- }
-
-
- local mk_link = function(index, text, icon, module)
- content = function()
- if index > 0 then
- slot.put(text)
- ui.image{ static = "icons/16/"..icon }
- else
- ui.image{ static = "icons/16/"..icon }
- slot.put(text)
- end
- end
- if records[this+index] then
- ui.link{
- content = content,
- module = module,
- view = "show",
- id = records[this+index].id,
- }
- else
- ui.container{
- content = content,
- }
- end
- end
-
- issues_selector
- :add_where{"issue.area_id = ?", issue.area.id}
-
- local filters = execute.load_chunk{module="issue", chunk="_filters.lua", params = {filter = "frozen"}}
-
- local state = issue.state
-
- -- FIXME: fix filter names to reflect issue.state values
- if state == "voting" then
- state = "frozen"
- elseif state == "frozen" then
- state = "half_frozen"
- end
-
- filter = filters:get_filter("filter", state)
- if filter then
- filter.selector_modifier(issues_selector)
-
- -- add subfilter to voting pager, so only not voted entries will be shown
- -- as this seems the most usefull exception
- if filter.name == "frozen" then
- filter_voting_name = "not_voted"
- local vfilter = filters:get_filter("filter_voting", "not_voted")
- if vfilter then
- vfilter.selector_modifier(issues_selector)
- end
- end
- end
-
- records = issues_selector:exec()
-
- for i,cissue in ipairs(records) do
- if cissue.id == issue.id then
- this = i
- break
- end
- end
-
- mk_link(-1, _("Previous issue"), "resultset_previous.png", "issue")
- if issue.area then
- ui.link{
- content = function()
- if issue_filter_map[state] then
- ui.image{ static = "icons/16/"..issue_filter_map[state] }
- end
- slot.put(issue.area.name)
- end,
- module = "area",
- view = "show",
- id = issue.area.id,
- params = {
- filter = filter and filter.name or nil,
- filter_voting = filter_voting_name,
- tab = "issues"
- }
- }
- end
- mk_link(1, _("Next issue"), "resultset_next.png", "issue")
-
- -- show pager for initiatives if available
- if initiative then
- ui.container{ content = function() end, attr = {class = "content_navigation_seperator"}}
-
- records = issue:get_reference_selector("initiatives"):exec()
- for i,cissue in ipairs(records) do
- if cissue.id == initiative.id then
- this = i
- break
- end
- end
- mk_link(-1, _("Previous initiative"), "resultset_previous.png", "initiative")
- mk_link(1, _("Next initiative"), "resultset_next.png", "initiative")
- end
- end
-end
-
-)
- --]]
-
slot.select("actions", function()
if app.session.member_id then
@@ -256,10 +133,6 @@
local issue = param.get("issue", "table")
-
-
--- ui.twitter("http://example.com/t" .. tostring(issue.id))
-
if config.public_access_issue_head and not app.session.member_id then
config.public_access_issue_head(issue)
end
diff -r bde068b37608 -r fecd4c13054a app/main/member/_area_list.lua
--- a/app/main/member/_area_list.lua Mon Feb 13 00:16:42 2012 +0100
+++ b/app/main/member/_area_list.lua Mon Feb 13 01:53:41 2012 +0100
@@ -5,18 +5,24 @@
:join("membership", nil, { "membership.area_id = area.id AND membership.member_id = ?", member.id })
:add_where{ "area.unit_id = ?", unit.id }
:add_order_by("area.member_weight DESC")
- ui.link{
- attr = { class = "heading" },
- text = unit.name,
- module = "area", view = "list", params = { unit_id = unit.id }
- }
if areas_selector:count() > 0 then
execute.view{
module = "area", view = "_list",
- params = { areas_selector = areas_selector },
+ params = { areas_selector = areas_selector, title = function()
+ ui.link{
+ attr = { class = "heading" },
+ text = unit.name,
+ module = "area", view = "list", params = { unit_id = unit.id }
+ }
+ end},
}
else
+ ui.link{
+ attr = { class = "heading" },
+ text = unit.name,
+ module = "area", view = "list", params = { unit_id = unit.id }
+ }
ui.tag{ content = _"You have voting privileges for this unit, but you are not member of any of its areas." }
slot.put(" ")
ui.link{
@@ -25,6 +31,7 @@
}
end
slot.put("
")
+ slot.put("
")
end
diff -r bde068b37608 -r fecd4c13054a app/main/member/show_tab.lua
--- a/app/main/member/show_tab.lua Mon Feb 13 00:16:42 2012 +0100
+++ b/app/main/member/show_tab.lua Mon Feb 13 01:53:41 2012 +0100
@@ -154,7 +154,7 @@
local areas_selector = member:get_reference_selector("areas")
tabs[#tabs+1] = {
name = "areas",
- label = _"Areas" .. " (" .. tostring(areas_selector:count()) .. ")",
+ label = _"Areas",
icon = { static = "icons/16/package.png" },
module = "member",
view = "_area_list",
@@ -164,7 +164,7 @@
local issues_selector = Issue:new_selector()
tabs[#tabs+1] = {
name = "issues",
- label = _"Issues" .. " (" .. tostring(issues_selector:count()) .. ")",
+ label = _"Issues",
icon = { static = "icons/16/folder.png" },
module = "issue",
view = "_list",
diff -r bde068b37608 -r fecd4c13054a app/main/supporter/_show_box.lua
--- a/app/main/supporter/_show_box.lua Mon Feb 13 00:16:42 2012 +0100
+++ b/app/main/supporter/_show_box.lua Mon Feb 13 01:53:41 2012 +0100
@@ -1,142 +1,116 @@
+local initiative = param.get("initiative", "table") or Initiative:by_id(param.get_id())
-local initiative = param.get("initiative", "table")
-local supporter = Supporter:by_pk(initiative.id, app.session.member.id)
+-- TODO performance
+local initiator = Initiator:by_pk(initiative.id, app.session.member.id)
-local unique_string = multirand.string(16, '0123456789abcdef')
-
+ui.partial{
+ module = "initiative",
+ view = "show_support",
+ id = initiative.id,
+ target = "initiative_" .. tostring(initiative.id) .. "_support",
+ content = function()
-local partial = {
- routing = {
- default = {
- mode = "redirect",
- module = "initiative",
- view = "show_support",
- id = initiative.id
- }
- }
-}
+ ui.container{
+ attr = { class = "actions" },
+ content = function()
+
+ local initiative = param.get("initiative", "table")
+ local supporter = Supporter:by_pk(initiative.id, app.session.member.id)
+
+ local partial = {
+ routing = {
+ default = {
+ mode = "redirect",
+ module = "initiative",
+ view = "show_support",
+ id = initiative.id
+ }
+ }
+ }
-local routing = {
- default = {
- mode = "redirect",
- module = request.get_module(),
- view = request.get_view(),
- id = param.get_id_cgi(),
- params = param.get_all_cgi()
- }
-}
+ local routing = {
+ default = {
+ mode = "redirect",
+ module = request.get_module(),
+ view = request.get_view(),
+ id = param.get_id_cgi(),
+ params = param.get_all_cgi()
+ }
+ }
-if not initiative.issue.fully_frozen and not initiative.issue.closed then
- if supporter then
- if not supporter:has_critical_opinion() then
- ui.container{
- attr = {
- class = "head head_supporter",
- style = "cursor: pointer;",
- onclick = "document.getElementById('support_content_" .. unique_string .. "').style.display = 'block';"
- },
- content = function()
- ui.image{
- static = "icons/16/thumb_up_green.png"
- }
- if supporter.auto_support then
- slot.put(_"Your are supporter (Autosupport enabled)")
+ if not initiative.issue.fully_frozen and not initiative.issue.closed then
+ if supporter then
+ if not supporter:has_critical_opinion() then
+ ui.container{ attr = { class = "supporter" }, content = function()
+ ui.image{
+ static = "icons/16/thumb_up_green.png"
+ }
+ slot.put(_"Your are supporter")
+ end }
+ else
+ ui.tag{ attr = { class = "potential_supporter" }, content = function()
+ ui.image{
+ static = "icons/16/thumb_up.png"
+ }
+ slot.put(_"Your are potential supporter")
+ end }
+ end
+ ui.link{
+ image = { static = "icons/16/cross.png" },
+ text = _"Withdraw support",
+ module = "initiative",
+ action = "remove_support",
+ id = initiative.id,
+ routing = routing,
+ partial = partial
+ }
else
- slot.put(_"Your are supporter")
- end
- ui.image{
- static = "icons/16/dropdown.png"
- }
- end
- }
- else
- ui.container{
- attr = {
- class = "head head_potential_supporter",
- style = "cursor: pointer;",
- onclick = "document.getElementById('support_content_" .. unique_string .. "').style.display = 'block';"
- },
- content = function()
- ui.image{
- static = "icons/16/thumb_up.png"
- }
- if supporter.auto_support then
- slot.put(_"Your are potential supporter (WARNING: Autosupport enabled)")
- else
- slot.put(_"Your are potential supporter")
- end
- ui.image{
- static = "icons/16/dropdown.png"
- }
- end
- }
- end
- ui.container{
- attr = { class = "content", id = "support_content_" .. unique_string .. "" },
- content = function()
- ui.container{
- attr = {
- class = "close",
- style = "cursor: pointer;",
- onclick = "document.getElementById('support_content_" .. unique_string .. "').style.display = 'none';"
- },
- content = function()
- ui.image{ static = "icons/16/cross.png" }
- end
- }
- if supporter then
- if config.auto_support then
- if supporter.auto_support then
+
+ if not initiative.revoked then
+ local params = param.get_all_cgi()
+ params.dyn = nil
ui.link{
- image = { static = "icons/16/cancel.png" },
- text = _"Disable autosupport for this initiative",
+ image = { static = "icons/16/thumb_up_green.png" },
+ text = _"Support this initiative",
module = "initiative",
action = "add_support",
id = initiative.id,
routing = routing,
- partial = partial,
- params = { auto_support = false }
- }
- else
- ui.link{
- image = { static = "icons/16/arrow_refresh.png" },
- text = _"Enable autosupport for this initiative",
- module = "initiative",
- action = "add_support",
- id = initiative.id,
- routing = routing,
- partial = partial,
- params = { auto_support = true }
+ partial = partial
}
end
end
+ end
+
+
+ if (initiative.discussion_url and #initiative.discussion_url > 0) then
+ if initiative.discussion_url:find("^https?://") then
+ if initiative.discussion_url and #initiative.discussion_url > 0 then
+ ui.link{
+ attr = {
+ target = "_blank",
+ title = _"Discussion with initiators"
+ },
+ image = { static = "icons/16/comments.png" },
+ text = _"Discuss with initiators",
+ external = initiative.discussion_url
+ }
+ end
+ else
+ slot.put(encode.html(initiative.discussion_url))
+ end
+ end
+ if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then
ui.link{
- image = { static = "icons/16/thumb_down_red.png" },
- text = _"Remove my support from this initiative",
- module = "initiative",
- action = "remove_support",
- id = initiative.id,
- routing = routing,
- partial = partial
+ image = { static = "icons/16/comments.png" },
+ text = _"change discussion URL",
+ module = "initiative",
+ view = "edit",
+ id = initiative.id
}
- else
end
end
}
- else
- if not initiative.revoked then
- local params = param.get_all_cgi()
- params.dyn = nil
- ui.link{
- image = { static = "icons/16/thumb_up_green.png" },
- text = _"Support this initiative",
- module = "initiative",
- action = "add_support",
- id = initiative.id,
- routing = routing,
- partial = partial
- }
- end
+ slot.put("")
end
-end
-
+}
diff -r bde068b37608 -r fecd4c13054a env/ui/tabs.lua
--- a/env/ui/tabs.lua Mon Feb 13 00:16:42 2012 +0100
+++ b/env/ui/tabs.lua Mon Feb 13 01:53:41 2012 +0100
@@ -1,241 +1,54 @@
-if config.user_tab_mode == "accordeon" or config.user_tab_mode == "accordeon_first_expanded" or config.user_tab_mode == "accordeon_all_expanded" then
-
- function ui.tabs(tabs)
- local params = param.get_all_cgi()
- local current_tabs_string = params["tab"]
- local current_tabs = {}
- if current_tabs_string then
- for current_tab in current_tabs_string:gmatch("([^%|]+)") do
- current_tabs[current_tab] = current_tab
- end
- end
-
- local unique_string = param.get("tab_id") or multirand.string(16, '0123456789abcdef')
-
- function render_tab(tab, first)
+function ui.tabs(tabs)
+ ui.container{
+ attr = { class = "ui_tabs" },
+ content = function()
local params = param.get_all_cgi()
- local active = false
- for current_tab in pairs(current_tabs) do
- if tab.name == current_tab then
- active = true
- end
- end
- if config.user_tab_mode == "accordeon_first_expanded" then
- if first and current_tabs_string == nil then
- active = true
- end
- end
-
- if active and not first then
- app.html_title.prefix = tab.label
- end
-
- local link_tabs = {}
- if config.user_tab_mode == "accordeon"
- or config.user_tab_mode == "accordeon_first_expanded"
- or config.user_tab_mode == "accordeon_all_expanded" and current_tabs_string
- then
- if not current_tabs_string and not first then
- link_tabs[tabs[1].name] = true
- end
- for current_tab in pairs(current_tabs) do
- if current_tab ~= tab.name then
- link_tabs[current_tab] = true
- end
- end
- elseif config.user_tab_mode == "accordeon_all_expanded" and not current_tabs_string then
- for i, current_tab in ipairs(tabs) do
- if current_tab.name ~= tab.name then
- link_tabs[current_tab.name] = true
- end
- end
- end
- if not active then
- link_tabs[tab.name] = true
- end
-
- params["tab"] = tab.name
- local onclick
- if not tab.content then
- onclick =
- 'if (ui_tabs_active["' .. unique_string .. '"]["' .. tab.name .. '"]) {' ..
- 'el=document.getElementById("tab' .. unique_string .. '_content_' .. tab.name .. '");' ..
- 'el.innerHTML="";' ..
- 'el.style.display="none";' ..
- 'ui_tabs_active["' .. unique_string .. '"]["' .. tab.name .. '"]=false' ..
- '} else {' ..
- 'ui_tabs_active["' .. unique_string .. '"]["' .. tab.name .. '"]=true;' ..
- 'document.getElementById("tab' .. unique_string .. '_content_' .. tab.name .. '").style.display="block"; ' ..
- ui._partial_load_js{
- params = { tab = tab.name }
- } ..
- '};' ..
- 'return(false);'
- end
- ui.link{
- attr = {
- name = "tab_" .. tab.name,
- class = (
- tab.name == current_tab and "ui_tabs_accordeon_head selected" .. (tab.class and (" " .. tab.class) or "") or
- not current_tab and i == 1 and "ui_tabs_accordeon_head selected" .. (tab.class and (" " .. tab.class) or "") or
- "ui_tabs_accordeon_head" .. (tab.class and (" " .. tab.class) or "")
- ),
- id = "tab" .. unique_string .. "_head_" .. tab.name,
- onclick = onclick,
- },
- module = request.get_module(),
- view = request.get_view(),
- id = param.get_id_cgi(),
- params = params,
- anchor = "tab" .. unique_string .. "_" .. tab.name,
+ local current_tab = params["tab"]
+ ui.container{
+ attr = { class = "ui_tabs_links" },
content = function()
- if tab.icon then
- if not tab.icon.attr then
- tab.icon.attr = {}
- end
- tab.icon.attr.id = "tab" .. unique_string .. "_icon_" .. tab.name
- tab.icon.attr.width = 16
- tab.icon.attr.height = 16
- ui.image(tab.icon)
- end
- slot.put(tab.label)
- end
- }
- local expanded = active or not request.get_json_request_slots() and config.user_tab_mode == "accordeon_all_expanded" and not current_tabs_string
- ui.container{
- attr = {
- class = "ui_tabs_accordeon_content" .. (tab.class and (" " .. tab.class) or ""),
- style = not expanded and "display: none;" or nil,
- id = "tab" .. unique_string .. "_content_" .. tab.name
- },
- content = function()
- if expanded then
- ui.script{ script = 'ui_tabs_active["' .. unique_string .. '"]["' .. tab.name .. '"] = true;' }
- execute.view{
- module = tab.module,
- view = tab.view,
- id = tab.id,
- params = tab.params
+ for i, tab in ipairs(tabs) do
+ params["tab"] = i > 1 and tab.name or nil
+ ui.link{
+ attr = {
+ class = (
+ tab.name == current_tab and "selected" .. (tab.class and (" " .. tab.class) or "") or
+ not current_tab and i == 1 and "selected" .. (tab.class and (" " .. tab.class) or "") or
+ "" .. (tab.class and (" " .. tab.class) or "")
+ )
+ },
+ module = request.get_module(),
+ view = request.get_view(),
+ id = param.get_id_cgi(),
+ content = tab.label,
+ params = params
}
- else
- slot.put(" ")
+ slot.put(" ")
end
end
}
- end
-
- if not request.get_json_request_slots() or not current_tabs_string then
- ui.script{ script = "ui_tabs_active['" .. unique_string .. "'] = {};" }
- ui.container{
- attr = { class = "ui_tabs" },
- content = function()
- for i, tab in ipairs(tabs) do
- local static_params = tabs.static_params or {}
- static_params.tab = tab.name
- static_params.tab_id = unique_string
- ui.partial{
- module = tabs.module,
- view = tabs.view,
- id = tabs.id,
- params = static_params,
- param_names = { "page" },
- hourglass_target = "tab" .. unique_string .. "_icon_" .. tab.name,
- target = "tab" .. unique_string .. "_content_" .. tab.name,
- content = function()
- render_tab(tab, i == 1)
+ for i, tab in ipairs(tabs) do
+ if tab.name == current_tab and i > 1 then
+ app.html_title.prefix = tab.label
end
- }
- end
+ if tab.name == current_tab or not current_tab and i == 1 then
+ ui.container{
+ attr = { class = "ui_tabs_content" },
+ content = function()
+ if tab.content then
+ tab.content()
+ else
+ execute.view{
+ module = tab.module,
+ view = tab.view,
+ id = tab.id,
+ params = tab.params,
+ }
+ end
+ end
+ }
end
- }
- else
- local dyntab
- for i, tab in ipairs(tabs) do
- if tab.name == current_tabs_string then
- dyntab = tab
- end
- end
- if dyntab then
- local static_params = tabs.static_params or {}
- static_params.tab = dyntab.name
- static_params.tab_id = unique_string
- dyntab.params.tab_id = unique_string
- ui.partial{
- module = tabs.module,
- view = tabs.view,
- id = tabs.id,
- params = static_params,
- param_names = { "page" },
- hourglass_target = "tab" .. unique_string .. "_icon_" .. dyntab.name,
- target = "tab" .. unique_string .. "_content_" .. dyntab.name,
- content = function()
- execute.view{
- module = dyntab.module,
- view = dyntab.view,
- id = dyntab.id,
- params = dyntab.params,
- }
- end
- }
end
end
- end
-
-else -- 'classic tab'
-
- function ui.tabs(tabs)
- ui.container{
- attr = { class = "ui_tabs" },
- content = function()
- local params = param.get_all_cgi()
- local current_tab = params["tab"]
- ui.container{
- attr = { class = "ui_tabs_links" },
- content = function()
- for i, tab in ipairs(tabs) do
- params["tab"] = i > 1 and tab.name or nil
- ui.link{
- attr = {
- class = (
- tab.name == current_tab and "selected" .. (tab.class and (" " .. tab.class) or "") or
- not current_tab and i == 1 and "selected" .. (tab.class and (" " .. tab.class) or "") or
- "" .. (tab.class and (" " .. tab.class) or "")
- )
- },
- module = request.get_module(),
- view = request.get_view(),
- id = param.get_id_cgi(),
- content = tab.label,
- params = params
- }
- slot.put(" ")
- end
- end
- }
- for i, tab in ipairs(tabs) do
- if tab.name == current_tab and i > 1 then
- app.html_title.prefix = tab.label
- end
- if tab.name == current_tab or not current_tab and i == 1 then
- ui.container{
- attr = { class = "ui_tabs_content" },
- content = function()
- if tab.content then
- tab.content()
- else
- execute.view{
- module = tab.module,
- view = tab.view,
- id = tab.id,
- params = tab.params,
- }
- end
- end
- }
- end
- end
- end
- }
- end
-
+ }
end
diff -r bde068b37608 -r fecd4c13054a static/style.css
--- a/static/style.css Mon Feb 13 00:16:42 2012 +0100
+++ b/static/style.css Mon Feb 13 01:53:41 2012 +0100
@@ -32,7 +32,7 @@
}
td, th {
- padding: 0.5ex 0.5em 0.5ex 0.5em;
+ padding: 0.5ex 0.5em 0.5ex 0em;
}
td {
@@ -41,7 +41,6 @@
th {
vertical-align: bottom;
- font-size: 75%;
font-weight: bold;
}
@@ -113,7 +112,10 @@
*/
.topbar {
- background-color: #444;
+ background-color: #000;
+ background: -webkit-gradient(linear, left top, left bottom,
+ color-stop(0%, #888), color-stop(25%,#333)
+ );
color: #fff;
font-size: 90%;
line-height: 100%;
@@ -199,7 +201,7 @@
.title {
background-color: #ddd;
background: -webkit-gradient(linear, left top, left bottom,
- color-stop(0%,#ddd), color-stop(100%,#fff)
+ color-stop(15%,#ddd), color-stop(100%,#fff)
);
text-shadow: #fff 0px 0px 3px;
color: #000;
@@ -261,10 +263,10 @@
.slot_initiative_head {
background: -webkit-gradient(linear, left top, left bottom,
/*color-stop(0%,#AFEFB9), color-stop(100%,#ffffff) */
- color-stop(0%,#e7e7e7), color-stop(100%,#fff)
+ color-stop(0%, #fff), color-stop(15%,#e7e7e7), color-stop(100%,#fff)
);
padding-left: 1em;
- padding-top: 2ex;
+ padding-top: 1ex;
text-shadow: #fff 0px 0px 3px;
}
@@ -339,12 +341,14 @@
padding-right: 0.2em;
}
.actions .supporter,
+.actions .potential_supporter,
.vote_info .head {
float: left;
margin-right: 1em;
}
.actions .supporter,
+.actions .potential_supporter,
.actions .interest .head {
padding-right: 0.3em;
}
@@ -798,18 +802,14 @@
*/
.issues .issue {
- xborder: 1px solid #ccc;
overflow: hidden;
margin-bottom: 2ex;
border-radius: 8px;
}
.issues .issue .issue_info {
- xfloat: left;
- xwidth: 25%;
padding: 1ex;
line-height: 140%;
- xoverflow: hidden;
background: -webkit-gradient(linear, left top, left bottom,
color-stop(0%,#e7e7e7), color-stop(33%, #f7f7f7), color-stop(66%,#fff));
}
@@ -1128,8 +1128,6 @@
display: block;
font-size: 120%;
font-weight: bold;
- margin-top: 2ex;
- margin-bottom: 1ex;
}
.heading.first {