liquid_feedback_frontend
changeset 275:fc14e76afe31
Made filter better useable
author | bsw |
---|---|
date | Sun Feb 12 13:42:08 2012 +0100 (2012-02-12) |
parents | aec9df5b4cd3 |
children | f460555c9896 |
files | app/main/initiative/show_support.lua app/main/issue/_filters.lua app/main/issue/_list.lua app/main/member/_list.lua static/style.css |
line diff
1.1 --- a/app/main/initiative/show_support.lua Sun Feb 12 12:20:19 2012 +0100 1.2 +++ b/app/main/initiative/show_support.lua Sun Feb 12 13:42:08 2012 +0100 1.3 @@ -44,14 +44,14 @@ 1.4 if not initiative.issue.fully_frozen and not initiative.issue.closed then 1.5 if supporter then 1.6 if not supporter:has_critical_opinion() then 1.7 - ui.tag{ content = function() 1.8 + ui.tag{ attr = { class = "supporter" }, content = function() 1.9 ui.image{ 1.10 static = "icons/16/thumb_up_green.png" 1.11 } 1.12 slot.put(_"Your are supporter") 1.13 end } 1.14 else 1.15 - ui.tag{ content = function() 1.16 + ui.tag{ attr = { class = "potential_supporter" }, content = function() 1.17 ui.image{ 1.18 static = "icons/16/thumb_up.png" 1.19 }
2.1 --- a/app/main/issue/_filters.lua Sun Feb 12 12:20:19 2012 +0100 2.2 +++ b/app/main/issue/_filters.lua Sun Feb 12 13:42:08 2012 +0100 2.3 @@ -3,7 +3,6 @@ 2.4 -- FIXME: the filter should be named like the corresponding issue.state value 2.5 2.6 filters[#filters+1] = { 2.7 - label = _"Filter", 2.8 name = "filter", 2.9 { 2.10 name = "open", 2.11 @@ -63,36 +62,7 @@ 2.12 } 2.13 2.14 2.15 -if app.session.member and param.get("filter") == "frozen" then 2.16 - filters[#filters+1] = { 2.17 - label = _"Filter", 2.18 - name = "filter_voting", 2.19 - { 2.20 - name = "any", 2.21 - label = _"Any", 2.22 - selector_modifier = function() end 2.23 - }, 2.24 - { 2.25 - name = "not_voted", 2.26 - label = _"Not voted", 2.27 - selector_modifier = function(selector) 2.28 - selector:left_join("direct_voter", nil, { "direct_voter.issue_id = issue.id AND direct_voter.member_id = ?", app.session.member.id }) 2.29 - selector:add_where("direct_voter.member_id ISNULL") 2.30 - end 2.31 - }, 2.32 - { 2.33 - name = "voted", 2.34 - label = _"Voted", 2.35 - selector_modifier = function(selector) 2.36 - selector:join("direct_voter", nil, { "direct_voter.issue_id = issue.id AND direct_voter.member_id = ?", app.session.member.id }) 2.37 - end 2.38 - }, 2.39 - } 2.40 -end 2.41 - 2.42 - 2.43 filters[#filters+1] = { 2.44 - label = _"Filter", 2.45 name = "filter_interest", 2.46 { 2.47 name = "any", 2.48 @@ -130,44 +100,64 @@ 2.49 } 2.50 2.51 if not param.get("no_sort", atom.boolean) then 2.52 + 2.53 + local filter = { name = "order" } 2.54 + 2.55 + local text = _"Time left" 2.56 + if f == "finished" or f == "cancelled" then 2.57 + text = _"Recently closed" 2.58 + end 2.59 + filter[#filter+1] = { 2.60 + name = "state_time", 2.61 + label = text, 2.62 + selector_modifier = function(selector) 2.63 + selector:add_order_by("issue.closed DESC, coalesce(issue.fully_frozen + issue.voting_time, issue.half_frozen + issue.verification_time, issue.accepted + issue.discussion_time, issue.created + issue.admission_time) - now()") 2.64 + end 2.65 + } 2.66 + 2.67 + filter[#filter+1] = { 2.68 + name = "max_potential_support", 2.69 + label = _"Supporter count", 2.70 + selector_modifier = function(selector) 2.71 + selector:add_order_by("(SELECT max(supporter_count) FROM initiative WHERE initiative.issue_id = issue.id) DESC") 2.72 + end 2.73 + } 2.74 + 2.75 + filter[#filter+1] = { 2.76 + name = "newest", 2.77 + label = _"Newest", 2.78 + selector_modifier = function(selector) 2.79 + selector:add_order_by("issue.created DESC") 2.80 + end 2.81 + } 2.82 + 2.83 + filters[#filters+1] = filter 2.84 + 2.85 +end 2.86 + 2.87 +if app.session.member and param.get("filter") == "frozen" then 2.88 filters[#filters+1] = { 2.89 - label = _"Order by", 2.90 - name = "issue_list", 2.91 + name = "filter_voting", 2.92 { 2.93 - name = "max_potential_support", 2.94 - label = _"Max potential support", 2.95 - selector_modifier = function(selector) 2.96 - selector:add_order_by("(SELECT max(supporter_count) FROM initiative WHERE initiative.issue_id = issue.id) DESC") 2.97 - end 2.98 + name = "any", 2.99 + label = _"Any", 2.100 + selector_modifier = function() end 2.101 }, 2.102 { 2.103 - name = "max_support", 2.104 - label = _"Max support", 2.105 + name = "not_voted", 2.106 + label = _"Not voted", 2.107 selector_modifier = function(selector) 2.108 - selector:add_order_by("(SELECT max(satisfied_supporter_count) FROM initiative WHERE initiative.issue_id = issue.id) DESC") 2.109 + selector:left_join("direct_voter", nil, { "direct_voter.issue_id = issue.id AND direct_voter.member_id = ?", app.session.member.id }) 2.110 + selector:add_where("direct_voter.member_id ISNULL") 2.111 end 2.112 }, 2.113 { 2.114 - name = "population", 2.115 - label = _"Population", 2.116 + name = "voted", 2.117 + label = _"Voted", 2.118 selector_modifier = function(selector) 2.119 - selector:add_order_by("issue.population DESC") 2.120 + selector:join("direct_voter", nil, { "direct_voter.issue_id = issue.id AND direct_voter.member_id = ?", app.session.member.id }) 2.121 end 2.122 }, 2.123 - { 2.124 - name = "newest", 2.125 - label = _"Newest", 2.126 - selector_modifier = function(selector) 2.127 - selector:add_order_by("issue.created DESC") 2.128 - end 2.129 - }, 2.130 - { 2.131 - name = "oldest", 2.132 - label = _"Oldest", 2.133 - selector_modifier = function(selector) 2.134 - selector:add_order_by("issue.created") 2.135 - end 2.136 - } 2.137 } 2.138 end 2.139
3.1 --- a/app/main/issue/_list.lua Sun Feb 12 12:20:19 2012 +0100 3.2 +++ b/app/main/issue/_list.lua Sun Feb 12 13:42:08 2012 +0100 3.3 @@ -17,11 +17,7 @@ 3.4 local filters = execute.load_chunk{module="issue", chunk="_filters.lua"} 3.5 3.6 filters.content = function() 3.7 - local ui_paginate = ui.paginate 3.8 - if param.get("per_page") == "all" then 3.9 - ui_paginate = function(args) args.content() end 3.10 - end 3.11 - ui_paginate{ 3.12 + ui.paginate{ 3.13 per_page = tonumber(param.get("per_page")), 3.14 selector = issues_selector, 3.15 content = function() 3.16 @@ -111,8 +107,8 @@ 3.17 } 3.18 end 3.19 3.20 +filters.opened = true 3.21 filters.selector = issues_selector 3.22 -filters.label = _"Change filters and order" 3.23 3.24 if param.get("no_filter", atom.boolean) then 3.25 filters.content()
4.1 --- a/app/main/member/_list.lua Sun Feb 12 12:20:19 2012 +0100 4.2 +++ b/app/main/member/_list.lua Sun Feb 12 13:42:08 2012 +0100 4.3 @@ -18,7 +18,6 @@ 4.4 ui.add_partial_param_names{ "member_list" } 4.5 4.6 local filter = { 4.7 - label = _"Order by", 4.8 name = "member_list", 4.9 { 4.10 name = "name",
5.1 --- a/static/style.css Sun Feb 12 12:20:19 2012 +0100 5.2 +++ b/static/style.css Sun Feb 12 13:42:08 2012 +0100 5.3 @@ -369,13 +369,13 @@ 5.4 } 5.5 5.6 .interest .head_active, 5.7 -.slot_support .head_potential_supporter{ 5.8 +.actions .potential_supporter{ 5.9 background-color: #fec; 5.10 box-shadow: #fff 0px 0px 10px 1px; 5.11 border-radius: 5px; 5.12 } 5.13 5.14 -.slot_support .head_supporter { 5.15 +.actions .supporter { 5.16 background-color: #dfc; 5.17 box-shadow: #fff 0px 0px 10px 1px; 5.18 border-radius: 5px; 5.19 @@ -410,6 +410,10 @@ 5.20 font-size: 80%; 5.21 } 5.22 5.23 +.slot_actions .change_delegation { 5.24 + float: left; 5.25 +} 5.26 + 5.27 .vote_info .close { 5.28 position: absolute; 5.29 top: 0; 5.30 @@ -630,23 +634,34 @@ 5.31 * ui.filters 5.32 */ 5.33 5.34 +.ui_filter { 5.35 + overflow: hidden; 5.36 +} 5.37 + 5.38 .ui_filter_closed_head, 5.39 .ui_filter_head { 5.40 color: #777; 5.41 margin-top: 1ex; 5.42 margin-bottom: 1.5ex; 5.43 font-size: 75%; 5.44 + float: left; 5.45 +} 5.46 + 5.47 +.ui_filter_head { 5.48 + margin-right: 2em; 5.49 } 5.50 5.51 .ui_filter_head a { 5.52 color: #777; 5.53 padding: 0.5ex; 5.54 + margin-right: 0.2em; 5.55 } 5.56 5.57 .ui_filter_head a.active { 5.58 color: #fff; 5.59 background-color: #777; 5.60 padding: 0.5ex; 5.61 + border-radius: 5px; 5.62 } 5.63 5.64 /************************************************************************* 5.65 @@ -654,6 +669,7 @@ 5.66 */ 5.67 5.68 .ui_paginate_head { 5.69 + display: none; 5.70 margin-bottom: 1ex; 5.71 } 5.72 5.73 @@ -662,7 +678,7 @@ 5.74 } 5.75 5.76 .ui_paginate_select a { 5.77 - padding: 0.5ex; 5.78 + padding: 0.5em; 5.79 } 5.80 5.81 /*************************************************************************