liquid_feedback_frontend

annotate app/main/supporter/_show_box.lua @ 119:915cc0341538

Allow policies to be selected in admin interface of area
author Daniel Poelzleithner <poelzi@poelzi.org>
date Mon Oct 04 14:19:08 2010 +0200 (2010-10-04)
parents 00d1004545f1
children 034f96181e59
rev   line source
bsw/jbe@0 1
bsw/jbe@19 2 local initiative = param.get("initiative", "table")
bsw/jbe@19 3 local supporter = Supporter:by_pk(initiative.id, app.session.member.id)
bsw/jbe@19 4
bsw/jbe@19 5 local unique_string = multirand.string(16, '0123456789abcdef')
bsw/jbe@19 6
bsw/jbe@19 7
bsw/jbe@19 8 local partial = {
bsw/jbe@19 9 routing = {
bsw/jbe@19 10 default = {
bsw/jbe@19 11 mode = "redirect",
bsw/jbe@19 12 module = "initiative",
bsw/jbe@19 13 view = "show_support",
bsw/jbe@19 14 id = initiative.id
bsw/jbe@19 15 }
bsw/jbe@19 16 }
bsw/jbe@19 17 }
bsw/jbe@0 18
bsw/jbe@19 19 local routing = {
bsw/jbe@19 20 default = {
bsw/jbe@19 21 mode = "redirect",
bsw/jbe@19 22 module = request.get_module(),
bsw/jbe@19 23 view = request.get_view(),
bsw/jbe@19 24 id = param.get_id_cgi(),
bsw/jbe@19 25 params = param.get_all_cgi()
bsw/jbe@19 26 }
bsw/jbe@19 27 }
bsw/jbe@19 28
bsw/jbe@19 29 if not initiative.issue.fully_frozen and not initiative.issue.closed then
bsw/jbe@19 30 if supporter then
bsw/jbe@19 31 if not supporter:has_critical_opinion() then
bsw@10 32 ui.container{
bsw/jbe@19 33 attr = {
bsw/jbe@19 34 class = "head head_supporter",
bsw/jbe@19 35 style = "cursor: pointer;",
bsw/jbe@19 36 onclick = "document.getElementById('support_content_" .. unique_string .. "').style.display = 'block';"
bsw/jbe@19 37 },
bsw@10 38 content = function()
bsw/jbe@19 39 ui.image{
bsw/jbe@19 40 static = "icons/16/thumb_up_green.png"
bsw/jbe@0 41 }
bsw/jbe@19 42 slot.put(_"Your are supporter")
bsw/jbe@19 43 ui.image{
bsw/jbe@19 44 static = "icons/16/dropdown.png"
bsw/jbe@19 45 }
bsw@10 46 end
bsw@10 47 }
bsw@10 48 else
bsw/jbe@19 49 ui.container{
bsw/jbe@19 50 attr = {
bsw/jbe@19 51 class = "head head_potential_supporter",
bsw/jbe@19 52 style = "cursor: pointer;",
bsw/jbe@19 53 onclick = "document.getElementById('support_content_" .. unique_string .. "').style.display = 'block';"
bsw/jbe@19 54 },
bsw/jbe@19 55 content = function()
bsw/jbe@19 56 ui.image{
bsw/jbe@19 57 static = "icons/16/thumb_up.png"
bsw/jbe@19 58 }
bsw/jbe@19 59 slot.put(_"Your are potential supporter")
bsw/jbe@19 60 ui.image{
bsw/jbe@19 61 static = "icons/16/dropdown.png"
bsw/jbe@19 62 }
bsw/jbe@19 63 end
bsw/jbe@19 64 }
bsw/jbe@19 65 end
bsw/jbe@19 66 ui.container{
bsw/jbe@19 67 attr = { class = "content", id = "support_content_" .. unique_string .. "" },
bsw/jbe@19 68 content = function()
bsw/jbe@19 69 ui.container{
bsw/jbe@19 70 attr = {
bsw/jbe@19 71 class = "close",
bsw/jbe@19 72 style = "cursor: pointer;",
bsw/jbe@19 73 onclick = "document.getElementById('support_content_" .. unique_string .. "').style.display = 'none';"
bsw/jbe@19 74 },
bsw@10 75 content = function()
bsw/jbe@19 76 ui.image{ static = "icons/16/cross.png" }
bsw/jbe@19 77 end
bsw/jbe@19 78 }
bsw/jbe@19 79 if supporter then
bsw/jbe@19 80 ui.link{
bsw/jbe@19 81 image = { static = "icons/16/thumb_down_red.png" },
bsw/jbe@19 82 text = _"Remove my support from this initiative",
bsw/jbe@19 83 module = "initiative",
bsw/jbe@19 84 action = "remove_support",
bsw/jbe@19 85 id = initiative.id,
bsw/jbe@19 86 routing = routing,
bsw/jbe@19 87 partial = partial
bsw/jbe@0 88 }
bsw/jbe@19 89 else
bsw/jbe@19 90 end
bsw/jbe@0 91 end
bsw/jbe@19 92 }
bsw/jbe@19 93 else
bsw/jbe@19 94 if not initiative.revoked then
bsw/jbe@19 95 local params = param.get_all_cgi()
bsw/jbe@19 96 params.dyn = nil
bsw/jbe@19 97 ui.link{
bsw/jbe@19 98 image = { static = "icons/16/thumb_up_green.png" },
bsw/jbe@19 99 text = _"Support this initiative",
bsw/jbe@19 100 module = "initiative",
bsw/jbe@19 101 action = "add_support",
bsw/jbe@19 102 id = initiative.id,
bsw/jbe@19 103 routing = routing,
bsw/jbe@19 104 partial = partial
bsw/jbe@19 105 }
bsw/jbe@4 106 end
bsw@10 107 end
bsw/jbe@19 108 end
bsw@10 109

Impressum / About Us