liquid_feedback_frontend
changeset 469:3e2e233330d9
Added some whitespace to updated initiatives list and removed filter from initiatives
author | bsw |
---|---|
date | Wed Mar 14 11:26:22 2012 +0100 (2012-03-14) |
parents | 19916608d28c |
children | 5ddfc60ee450 |
files | app/main/index/_updated_drafts.lua app/main/initiative/_list.lua |
line diff
1.1 --- a/app/main/index/_updated_drafts.lua Wed Mar 14 11:20:14 2012 +0100 1.2 +++ b/app/main/index/_updated_drafts.lua Wed Mar 14 11:26:22 2012 +0100 1.3 @@ -1,9 +1,11 @@ 1.4 local initiatives_selector = param.get("initiatives_selector", "table") 1.5 if initiatives_selector:count() > 0 then 1.6 ui.container{ 1.7 - attr = { style = "font-weight: bold;" }, 1.8 + attr = { class = "heading" }, 1.9 content = _"Open initiatives you are supporting which has been updated their draft:" 1.10 } 1.11 + 1.12 + slot.put("<br />") 1.13 1.14 execute.view{ 1.15 module = "initiative",
2.1 --- a/app/main/initiative/_list.lua Wed Mar 14 11:20:14 2012 +0100 2.2 +++ b/app/main/initiative/_list.lua Wed Mar 14 11:26:22 2012 +0100 2.3 @@ -23,10 +23,11 @@ 2.4 :add_field("_direct_supporter_snapshot.member_id NOTNULL", "is_supporter_via_delegation") 2.5 end 2.6 2.7 +initiatives_selector:add_order_by("id") 2.8 + 2.9 local initiatives_count = initiatives_selector:count() 2.10 2.11 local limit = param.get("limit", atom.number) 2.12 -local no_sort = param.get("no_sort", atom.boolean) 2.13 2.14 local more_initiatives_count 2.15 if limit then 2.16 @@ -45,91 +46,36 @@ 2.17 2.18 ui.add_partial_param_names{ name } 2.19 2.20 -local order_filter = { 2.21 - name = name, 2.22 - label = _"Order by" 2.23 -} 2.24 - 2.25 -if issue and issue.ranks_available then 2.26 - order_filter[#order_filter+1] = { 2.27 - name = "rank", 2.28 - label = _"Rank", 2.29 - selector_modifier = function(selector) selector:add_order_by("initiative.rank, initiative.admitted DESC, vote_ratio(initiative.positive_votes, initiative.negative_votes) DESC, initiative.id") end 2.30 - } 2.31 -end 2.32 - 2.33 -order_filter[#order_filter+1] = { 2.34 - name = "potential_support", 2.35 - label = _"Potential support", 2.36 - selector_modifier = function(selector) selector:add_order_by("CASE WHEN issue.population = 0 THEN 0 ELSE initiative.supporter_count::float / issue.population::float END DESC, initiative.id") end 2.37 -} 2.38 - 2.39 -order_filter[#order_filter+1] = { 2.40 - name = "support", 2.41 - label = _"Support", 2.42 - selector_modifier = function(selector) selector:add_order_by("initiative.satisfied_supporter_count::float / issue.population::float DESC, initiative.id") end 2.43 -} 2.44 - 2.45 -order_filter[#order_filter+1] = { 2.46 - name = "newest", 2.47 - label = _"Newest", 2.48 - selector_modifier = function(selector) selector:add_order_by("initiative.created DESC, initiative.id") end 2.49 -} 2.50 - 2.51 -order_filter[#order_filter+1] = { 2.52 - name = "oldest", 2.53 - label = _"Oldest", 2.54 - selector_modifier = function(selector) selector:add_order_by("initiative.created, initiative.id") end 2.55 -} 2.56 - 2.57 -ui_filters = ui.filters 2.58 - 2.59 -if no_sort then 2.60 - ui_filters = function(args) args.content() end 2.61 - if issue.ranks_available then 2.62 - initiatives_selector:add_order_by("initiative.rank, initiative.admitted DESC, vote_ratio(initiative.positive_votes, initiative.negative_votes) DESC, initiative.id") 2.63 - else 2.64 - initiatives_selector:add_order_by("CASE WHEN issue.population = 0 OR initiative.supporter_count = 0 OR initiative.supporter_count ISNULL THEN 0 ELSE initiative.supporter_count::float / issue.population::float END DESC, initiative.id") 2.65 - end 2.66 -end 2.67 - 2.68 -ui_filters{ 2.69 - label = _"Change order", 2.70 - order_filter, 2.71 +ui.paginate{ 2.72 + name = issue and "issue_" .. tostring(issue.id) .. "_page" or nil, 2.73 selector = initiatives_selector, 2.74 + per_page = param.get("per_page", atom.number) or limit, 2.75 content = function() 2.76 - ui.paginate{ 2.77 - name = issue and "issue_" .. tostring(issue.id) .. "_page" or nil, 2.78 - selector = initiatives_selector, 2.79 - per_page = param.get("per_page", atom.number) or limit, 2.80 - content = function() 2.81 - local initiatives = initiatives_selector:exec() 2.82 - if highlight_initiative then 2.83 - local highlight_initiative_found 2.84 - for i, initiative in ipairs(initiatives) do 2.85 - if initiative.id == highlight_initiative.id then 2.86 - highhighlight_initiative_found = true 2.87 - end 2.88 - end 2.89 - if not highhighlight_initiative_found then 2.90 - initiatives[#initiatives+1] = highlight_initiative 2.91 - if more_initiatives_count then 2.92 - more_initiatives_count = more_initiatives_count - 1 2.93 - end 2.94 - end 2.95 - end 2.96 - for i, initiative in ipairs(initiatives) do 2.97 - execute.view{ 2.98 - module = "initiative", 2.99 - view = "_list_element", 2.100 - params = { 2.101 - initiative = initiative, 2.102 - selected = highlight_initiative and highlight_initiative.id == initiative.id or nil, 2.103 - } 2.104 - } 2.105 + local initiatives = initiatives_selector:exec() 2.106 + if highlight_initiative then 2.107 + local highlight_initiative_found 2.108 + for i, initiative in ipairs(initiatives) do 2.109 + if initiative.id == highlight_initiative.id then 2.110 + highhighlight_initiative_found = true 2.111 end 2.112 end 2.113 - } 2.114 + if not highhighlight_initiative_found then 2.115 + initiatives[#initiatives+1] = highlight_initiative 2.116 + if more_initiatives_count then 2.117 + more_initiatives_count = more_initiatives_count - 1 2.118 + end 2.119 + end 2.120 + end 2.121 + for i, initiative in ipairs(initiatives) do 2.122 + execute.view{ 2.123 + module = "initiative", 2.124 + view = "_list_element", 2.125 + params = { 2.126 + initiative = initiative, 2.127 + selected = highlight_initiative and highlight_initiative.id == initiative.id or nil, 2.128 + } 2.129 + } 2.130 + end 2.131 end 2.132 } 2.133