liquid_feedback_frontend

annotate app/main/supporter/_show_box.lua @ 725:344e5fdce8c9

Fixed public search, made draft history available again
author bsw
date Thu Jun 28 13:52:42 2012 +0200 (2012-06-28)
parents b1ba5d237b6d
children 2cfa41e89c15
rev   line source
bsw@278 1 local initiative = param.get("initiative", "table") or Initiative:by_id(param.get_id())
bsw/jbe@0 2
bsw/jbe@19 3
bsw@525 4 local initiative = param.get("initiative", "table")
bsw@525 5 local supporter = Supporter:by_pk(initiative.id, app.session.member.id)
bsw@278 6
bsw@525 7 local partial = {
bsw@525 8 routing = {
bsw@525 9 default = {
bsw@525 10 mode = "redirect",
bsw@525 11 module = "initiative",
bsw@525 12 view = "show_support",
bsw@525 13 id = initiative.id
bsw@525 14 }
bsw@525 15 }
bsw@525 16 }
bsw/jbe@0 17
bsw@525 18 local routing = {
bsw@525 19 default = {
bsw@525 20 mode = "redirect",
bsw@525 21 module = request.get_module(),
bsw@525 22 view = request.get_view(),
bsw@525 23 id = param.get_id_cgi(),
bsw@525 24 params = param.get_all_cgi()
bsw@525 25 }
bsw@525 26 }
bsw/jbe@19 27
bsw@525 28 if not initiative.issue.fully_frozen and not initiative.issue.closed then
bsw@525 29 if supporter then
bsw@525 30 if not supporter:has_critical_opinion() then
bsw@525 31 ui.tag{ content = function()
bsw@525 32 ui.image{
bsw@525 33 static = "icons/16/thumb_up_green.png"
bsw@525 34 }
bsw@529 35 if initiative.issue.closed then
bsw@529 36 slot.put(_"You were supporter")
bsw@529 37 else
bsw@529 38 slot.put(_"You are supporter")
bsw@529 39 end
bsw@525 40 end }
bsw@525 41 else
bsw@525 42 ui.tag{ attr = { class = "potential_supporter" }, content = function()
bsw@525 43 ui.image{
bsw@525 44 static = "icons/16/thumb_up.png"
bsw@525 45 }
bsw@529 46 if initiative.issue.closed then
bsw@529 47 slot.put(_"You were potential supporter")
bsw@529 48 else
bsw@529 49 slot.put(_"You are potential supporter")
bsw@529 50 end
bsw@525 51 end }
bsw@525 52 end
bsw@525 53 slot.put(" (")
bsw@525 54 ui.link{
bsw@525 55 text = _"Withdraw",
bsw@525 56 module = "initiative",
bsw@525 57 action = "remove_support",
bsw@525 58 id = initiative.id,
bsw@525 59 routing = routing,
bsw@525 60 partial = partial
bsw@525 61 }
bsw@525 62 slot.put(") ")
bsw@525 63 elseif not initiative.revoked and app.session.member:has_voting_right_for_unit_id(initiative.issue.area.unit_id) then
bsw@525 64 local params = param.get_all_cgi()
bsw@525 65 params.dyn = nil
bsw@525 66 ui.link{
bsw@525 67 text = _"Support this initiative",
bsw@525 68 module = "initiative",
bsw@525 69 action = "add_support",
bsw@525 70 id = initiative.id,
bsw@525 71 routing = routing,
bsw@525 72 partial = partial
bsw@525 73 }
bsw@525 74 slot.put(" ")
bsw@525 75 end
bsw@525 76 end
bsw@278 77
bsw@280 78
bsw@525 79
bsw@525 80 if not initiative.issue.closed then
bsw@725 81 slot.put(" · ")
bsw@525 82 local ignored_initiative = IgnoredInitiative:by_pk(app.session.member.id, initiative.id)
bsw@525 83 if ignored_initiative then
bsw@525 84 ui.tag{
bsw@525 85 content = _"You have ignored this initiative"
bsw/jbe@19 86 }
bsw@525 87 ui.link{
bsw@525 88 text = _"Stop ignoring initiative",
bsw@525 89 module = "initiative",
bsw@525 90 action = "update_ignore",
bsw@525 91 id = initiative.id,
bsw@525 92 params = { delete = true },
bsw@525 93 routing = {
bsw@525 94 default = {
bsw@525 95 mode = "redirect",
bsw@525 96 module = request.get_module(),
bsw@525 97 view = request.get_view(),
bsw@525 98 id = param.get_id_cgi(),
bsw@525 99 params = param.get_all_cgi()
bsw@525 100 }
bsw@525 101 }
bsw@525 102 }
bsw@525 103 else
bsw@525 104 ui.link{
bsw@525 105 text = _"Ignore initiative",
bsw@525 106 module = "initiative",
bsw@525 107 action = "update_ignore",
bsw@525 108 id = initiative.id,
bsw@525 109 routing = {
bsw@525 110 default = {
bsw@525 111 mode = "redirect",
bsw@525 112 module = request.get_module(),
bsw@525 113 view = request.get_view(),
bsw@525 114 id = param.get_id_cgi(),
bsw@525 115 params = param.get_all_cgi()
bsw@525 116 }
bsw@525 117 }
bsw@525 118 }
bsw@10 119 end
bsw@525 120 end

Impressum / About Us