liquid_feedback_frontend

changeset 57:4f39f0a0d5b5

Listing of updated drafts on start page; Code cleanup; Minor bugfix

MOTD, initiator invite, issues to vote and listing of updated drafts shown as tabs on start page;
Bugfix: Initiator icon only shown when initiatorship has been accepted
author bsw
date Sat Apr 17 21:59:02 2010 +0200 (2010-04-17)
parents 5a1f67c90e85
children 29caccea23cb
files app/main/index/_initiator_invites.lua app/main/index/_motd.lua app/main/index/_not_voted_issues.lua app/main/index/_updated_drafts.lua app/main/index/index.lua app/main/index/show_tab.lua app/main/initiative/_list.lua app/main/member/_show.lua app/main/member/show.lua app/main/member/show_tab.lua env/ui/tabs.lua static/style.css
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/app/main/index/_initiator_invites.lua	Sat Apr 17 21:59:02 2010 +0200
     1.3 @@ -0,0 +1,16 @@
     1.4 +local initiatives_selector = param.get("initiatives_selector", "table")
     1.5 +
     1.6 +if initiatives_selector:count() > 0 then
     1.7 +  ui.container{
     1.8 +    attr = { style = "font-weight: bold;" },
     1.9 +    content = _"Initiatives that invited you to become initiator:"
    1.10 +  }
    1.11 +
    1.12 +  execute.view{
    1.13 +    module = "initiative",
    1.14 +    view = "_list",
    1.15 +    params = { initiatives_selector = initiatives_selector }
    1.16 +  }
    1.17 +else
    1.18 +  ui.field.text{ value = _"You are currently not invited to any initiative." }
    1.19 +end
    1.20 \ No newline at end of file
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/app/main/index/_motd.lua	Sat Apr 17 21:59:02 2010 +0200
     2.3 @@ -0,0 +1,15 @@
     2.4 +local lang = locale.get("lang")
     2.5 +local basepath = request.get_app_basepath() 
     2.6 +local file_name = basepath .. "/locale/motd/" .. lang .. ".txt"
     2.7 +local file = io.open(file_name)
     2.8 +if file ~= nil then
     2.9 +  local help_text = file:read("*a")
    2.10 +  if #help_text > 0 then
    2.11 +    ui.container{
    2.12 +      attr = { class = "wiki" },
    2.13 +      content = function()
    2.14 +        slot.put(format.wiki_text(help_text))
    2.15 +      end
    2.16 +    }
    2.17 +  end
    2.18 +end
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/app/main/index/_not_voted_issues.lua	Sat Apr 17 21:59:02 2010 +0200
     3.3 @@ -0,0 +1,64 @@
     3.4 +local areas = param.get("areas", "table")
     3.5 +
     3.6 +if #areas > 0 then
     3.7 +  ui.container{
     3.8 +    attr = { style = "font-weight: bold;" },
     3.9 +    content = _"Current votings in areas you are member of and issues you are interested in:"
    3.10 +  }
    3.11 +  
    3.12 +  ui.list{
    3.13 +    records = areas,
    3.14 +    columns = {
    3.15 +      {
    3.16 +        name = "name"
    3.17 +      },
    3.18 +      {
    3.19 +        content = function(record)
    3.20 +          if record.is_member and record.issues_to_vote_count > 0 then
    3.21 +            ui.link{
    3.22 +              content = function()
    3.23 +                if record.issues_to_vote_count > 1 then
    3.24 +                  slot.put(_("#{issues_to_vote_count} issue(s)", { issues_to_vote_count = record.issues_to_vote_count }))
    3.25 +                else
    3.26 +                  slot.put(_("One issue"))
    3.27 +                end
    3.28 +              end,
    3.29 +              module = "area",
    3.30 +              view = "show",
    3.31 +              id = record.id,
    3.32 +              params = { 
    3.33 +                filter = "frozen",
    3.34 +                filter_voting = "not_voted"
    3.35 +              }
    3.36 +            }
    3.37 +          else
    3.38 +            slot.put(_"Not a member")
    3.39 +          end
    3.40 +        end
    3.41 +      },
    3.42 +      {
    3.43 +        content = function(record)
    3.44 +          if record.interested_issues_to_vote_count > 0 then
    3.45 +            ui.link{
    3.46 +              content = function()
    3.47 +                if record.interested_issues_to_vote_count > 1 then
    3.48 +                  slot.put(_("#{interested_issues_to_vote_count} issue(s) you are interested in", { interested_issues_to_vote_count = record.interested_issues_to_vote_count }))
    3.49 +                else
    3.50 +                  slot.put(_"One issue you are interested in")
    3.51 +                end
    3.52 +              end,
    3.53 +              module = "area",
    3.54 +              view = "show",
    3.55 +              id = record.id,
    3.56 +              params = { 
    3.57 +                filter = "frozen",
    3.58 +                filter_interest = "my",
    3.59 +                filter_voting = "not_voted"
    3.60 +              }
    3.61 +            }
    3.62 +          end
    3.63 +        end
    3.64 +      },
    3.65 +    }
    3.66 +  }
    3.67 +end
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/app/main/index/_updated_drafts.lua	Sat Apr 17 21:59:02 2010 +0200
     4.3 @@ -0,0 +1,17 @@
     4.4 +local initiatives_selector = Initiative:new_selector()
     4.5 +  :join("issue", "_issue_state", "_issue_state.id = initiative.issue_id AND _issue_state.closed ISNULL AND _issue_state.fully_frozen ISNULL")
     4.6 +  :join("current_draft", "_current_draft", "_current_draft.initiative_id = initiative.id")
     4.7 +  :join("supporter", "supporter", { "supporter.member_id = ? AND supporter.initiative_id = initiative.id AND supporter.draft_id < _current_draft.id", app.session.member_id })
     4.8 +
     4.9 +if initiatives_selector:count() > 0 then
    4.10 +  ui.container{
    4.11 +    attr = { style = "font-weight: bold;" },
    4.12 +    content = _"Open initiatives you are supporting which has been updated their draft:"
    4.13 +  }
    4.14 +
    4.15 +  execute.view{
    4.16 +    module = "initiative",
    4.17 +    view = "_list",
    4.18 +    params = { initiatives_selector = initiatives_selector }
    4.19 +  }
    4.20 +end
    4.21 \ No newline at end of file
     5.1 --- a/app/main/index/index.lua	Fri Apr 16 14:51:30 2010 +0200
     5.2 +++ b/app/main/index/index.lua	Sat Apr 17 21:59:02 2010 +0200
     5.3 @@ -55,7 +55,6 @@
     5.4        module = "member",
     5.5        view = "edit"
     5.6      }
     5.7 -  
     5.8      ui.link{
     5.9        content = function()
    5.10            ui.image{ static = "icons/16/user_gray.png" }
    5.11 @@ -64,12 +63,10 @@
    5.12        module = "member",
    5.13        view = "edit_images"
    5.14      }
    5.15 -  
    5.16      execute.view{
    5.17        module = "delegation",
    5.18        view = "_show_box"
    5.19      }
    5.20 -  
    5.21      ui.link{
    5.22        content = function()
    5.23            ui.image{ static = "icons/16/wrench.png" }
    5.24 @@ -78,7 +75,6 @@
    5.25        module = "member",
    5.26        view = "settings"
    5.27      }
    5.28 -  
    5.29      if config.download_dir then
    5.30        ui.link{
    5.31          content = function()
    5.32 @@ -92,133 +88,13 @@
    5.33    end
    5.34  end)
    5.35  
    5.36 -local lang = locale.get("lang")
    5.37 -local basepath = request.get_app_basepath() 
    5.38 -local file_name = basepath .. "/locale/motd/" .. lang .. ".txt"
    5.39 -local file = io.open(file_name)
    5.40 -if file ~= nil then
    5.41 -  local help_text = file:read("*a")
    5.42 -  if #help_text > 0 then
    5.43 -    ui.container{
    5.44 -      attr = { class = "motd wiki" },
    5.45 -      content = function()
    5.46 -        slot.put(format.wiki_text(help_text))
    5.47 -      end
    5.48 -    }
    5.49 -  end
    5.50 -end
    5.51 -
    5.52 -
    5.53  util.help("index.index", _"Home")
    5.54  
    5.55 -local areas = {}
    5.56 -if app.session.member then
    5.57 -  local selector = Area:new_selector()
    5.58 -    :reset_fields()
    5.59 -    :add_field("area.id", nil, { "grouped" })
    5.60 -    :add_field("area.name", nil, { "grouped" })
    5.61 -    :add_field("membership.member_id NOTNULL", "is_member", { "grouped" })
    5.62 -    :add_field("count(issue.id)", "issues_to_vote_count")
    5.63 -    :add_field("count(interest.member_id)", "interested_issues_to_vote_count")
    5.64 -    :join("issue", nil, "issue.area_id = area.id AND issue.fully_frozen NOTNULL AND issue.closed ISNULL")
    5.65 -    :left_join("direct_voter", nil, { "direct_voter.issue_id = issue.id AND direct_voter.member_id = ?", app.session.member.id })
    5.66 -    :add_where{ "direct_voter.member_id ISNULL" }
    5.67 -    :left_join("interest", nil, { "interest.issue_id = issue.id AND interest.member_id = ?", app.session.member.id })
    5.68 -    :left_join("membership", nil, { "membership.area_id = area.id AND membership.member_id = ? ", app.session.member.id })
    5.69 -  
    5.70 -  for i, area in ipairs(selector:exec()) do
    5.71 -    if area.is_member or area.interested_issues_to_vote_count > 0 then
    5.72 -      areas[#areas+1] = area
    5.73 -    end
    5.74 -  end
    5.75 -end
    5.76 -
    5.77 -if #areas > 0 then
    5.78 -  ui.container{
    5.79 -    attr = { style = "font-weight: bold;" },
    5.80 -    content = _"Current votings in areas you are member of and issues you are interested in:"
    5.81 +execute.view{
    5.82 +  module = "member",
    5.83 +  view = "_show",
    5.84 +  params = {
    5.85 +    member = app.session.member,
    5.86 +    show_as_homepage = true
    5.87    }
    5.88 -  
    5.89 -  ui.list{
    5.90 -    records = areas,
    5.91 -    columns = {
    5.92 -      {
    5.93 -        name = "name"
    5.94 -      },
    5.95 -      {
    5.96 -        content = function(record)
    5.97 -          if record.is_member and record.issues_to_vote_count > 0 then
    5.98 -            ui.link{
    5.99 -              content = function()
   5.100 -                if record.issues_to_vote_count > 1 then
   5.101 -                  slot.put(_("#{issues_to_vote_count} issue(s)", { issues_to_vote_count = record.issues_to_vote_count }))
   5.102 -                else
   5.103 -                  slot.put(_("One issue"))
   5.104 -                end
   5.105 -              end,
   5.106 -              module = "area",
   5.107 -              view = "show",
   5.108 -              id = record.id,
   5.109 -              params = { 
   5.110 -                filter = "frozen",
   5.111 -                filter_voting = "not_voted"
   5.112 -              }
   5.113 -            }
   5.114 -          else
   5.115 -            slot.put(_"Not a member")
   5.116 -          end
   5.117 -        end
   5.118 -      },
   5.119 -      {
   5.120 -        content = function(record)
   5.121 -          if record.interested_issues_to_vote_count > 0 then
   5.122 -            ui.link{
   5.123 -              content = function()
   5.124 -                if record.interested_issues_to_vote_count > 1 then
   5.125 -                  slot.put(_("#{interested_issues_to_vote_count} issue(s) you are interested in", { interested_issues_to_vote_count = record.interested_issues_to_vote_count }))
   5.126 -                else
   5.127 -                  slot.put(_"One issue you are interested in")
   5.128 -                end
   5.129 -              end,
   5.130 -              module = "area",
   5.131 -              view = "show",
   5.132 -              id = record.id,
   5.133 -              params = { 
   5.134 -                filter = "frozen",
   5.135 -                filter_interest = "my",
   5.136 -                filter_voting = "not_voted"
   5.137 -              }
   5.138 -            }
   5.139 -          end
   5.140 -        end
   5.141 -      },
   5.142 -    }
   5.143 -  }
   5.144 -end
   5.145 -
   5.146 -local initiatives_selector = Initiative:new_selector()
   5.147 -  :join("issue", "_issue_state", "_issue_state.id = initiative.issue_id")
   5.148 -  :join("initiator", nil, { "initiator.initiative_id = initiative.id AND initiator.member_id = ? AND initiator.accepted ISNULL", app.session.member.id })
   5.149 -  :add_where("_issue_state.closed ISNULL AND _issue_state.half_frozen ISNULL")
   5.150 -
   5.151 -if initiatives_selector:count() > 0 then
   5.152 -  ui.container{
   5.153 -    attr = { style = "font-weight: bold;" },
   5.154 -    content = _"Initiatives that invited you to become initiator:"
   5.155 -  }
   5.156 -
   5.157 -  execute.view{
   5.158 -    module = "initiative",
   5.159 -    view = "_list",
   5.160 -    params = { initiatives_selector = initiatives_selector }
   5.161 -  }
   5.162 -end
   5.163 -
   5.164 -
   5.165 -if app.session.member then
   5.166 -  execute.view{
   5.167 -    module = "member",
   5.168 -    view = "_show",
   5.169 -    params = { member = app.session.member }
   5.170 -  }
   5.171 -end
   5.172 +}
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/app/main/index/show_tab.lua	Sat Apr 17 21:59:02 2010 +0200
     6.3 @@ -0,0 +1,72 @@
     6.4 +local tabs = {
     6.5 +  module = "index",
     6.6 +  view = "show_tab"
     6.7 +}
     6.8 +
     6.9 +local selector = Area:new_selector()
    6.10 +  :reset_fields()
    6.11 +  :add_field("area.id", nil, { "grouped" })
    6.12 +  :add_field("area.name", nil, { "grouped" })
    6.13 +  :add_field("membership.member_id NOTNULL", "is_member", { "grouped" })
    6.14 +  :add_field("count(issue.id)", "issues_to_vote_count")
    6.15 +  :add_field("count(interest.member_id)", "interested_issues_to_vote_count")
    6.16 +  :add_field("count(interest.member_id NOTNULL OR interest.member_id NOTNULL)", "issues_to_vote_count_sum")
    6.17 +  :join("issue", nil, "issue.area_id = area.id AND issue.fully_frozen NOTNULL AND issue.closed ISNULL")
    6.18 +  :left_join("direct_voter", nil, { "direct_voter.issue_id = issue.id AND direct_voter.member_id = ?", app.session.member.id })
    6.19 +  :add_where{ "direct_voter.member_id ISNULL" }
    6.20 +  :left_join("interest", nil, { "interest.issue_id = issue.id AND interest.member_id = ?", app.session.member.id })
    6.21 +  :left_join("membership", nil, { "membership.area_id = area.id AND membership.member_id = ? ", app.session.member.id })
    6.22 +
    6.23 +local not_voted_areas = {}
    6.24 +local issues_to_vote_count = 0
    6.25 +for i, area in ipairs(selector:exec()) do
    6.26 +  if area.is_member or area.interested_issues_to_vote_count > 0 then
    6.27 +    not_voted_areas[#not_voted_areas+1] = area
    6.28 +  end
    6.29 +  issues_to_vote_count = issues_to_vote_count + area.issues_to_vote_count_sum
    6.30 +end
    6.31 +
    6.32 +tabs[#tabs+1] = {
    6.33 +  name = "not_voted_issues",
    6.34 +  label = _"Not voted issues" .. " (" .. tostring(issues_to_vote_count) .. ")",
    6.35 +  icon = { static = "icons/16/email_open.png" },
    6.36 +  module = "index",
    6.37 +  view = "_not_voted_issues",
    6.38 +  params = {
    6.39 +    areas = not_voted_areas
    6.40 +  }
    6.41 +}
    6.42 +
    6.43 +local initiator_invites_selector = Initiative:new_selector()
    6.44 +  :join("issue", "_issue_state", "_issue_state.id = initiative.issue_id")
    6.45 +  :join("initiator", nil, { "initiator.initiative_id = initiative.id AND initiator.member_id = ? AND initiator.accepted ISNULL", app.session.member.id })
    6.46 +  :add_where("_issue_state.closed ISNULL AND _issue_state.half_frozen ISNULL")
    6.47 +
    6.48 +tabs[#tabs+1] = {
    6.49 +  name = "initiator_invites",
    6.50 +  label = _"Initiator invites" .. " (" .. tostring(initiator_invites_selector:count()) .. ")",
    6.51 +  icon = { static = "icons/16/email_open.png" },
    6.52 +  module = "index",
    6.53 +  view = "_initiator_invites",
    6.54 +  params = {
    6.55 +    initiatives_selector = initiator_invites_selector
    6.56 +  }
    6.57 +}
    6.58 +
    6.59 +local updated_drafts_selector = Initiative:new_selector()
    6.60 +  :join("issue", "_issue_state", "_issue_state.id = initiative.issue_id AND _issue_state.closed ISNULL AND _issue_state.fully_frozen ISNULL")
    6.61 +  :join("current_draft", "_current_draft", "_current_draft.initiative_id = initiative.id")
    6.62 +  :join("supporter", "supporter", { "supporter.member_id = ? AND supporter.initiative_id = initiative.id AND supporter.draft_id < _current_draft.id", app.session.member_id })
    6.63 +
    6.64 +tabs[#tabs+1] = {
    6.65 +  name = "updated_drafts",
    6.66 +  label = _"Updated drafts" .. " (" .. tostring(updated_drafts_selector:count()) .. ")",
    6.67 +  icon = { static = "icons/16/email_open.png" },
    6.68 +  module = "index",
    6.69 +  view = "_updated_drafts",
    6.70 +  params = {
    6.71 +    initiatives_selector = updated_drafts_selector
    6.72 +  }
    6.73 +}
    6.74 +
    6.75 +ui.tabs(tabs)
    6.76 \ No newline at end of file
     7.1 --- a/app/main/initiative/_list.lua	Fri Apr 16 14:51:30 2010 +0200
     7.2 +++ b/app/main/initiative/_list.lua	Sat Apr 17 21:59:02 2010 +0200
     7.3 @@ -9,7 +9,7 @@
     7.4  
     7.5  if app.session.member_id then
     7.6    initiatives_selector
     7.7 -    :left_join("initiator", "_initiator", { "_initiator.initiative_id = initiative.id AND _initiator.member_id = ?", app.session.member.id} )
     7.8 +    :left_join("initiator", "_initiator", { "_initiator.initiative_id = initiative.id AND _initiator.member_id = ? AND _initiator.accepted", app.session.member.id} )
     7.9      :left_join("supporter", "_supporter", { "_supporter.initiative_id = initiative.id AND _supporter.member_id = ?", app.session.member.id} )
    7.10    
    7.11      :add_field("(_initiator.member_id NOTNULL)", "is_initiator")
     8.1 --- a/app/main/member/_show.lua	Fri Apr 16 14:51:30 2010 +0200
     8.2 +++ b/app/main/member/_show.lua	Sat Apr 17 21:59:02 2010 +0200
     8.3 @@ -2,6 +2,7 @@
     8.4    module = "member",
     8.5    view = "show_tab",
     8.6    params = { 
     8.7 -    member = param.get("member", "table")
     8.8 +    member = param.get("member", "table"),
     8.9 +    show_as_homepage = param.get("show_as_homepage", atom.boolean)
    8.10    }
    8.11  }
    8.12 \ No newline at end of file
     9.1 --- a/app/main/member/show.lua	Fri Apr 16 14:51:30 2010 +0200
     9.2 +++ b/app/main/member/show.lua	Sat Apr 17 21:59:02 2010 +0200
     9.3 @@ -13,11 +13,12 @@
     9.4  
     9.5  slot.put_into("title", encode.html(_"Member '#{member}'":gsub("#{member}", member.name)))
     9.6  
     9.7 -if member.id ~= app.session.member.id then
     9.8 -  --TODO performance
     9.9 -  local contact = Contact:by_pk(app.session.member.id, member.id)
    9.10 -  if contact then
    9.11 -    slot.select("actions", function()
    9.12 +slot.select("actions", function()
    9.13 +  if member.id == app.session.member.id then
    9.14 +  else
    9.15 +    --TODO performance
    9.16 +    local contact = Contact:by_pk(app.session.member.id, member.id)
    9.17 +    if contact then
    9.18        ui.container{
    9.19          attr = { class = "interest" },
    9.20          content = _"You have saved this member as contact."
    9.21 @@ -38,9 +39,7 @@
    9.22            }
    9.23          }
    9.24        }
    9.25 -    end)
    9.26 -  else
    9.27 -    slot.select("actions", function()
    9.28 +    else
    9.29        ui.link{
    9.30          image   = { static = "icons/16/book_add.png" },
    9.31          text    = _"Add to my contacts",
    9.32 @@ -57,9 +56,9 @@
    9.33            }
    9.34          }
    9.35        }
    9.36 -    end)
    9.37 +    end
    9.38    end
    9.39 -end
    9.40 +end)
    9.41  
    9.42  slot.select("actions", function()
    9.43    ui.link{
    10.1 --- a/app/main/member/show_tab.lua	Fri Apr 16 14:51:30 2010 +0200
    10.2 +++ b/app/main/member/show_tab.lua	Sat Apr 17 21:59:02 2010 +0200
    10.3 @@ -1,3 +1,5 @@
    10.4 +local show_as_homepage = param.get("show_as_homepage", atom.boolean)
    10.5 +
    10.6  local member
    10.7  
    10.8  if request.get_json_request_slots() then
    10.9 @@ -6,84 +8,183 @@
   10.10    member = param.get("member", "table")
   10.11  end
   10.12  
   10.13 +local tabs = {
   10.14 +  module = "member",
   10.15 +  view = "show_tab",
   10.16 +  static_params = {
   10.17 +    member_id = member.id,
   10.18 +    show_as_homepage = show_as_homepage
   10.19 +  }
   10.20 +}
   10.21 +
   10.22 +if show_as_homepage and app.session.member_id == member.id then
   10.23 +  tabs[#tabs+1] = {
   10.24 +    class = "yellow",
   10.25 +    name = "motd",
   10.26 +    label = _"Message of the day",
   10.27 +    icon = { static = "icons/16/bell.png" },
   10.28 +    module = "index",
   10.29 +    view = "_motd",
   10.30 +    params = {}
   10.31 +  }
   10.32 +
   10.33 +  local selector = Area:new_selector()
   10.34 +    :reset_fields()
   10.35 +    :add_field("area.id", nil, { "grouped" })
   10.36 +    :add_field("area.name", nil, { "grouped" })
   10.37 +    :add_field("membership.member_id NOTNULL", "is_member", { "grouped" })
   10.38 +    :add_field("count(issue.id)", "issues_to_vote_count")
   10.39 +    :add_field("count(interest.member_id)", "interested_issues_to_vote_count")
   10.40 +    :add_field("count(interest.member_id NOTNULL OR interest.member_id NOTNULL)", "issues_to_vote_count_sum")
   10.41 +    :join("issue", nil, "issue.area_id = area.id AND issue.fully_frozen NOTNULL AND issue.closed ISNULL")
   10.42 +    :left_join("direct_voter", nil, { "direct_voter.issue_id = issue.id AND direct_voter.member_id = ?", app.session.member.id })
   10.43 +    :add_where{ "direct_voter.member_id ISNULL" }
   10.44 +    :left_join("interest", nil, { "interest.issue_id = issue.id AND interest.member_id = ?", app.session.member.id })
   10.45 +    :left_join("membership", nil, { "membership.area_id = area.id AND membership.member_id = ? ", app.session.member.id })
   10.46 +
   10.47 +  local not_voted_areas = {}
   10.48 +  local issues_to_vote_count = 0
   10.49 +  for i, area in ipairs(selector:exec()) do
   10.50 +    if area.is_member or area.interested_issues_to_vote_count > 0 then
   10.51 +      not_voted_areas[#not_voted_areas+1] = area
   10.52 +    end
   10.53 +    issues_to_vote_count = issues_to_vote_count + area.issues_to_vote_count_sum
   10.54 +  end
   10.55 +
   10.56 +  if issues_to_vote_count > 0 then
   10.57 +    tabs[#tabs+1] = {
   10.58 +      class = "yellow",
   10.59 +      name = "not_voted_issues",
   10.60 +      label = _"Not voted issues" .. " (" .. tostring(issues_to_vote_count) .. ")",
   10.61 +      icon = { static = "icons/16/email_open.png" },
   10.62 +      module = "index",
   10.63 +      view = "_not_voted_issues",
   10.64 +      params = {
   10.65 +        areas = not_voted_areas
   10.66 +      }
   10.67 +    }
   10.68 +  end
   10.69 +
   10.70 +  local initiator_invites_selector = Initiative:new_selector()
   10.71 +    :join("issue", "_issue_state", "_issue_state.id = initiative.issue_id")
   10.72 +    :join("initiator", nil, { "initiator.initiative_id = initiative.id AND initiator.member_id = ? AND initiator.accepted ISNULL", app.session.member.id })
   10.73 +    :add_where("_issue_state.closed ISNULL AND _issue_state.half_frozen ISNULL")
   10.74 +
   10.75 +  if initiator_invites_selector:count() > 0 then
   10.76 +    tabs[#tabs+1] = {
   10.77 +      class = "yellow",
   10.78 +      name = "initiator_invites",
   10.79 +      label = _"Initiator invites" .. " (" .. tostring(initiator_invites_selector:count()) .. ")",
   10.80 +      icon = { static = "icons/16/user_add.png" },
   10.81 +      module = "index",
   10.82 +      view = "_initiator_invites",
   10.83 +      params = {
   10.84 +        initiatives_selector = initiator_invites_selector
   10.85 +      }
   10.86 +    }
   10.87 +  end
   10.88 +
   10.89 +  local updated_drafts_selector = Initiative:new_selector()
   10.90 +    :join("issue", "_issue_state", "_issue_state.id = initiative.issue_id AND _issue_state.closed ISNULL AND _issue_state.fully_frozen ISNULL")
   10.91 +    :join("current_draft", "_current_draft", "_current_draft.initiative_id = initiative.id")
   10.92 +    :join("supporter", "supporter", { "supporter.member_id = ? AND supporter.initiative_id = initiative.id AND supporter.draft_id < _current_draft.id", app.session.member_id })
   10.93 +
   10.94 +  if updated_drafts_selector:count() > 0 then
   10.95 +    tabs[#tabs+1] = {
   10.96 +      class = "yellow",
   10.97 +      name = "updated_drafts",
   10.98 +      label = _"Updated drafts" .. " (" .. tostring(updated_drafts_selector:count()) .. ")",
   10.99 +      icon = { static = "icons/16/script.png" },
  10.100 +      module = "index",
  10.101 +      view = "_updated_drafts",
  10.102 +      params = {
  10.103 +        initiatives_selector = updated_drafts_selector
  10.104 +      }
  10.105 +    }
  10.106 +  end
  10.107 +end
  10.108 +
  10.109 +tabs[#tabs+1] = {
  10.110 +  name = "profile",
  10.111 +  label = _"Profile",
  10.112 +  icon = { static = "icons/16/application_form.png" },
  10.113 +  module = "member",
  10.114 +  view = "_profile",
  10.115 +  params = { member = member },
  10.116 +}
  10.117 +
  10.118  local areas_selector = member:get_reference_selector("areas")
  10.119 +tabs[#tabs+1] = {
  10.120 +  name = "areas",
  10.121 +  label = _"Areas" .. " (" .. tostring(areas_selector:count()) .. ")",
  10.122 +  icon = { static = "icons/16/package.png" },
  10.123 +  module = "area",
  10.124 +  view = "_list",
  10.125 +  params = { areas_selector = areas_selector },
  10.126 +}
  10.127 +
  10.128  local issues_selector = member:get_reference_selector("issues")
  10.129 +tabs[#tabs+1] = {
  10.130 +  name = "issues",
  10.131 +  label = _"Issues" .. " (" .. tostring(issues_selector:count()) .. ")",
  10.132 +  icon = { static = "icons/16/folder.png" },
  10.133 +  module = "issue",
  10.134 +  view = "_list",
  10.135 +  params = { issues_selector = issues_selector },
  10.136 +}
  10.137 +
  10.138  local supported_initiatives_selector = member:get_reference_selector("supported_initiatives")
  10.139 +tabs[#tabs+1] = {
  10.140 +  name = "supported_initiatives",
  10.141 +  label = _"Supported initiatives" .. " (" .. tostring(supported_initiatives_selector:count()) .. ")",
  10.142 +  icon = { static = "icons/16/thumb_up_green.png" },
  10.143 +  module = "initiative",
  10.144 +  view = "_list",
  10.145 +  params = { initiatives_selector = supported_initiatives_selector },
  10.146 +}
  10.147 +
  10.148  local initiated_initiatives_selector = member:get_reference_selector("initiated_initiatives"):add_where("initiator.accepted = true")
  10.149 +tabs[#tabs+1] = {
  10.150 +  name = "initiatied_initiatives",
  10.151 +  label = _"Initiated initiatives" .. " (" .. tostring(initiated_initiatives_selector:count()) .. ")",
  10.152 +  icon = { static = "icons/16/user_edit.png" },
  10.153 +  module = "initiative",
  10.154 +  view = "_list",
  10.155 +  params = { initiatives_selector = initiated_initiatives_selector },
  10.156 +}
  10.157 +
  10.158  local incoming_delegations_selector = member:get_reference_selector("incoming_delegations")
  10.159    :left_join("issue", "_member_showtab_issue", "_member_showtab_issue.id = delegation.issue_id")
  10.160    :add_where("_member_showtab_issue.closed ISNULL")
  10.161 +tabs[#tabs+1] = {
  10.162 +  name = "incoming_delegations",
  10.163 +  label = _"Incoming delegations" .. " (" .. tostring(incoming_delegations_selector:count()) .. ")",
  10.164 +  icon = { static = "icons/16/table_go.png" },
  10.165 +  module = "delegation",
  10.166 +  view = "_list",
  10.167 +  params = { delegations_selector = incoming_delegations_selector, incoming = true },
  10.168 +}
  10.169 +
  10.170  local outgoing_delegations_selector = member:get_reference_selector("outgoing_delegations")
  10.171    :left_join("issue", "_member_showtab_issue", "_member_showtab_issue.id = delegation.issue_id")
  10.172    :add_where("_member_showtab_issue.closed ISNULL")
  10.173 -local contacts_selector = member:get_reference_selector("saved_members"):add_where("public")
  10.174 +tabs[#tabs+1] = {
  10.175 +  name = "outgoing_delegations",
  10.176 +  label = _"Outgoing delegations" .. " (" .. tostring(outgoing_delegations_selector:count()) .. ")",
  10.177 +  icon = { static = "icons/16/table_go.png" },
  10.178 +  module = "delegation",
  10.179 +  view = "_list",
  10.180 +  params = { delegations_selector = outgoing_delegations_selector, outgoing = true },
  10.181 +}
  10.182  
  10.183 -ui.tabs{
  10.184 +local contacts_selector = member:get_reference_selector("saved_members"):add_where("public")
  10.185 +tabs[#tabs+1] = {
  10.186 +  name = "contacts",
  10.187 +  label = _"Contacts" .. " (" .. tostring(contacts_selector:count()) .. ")",
  10.188 +  icon = { static = "icons/16/book_edit.png" },
  10.189    module = "member",
  10.190 -  view = "show_tab",
  10.191 -  static_params = { member_id = member.id },
  10.192 -  {
  10.193 -    name = "profile",
  10.194 -    label = _"Profile",
  10.195 -    icon = { static = "icons/16/application_form.png" },
  10.196 -    module = "member",
  10.197 -    view = "_profile",
  10.198 -    params = { member = member },
  10.199 -  },
  10.200 -  {
  10.201 -    name = "areas",
  10.202 -    label = _"Areas" .. " (" .. tostring(areas_selector:count()) .. ")",
  10.203 -    icon = { static = "icons/16/package.png" },
  10.204 -    module = "area",
  10.205 -    view = "_list",
  10.206 -    params = { areas_selector = areas_selector },
  10.207 -  },
  10.208 -  {
  10.209 -    name = "issues",
  10.210 -    label = _"Issues" .. " (" .. tostring(issues_selector:count()) .. ")",
  10.211 -    icon = { static = "icons/16/folder.png" },
  10.212 -    module = "issue",
  10.213 -    view = "_list",
  10.214 -    params = { issues_selector = issues_selector },
  10.215 -  },
  10.216 -  {
  10.217 -    name = "supported_initiatives",
  10.218 -    label = _"Supported initiatives" .. " (" .. tostring(supported_initiatives_selector:count()) .. ")",
  10.219 -    icon = { static = "icons/16/thumb_up_green.png" },
  10.220 -    module = "initiative",
  10.221 -    view = "_list",
  10.222 -    params = { initiatives_selector = supported_initiatives_selector },
  10.223 -  },
  10.224 -  {
  10.225 -    name = "initiatied_initiatives",
  10.226 -    label = _"Initiated initiatives" .. " (" .. tostring(initiated_initiatives_selector:count()) .. ")",
  10.227 -    icon = { static = "icons/16/user_edit.png" },
  10.228 -    module = "initiative",
  10.229 -    view = "_list",
  10.230 -    params = { initiatives_selector = initiated_initiatives_selector },
  10.231 -  },
  10.232 -  {
  10.233 -    name = "incoming_delegations",
  10.234 -    label = _"Incoming delegations" .. " (" .. tostring(incoming_delegations_selector:count()) .. ")",
  10.235 -    icon = { static = "icons/16/table_go.png" },
  10.236 -    module = "delegation",
  10.237 -    view = "_list",
  10.238 -    params = { delegations_selector = incoming_delegations_selector, incoming = true },
  10.239 -  },
  10.240 -  {
  10.241 -    name = "outgoing_delegations",
  10.242 -    label = _"Outgoing delegations" .. " (" .. tostring(outgoing_delegations_selector:count()) .. ")",
  10.243 -    icon = { static = "icons/16/table_go.png" },
  10.244 -    module = "delegation",
  10.245 -    view = "_list",
  10.246 -    params = { delegations_selector = outgoing_delegations_selector, outgoing = true },
  10.247 -  },
  10.248 -  {
  10.249 -    name = "contacts",
  10.250 -    label = _"Contacts" .. " (" .. tostring(contacts_selector:count()) .. ")",
  10.251 -    icon = { static = "icons/16/book_edit.png" },
  10.252 -    module = "member",
  10.253 -    view = "_list",
  10.254 -    params = { members_selector = contacts_selector },
  10.255 -  }
  10.256 +  view = "_list",
  10.257 +  params = { members_selector = contacts_selector },
  10.258  }
  10.259 +
  10.260 +ui.tabs(tabs)
  10.261 \ No newline at end of file
    11.1 --- a/env/ui/tabs.lua	Fri Apr 16 14:51:30 2010 +0200
    11.2 +++ b/env/ui/tabs.lua	Sat Apr 17 21:59:02 2010 +0200
    11.3 @@ -77,9 +77,9 @@
    11.4          attr = {
    11.5            name = "tab_" .. tab.name,
    11.6            class = (
    11.7 -            tab.name == current_tab and "ui_tabs_accordeon_head selected" or
    11.8 -            not current_tab and i == 1 and "ui_tabs_accordeon_head selected" or
    11.9 -            "ui_tabs_accordeon_head"
   11.10 +            tab.name == current_tab and "ui_tabs_accordeon_head selected" .. (tab.class and (" " .. tab.class) or "") or
   11.11 +            not current_tab and i == 1 and "ui_tabs_accordeon_head selected" .. (tab.class and (" " .. tab.class) or "")  or
   11.12 +            "ui_tabs_accordeon_head" .. (tab.class and (" " .. tab.class) or "") 
   11.13            ),
   11.14            id = "tab" .. unique_string .. "_head_" .. tab.name,
   11.15            onclick = onclick,
   11.16 @@ -105,7 +105,7 @@
   11.17        local expanded = active or not request.get_json_request_slots() and config.user_tab_mode == "accordeon_all_expanded" and not current_tabs_string
   11.18        ui.container{
   11.19          attr = {
   11.20 -          class = "ui_tabs_accordeon_content",
   11.21 +          class = "ui_tabs_accordeon_content" .. (tab.class and (" " .. tab.class) or ""),
   11.22            style = not expanded and "display: none;" or nil,
   11.23            id = "tab" .. unique_string .. "_content_" .. tab.name
   11.24          },
   11.25 @@ -198,9 +198,9 @@
   11.26                ui.link{
   11.27                  attr = { 
   11.28                    class = (
   11.29 -                    tab.name == current_tab and "selected" or
   11.30 -                    not current_tab and i == 1 and "selected" or
   11.31 -                    ""
   11.32 +                    tab.name == current_tab and "selected" .. (tab.class and (" " .. tab.class) or "") or
   11.33 +                    not current_tab and i == 1 and "selected" .. (tab.class and (" " .. tab.class) or "") or
   11.34 +                    "" .. (tab.class and (" " .. tab.class) or "")
   11.35                    )
   11.36                  },
   11.37                  module  = request.get_module(),
    12.1 --- a/static/style.css	Fri Apr 16 14:51:30 2010 +0200
    12.2 +++ b/static/style.css	Sat Apr 17 21:59:02 2010 +0200
    12.3 @@ -503,7 +503,32 @@
    12.4    font-size: 120%;
    12.5  }
    12.6  
    12.7 +.ui_tabs_links a.yellow {
    12.8 +  background-color: #fec;
    12.9 +  color: #000;
   12.10 +}
   12.11  
   12.12 +.ui_tabs_links a.yellow:hover {
   12.13 +  background-color: #edb;
   12.14 +}
   12.15 +
   12.16 +.ui_tabs_links a.yellow.selected {
   12.17 +  background-color: #654;
   12.18 +  color: #fff;
   12.19 +  text-decoration: none;
   12.20 +  padding: 1ex;
   12.21 +}
   12.22 +
   12.23 +.web20 .ui_tabs_accordeon_head.yellow {
   12.24 +  background-color: #fec;
   12.25 +  border-color: #b96;
   12.26 +  xpadding: 1ex;
   12.27 +  xmargin-bottom: 2ex;
   12.28 +}
   12.29 +
   12.30 +.web20 .ui_tabs_accordeon_content.yellow {
   12.31 +  border-color: #b96;
   12.32 +}
   12.33  
   12.34  /*************************************************************************
   12.35   * ui.filters

Impressum / About Us