liquid_feedback_frontend
changeset 1603:d14462e2b38b
Reworked interest add/remove
author | bsw |
---|---|
date | Mon Feb 01 20:56:14 2021 +0100 (2021-02-01) |
parents | a3a7120a67be |
children | 29cf02084694 |
files | app/main/delegation/_info.lua app/main/issue/_list.lua app/main/issue/_sidebar.lua |
line diff
1.1 --- a/app/main/delegation/_info.lua Mon Feb 01 14:32:47 2021 +0100 1.2 +++ b/app/main/delegation/_info.lua Mon Feb 01 20:56:14 2021 +0100 1.3 @@ -169,39 +169,58 @@ 1.4 end 1.5 end 1.6 1.7 -if not param.get("no_star", "boolean") then 1.8 - 1.9 - if info.own_participation then 1.10 - if issue and issue.fully_frozen then 1.11 - ui.link{ 1.12 - attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" }, 1.13 - module = "vote", view = "list", params = { 1.14 - issue_id = issue.id 1.15 +if not param.get("no_star", "boolean") and issue then 1.16 + local redirect_unit = request.get_param{ name = "unit" } 1.17 + local redirect_area = request.get_param{ name = "area" } 1.18 + 1.19 + if issue.fully_frozen and info.own_participation then 1.20 + ui.link{ 1.21 + attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" }, 1.22 + module = "vote", view = "list", params = { 1.23 + issue_id = issue.id 1.24 + }, 1.25 + content = function () 1.26 + ui.tag { content = _"you voted" } 1.27 + end 1.28 + } 1.29 + elseif not issue.half_frozen and not info.own_participation then 1.30 + ui.link{ 1.31 + attr = { class = "float-right mdl-button mdl-js-button mdl-button--icon mdl-button--accent" }, 1.32 + module = "interest", action = "update", params = { issue_id = issue.id }, 1.33 + routing = { default = { 1.34 + mode = "redirect", module = "index", view = "index", params = { 1.35 + unit = redirect_unit, area = redirect_area 1.36 }, 1.37 - content = function () 1.38 - ui.tag { content = _"you voted" } 1.39 - end 1.40 - } 1.41 - else 1.42 - if issue then 1.43 + anchor = "issue_" .. issue.id 1.44 + } }, 1.45 + content = function() 1.46 + ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "star_outline" } 1.47 + end 1.48 + } 1.49 + elseif not issue.half_frozen and info.own_participation then 1.50 + ui.link{ 1.51 + attr = { class = "float-right mdl-button mdl-js-button mdl-button--icon mdl-button--accent" }, 1.52 + module = "interest", action = "update", params = { issue_id = issue.id, delete = true }, 1.53 + routing = { default = { 1.54 + mode = "redirect", module = "index", view = "index", params = { 1.55 + unit = redirect_unit, area = redirect_area 1.56 + }, 1.57 + anchor = "issue_" .. issue.id 1.58 + } }, 1.59 + content = function() 1.60 ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "star" } 1.61 - slot.put(" ") 1.62 - ui.tag{ content = _"you are interested" } 1.63 - if not issue.closed and info.own_participation and info.weight and info.weight > 1 then 1.64 - slot.put(" ") 1.65 - ui.link { 1.66 - attr = { class = "right" }, content = "+" .. (info.weight - 1), 1.67 - module = "interest", view = "show_incoming", params = { 1.68 - issue_id = issue.id, member_id = member.id 1.69 - } 1.70 - } 1.71 - end 1.72 - else 1.73 - local text = _"you are subscribed" 1.74 - ui.image { attr = { class = "icon24 star", title = text, alt = text }, static = "icons/48/star.png" } 1.75 end 1.76 + } 1.77 + if not issue.closed and info.own_participation and info.weight and info.weight > 1 then 1.78 slot.put(" ") 1.79 + ui.link { 1.80 + attr = { class = "right" }, content = "+" .. (info.weight - 1), 1.81 + module = "interest", view = "show_incoming", params = { 1.82 + issue_id = issue.id, member_id = member.id 1.83 + } 1.84 + } 1.85 end 1.86 + slot.put(" ") 1.87 end 1.88 end 1.89
2.1 --- a/app/main/issue/_list.lua Mon Feb 01 14:32:47 2021 +0100 2.2 +++ b/app/main/issue/_list.lua Mon Feb 01 20:56:14 2021 +0100 2.3 @@ -121,7 +121,7 @@ 2.4 class = class .. " suggestion" 2.5 end 2.6 2.7 - ui.container{ attr = { class = class, }, content = function() 2.8 + ui.container{ attr = { class = class, id = "issue_" .. issue.id }, content = function() 2.9 local event_name 2.10 local event_icon 2.11 local negative_event = false
3.1 --- a/app/main/issue/_sidebar.lua Mon Feb 01 14:32:47 2021 +0100 3.2 +++ b/app/main/issue/_sidebar.lua Mon Feb 01 20:56:14 2021 +0100 3.3 @@ -39,7 +39,7 @@ 3.4 elseif not issue.closed then 3.5 if issue.member_info.own_participation then 3.6 ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function() 3.7 - ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "remove_red_eye" } 3.8 + ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "star" } 3.9 slot.put(" ") 3.10 ui.tag{ content = _"You are interested in this issue" } 3.11 end } 3.12 @@ -101,7 +101,7 @@ 3.13 mode = "redirect", module = initiative and "initiative" or "issue", view = "show", id = initiative and initiative.id or issue.id 3.14 } }, 3.15 content = function() 3.16 - ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "remove_red_eye" } 3.17 + ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "star" } 3.18 slot.put(" ") 3.19 ui.tag{ content = _"add my interest" } 3.20 end