liquid_feedback_frontend

diff app/main/initiative/show.lua @ 2:5c601807d397

Version alpha3

Dark green part of issue supporter bargraph represents all satisfied supporters, regardless of having seen the latest draft

Wiki formatting for drafts

Showing differences between two drafts of the same initiative

Display of outgoing delegation chains

Many other improvements
author bsw
date Mon Nov 23 12:00:00 2009 +0100 (2009-11-23)
parents 3bfb2fcf7ab9
children 768faea1096d
line diff
     1.1 --- a/app/main/initiative/show.lua	Wed Nov 18 12:00:00 2009 +0100
     1.2 +++ b/app/main/initiative/show.lua	Mon Nov 23 12:00:00 2009 +0100
     1.3 @@ -14,6 +14,11 @@
     1.4    params = { issue_id = initiative.issue_id }
     1.5  }
     1.6  
     1.7 +execute.view{
     1.8 +  module = "issue",
     1.9 +  view = "_show_box",
    1.10 +  params = { issue = initiative.issue }
    1.11 +}
    1.12  
    1.13  slot.select("path", function()
    1.14    ui.link{
    1.15 @@ -24,7 +29,7 @@
    1.16    }
    1.17    ui.container{ content = "::" }
    1.18    ui.link{
    1.19 -    content = _"Issue ##{id} (#{policy_name})":gsub("#{id}", initiative.issue.id):gsub("#{policy_name}", initiative.issue.policy.name),
    1.20 +    content = _"Issue ##{id}":gsub("#{id}", initiative.issue.id),
    1.21      module = "issue",
    1.22      view = "show",
    1.23      id = initiative.issue.id
    1.24 @@ -35,6 +40,18 @@
    1.25  
    1.26  slot.select("actions", function()
    1.27  
    1.28 +  if Initiator:by_pk(initiative.id, app.session.member.id) then
    1.29 +    ui.link{
    1.30 +      content = function()
    1.31 +        ui.image{ static = "icons/16/script_add.png" }
    1.32 +        slot.put(_"Edit draft")
    1.33 +      end,
    1.34 +      module = "draft",
    1.35 +      view = "new",
    1.36 +      params = { initiative_id = initiative.id }
    1.37 +    }
    1.38 +  end
    1.39 +
    1.40    ui.twitter("http://example.com/i" .. tostring(initiative.id) .. " " .. initiative.name)
    1.41  
    1.42  end)
    1.43 @@ -88,6 +105,48 @@
    1.44    end
    1.45  }
    1.46  
    1.47 +local supporter = app.session.member:get_reference_selector("supporters")
    1.48 +  :add_where{ "initiative_id = ?", initiative.id }
    1.49 +  :optional_object_mode()
    1.50 +  :exec()
    1.51 +
    1.52 +if supporter then
    1.53 +  local old_draft_id = supporter.draft_id
    1.54 +  local new_draft_id = initiative.current_draft.id
    1.55 +  if old_draft_id ~= new_draft_id then
    1.56 +    ui.container{
    1.57 +      attr = { class = "draft_updated_info" },
    1.58 +      content = function()
    1.59 +        slot.put("The draft of this initiative has been updated!")
    1.60 +        slot.put(" ")
    1.61 +        ui.link{
    1.62 +          content = _"Show diff",
    1.63 +          module = "draft",
    1.64 +          view = "diff",
    1.65 +          params = {
    1.66 +            old_draft_id = old_draft_id,
    1.67 +            new_draft_id = new_draft_id
    1.68 +          }
    1.69 +        }
    1.70 +        slot.put(" ")
    1.71 +        ui.link{
    1.72 +          content = _"Refresh support to current draft",
    1.73 +          module = "initiative",
    1.74 +          action = "add_support",
    1.75 +          id = initiative.id,
    1.76 +          routing = {
    1.77 +            default = {
    1.78 +              mode = "redirect",
    1.79 +              module = "initiative",
    1.80 +              view = "show",
    1.81 +              id = initiative.id
    1.82 +            }
    1.83 +          }
    1.84 +        }
    1.85 +      end
    1.86 +    }
    1.87 +  end
    1.88 +end
    1.89  
    1.90  ui.tabs{
    1.91    {
    1.92 @@ -95,41 +154,6 @@
    1.93      label = _"Current draft",
    1.94      content = function()
    1.95        execute.view{ module = "draft", view = "_show", params = { draft = initiative.current_draft } }
    1.96 -      if Initiator:by_pk(initiative.id, app.session.member.id) then
    1.97 -        ui.link{
    1.98 -          content = function()
    1.99 -            ui.image{ static = "icons/16/script_add.png" }
   1.100 -            slot.put(_"Add new draft")
   1.101 -          end,
   1.102 -          module = "draft",
   1.103 -          view = "new",
   1.104 -          params = { initiative_id = initiative.id }
   1.105 -        }
   1.106 -      end
   1.107 -    end
   1.108 -  },
   1.109 -  {
   1.110 -    name = "details",
   1.111 -    label = _"Details",
   1.112 -    content = function()
   1.113 -      ui.form{
   1.114 -        attr = { class = "vertical" },
   1.115 -        record = initiative,
   1.116 -        readonly = true,
   1.117 -        content = function()
   1.118 -          ui.field.text{ label = _"Issue policy", value = initiative.issue.policy.name }
   1.119 -          ui.field.text{
   1.120 -            label = _"Created at",
   1.121 -            value = tostring(initiative.created)
   1.122 -          }
   1.123 -          ui.field.text{
   1.124 -            label = _"Created at",
   1.125 -            value = format.timestamp(initiative.created)
   1.126 -          }
   1.127 -          ui.field.date{ label = _"Revoked at", name = "revoked" }
   1.128 -          ui.field.boolean{ label = _"Admitted", name = "admitted" }
   1.129 -        end
   1.130 -      }
   1.131      end
   1.132    },
   1.133    {
   1.134 @@ -171,6 +195,30 @@
   1.135        execute.view{ module = "draft", view = "_list", params = { drafts = initiative.drafts } }
   1.136      end
   1.137    },
   1.138 +  {
   1.139 +    name = "details",
   1.140 +    label = _"Details",
   1.141 +    content = function()
   1.142 +      ui.form{
   1.143 +        attr = { class = "vertical" },
   1.144 +        record = initiative,
   1.145 +        readonly = true,
   1.146 +        content = function()
   1.147 +          ui.field.text{ label = _"Issue policy", value = initiative.issue.policy.name }
   1.148 +          ui.field.text{
   1.149 +            label = _"Created at",
   1.150 +            value = tostring(initiative.created)
   1.151 +          }
   1.152 +          ui.field.text{
   1.153 +            label = _"Created at",
   1.154 +            value = format.timestamp(initiative.created)
   1.155 +          }
   1.156 +          ui.field.date{ label = _"Revoked at", name = "revoked" }
   1.157 +          ui.field.boolean{ label = _"Admitted", name = "admitted" }
   1.158 +        end
   1.159 +      }
   1.160 +    end
   1.161 +  },
   1.162  }
   1.163  
   1.164  

Impressum / About Us