| rev | 
   line source | 
| 
bsw/jbe@4
 | 
     1 local issue = param.get("issue", "table")
 | 
| 
poelzi@111
 | 
     2 local initiative = param.get("initiative", "table")
 | 
| 
bsw/jbe@4
 | 
     3 
 | 
| 
bsw@51
 | 
     4 local direct_voter
 | 
| 
bsw@51
 | 
     5 
 | 
| 
bsw@51
 | 
     6 if app.session.member_id then
 | 
| 
bsw@51
 | 
     7   direct_voter = DirectVoter:by_pk(issue.id, app.session.member.id)
 | 
| 
bsw@51
 | 
     8 end
 | 
| 
bsw/jbe@19
 | 
     9 
 | 
| 
bsw/jbe@52
 | 
    10 if config.feature_rss_enabled then
 | 
| 
bsw/jbe@52
 | 
    11   util.html_rss_head{ title = _"Initiatives in this issue (last created first)", module = "initiative", view = "list_rss", params = { issue_id = issue.id } }
 | 
| 
bsw/jbe@52
 | 
    12   util.html_rss_head{ title = _"Initiatives in this issue (last updated first)", module = "initiative", view = "list_rss", params = { issue_id = issue.id, order = "last_updated" } }
 | 
| 
bsw/jbe@52
 | 
    13 end
 | 
| 
bsw/jbe@4
 | 
    14 
 | 
| 
bsw/jbe@19
 | 
    15 slot.select("title", function()
 | 
| 
bsw@271
 | 
    16   ui.link{
 | 
| 
bsw@271
 | 
    17     content = _("Issue ##{id}", { id = issue.id }),
 | 
| 
bsw@271
 | 
    18     module = "issue",
 | 
| 
bsw@271
 | 
    19     view = "show",
 | 
| 
bsw@271
 | 
    20     id = issue.id
 | 
| 
bsw@271
 | 
    21   }
 | 
| 
bsw@273
 | 
    22   slot.put(" · ")
 | 
| 
bsw/jbe@4
 | 
    23   ui.link{
 | 
| 
bsw/jbe@19
 | 
    24     content = issue.area.name,
 | 
| 
bsw/jbe@4
 | 
    25     module = "area",
 | 
| 
bsw/jbe@4
 | 
    26     view = "show",
 | 
| 
bsw/jbe@4
 | 
    27     id = issue.area.id
 | 
| 
bsw/jbe@4
 | 
    28   }
 | 
| 
bsw@271
 | 
    29   if not config.single_unit_id then
 | 
| 
bsw@271
 | 
    30     slot.put(" · ")
 | 
| 
bsw@271
 | 
    31     ui.link{
 | 
| 
bsw@271
 | 
    32       content = issue.area.unit.name,
 | 
| 
bsw@301
 | 
    33       module = "unit",
 | 
| 
bsw@301
 | 
    34       view = "show",
 | 
| 
bsw@301
 | 
    35       id = issue.area.unit_id
 | 
| 
bsw@271
 | 
    36     }
 | 
| 
bsw@271
 | 
    37   end
 | 
| 
bsw/jbe@5
 | 
    38 end)
 | 
| 
bsw/jbe@5
 | 
    39 
 | 
| 
bsw/jbe@4
 | 
    40 
 | 
| 
bsw@271
 | 
    41 slot.select("title2", function()
 | 
| 
bsw@271
 | 
    42   ui.tag{
 | 
| 
bsw@271
 | 
    43     tag = "div",
 | 
| 
bsw@317
 | 
    44     attr = { class = "issue_policy_info" },
 | 
| 
bsw@271
 | 
    45     content = function()
 | 
| 
bsw@272
 | 
    46     
 | 
| 
bsw@272
 | 
    47       ui.link{
 | 
| 
bsw@272
 | 
    48         text = issue.policy.name,
 | 
| 
bsw@272
 | 
    49         module = "policy",
 | 
| 
bsw@272
 | 
    50         view = "show",
 | 
| 
bsw@272
 | 
    51         id = issue.policy.id
 | 
| 
bsw@272
 | 
    52       }
 | 
| 
bsw@272
 | 
    53 
 | 
| 
bsw@271
 | 
    54       slot.put(" · ")
 | 
| 
bsw@271
 | 
    55       ui.tag{ content = issue.state_name }
 | 
| 
bsw@271
 | 
    56 
 | 
| 
bsw@273
 | 
    57       if issue.state_time_left then
 | 
| 
bsw@273
 | 
    58         slot.put(" · ")
 | 
| 
bsw@273
 | 
    59         ui.tag{ content = _("#{time_left} left", { time_left = issue.state_time_left }) }
 | 
| 
bsw@271
 | 
    60       end
 | 
| 
bsw@271
 | 
    61 
 | 
| 
bsw@271
 | 
    62     end
 | 
| 
bsw@271
 | 
    63   }
 | 
| 
bsw@271
 | 
    64 
 | 
| 
bsw@271
 | 
    65   
 | 
| 
bsw@271
 | 
    66 end)
 | 
| 
bsw@271
 | 
    67 
 | 
| 
bsw/jbe@4
 | 
    68 slot.select("actions", function()
 | 
| 
bsw/jbe@5
 | 
    69 
 | 
| 
bsw@51
 | 
    70   if app.session.member_id then
 | 
| 
bsw@51
 | 
    71 
 | 
| 
bsw@281
 | 
    72     if issue.state == 'voting' and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then
 | 
| 
bsw@51
 | 
    73       local text
 | 
| 
bsw@51
 | 
    74       if not direct_voter then
 | 
| 
bsw@51
 | 
    75         text = _"Vote now"
 | 
| 
bsw@51
 | 
    76       else
 | 
| 
bsw@51
 | 
    77         text = _"Change vote"
 | 
| 
bsw@51
 | 
    78       end
 | 
| 
bsw@51
 | 
    79       ui.link{
 | 
| 
bsw@51
 | 
    80         content = function()
 | 
| 
bsw@51
 | 
    81           ui.image{ static = "icons/16/email_open.png" }
 | 
| 
bsw@51
 | 
    82           slot.put(text)
 | 
| 
bsw@51
 | 
    83         end,
 | 
| 
bsw@51
 | 
    84         module = "vote",
 | 
| 
bsw@51
 | 
    85         view = "list",
 | 
| 
bsw@51
 | 
    86         params = { issue_id = issue.id }
 | 
| 
bsw@51
 | 
    87       }
 | 
| 
bsw/jbe@19
 | 
    88     end
 | 
| 
bsw/jbe@5
 | 
    89 
 | 
| 
bsw/jbe@5
 | 
    90     execute.view{
 | 
| 
bsw@51
 | 
    91       module = "interest",
 | 
| 
bsw/jbe@5
 | 
    92       view = "_show_box",
 | 
| 
bsw@339
 | 
    93       params = { issue = issue, initiative = initiative }
 | 
| 
bsw/jbe@5
 | 
    94     }
 | 
| 
bsw@7
 | 
    95 
 | 
| 
bsw@51
 | 
    96     if not issue.closed then
 | 
| 
bsw@51
 | 
    97       execute.view{
 | 
| 
bsw@51
 | 
    98         module = "delegation",
 | 
| 
bsw@51
 | 
    99         view = "_show_box",
 | 
| 
poelzi@111
 | 
   100         params = { issue_id = issue.id,
 | 
| 
poelzi@111
 | 
   101                    initiative_id = initiative and initiative.id or nil}
 | 
| 
bsw@51
 | 
   102       }
 | 
| 
bsw@51
 | 
   103     end
 | 
| 
bsw@51
 | 
   104 
 | 
| 
bsw@51
 | 
   105   end
 | 
| 
bsw/jbe@4
 | 
   106 
 | 
| 
bsw@10
 | 
   107   if config.issue_discussion_url_func then
 | 
| 
bsw@10
 | 
   108     local url = config.issue_discussion_url_func(issue)
 | 
| 
bsw@10
 | 
   109     ui.link{
 | 
| 
bsw@10
 | 
   110       attr = { target = "_blank" },
 | 
| 
bsw@10
 | 
   111       external = url,
 | 
| 
bsw@10
 | 
   112       content = function()
 | 
| 
bsw@10
 | 
   113         ui.image{ static = "icons/16/comments.png" }
 | 
| 
bsw@10
 | 
   114         slot.put(_"Discussion on issue")
 | 
| 
bsw@10
 | 
   115       end,
 | 
| 
bsw@10
 | 
   116     }
 | 
| 
bsw@10
 | 
   117   end
 | 
| 
bsw@286
 | 
   118 
 | 
| 
bsw@286
 | 
   119   if config.etherpad and app.session.member then
 | 
| 
bsw@286
 | 
   120     local url = config.etherpad.base_url .. "p/" .. config.etherpad.group_id .. "$Issue" .. issue.id
 | 
| 
bsw@286
 | 
   121     ui.link{
 | 
| 
bsw@286
 | 
   122       attr = { target = "_blank" },
 | 
| 
bsw@286
 | 
   123       external = url,
 | 
| 
bsw@286
 | 
   124       content = function()
 | 
| 
bsw@286
 | 
   125         ui.image{ static = "icons/16/comments.png" }
 | 
| 
bsw@286
 | 
   126         slot.put(_"Issue pad")
 | 
| 
bsw@286
 | 
   127       end,
 | 
| 
bsw@286
 | 
   128     }
 | 
| 
bsw@286
 | 
   129   end
 | 
| 
bsw@286
 | 
   130 
 | 
| 
bsw/jbe@4
 | 
   131 end)
 | 
| 
bsw/jbe@4
 | 
   132 
 | 
| 
bsw@281
 | 
   133 if app.session.member_id and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then
 | 
| 
bsw@272
 | 
   134   slot.select("actions", function()
 | 
| 
bsw@272
 | 
   135     if not issue.fully_frozen and not issue.closed then
 | 
| 
bsw@272
 | 
   136       ui.link{
 | 
| 
bsw@272
 | 
   137         image  = { static = "icons/16/script_add.png" },
 | 
| 
bsw@272
 | 
   138         attr   = { class = "action" },
 | 
| 
bsw@272
 | 
   139         text   = _"Create alternative initiative",
 | 
| 
bsw@272
 | 
   140         module = "initiative",
 | 
| 
bsw@272
 | 
   141         view   = "new",
 | 
| 
bsw@272
 | 
   142         params = { issue_id = issue.id }
 | 
| 
bsw@272
 | 
   143       }
 | 
| 
bsw@272
 | 
   144     end
 | 
| 
bsw@272
 | 
   145   end)
 | 
| 
bsw@272
 | 
   146 end
 | 
| 
bsw/jbe@4
 | 
   147 
 | 
| 
bsw@271
 | 
   148 local issue = param.get("issue", "table")
 | 
| 
bsw@271
 | 
   149 
 | 
| 
bsw@60
 | 
   150 if config.public_access_issue_head and not app.session.member_id then
 | 
| 
bsw@60
 | 
   151   config.public_access_issue_head(issue)
 | 
| 
bsw@60
 | 
   152 end
 | 
| 
bsw/jbe@6
 | 
   153 
 | 
| 
bsw@281
 | 
   154 if app.session.member_id and issue.state == 'voting' and not direct_voter
 | 
| 
bsw@281
 | 
   155   and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id)
 | 
| 
bsw@281
 | 
   156 then
 | 
| 
bsw/jbe@6
 | 
   157   ui.container{
 | 
| 
bsw/jbe@6
 | 
   158     attr = { class = "voting_active_info" },
 | 
| 
bsw/jbe@6
 | 
   159     content = function()
 | 
| 
bsw/jbe@6
 | 
   160       slot.put(_"Voting for this issue is currently running!")
 | 
| 
bsw/jbe@6
 | 
   161       slot.put(" ")
 | 
| 
bsw@51
 | 
   162       if app.session.member_id then
 | 
| 
bsw@51
 | 
   163         ui.link{
 | 
| 
bsw@51
 | 
   164           content = function()
 | 
| 
bsw@51
 | 
   165             slot.put(_"Vote now")
 | 
| 
bsw@51
 | 
   166           end,
 | 
| 
bsw@51
 | 
   167           module = "vote",
 | 
| 
bsw@51
 | 
   168           view = "list",
 | 
| 
bsw@51
 | 
   169           params = { issue_id = issue.id }
 | 
| 
bsw@51
 | 
   170         }
 | 
| 
bsw@51
 | 
   171       end
 | 
| 
bsw/jbe@6
 | 
   172     end
 | 
| 
bsw/jbe@6
 | 
   173   }
 | 
| 
bsw/jbe@6
 | 
   174   slot.put("<br />")
 | 
| 
bsw/jbe@6
 | 
   175 end
 | 
| 
bsw/jbe@6
 | 
   176 
 |