liquid_feedback_frontend

diff app/main/initiative/show.lua @ 4:80c215dbf076

Version alpha5

Many optical changes and improved usability

Support for different wiki-formatting-engines

Help system
author bsw/jbe
date Thu Dec 10 12:00:00 2009 +0100 (2009-12-10)
parents 768faea1096d
children afd9f769c7ae
line diff
     1.1 --- a/app/main/initiative/show.lua	Mon Nov 30 12:00:00 2009 +0100
     1.2 +++ b/app/main/initiative/show.lua	Thu Dec 10 12:00:00 2009 +0100
     1.3 @@ -1,5 +1,15 @@
     1.4  local initiative = Initiative:new_selector():add_where{ "id = ?", param.get_id()}:single_object_mode():exec()
     1.5  
     1.6 +
     1.7 +
     1.8 +execute.view{
     1.9 +  module = "issue",
    1.10 +  view = "_show_head",
    1.11 +  params = { issue = initiative.issue }
    1.12 +}
    1.13 +
    1.14 +local initiator = Initiator:by_pk(initiative.id, app.session.member.id)
    1.15 +
    1.16  --slot.put_into("html_head", '<link rel="alternate" type="application/rss+xml" title="RSS" href="../show/' .. tostring(initiative.id) .. '.rss" />')
    1.17  
    1.18  execute.view{
    1.19 @@ -8,6 +18,8 @@
    1.20    params = { initiative = initiative }
    1.21  }
    1.22  
    1.23 +--[[
    1.24 +
    1.25  execute.view{
    1.26    module = "delegation",
    1.27    view = "_show_box",
    1.28 @@ -20,6 +32,7 @@
    1.29    params = { issue = initiative.issue }
    1.30  }
    1.31  
    1.32 +
    1.33  slot.select("path", function()
    1.34    ui.link{
    1.35      content = _"Area '#{name}'":gsub("#{name}", initiative.issue.area.name),
    1.36 @@ -37,29 +50,27 @@
    1.37  end)
    1.38  
    1.39  slot.put_into("title", encode.html(_"Initiative: '#{name}'":gsub("#{name}", initiative.shortened_name) ))
    1.40 +--]]
    1.41 +
    1.42 +slot.put_into("sub_title", encode.html(_"Initiative: '#{name}'":gsub("#{name}", initiative.shortened_name) ))
    1.43  
    1.44  slot.select("actions", function()
    1.45  
    1.46 -  local initiator = Initiator:by_pk(initiative.id, app.session.member.id)
    1.47 -
    1.48 -  if initiator then
    1.49 +  if not initiative.issue.fully_frozen and not initiative.issue.closed then
    1.50      ui.link{
    1.51        content = function()
    1.52 -        ui.image{ static = "icons/16/script_add.png" }
    1.53 -        slot.put(_"Edit draft")
    1.54 +        ui.image{ static = "icons/16/script.png" }
    1.55 +        slot.put(_"Show other initiatives")
    1.56        end,
    1.57 -      module = "draft",
    1.58 -      view = "new",
    1.59 -      params = { initiative_id = initiative.id }
    1.60 +      module = "issue",
    1.61 +      view = "show",
    1.62 +      id = initiative.issue.id
    1.63      }
    1.64 -  end
    1.65 -
    1.66 -  if not initiative.issue.fully_frozen and not initiative.issue.closed then
    1.67      ui.link{
    1.68        attr = { class = "action" },
    1.69        content = function()
    1.70          ui.image{ static = "icons/16/script_add.png" }
    1.71 -        slot.put(_"Create alternative initiative" )
    1.72 +        slot.put(_"Create alternative initiative")
    1.73        end,
    1.74        module = "initiative",
    1.75        view = "new",
    1.76 @@ -68,28 +79,50 @@
    1.77    end
    1.78  --  ui.twitter("http://example.com/i" .. tostring(initiative.id) .. " " .. initiative.name)
    1.79  
    1.80 -  if initiative.discussion_url and #initiative.discussion_url > 0 then
    1.81 -    ui.link{
    1.82 -      attr = { 
    1.83 -        target = _"blank",
    1.84 -        title = initiative.discussion_url
    1.85 -      },
    1.86 +end)
    1.87 +
    1.88 +
    1.89 +util.help("initiative.show")
    1.90 +
    1.91 +
    1.92 +ui.container{
    1.93 +  attr = { class = "vertical" },
    1.94 +  content = function()
    1.95 +    ui.container{
    1.96 +      attr = { class = "ui_field_label" },
    1.97 +      content = _"Discussion URL"
    1.98 +    }
    1.99 +    ui.tag{
   1.100 +      tag = "span",
   1.101        content = function()
   1.102 -        ui.image{ static = "icons/16/comments.png" }
   1.103 -        slot.put(_"External discussion")
   1.104 -      end,
   1.105 -      external = initiative.discussion_url
   1.106 +        if initiative.discussion_url and #initiative.discussion_url > 0 then
   1.107 +          ui.link{
   1.108 +            attr = {
   1.109 +              class = "actions",
   1.110 +              target = _"blank",
   1.111 +              title = initiative.discussion_url
   1.112 +            },
   1.113 +            content = function()
   1.114 +              slot.put(encode.html(initiative.discussion_url))
   1.115 +            end,
   1.116 +            external = initiative.discussion_url
   1.117 +          }
   1.118 +        end
   1.119 +        slot.put(" ")
   1.120 +        if initiator then
   1.121 +          ui.link{
   1.122 +            attr = { class = "actions" },
   1.123 +            content = _"(change URL)",
   1.124 +            module = "initiative",
   1.125 +            view = "edit",
   1.126 +            id = initiative.id
   1.127 +          }
   1.128 +        end
   1.129 +      end
   1.130      }
   1.131    end
   1.132 -  if initiator then
   1.133 -    ui.link{
   1.134 -      content = _"(change)",
   1.135 -      module = "initiative",
   1.136 -      view = "edit",
   1.137 -      id = initiative.id
   1.138 -    }
   1.139 -  end
   1.140 -end)
   1.141 +}
   1.142 +
   1.143  
   1.144  
   1.145  ui.container{
   1.146 @@ -122,7 +155,14 @@
   1.147        },
   1.148        attr = { class = "vertical" },
   1.149        content = function()
   1.150 -        ui.field.text{ label = _"Name",        name = "name" }
   1.151 +        local supported = Supporter:by_pk(initiative.id, app.session.member.id) and true or false
   1.152 +        if not supported then
   1.153 +          ui.field.text{
   1.154 +            attr = { class = "warning" },
   1.155 +            value = _"You are currently not supporting this initiative. By adding suggestions to this initiative you will automatically become a potential supporter."
   1.156 +          }
   1.157 +        end
   1.158 +        ui.field.text{ label = _"Title (80 chars max)",        name = "name" }
   1.159          ui.field.text{ label = _"Description", name = "description", multiline = true }
   1.160          ui.field.select{ 
   1.161            label = _"Degree", 
   1.162 @@ -183,11 +223,23 @@
   1.163    end
   1.164  end
   1.165  
   1.166 +
   1.167  ui.tabs{
   1.168    {
   1.169      name = "current_draft",
   1.170      label = _"Current draft",
   1.171      content = function()
   1.172 +      if initiator then
   1.173 +        ui.link{
   1.174 +          content = function()
   1.175 +            ui.image{ static = "icons/16/script_add.png" }
   1.176 +            slot.put(_"Edit draft")
   1.177 +          end,
   1.178 +          module = "draft",
   1.179 +          view = "new",
   1.180 +          params = { initiative_id = initiative.id }
   1.181 +        }
   1.182 +      end
   1.183        execute.view{ module = "draft", view = "_show", params = { draft = initiative.current_draft } }
   1.184      end
   1.185    },
   1.186 @@ -195,7 +247,14 @@
   1.187      name = "suggestion",
   1.188      label = _"Suggestions",
   1.189      content = function()
   1.190 -      execute.view{ module = "suggestion", view = "_list", params = { suggestions_selector = initiative:get_reference_selector("suggestions") } }
   1.191 +      execute.view{
   1.192 +        module = "suggestion",
   1.193 +        view = "_list",
   1.194 +        params = {
   1.195 +          initiative = initiative,
   1.196 +          suggestions_selector = initiative:get_reference_selector("suggestions")
   1.197 +        }
   1.198 +      }
   1.199        slot.put("<br />")
   1.200        if not initiative.issue.frozen and not initiative.issue.closed then
   1.201          ui.link{
   1.202 @@ -220,8 +279,8 @@
   1.203            initiative = initiative,
   1.204            members_selector =  initiative:get_reference_selector("supporting_members_snapshot")
   1.205              :join("issue", nil, "issue.id = direct_supporter_snapshot.issue_id")
   1.206 -            :join("direct_population_snapshot", nil, "direct_population_snapshot.event = issue.latest_snapshot_event AND direct_population_snapshot.issue_id = issue.id AND direct_population_snapshot.member_id = member.id")
   1.207 -            :add_field("direct_population_snapshot.weight")
   1.208 +            :join("direct_interest_snapshot", nil, "direct_interest_snapshot.event = issue.latest_snapshot_event AND direct_interest_snapshot.issue_id = issue.id AND direct_interest_snapshot.member_id = member.id")
   1.209 +            :add_field("direct_interest_snapshot.weight")
   1.210              :add_where("direct_supporter_snapshot.event = issue.latest_snapshot_event")
   1.211          }
   1.212        }

Impressum / About Us