# HG changeset patch # User bsw # Date 1612209374 -3600 # Node ID d14462e2b38be8cfa8f8a9a754333f92e27897b7 # Parent a3a7120a67be417be09de7444caa6be8a2192976 Reworked interest add/remove diff -r a3a7120a67be -r d14462e2b38b app/main/delegation/_info.lua --- a/app/main/delegation/_info.lua Mon Feb 01 14:32:47 2021 +0100 +++ b/app/main/delegation/_info.lua Mon Feb 01 20:56:14 2021 +0100 @@ -169,39 +169,58 @@ end end -if not param.get("no_star", "boolean") then - - if info.own_participation then - if issue and issue.fully_frozen then - ui.link{ - attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" }, - module = "vote", view = "list", params = { - issue_id = issue.id +if not param.get("no_star", "boolean") and issue then + local redirect_unit = request.get_param{ name = "unit" } + local redirect_area = request.get_param{ name = "area" } + + if issue.fully_frozen and info.own_participation then + ui.link{ + attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" }, + module = "vote", view = "list", params = { + issue_id = issue.id + }, + content = function () + ui.tag { content = _"you voted" } + end + } + elseif not issue.half_frozen and not info.own_participation then + ui.link{ + attr = { class = "float-right mdl-button mdl-js-button mdl-button--icon mdl-button--accent" }, + module = "interest", action = "update", params = { issue_id = issue.id }, + routing = { default = { + mode = "redirect", module = "index", view = "index", params = { + unit = redirect_unit, area = redirect_area }, - content = function () - ui.tag { content = _"you voted" } - end - } - else - if issue then + anchor = "issue_" .. issue.id + } }, + content = function() + ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "star_outline" } + end + } + elseif not issue.half_frozen and info.own_participation then + ui.link{ + attr = { class = "float-right mdl-button mdl-js-button mdl-button--icon mdl-button--accent" }, + module = "interest", action = "update", params = { issue_id = issue.id, delete = true }, + routing = { default = { + mode = "redirect", module = "index", view = "index", params = { + unit = redirect_unit, area = redirect_area + }, + anchor = "issue_" .. issue.id + } }, + content = function() ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "star" } - slot.put(" ") - ui.tag{ content = _"you are interested" } - if not issue.closed and info.own_participation and info.weight and info.weight > 1 then - slot.put(" ") - ui.link { - attr = { class = "right" }, content = "+" .. (info.weight - 1), - module = "interest", view = "show_incoming", params = { - issue_id = issue.id, member_id = member.id - } - } - end - else - local text = _"you are subscribed" - ui.image { attr = { class = "icon24 star", title = text, alt = text }, static = "icons/48/star.png" } end + } + if not issue.closed and info.own_participation and info.weight and info.weight > 1 then slot.put(" ") + ui.link { + attr = { class = "right" }, content = "+" .. (info.weight - 1), + module = "interest", view = "show_incoming", params = { + issue_id = issue.id, member_id = member.id + } + } end + slot.put(" ") end end diff -r a3a7120a67be -r d14462e2b38b app/main/issue/_list.lua --- a/app/main/issue/_list.lua Mon Feb 01 14:32:47 2021 +0100 +++ b/app/main/issue/_list.lua Mon Feb 01 20:56:14 2021 +0100 @@ -121,7 +121,7 @@ class = class .. " suggestion" end - ui.container{ attr = { class = class, }, content = function() + ui.container{ attr = { class = class, id = "issue_" .. issue.id }, content = function() local event_name local event_icon local negative_event = false diff -r a3a7120a67be -r d14462e2b38b app/main/issue/_sidebar.lua --- a/app/main/issue/_sidebar.lua Mon Feb 01 14:32:47 2021 +0100 +++ b/app/main/issue/_sidebar.lua Mon Feb 01 20:56:14 2021 +0100 @@ -39,7 +39,7 @@ elseif not issue.closed then if issue.member_info.own_participation then ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function() - ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "remove_red_eye" } + ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "star" } slot.put(" ") ui.tag{ content = _"You are interested in this issue" } end } @@ -101,7 +101,7 @@ mode = "redirect", module = initiative and "initiative" or "issue", view = "show", id = initiative and initiative.id or issue.id } }, content = function() - ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "remove_red_eye" } + ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "star" } slot.put(" ") ui.tag{ content = _"add my interest" } end