liquid_feedback_frontend

diff app/main/delegation/_info.lua @ 1618:2f9e1e882de6

Add/remove interest via fetch
author bsw
date Mon Feb 01 23:43:54 2021 +0100 (2021-02-01)
parents d14462e2b38b
children 62856200414d
line diff
     1.1 --- a/app/main/delegation/_info.lua	Mon Feb 01 21:57:34 2021 +0100
     1.2 +++ b/app/main/delegation/_info.lua	Mon Feb 01 23:43:54 2021 +0100
     1.3 @@ -185,8 +185,13 @@
     1.4      }
     1.5    elseif not issue.half_frozen and not info.own_participation then
     1.6      ui.link{
     1.7 -      attr = { class = "float-right mdl-button mdl-js-button mdl-button--icon mdl-button--accent" },
     1.8 -      module = "interest", action = "update", params = { issue_id = issue.id },
     1.9 +      attr = {
    1.10 +        class = "float-right mdl-button mdl-js-button mdl-button--icon mdl-button--accent",
    1.11 +      },
    1.12 +      form_attr = {
    1.13 +        onsubmit = "toggleInterest(" .. issue.id .. ", 'issue_" .. issue.id .. "_interest_icon'); return false;"  
    1.14 +      },
    1.15 +      module = "interest", action = "update", params = { issue_id = issue.id, interested = true },
    1.16        routing = { default = {
    1.17          mode = "redirect", module = "index", view = "index", params = {
    1.18            unit = redirect_unit, area = redirect_area
    1.19 @@ -194,13 +199,18 @@
    1.20          anchor = "issue_" .. issue.id
    1.21        } },
    1.22        content = function()
    1.23 -        ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "star_outline" }
    1.24 +        ui.tag{ tag = "i", attr = { id = "issue_" .. issue.id .. "_interest_icon", class = "material-icons" }, content = "star_outline" }
    1.25        end
    1.26      }
    1.27    elseif not issue.half_frozen and info.own_participation then
    1.28      ui.link{
    1.29 -      attr = { class = "float-right mdl-button mdl-js-button mdl-button--icon mdl-button--accent" },
    1.30 -      module = "interest", action = "update", params = { issue_id = issue.id, delete = true },
    1.31 +      attr = {
    1.32 +        class = "float-right mdl-button mdl-js-button mdl-button--icon mdl-button--accent"
    1.33 +      },
    1.34 +      form_attr = {
    1.35 +        onsubmit = "toggleInterest(" .. issue.id .. ", 'issue_" .. issue.id .. "_interest_icon'); return false;"  
    1.36 +      },
    1.37 +      module = "interest", action = "update", params = { issue_id = issue.id, interested = false },
    1.38        routing = { default = {
    1.39          mode = "redirect", module = "index", view = "index", params = {
    1.40            unit = redirect_unit, area = redirect_area
    1.41 @@ -208,7 +218,7 @@
    1.42          anchor = "issue_" .. issue.id
    1.43        } },
    1.44        content = function()
    1.45 -        ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "star" }
    1.46 +        ui.tag{ tag = "i", attr = { id = "issue_" .. issue.id .. "_interest_icon", class = "material-icons" }, content = "star" }
    1.47        end
    1.48      }
    1.49      if not issue.closed and info.own_participation and info.weight and info.weight > 1 then

Impressum / About Us