liquid_feedback_frontend

diff app/main/initiative/_list.lua @ 11:77d58efe99fd

Version beta7

Important security fixes:
- Added missing HTML encoding to postal address of member
- Link to discussion URL only if it starts with http(s)://

Other bugfixes:
- Fixed wrong display of 2nd level delegating voters for an initiative
- Do not display invited initiators as initiators while voting
- Added missing translation

New features:
- Public message of the day
- Both direct and indirect supporter count is shown in tab heads
- Support shown in initiative lists

Language chooser at the login page has been added (again)
author bsw
date Fri Jan 22 12:00:00 2010 +0100 (2010-01-22)
parents 72c5e0ee7c98
children 00d1004545f1
line diff
     1.1 --- a/app/main/initiative/_list.lua	Sun Jan 10 12:00:00 2010 +0100
     1.2 +++ b/app/main/initiative/_list.lua	Fri Jan 22 12:00:00 2010 +0100
     1.3 @@ -1,6 +1,18 @@
     1.4  local initiatives_selector = param.get("initiatives_selector", "table")
     1.5  initiatives_selector:join("issue", nil, "issue.id = initiative.issue_id")
     1.6  
     1.7 +local limit = param.get("limit", atom.number)
     1.8 +
     1.9 +local more_initiatives_count
    1.10 +if limit then
    1.11 +  local initiatives_count = initiatives_selector:count()
    1.12 +  if initiatives_count > limit then
    1.13 +    more_initiatives_count = initiatives_count - limit
    1.14 +  end
    1.15 +  initiatives_selector:limit(limit)
    1.16 +end
    1.17 +
    1.18 +
    1.19  local issue = param.get("issue", "table")
    1.20  
    1.21  local order_options = {}
    1.22 @@ -53,12 +65,22 @@
    1.23    end
    1.24  end
    1.25  
    1.26 +initiatives_selector
    1.27 +  :left_join("initiator", "_initiator", { "_initiator.initiative_id = initiative.id AND _initiator.member_id = ?", app.session.member.id} )
    1.28 +  :left_join("supporter", "_supporter", { "_supporter.initiative_id = initiative.id AND _supporter.member_id = ?", app.session.member.id} )
    1.29 +
    1.30 +  :add_field("(_initiator.member_id NOTNULL)", "is_initiator")
    1.31 +  :add_field({"(_supporter.member_id NOTNULL) AND NOT EXISTS(SELECT 1 FROM opinion WHERE opinion.initiative_id = initiative.id AND opinion.member_id = ? AND ((opinion.degree = 2 AND NOT fulfilled) OR (opinion.degree = -2 AND fulfilled)))", app.session.member.id }, "is_supporter")
    1.32 +  :add_field({"EXISTS(SELECT 1 FROM opinion WHERE opinion.initiative_id = initiative.id AND opinion.member_id = ? AND ((opinion.degree = 2 AND NOT fulfilled) OR (opinion.degree = -2 AND fulfilled)))", app.session.member.id }, "is_potential_supporter")
    1.33 +
    1.34 +
    1.35  ui_order{
    1.36    name = name,
    1.37    selector = initiatives_selector,
    1.38    options = order_options,
    1.39    content = function()
    1.40      ui.paginate{
    1.41 +      name = issue and "issue_" .. tostring(issue.id) .. "_page" or nil,
    1.42        selector = initiatives_selector,
    1.43        per_page = param.get("per_page", atom.number),
    1.44        content = function()
    1.45 @@ -130,6 +152,30 @@
    1.46                  static = "icons/16/new.png"
    1.47                }
    1.48              end
    1.49 +            if record.is_supporter then
    1.50 +              slot.put(" ")
    1.51 +              local label = _"You are supporting this initiative"
    1.52 +              ui.image{
    1.53 +                attr = { alt = label, title = label },
    1.54 +                static = "icons/16/thumb_up_green.png"
    1.55 +              }
    1.56 +            end
    1.57 +            if record.is_potential_supporter then
    1.58 +              slot.put(" ")
    1.59 +              local label = _"You are potential supporter of this initiative"
    1.60 +              ui.image{
    1.61 +                attr = { alt = label, title = label },
    1.62 +                static = "icons/16/thumb_up.png"
    1.63 +              }
    1.64 +            end
    1.65 +            if record.is_initiator then
    1.66 +              slot.put(" ")
    1.67 +              local label = _"You are iniator of this initiative"
    1.68 +              ui.image{
    1.69 +                attr = { alt = label, title = label },
    1.70 +                static = "icons/16/user_edit.png"
    1.71 +              }
    1.72 +            end
    1.73            end
    1.74          }
    1.75  
    1.76 @@ -141,4 +187,14 @@
    1.77        end
    1.78      }
    1.79    end
    1.80 -}
    1.81 \ No newline at end of file
    1.82 +}
    1.83 +
    1.84 +if more_initiatives_count then
    1.85 +  ui.link{
    1.86 +    attr = { style = "font-size: 75%; font-style: italic;" },
    1.87 +    content = _("#{count} more initiatives", { count = more_initiatives_count }),
    1.88 +    module = "issue",
    1.89 +    view = "show",
    1.90 +    id = issue.id,
    1.91 +  }
    1.92 +end

Impressum / About Us