liquid_feedback_frontend

changeset 572:1b799fcdae31

Fixed middots at issue actions
author bsw
date Tue Jun 19 23:35:10 2012 +0200 (2012-06-19)
parents 63eda58a870e
children b8e72db6dd0d
files app/main/interest/_show_box.lua app/main/issue/_show.lua
line diff
     1.1 --- a/app/main/interest/_show_box.lua	Tue Jun 19 23:21:34 2012 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,52 +0,0 @@
     1.4 -
     1.5 -local issue = param.get("issue", "table")
     1.6 -local initiative = param.get("initiative", "table")
     1.7 -
     1.8 -if issue.member_info.own_participation then
     1.9 -
    1.10 -  if issue.closed then
    1.11 -    ui.tag{ content = _"You were interested" }
    1.12 -  else
    1.13 -    ui.tag{ content = _"You are interested" }
    1.14 -  end
    1.15 -  slot.put(" ")
    1.16 -
    1.17 -  if issue.state ~= "finished" and issue.state ~= "cancelled" and issue.state ~= "voting" then
    1.18 -    slot.put("(")
    1.19 -    ui.link{
    1.20 -      text    = _"Withdraw",
    1.21 -      module  = "interest",
    1.22 -      action  = "update",
    1.23 -      params  = { issue_id = issue.id, delete = true },
    1.24 -      routing = {
    1.25 -        default = {
    1.26 -          mode = "redirect",
    1.27 -          module = request.get_module(),
    1.28 -          view = request.get_view(),
    1.29 -          id = param.get_id_cgi(),
    1.30 -          params = param.get_all_cgi()
    1.31 -        }
    1.32 -      }
    1.33 -    }
    1.34 -    slot.put(") ")
    1.35 -  end
    1.36 -elseif app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then
    1.37 -  if not issue.closed and not issue.fully_frozen then
    1.38 -    ui.link{
    1.39 -      text    = _"Add my interest",
    1.40 -      module  = "interest",
    1.41 -      action  = "update",
    1.42 -      params  = { issue_id = issue.id },
    1.43 -      routing = {
    1.44 -        default = {
    1.45 -          mode = "redirect",
    1.46 -          module = request.get_module(),
    1.47 -          view = request.get_view(),
    1.48 -          id = param.get_id_cgi(),
    1.49 -          params = param.get_all_cgi()
    1.50 -        }
    1.51 -      }
    1.52 -    }
    1.53 -    slot.put(" ")
    1.54 -  end
    1.55 -end
     2.1 --- a/app/main/issue/_show.lua	Tue Jun 19 23:21:34 2012 +0200
     2.2 +++ b/app/main/issue/_show.lua	Tue Jun 19 23:35:10 2012 +0200
     2.3 @@ -72,60 +72,94 @@
     2.4      end
     2.5    }
     2.6  
     2.7 -  ui.container{
     2.8 -    attr = { class = "content actions" }, content = function()
     2.9 +  local links = {}
    2.10    
    2.11      if voteable then
    2.12 -      ui.link{
    2.13 +      links[#links+1] ={
    2.14          content = vote_link_text,
    2.15          module = "vote",
    2.16          view = "list",
    2.17          params = { issue_id = issue.id }
    2.18        }
    2.19 -      slot.put(" · ")
    2.20      end
    2.21  
    2.22      if app.session.member_id then
    2.23 -      execute.view{
    2.24 -        module = "interest",
    2.25 -        view = "_show_box",
    2.26 -        params = { issue = issue, initiative = initiative }
    2.27 -      }
    2.28 -      slot.put(" · ")
    2.29 +
    2.30 +      if issue.member_info.own_participation then
    2.31 +        if issue.closed then
    2.32 +          links[#links+1] = { content = _"You were interested" }
    2.33 +        else
    2.34 +          links[#links+1] = { content = _"You are interested" }
    2.35 +        end
    2.36 +      end
    2.37 +      
    2.38 +      if not issue.closed and not issue.fully_frozen then
    2.39 +        if issue.member_info.own_participation then
    2.40 +          links[#links+1] = {
    2.41 +            in_brackets = true,
    2.42 +            text    = _"Withdraw",
    2.43 +            module  = "interest",
    2.44 +            action  = "update",
    2.45 +            params  = { issue_id = issue.id, delete = true },
    2.46 +            routing = {
    2.47 +              default = {
    2.48 +                mode = "redirect",
    2.49 +                module = request.get_module(),
    2.50 +                view = request.get_view(),
    2.51 +                id = param.get_id_cgi(),
    2.52 +                params = param.get_all_cgi()
    2.53 +              }
    2.54 +            }
    2.55 +          }
    2.56 +        elseif app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then
    2.57 +          links[#links+1] = {
    2.58 +            text    = _"Add my interest",
    2.59 +            module  = "interest",
    2.60 +            action  = "update",
    2.61 +            params  = { issue_id = issue.id },
    2.62 +            routing = {
    2.63 +              default = {
    2.64 +                mode = "redirect",
    2.65 +                module = request.get_module(),
    2.66 +                view = request.get_view(),
    2.67 +                id = param.get_id_cgi(),
    2.68 +                params = param.get_all_cgi()
    2.69 +              }
    2.70 +            }
    2.71 +          }
    2.72 +        end
    2.73 +      end
    2.74      end
    2.75  
    2.76 -    if not issue.closed and app.session.member_id then
    2.77 +    if not issue.closed and app.session.member_id and app.session.member:has_voting_right_for_unit_id(issue.area.unit) then
    2.78        if issue.member_info.own_delegation_scope ~= "issue" then
    2.79 -        ui.link{ text = _"Delegate issue", module = "delegation", view = "show", params = { issue_id = issue.id } }
    2.80 +        links[#links+1] = { text = _"Delegate issue", module = "delegation", view = "show", params = { issue_id = issue.id } }
    2.81        else
    2.82 -        ui.link{ text = _"Change issue delegation", module = "delegation", view = "show", params = { issue_id = issue.id } }
    2.83 +        links[#links+1] = { text = _"Change issue delegation", module = "delegation", view = "show", params = { issue_id = issue.id } }
    2.84        end
    2.85 -      slot.put(" · ")
    2.86      end
    2.87  
    2.88      if config.issue_discussion_url_func then
    2.89        local url = config.issue_discussion_url_func(issue)
    2.90 -      ui.link{
    2.91 +      links[#links+1] = {
    2.92          attr = { target = "_blank" },
    2.93          external = url,
    2.94          content = _"Discussion on issue"
    2.95        }
    2.96 -      slot.put(" · ")
    2.97      end
    2.98  
    2.99      if config.etherpad and app.session.member then
   2.100 -      ui.link{
   2.101 +      links[#links+1] = {
   2.102          attr = { target = "_blank" },
   2.103          external = issue.etherpad_url,
   2.104          content = _"Issue pad"
   2.105        }
   2.106 -      slot.put(" · ")
   2.107      end
   2.108  
   2.109  
   2.110      if app.session.member_id and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then
   2.111        if not issue.fully_frozen and not issue.closed then
   2.112 -        ui.link{
   2.113 +      links[#links+1] = {
   2.114            attr   = { class = "action" },
   2.115            text   = _"Create alternative initiative",
   2.116            module = "initiative",
   2.117 @@ -135,6 +169,22 @@
   2.118        end
   2.119      end
   2.120  
   2.121 +  ui.container{ attr = { class = "content actions" }, content = function()
   2.122 +    for i, link in ipairs(links) do
   2.123 +      if link.in_brackets then
   2.124 +        slot.put(" (")
   2.125 +      elseif i > 1 then
   2.126 +        slot.put(" · ")
   2.127 +      end
   2.128 +      if link.module then
   2.129 +        ui.link(link)
   2.130 +      else
   2.131 +        ui.tag(link)
   2.132 +      end
   2.133 +      if link.in_brackets then
   2.134 +        slot.put(")")
   2.135 +      end
   2.136 +    end
   2.137    end }
   2.138  
   2.139    if not for_listing then

Impressum / About Us