liquid_feedback_frontend
annotate app/main/initiative/_list.lua @ 10:72c5e0ee7c98
Version beta6
Bugfixes:
- Security fix: Every user was able to change the discussion URL of an initiative
- Creation of new issues in areas without default policies is now possible
- Members can now be sorted in different ways
- No error when trying to compare a draft with itself
- Added missing local statement to variable initialization in app/main/delegation/new.lua
- CSS flaw in initiative action bar fixed
New features:
- Possiblity to invite other users to become initiator
- Revokation of initiatives implemented
- Number of suggestions, supporters, etc. is shown on corresponding tabs of initiative view
- Members can now be sorted by account creation (default sorting is "newest first")
- Configuration option to create an automatic discussion link for all issues
- First draft of global timeline feature (not accessible via link yet)
- Custom stylesheet URL for users marked as developers
In area listing the number of closed issues is shown too
Renamed "author" field of initiative to "last author"
Removed wrongly included file app/main/member/_show_thumb.lua.orig in the distribution
Help texts updated
Bugfixes:
- Security fix: Every user was able to change the discussion URL of an initiative
- Creation of new issues in areas without default policies is now possible
- Members can now be sorted in different ways
- No error when trying to compare a draft with itself
- Added missing local statement to variable initialization in app/main/delegation/new.lua
- CSS flaw in initiative action bar fixed
New features:
- Possiblity to invite other users to become initiator
- Revokation of initiatives implemented
- Number of suggestions, supporters, etc. is shown on corresponding tabs of initiative view
- Members can now be sorted by account creation (default sorting is "newest first")
- Configuration option to create an automatic discussion link for all issues
- First draft of global timeline feature (not accessible via link yet)
- Custom stylesheet URL for users marked as developers
In area listing the number of closed issues is shown too
Renamed "author" field of initiative to "last author"
Removed wrongly included file app/main/member/_show_thumb.lua.orig in the distribution
Help texts updated
| author | bsw |
|---|---|
| date | Sun Jan 10 12:00:00 2010 +0100 (2010-01-10) |
| parents | afd9f769c7ae |
| children | 77d58efe99fd |
| rev | line source |
|---|---|
| bsw/jbe@0 | 1 local initiatives_selector = param.get("initiatives_selector", "table") |
| bsw/jbe@0 | 2 initiatives_selector:join("issue", nil, "issue.id = initiative.issue_id") |
| bsw/jbe@0 | 3 |
| bsw/jbe@0 | 4 local issue = param.get("issue", "table") |
| bsw/jbe@0 | 5 |
| bsw/jbe@0 | 6 local order_options = {} |
| bsw/jbe@0 | 7 |
| bsw/jbe@0 | 8 if issue and issue.ranks_available then |
| bsw/jbe@0 | 9 order_options[#order_options+1] = { |
| bsw/jbe@0 | 10 name = "rank", |
| bsw/jbe@0 | 11 label = _"Rank", |
| bsw/jbe@5 | 12 order_by = "initiative.rank, initiative.admitted DESC, vote_ratio(initiative.positive_votes, initiative.negative_votes) DESC, initiative.id" |
| bsw/jbe@0 | 13 } |
| bsw/jbe@0 | 14 end |
| bsw/jbe@0 | 15 |
| bsw/jbe@0 | 16 order_options[#order_options+1] = { |
| bsw/jbe@5 | 17 name = "potential_support", |
| bsw/jbe@5 | 18 label = _"Potential support", |
| bsw/jbe@5 | 19 order_by = "initiative.supporter_count::float / issue.population::float DESC, initiative.id" |
| bsw/jbe@5 | 20 } |
| bsw/jbe@5 | 21 |
| bsw/jbe@5 | 22 order_options[#order_options+1] = { |
| bsw/jbe@0 | 23 name = "support", |
| bsw/jbe@0 | 24 label = _"Support", |
| bsw/jbe@5 | 25 order_by = "initiative.satisfied_supporter_count::float / issue.population::float DESC, initiative.id" |
| bsw/jbe@0 | 26 } |
| bsw/jbe@0 | 27 |
| bsw/jbe@0 | 28 order_options[#order_options+1] = { |
| bsw/jbe@0 | 29 name = "newest", |
| bsw/jbe@0 | 30 label = _"Newest", |
| bsw/jbe@5 | 31 order_by = "initiative.created DESC, initiative.id" |
| bsw/jbe@0 | 32 } |
| bsw/jbe@0 | 33 |
| bsw/jbe@0 | 34 order_options[#order_options+1] = { |
| bsw/jbe@0 | 35 name = "oldest", |
| bsw/jbe@0 | 36 label = _"Oldest", |
| bsw/jbe@5 | 37 order_by = "initiative.created, initiative.id" |
| bsw/jbe@0 | 38 } |
| bsw/jbe@0 | 39 |
| bsw/jbe@0 | 40 local name = "initiative_list" |
| bsw/jbe@0 | 41 if issue then |
| bsw/jbe@0 | 42 name = "issue_" .. tostring(issue.id) .. "_initiative_list" |
| bsw/jbe@0 | 43 end |
| bsw/jbe@0 | 44 |
| bsw@10 | 45 ui_order = ui.order |
| bsw@10 | 46 |
| bsw@10 | 47 if param.get("no_sort", atom.boolean) then |
| bsw@10 | 48 ui_order = function(args) args.content() end |
| bsw@10 | 49 if issue.ranks_available then |
| bsw@10 | 50 initiatives_selector:add_order_by("initiative.rank, initiative.admitted DESC, vote_ratio(initiative.positive_votes, initiative.negative_votes) DESC, initiative.id") |
| bsw@10 | 51 else |
| bsw@10 | 52 initiatives_selector:add_order_by("initiative.supporter_count::float / issue.population::float DESC, initiative.id") |
| bsw@10 | 53 end |
| bsw@10 | 54 end |
| bsw@10 | 55 |
| bsw@10 | 56 ui_order{ |
| bsw/jbe@0 | 57 name = name, |
| bsw/jbe@0 | 58 selector = initiatives_selector, |
| bsw/jbe@0 | 59 options = order_options, |
| bsw/jbe@0 | 60 content = function() |
| bsw/jbe@0 | 61 ui.paginate{ |
| bsw/jbe@0 | 62 selector = initiatives_selector, |
| bsw@10 | 63 per_page = param.get("per_page", atom.number), |
| bsw/jbe@0 | 64 content = function() |
| bsw/jbe@0 | 65 local initiatives = initiatives_selector:exec() |
| bsw/jbe@0 | 66 local columns = {} |
| bsw@2 | 67 columns[#columns+1] = { |
| bsw@2 | 68 content = function(record) |
| bsw@2 | 69 if record.issue.accepted and record.issue.closed and record.issue.ranks_available then |
| bsw@3 | 70 ui.field.rank{ attr = { class = "rank" }, value = record.rank } |
| bsw@3 | 71 end |
| bsw@3 | 72 end |
| bsw@3 | 73 } |
| bsw@3 | 74 columns[#columns+1] = { |
| bsw@3 | 75 content = function(record) |
| bsw/jbe@5 | 76 if record.issue.accepted and record.issue.closed then |
| bsw/jbe@5 | 77 if record.issue.ranks_available then |
| bsw/jbe@5 | 78 if record.negative_votes and record.positive_votes then |
| bsw/jbe@5 | 79 local max_value = record.issue.voter_count |
| bsw/jbe@5 | 80 ui.bargraph{ |
| bsw/jbe@5 | 81 max_value = max_value, |
| bsw/jbe@5 | 82 width = 100, |
| bsw/jbe@5 | 83 bars = { |
| bsw/jbe@5 | 84 { color = "#0a0", value = record.positive_votes }, |
| bsw/jbe@5 | 85 { color = "#aaa", value = max_value - record.negative_votes - record.positive_votes }, |
| bsw/jbe@5 | 86 { color = "#a00", value = record.negative_votes }, |
| bsw/jbe@5 | 87 } |
| bsw/jbe@0 | 88 } |
| bsw/jbe@5 | 89 end |
| bsw/jbe@5 | 90 else |
| bsw/jbe@5 | 91 slot.put(_"Counting of votes") |
| bsw/jbe@0 | 92 end |
| bsw@2 | 93 else |
| bsw/jbe@0 | 94 local max_value = (record.issue.population or 0) |
| bsw/jbe@0 | 95 ui.bargraph{ |
| bsw/jbe@0 | 96 max_value = max_value, |
| bsw/jbe@4 | 97 width = 100, |
| bsw/jbe@0 | 98 bars = { |
| bsw@2 | 99 { color = "#0a0", value = (record.satisfied_supporter_count or 0) }, |
| bsw/jbe@5 | 100 { color = "#777", value = (record.supporter_count or 0) - (record.satisfied_supporter_count or 0) }, |
| bsw/jbe@0 | 101 { color = "#ddd", value = max_value - (record.supporter_count or 0) }, |
| bsw/jbe@0 | 102 } |
| bsw/jbe@0 | 103 } |
| bsw/jbe@0 | 104 end |
| bsw@2 | 105 end |
| bsw@2 | 106 } |
| bsw/jbe@0 | 107 columns[#columns+1] = { |
| bsw/jbe@0 | 108 content = function(record) |
| bsw@10 | 109 local link_class |
| bsw@10 | 110 if record.revoked then |
| bsw@10 | 111 link_class = "revoked" |
| bsw@10 | 112 end |
| bsw/jbe@0 | 113 ui.link{ |
| bsw@10 | 114 attr = { class = link_class }, |
| bsw/jbe@0 | 115 content = function() |
| bsw@2 | 116 local name |
| bsw@2 | 117 if record.name_highlighted then |
| bsw@2 | 118 name = encode.highlight(record.name_highlighted) |
| bsw@2 | 119 else |
| bsw@2 | 120 name = encode.html(record.name) |
| bsw@2 | 121 end |
| bsw@2 | 122 slot.put(name) |
| bsw/jbe@0 | 123 end, |
| bsw/jbe@0 | 124 module = "initiative", |
| bsw/jbe@0 | 125 view = "show", |
| bsw/jbe@0 | 126 id = record.id |
| bsw/jbe@0 | 127 } |
| bsw@2 | 128 if record.issue.state == "new" then |
| bsw@2 | 129 ui.image{ |
| bsw@2 | 130 static = "icons/16/new.png" |
| bsw@2 | 131 } |
| bsw@2 | 132 end |
| bsw/jbe@0 | 133 end |
| bsw/jbe@0 | 134 } |
| bsw/jbe@0 | 135 |
| bsw/jbe@0 | 136 ui.list{ |
| bsw/jbe@0 | 137 attr = { class = "initiatives" }, |
| bsw/jbe@0 | 138 records = initiatives, |
| bsw/jbe@0 | 139 columns = columns |
| bsw/jbe@0 | 140 } |
| bsw/jbe@0 | 141 end |
| bsw/jbe@0 | 142 } |
| bsw/jbe@0 | 143 end |
| bsw/jbe@0 | 144 } |