liquid_feedback_frontend
annotate app/main/index/show_tab.lua @ 157:24e47baf5f9b
strip html from fallback title
if the slot is used for title, make sure the html is stripped from it
if the slot is used for title, make sure the html is stripped from it
| author | Daniel Poelzleithner <poelzi@poelzi.org> |
|---|---|
| date | Fri Oct 08 20:31:09 2010 +0200 (2010-10-08) |
| parents | 4f39f0a0d5b5 |
| children |
| rev | line source |
|---|---|
| bsw@57 | 1 local tabs = { |
| bsw@57 | 2 module = "index", |
| bsw@57 | 3 view = "show_tab" |
| bsw@57 | 4 } |
| bsw@57 | 5 |
| bsw@57 | 6 local selector = Area:new_selector() |
| bsw@57 | 7 :reset_fields() |
| bsw@57 | 8 :add_field("area.id", nil, { "grouped" }) |
| bsw@57 | 9 :add_field("area.name", nil, { "grouped" }) |
| bsw@57 | 10 :add_field("membership.member_id NOTNULL", "is_member", { "grouped" }) |
| bsw@57 | 11 :add_field("count(issue.id)", "issues_to_vote_count") |
| bsw@57 | 12 :add_field("count(interest.member_id)", "interested_issues_to_vote_count") |
| bsw@57 | 13 :add_field("count(interest.member_id NOTNULL OR interest.member_id NOTNULL)", "issues_to_vote_count_sum") |
| bsw@57 | 14 :join("issue", nil, "issue.area_id = area.id AND issue.fully_frozen NOTNULL AND issue.closed ISNULL") |
| bsw@57 | 15 :left_join("direct_voter", nil, { "direct_voter.issue_id = issue.id AND direct_voter.member_id = ?", app.session.member.id }) |
| bsw@57 | 16 :add_where{ "direct_voter.member_id ISNULL" } |
| bsw@57 | 17 :left_join("interest", nil, { "interest.issue_id = issue.id AND interest.member_id = ?", app.session.member.id }) |
| bsw@57 | 18 :left_join("membership", nil, { "membership.area_id = area.id AND membership.member_id = ? ", app.session.member.id }) |
| bsw@57 | 19 |
| bsw@57 | 20 local not_voted_areas = {} |
| bsw@57 | 21 local issues_to_vote_count = 0 |
| bsw@57 | 22 for i, area in ipairs(selector:exec()) do |
| bsw@57 | 23 if area.is_member or area.interested_issues_to_vote_count > 0 then |
| bsw@57 | 24 not_voted_areas[#not_voted_areas+1] = area |
| bsw@57 | 25 end |
| bsw@57 | 26 issues_to_vote_count = issues_to_vote_count + area.issues_to_vote_count_sum |
| bsw@57 | 27 end |
| bsw@57 | 28 |
| bsw@57 | 29 tabs[#tabs+1] = { |
| bsw@57 | 30 name = "not_voted_issues", |
| bsw@57 | 31 label = _"Not voted issues" .. " (" .. tostring(issues_to_vote_count) .. ")", |
| bsw@57 | 32 icon = { static = "icons/16/email_open.png" }, |
| bsw@57 | 33 module = "index", |
| bsw@57 | 34 view = "_not_voted_issues", |
| bsw@57 | 35 params = { |
| bsw@57 | 36 areas = not_voted_areas |
| bsw@57 | 37 } |
| bsw@57 | 38 } |
| bsw@57 | 39 |
| bsw@57 | 40 local initiator_invites_selector = Initiative:new_selector() |
| bsw@57 | 41 :join("issue", "_issue_state", "_issue_state.id = initiative.issue_id") |
| bsw@57 | 42 :join("initiator", nil, { "initiator.initiative_id = initiative.id AND initiator.member_id = ? AND initiator.accepted ISNULL", app.session.member.id }) |
| bsw@57 | 43 :add_where("_issue_state.closed ISNULL AND _issue_state.half_frozen ISNULL") |
| bsw@57 | 44 |
| bsw@57 | 45 tabs[#tabs+1] = { |
| bsw@57 | 46 name = "initiator_invites", |
| bsw@57 | 47 label = _"Initiator invites" .. " (" .. tostring(initiator_invites_selector:count()) .. ")", |
| bsw@57 | 48 icon = { static = "icons/16/email_open.png" }, |
| bsw@57 | 49 module = "index", |
| bsw@57 | 50 view = "_initiator_invites", |
| bsw@57 | 51 params = { |
| bsw@57 | 52 initiatives_selector = initiator_invites_selector |
| bsw@57 | 53 } |
| bsw@57 | 54 } |
| bsw@57 | 55 |
| bsw@57 | 56 local updated_drafts_selector = Initiative:new_selector() |
| bsw@57 | 57 :join("issue", "_issue_state", "_issue_state.id = initiative.issue_id AND _issue_state.closed ISNULL AND _issue_state.fully_frozen ISNULL") |
| bsw@57 | 58 :join("current_draft", "_current_draft", "_current_draft.initiative_id = initiative.id") |
| bsw@57 | 59 :join("supporter", "supporter", { "supporter.member_id = ? AND supporter.initiative_id = initiative.id AND supporter.draft_id < _current_draft.id", app.session.member_id }) |
| bsw@57 | 60 |
| bsw@57 | 61 tabs[#tabs+1] = { |
| bsw@57 | 62 name = "updated_drafts", |
| bsw@57 | 63 label = _"Updated drafts" .. " (" .. tostring(updated_drafts_selector:count()) .. ")", |
| bsw@57 | 64 icon = { static = "icons/16/email_open.png" }, |
| bsw@57 | 65 module = "index", |
| bsw@57 | 66 view = "_updated_drafts", |
| bsw@57 | 67 params = { |
| bsw@57 | 68 initiatives_selector = updated_drafts_selector |
| bsw@57 | 69 } |
| bsw@57 | 70 } |
| bsw@57 | 71 |
| bsw@57 | 72 ui.tabs(tabs) |