liquid_feedback_frontend

diff app/main/issue/_show_head.lua @ 51:0849be391140

Public read access; Read-only API for initiatives; Prepared integration of OpenID
author bsw
date Sun Apr 04 22:05:11 2010 +0200 (2010-04-04)
parents 00d1004545f1
children 88ac7798b562
line diff
     1.1 --- a/app/main/issue/_show_head.lua	Wed Mar 31 17:50:32 2010 +0200
     1.2 +++ b/app/main/issue/_show_head.lua	Sun Apr 04 22:05:11 2010 +0200
     1.3 @@ -1,6 +1,10 @@
     1.4  local issue = param.get("issue", "table")
     1.5  
     1.6 -local direct_voter = DirectVoter:by_pk(issue.id, app.session.member.id)
     1.7 +local direct_voter
     1.8 +
     1.9 +if app.session.member_id then
    1.10 +  direct_voter = DirectVoter:by_pk(issue.id, app.session.member.id)
    1.11 +end
    1.12  
    1.13  slot.put_into("html_head", '<link rel="alternate" type="application/rss+xml" title="RSS" href="../show/' .. tostring(issue.id) .. '.rss" />')
    1.14  
    1.15 @@ -31,43 +35,47 @@
    1.16  
    1.17  slot.select("actions", function()
    1.18  
    1.19 -  if issue.state == 'voting' then
    1.20 -    local text
    1.21 -    if not direct_voter then
    1.22 -      text = _"Vote now"
    1.23 -    else
    1.24 -      text = _"Change vote"
    1.25 +  if app.session.member_id then
    1.26 +
    1.27 +    if issue.state == 'voting' then
    1.28 +      local text
    1.29 +      if not direct_voter then
    1.30 +        text = _"Vote now"
    1.31 +      else
    1.32 +        text = _"Change vote"
    1.33 +      end
    1.34 +      ui.link{
    1.35 +        content = function()
    1.36 +          ui.image{ static = "icons/16/email_open.png" }
    1.37 +          slot.put(text)
    1.38 +        end,
    1.39 +        module = "vote",
    1.40 +        view = "list",
    1.41 +        params = { issue_id = issue.id }
    1.42 +      }
    1.43      end
    1.44 -    ui.link{
    1.45 -      content = function()
    1.46 -        ui.image{ static = "icons/16/email_open.png" }
    1.47 -        slot.put(text)
    1.48 -      end,
    1.49 -      module = "vote",
    1.50 -      view = "list",
    1.51 -      params = { issue_id = issue.id }
    1.52 -    }
    1.53 -  end
    1.54  
    1.55 -  execute.view{
    1.56 -    module = "interest",
    1.57 -    view = "_show_box",
    1.58 -    params = { issue = issue }
    1.59 -  }
    1.60 -
    1.61 -  if not issue.closed then
    1.62      execute.view{
    1.63 -      module = "delegation",
    1.64 +      module = "interest",
    1.65        view = "_show_box",
    1.66 -      params = { issue_id = issue.id }
    1.67 +      params = { issue = issue }
    1.68      }
    1.69 -  end
    1.70  
    1.71 -  execute.view{
    1.72 -    module = "issue",
    1.73 -    view = "_show_vote_later_box",
    1.74 -    params = { issue = issue }
    1.75 -  }
    1.76 +    if not issue.closed then
    1.77 +      execute.view{
    1.78 +        module = "delegation",
    1.79 +        view = "_show_box",
    1.80 +        params = { issue_id = issue.id }
    1.81 +      }
    1.82 +    end
    1.83 +
    1.84 +    execute.view{
    1.85 +      module = "issue",
    1.86 +      view = "_show_vote_later_box",
    1.87 +      params = { issue = issue }
    1.88 +    }
    1.89 +
    1.90 +  end
    1.91  
    1.92    if config.issue_discussion_url_func then
    1.93      local url = config.issue_discussion_url_func(issue)
    1.94 @@ -98,14 +106,16 @@
    1.95      content = function()
    1.96        slot.put(_"Voting for this issue is currently running!")
    1.97        slot.put(" ")
    1.98 -      ui.link{
    1.99 -        content = function()
   1.100 -          slot.put(_"Vote now")
   1.101 -        end,
   1.102 -        module = "vote",
   1.103 -        view = "list",
   1.104 -        params = { issue_id = issue.id }
   1.105 -      }
   1.106 +      if app.session.member_id then
   1.107 +        ui.link{
   1.108 +          content = function()
   1.109 +            slot.put(_"Vote now")
   1.110 +          end,
   1.111 +          module = "vote",
   1.112 +          view = "list",
   1.113 +          params = { issue_id = issue.id }
   1.114 +        }
   1.115 +      end
   1.116      end
   1.117    }
   1.118    slot.put("<br />")

Impressum / About Us