liquid_feedback_frontend

diff app/main/issue/show.lua @ 19:00d1004545f1

Dynamic interface using XMLHttpRequests, and many other changes

Bugfixes:
- Only allow voting on admitted initiatives
- Repaired issue search
- Don't display delegations for closed issues on member page
- Don't show revoke link in initiative, when issue is already half_frozen
- Localization for voting JavaScript
- Display author of suggestions

Disclosure of voting data after voting is finished:
- Possibility to inspect every ballot including preferences
- Show number of voters preferring one initiative to another initiative

Interface behaviour changes:
- Reversed default order of drafts
- Default order of suggestions changed
- Show new drafts of initiatives only once per day in timeline

Accessibility:
- Barrier-free voting implemented
- POST links are now accessible without JavaScript
- Changed gray for unsatisfied supporters in bar graph to a lighter gray

Other interface improvements:
- Optical enhancements
- Dynamic interface using XMLHttpRequests
- Show usage terms in about section
- Show own membership in area listing
- Show uninformed supporters greyed out and marked with yellow question mark
- Warning box in non-admitted initiatives
- When voted, don't display voting notice and change label of voting link
- Show object counts in more tabulator heads
- Enlarged member statement input field

Miscellaneous:
- Code cleanup
- Added README file containing installation instructions
- Use new WebMCP function ui.filters{...} instead of own ui.filter and ui.order functions
author bsw/jbe
date Sat Feb 20 22:10:31 2010 +0100 (2010-02-20)
parents 559c6be0e1e9
children 7d0f4721d2f3
line diff
     1.1 --- a/app/main/issue/show.lua	Tue Feb 02 00:31:06 2010 +0100
     1.2 +++ b/app/main/issue/show.lua	Sat Feb 20 22:10:31 2010 +0100
     1.3 @@ -6,126 +6,59 @@
     1.4    params = { issue = issue }
     1.5  }
     1.6  
     1.7 +--[[
     1.8 +if not issue.fully_frozen and not issue.closed then
     1.9 +  slot.select("actions", function()
    1.10 +    ui.link{
    1.11 +      content = function()
    1.12 +        ui.image{ static = "icons/16/script_add.png" }
    1.13 +        slot.put(_"Create alternative initiative")
    1.14 +      end,
    1.15 +      module = "initiative",
    1.16 +      view = "new",
    1.17 +      params = { issue_id = issue.id }
    1.18 +    }
    1.19 +  end)
    1.20 +end
    1.21 +--]]
    1.22 +
    1.23  util.help("issue.show")
    1.24  
    1.25 -local voting_requested_percentage = 0
    1.26 -if issue.vote_later and issue.population and issue.population > 0 then
    1.27 -  voting_requested_percentage = math.ceil(issue.vote_later  / issue.population * 100)
    1.28 +if issue.state == "cancelled" then
    1.29 +  local policy = issue.policy
    1.30 +  ui.container{
    1.31 +    attr = { class = "not_admitted_info" },
    1.32 +    content = _("This issue has been cancelled. It failed the quorum of #{quorum}.", { quorum = format.percentage(policy.issue_quorum_num / policy.issue_quorum_den) })
    1.33 +  }
    1.34  end
    1.35 -local voting_requested_string = "(" .. tostring(voting_requested_percentage) .. "%)"
    1.36  
    1.37 -ui.tabs{
    1.38 -  {
    1.39 -    name = "initiatives",
    1.40 -    label = _"Initiatives",
    1.41 -    content = function()
    1.42 -      execute.view{
    1.43 -        module = "initiative",
    1.44 -        view = "_list",
    1.45 -        params = { 
    1.46 -          issue = issue,
    1.47 -          initiatives_selector = issue:get_reference_selector("initiatives")
    1.48 -        }
    1.49 -      }
    1.50 -      slot.put("<br />")
    1.51 -      if not issue.fully_frozen and not issue.closed then
    1.52 -        ui.link{
    1.53 -          attr = { class = "action" },
    1.54 -          content = function()
    1.55 -            ui.image{ static = "icons/16/script_add.png" }
    1.56 -            slot.put(_"Add new initiative to issue")
    1.57 -          end,
    1.58 -          module = "initiative",
    1.59 -          view = "new",
    1.60 -          params = { issue_id = issue.id }
    1.61 -        }
    1.62 -      end
    1.63 -    end
    1.64 -  },
    1.65 -  {
    1.66 -    name = "interested_members",
    1.67 -    label = _"Interested members",
    1.68 -    content = function()
    1.69 -      execute.view{
    1.70 -        module = "member",
    1.71 -        view = "_list",
    1.72 -        params = {
    1.73 -          issue = issue,
    1.74 -          members_selector =  issue:get_reference_selector("interested_members_snapshot")
    1.75 -            :join("issue", nil, "issue.id = direct_interest_snapshot.issue_id")
    1.76 -            :add_field("direct_interest_snapshot.weight")
    1.77 -            :add_where("direct_interest_snapshot.event = issue.latest_snapshot_event")
    1.78 -        }
    1.79 +ui.container{
    1.80 +  attr = { class = "issue_initiative_list" },
    1.81 +  content = function()
    1.82 +    execute.view{
    1.83 +      module = "initiative",
    1.84 +      view = "_list",
    1.85 +      params = {
    1.86 +        initiatives_selector = issue:get_reference_selector("initiatives"),
    1.87 +        issue = issue,
    1.88 +        expandable = true,
    1.89 +        for_initiative_id = param.get("for_initiative_id", atom.number),
    1.90 +        show_for_issue = true
    1.91        }
    1.92 -    end
    1.93 -  },
    1.94 -  {
    1.95 -    name = "delegations",
    1.96 -    label = _"Delegations",
    1.97 -    content = function()
    1.98 -      execute.view{
    1.99 -        module = "delegation",
   1.100 -        view = "_list",
   1.101 -        params = { delegations_selector = issue:get_reference_selector("delegations") }
   1.102 -      }
   1.103 -    end
   1.104 -  },
   1.105 -  {
   1.106 -    name = "voting_requests",
   1.107 -    label = _"Vote later requests" .. " " .. voting_requested_string,
   1.108 -    content = function()
   1.109 -      execute.view{
   1.110 -        module = "member",
   1.111 -        view = "_list",
   1.112 -        params = {
   1.113 -          issue = issue,
   1.114 -          members_selector =  issue:get_reference_selector("interested_members_snapshot")
   1.115 -            :join("issue", nil, "issue.id = direct_interest_snapshot.issue_id")
   1.116 -            :add_where("direct_interest_snapshot.voting_requested = false")
   1.117 -        }
   1.118 -      }
   1.119 -    end
   1.120 -  },
   1.121 -  {
   1.122 -    name = "details",
   1.123 -    label = _"Details",
   1.124 -    content = function()
   1.125 -      local policy = issue.policy
   1.126 -      ui.form{
   1.127 -        record = issue,
   1.128 -        readonly = true,
   1.129 -        attr = { class = "vertical" },
   1.130 -        content = function()
   1.131 -          ui.field.text{ label = _"State", name = "state" }
   1.132 -          ui.field.timestamp{ label = _"Created at",            name = "created" }
   1.133 -          ui.field.text{      label = _"Admission time",        value = policy.admission_time }
   1.134 -          ui.field.text{
   1.135 -            label = _"Issue quorum",
   1.136 -            value = format.percentage(policy.issue_quorum_num / policy.issue_quorum_den)
   1.137 -          }
   1.138 -          ui.field.timestamp{ label = _"Accepted at",              name = "accepted" }
   1.139 -          ui.field.text{      label = _"Discussion time",       value = policy.discussion_time }
   1.140 -          ui.field.vote_now{   label = _"Vote now", name = "vote_now" }
   1.141 -          ui.field.vote_later{ label = _"Vote later", name = "vote_later" }
   1.142 -          ui.field.timestamp{ label = _"Half frozen at",           name = "half_frozen" }
   1.143 -          ui.field.text{      label = _"Verification time",     value = policy.verification_time }
   1.144 -          ui.field.text{
   1.145 -            label   = _"Initiative quorum",
   1.146 -            value = format.percentage(policy.initiative_quorum_num / policy.initiative_quorum_den)
   1.147 -          }
   1.148 -          ui.field.timestamp{ label = _"Fully frozen at",          name = "fully_frozen" }
   1.149 -          ui.field.text{      label = _"Voting time",           value = policy.voting_time }
   1.150 -          ui.field.timestamp{ label = _"Closed",                name = "closed" }
   1.151 -        end
   1.152 -      }
   1.153 -      ui.form{
   1.154 -        record = issue.policy,
   1.155 -        readonly = true,
   1.156 -        content = function()
   1.157 -        end
   1.158 -      }
   1.159 -    end
   1.160 -  },
   1.161 +    }
   1.162 +  end
   1.163  }
   1.164  
   1.165 +slot.put("<br />")
   1.166  
   1.167 +execute.view{
   1.168 +  module = "issue",
   1.169 +  view = "show_tab",
   1.170 +  params = { issue = issue }
   1.171 +}
   1.172 +
   1.173 +if issue.snapshot then
   1.174 +  slot.put("<br />")
   1.175 +  ui.field.timestamp{ label = _"Last snapshot:", value = issue.snapshot }
   1.176 +end
   1.177 +

Impressum / About Us