annotate app/main/issue/_sidebar_issue.lua @ 1817:757a87af4c83
Added validation hook for profile updates
 | author | 
 bsw | 
 | date | 
 Mon Dec 13 11:57:35 2021 +0100 (2021-12-13) | 
 | parents | 
 97dfef4eb2d7  | 
 | children | 
  | 
 
 | rev | 
   line source | 
| 
bsw@1045
 | 
     1 local issue = param.get("issue", "table")
 | 
| 
bsw/jbe@1309
 | 
     2 local ommit_initiative_id = param.get ( "ommit_initiative_id", "number" )
 | 
| 
bsw@1045
 | 
     3 
 | 
| 
bsw/jbe@1309
 | 
     4 if #(issue.initiatives) > (ommit_initiative_id and 1 or 0) then
 | 
| 
bsw@1665
 | 
     5   ui.container{ attr = { class = "competing_initiatives" }, content = function()
 | 
| 
bsw@1665
 | 
     6     execute.view {
 | 
| 
bsw@1665
 | 
     7       module = "initiative", view = "_list",
 | 
| 
bsw@1665
 | 
     8       params = {
 | 
| 
bsw@1665
 | 
     9         issue = issue,
 | 
| 
bsw@1665
 | 
    10         initiatives = issue.initiatives,
 | 
| 
bsw@1665
 | 
    11         ommit_initiative_id = ommit_initiative_id
 | 
| 
bsw@1665
 | 
    12       }
 | 
| 
bsw@1045
 | 
    13     }
 | 
| 
bsw@1665
 | 
    14   end }
 | 
| 
bsw/jbe@1309
 | 
    15 end
 | 
| 
bsw/jbe@1309
 | 
    16 
 | 
| 
bsw/jbe@1309
 | 
    17 if #issue.initiatives == 1 then
 | 
| 
bsw/jbe@1309
 | 
    18   ui.container { attr = { class = "mdl-card__content" }, content = function()
 | 
| 
bsw/jbe@1309
 | 
    19     if not issue.closed and not (issue.state == "voting") then
 | 
| 
bsw/jbe@1309
 | 
    20       ui.tag { content = _"Currently this is the only initiative in this issue, because nobody started a competing initiative (yet)." }
 | 
| 
bsw/jbe@1309
 | 
    21     else
 | 
| 
bsw/jbe@1309
 | 
    22       ui.container { content = _"This is the only initiative in this issue, because nobody started a competing initiative." }
 | 
| 
bsw/jbe@1309
 | 
    23     end
 | 
| 
bsw/jbe@1309
 | 
    24   end }
 | 
| 
bsw/jbe@1309
 | 
    25 end
 | 
| 
bsw@1045
 | 
    26 
 | 
| 
bsw/jbe@1309
 | 
    27 if app.session.member 
 | 
| 
bsw/jbe@1309
 | 
    28     and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) 
 | 
| 
bsw/jbe@1309
 | 
    29     and not issue.closed and not issue.fully_frozen 
 | 
| 
bsw/jbe@1309
 | 
    30 then
 | 
| 
bsw/jbe@1309
 | 
    31   ui.container{ attr = { class = "mdl-card__actions mdl-card--border" }, content = function()
 | 
| 
bsw/jbe@1309
 | 
    32     ui.link {
 | 
| 
bsw/jbe@1309
 | 
    33       attr = { class = "mdl-button mdl-js-button" },
 | 
| 
bsw@1496
 | 
    34       module = "draft", view = "new", 
 | 
| 
bsw/jbe@1309
 | 
    35       params = { issue_id = issue.id },
 | 
| 
bsw/jbe@1309
 | 
    36       content = _"start a new competing initiative"
 | 
| 
bsw/jbe@1309
 | 
    37     }
 | 
| 
bsw/jbe@1309
 | 
    38   end }
 | 
| 
bsw/jbe@1309
 | 
    39 end
 |