annotate app/main/index/_not_voted_issues.lua @ 1603:d14462e2b38b
Reworked interest add/remove
 | author | 
 bsw | 
 | date | 
 Mon Feb 01 20:56:14 2021 +0100 (2021-02-01) | 
 | parents | 
 87c33552f406  | 
 | children | 
  | 
 
 | rev | 
   line source | 
| 
bsw@57
 | 
     1 local areas = param.get("areas", "table")
 | 
| 
bsw@57
 | 
     2 
 | 
| 
bsw@57
 | 
     3 if #areas > 0 then
 | 
| 
bsw@57
 | 
     4   ui.container{
 | 
| 
bsw@57
 | 
     5     attr = { style = "font-weight: bold;" },
 | 
| 
bsw@57
 | 
     6     content = _"Current votings in areas you are member of and issues you are interested in:"
 | 
| 
bsw@57
 | 
     7   }
 | 
| 
bsw@57
 | 
     8   
 | 
| 
bsw@57
 | 
     9   ui.list{
 | 
| 
bsw@57
 | 
    10     records = areas,
 | 
| 
bsw@57
 | 
    11     columns = {
 | 
| 
bsw@57
 | 
    12       {
 | 
| 
bsw@57
 | 
    13         name = "name"
 | 
| 
bsw@57
 | 
    14       },
 | 
| 
bsw@57
 | 
    15       {
 | 
| 
bsw@57
 | 
    16         content = function(record)
 | 
| 
bsw@57
 | 
    17           if record.is_member and record.issues_to_vote_count > 0 then
 | 
| 
bsw@57
 | 
    18             ui.link{
 | 
| 
bsw@57
 | 
    19               content = function()
 | 
| 
bsw@57
 | 
    20                 if record.issues_to_vote_count > 1 then
 | 
| 
bsw@57
 | 
    21                   slot.put(_("#{issues_to_vote_count} issue(s)", { issues_to_vote_count = record.issues_to_vote_count }))
 | 
| 
bsw@57
 | 
    22                 else
 | 
| 
bsw@57
 | 
    23                   slot.put(_("One issue"))
 | 
| 
bsw@57
 | 
    24                 end
 | 
| 
bsw@57
 | 
    25               end,
 | 
| 
bsw@57
 | 
    26               module = "area",
 | 
| 
bsw@57
 | 
    27               view = "show",
 | 
| 
bsw@57
 | 
    28               id = record.id,
 | 
| 
bsw@57
 | 
    29               params = { 
 | 
| 
bsw@478
 | 
    30                 tab = "open",
 | 
| 
bsw@57
 | 
    31                 filter = "frozen",
 | 
| 
bsw@478
 | 
    32                 filter_interest = "any",
 | 
| 
bsw@57
 | 
    33                 filter_voting = "not_voted"
 | 
| 
bsw@57
 | 
    34               }
 | 
| 
bsw@57
 | 
    35             }
 | 
| 
bsw@57
 | 
    36           else
 | 
| 
bsw@57
 | 
    37             slot.put(_"Not a member")
 | 
| 
bsw@57
 | 
    38           end
 | 
| 
bsw@57
 | 
    39         end
 | 
| 
bsw@57
 | 
    40       },
 | 
| 
bsw@57
 | 
    41       {
 | 
| 
bsw@57
 | 
    42         content = function(record)
 | 
| 
bsw@57
 | 
    43           if record.interested_issues_to_vote_count > 0 then
 | 
| 
bsw@57
 | 
    44             ui.link{
 | 
| 
bsw@57
 | 
    45               content = function()
 | 
| 
bsw@57
 | 
    46                 if record.interested_issues_to_vote_count > 1 then
 | 
| 
bsw@57
 | 
    47                   slot.put(_("#{interested_issues_to_vote_count} issue(s) you are interested in", { interested_issues_to_vote_count = record.interested_issues_to_vote_count }))
 | 
| 
bsw@57
 | 
    48                 else
 | 
| 
bsw@57
 | 
    49                   slot.put(_"One issue you are interested in")
 | 
| 
bsw@57
 | 
    50                 end
 | 
| 
bsw@57
 | 
    51               end,
 | 
| 
bsw@57
 | 
    52               module = "area",
 | 
| 
bsw@57
 | 
    53               view = "show",
 | 
| 
bsw@57
 | 
    54               id = record.id,
 | 
| 
bsw@57
 | 
    55               params = { 
 | 
| 
bsw@478
 | 
    56                 tab = "open",
 | 
| 
bsw@57
 | 
    57                 filter = "frozen",
 | 
| 
bsw@478
 | 
    58                 filter_interest = "issue",
 | 
| 
bsw@57
 | 
    59                 filter_voting = "not_voted"
 | 
| 
bsw@57
 | 
    60               }
 | 
| 
bsw@57
 | 
    61             }
 | 
| 
bsw@57
 | 
    62           end
 | 
| 
bsw@57
 | 
    63         end
 | 
| 
bsw@57
 | 
    64       },
 | 
| 
bsw@57
 | 
    65     }
 | 
| 
bsw@57
 | 
    66   }
 | 
| 
bsw@57
 | 
    67 end
 |