liquid_feedback_frontend

changeset 375:89d32158bfd5

Show unit delegatee on member area list, optical enhancements on member area list
author bsw
date Sun Mar 04 14:18:41 2012 +0100 (2012-03-04)
parents 178136e66341
children e957acdc4ba2
files app/main/area/_list.lua app/main/initiative/_list_element.lua app/main/member/_area_list.lua static/style.css
line diff
     1.1 --- a/app/main/area/_list.lua	Sat Mar 03 17:30:16 2012 +0100
     1.2 +++ b/app/main/area/_list.lua	Sun Mar 04 14:18:41 2012 +0100
     1.3 @@ -1,4 +1,5 @@
     1.4  local areas_selector = param.get("areas_selector", "table")
     1.5 +local hide_membership = param.get("hide_membership", atom.boolean)
     1.6  
     1.7  areas_selector
     1.8    :reset_fields()
     1.9 @@ -35,35 +36,22 @@
    1.10  
    1.11      ui.container{ attr = { class = "area" }, content = function()
    1.12  
    1.13 -      ui.container{ attr = { class = "info" }, content = function()
    1.14 -
    1.15 -        ui.container{ attr = { class = "bar" }, content = function()
    1.16 -          if area.member_weight and area.direct_member_count then
    1.17 -            local max_value = MemberCount:get()
    1.18 -            ui.bargraph{
    1.19 -              max_value = max_value,
    1.20 -              width = 100,
    1.21 -              bars = {
    1.22 -                { color = "#444", value = area.direct_member_count },
    1.23 -                { color = "#777", value = area.member_weight - area.direct_member_count },
    1.24 -                { color = "#ddd", value = max_value - area.member_weight },
    1.25 -              }
    1.26 +      ui.container{ attr = { class = "bar" }, content = function()
    1.27 +        if area.member_weight and area.direct_member_count then
    1.28 +          local max_value = MemberCount:get()
    1.29 +          ui.bargraph{
    1.30 +            max_value = max_value,
    1.31 +            width = 100,
    1.32 +            bars = {
    1.33 +              { color = "#444", value = area.direct_member_count },
    1.34 +              { color = "#777", value = area.member_weight - area.direct_member_count },
    1.35 +              { color = "#ddd", value = max_value - area.member_weight },
    1.36              }
    1.37 -          end
    1.38 -        end }
    1.39 +          }
    1.40 +        end
    1.41 +      end }
    1.42  
    1.43 -        ui.container{ attr = { class = "name" }, content = function()
    1.44 -            ui.link{
    1.45 -              text = area.name,
    1.46 -              module = "area",
    1.47 -              view = "show",
    1.48 -              id = area.id
    1.49 -            }
    1.50 -            slot.put(" ")
    1.51 -            ui.tag{ content = "" }
    1.52 -          end
    1.53 -        }
    1.54 -        
    1.55 +      if not hide_membership then
    1.56          ui.container{ attr = { class = "membership" }, content = function()
    1.57            if area.is_member then
    1.58              local text = _"Member of area"
    1.59 @@ -75,31 +63,41 @@
    1.60              slot.put('<img src="null.png" width="16" height="1" />')
    1.61            end
    1.62          end }
    1.63 -          
    1.64 -        ui.container{ attr = { class = "delegatee" }, content = function()
    1.65 -          if area.trustee_member_id then
    1.66 -            local trustee_member = Member:by_id(area.trustee_member_id)
    1.67 -            local text = _("Area delegated to '#{name}'", { name = area.trustee_member_name })
    1.68 -            local text = _"delegated to"
    1.69 -            ui.image{
    1.70 -              attr = { class = "delegation_arrow", alt = text, title = text },
    1.71 -              static = "delegation_arrow_24_horizontal.png"
    1.72 +      end
    1.73 +
    1.74 +      ui.container{ attr = { class = "delegatee" }, content = function()
    1.75 +        if area.trustee_member_id then
    1.76 +          local trustee_member = Member:by_id(area.trustee_member_id)
    1.77 +          local text = _("Area delegated to '#{name}'", { name = area.trustee_member_name })
    1.78 +          ui.image{
    1.79 +            attr = { class = "delegation_arrow", alt = text, title = text },
    1.80 +            static = "delegation_arrow_24_horizontal.png"
    1.81 +          }
    1.82 +          execute.view{
    1.83 +            module = "member_image",
    1.84 +            view = "_show",
    1.85 +            params = {
    1.86 +              member = trustee_member,
    1.87 +              image_type = "avatar",
    1.88 +              show_dummy = true,
    1.89 +              class = "micro_avatar",
    1.90 +              popup_text = text
    1.91              }
    1.92 -            execute.view{
    1.93 -              module = "member_image",
    1.94 -              view = "_show",
    1.95 -              params = {
    1.96 -                member = trustee_member,
    1.97 -                image_type = "avatar",
    1.98 -                show_dummy = true,
    1.99 -                class = "micro_avatar",
   1.100 -                popup_text = text
   1.101 -              }
   1.102 -            }
   1.103 -          else
   1.104 -            slot.put('<img src="null.png" width="24" height="1" />')
   1.105 -          end
   1.106 -        end }
   1.107 +          }
   1.108 +        else
   1.109 +          slot.put('<img src="null.png" width="41" height="1" />')
   1.110 +        end
   1.111 +      end }
   1.112 +  
   1.113 +      ui.container{ attr = { class = "name" }, content = function()
   1.114 +        ui.link{
   1.115 +          text = area.name,
   1.116 +          module = "area",
   1.117 +          view = "show",
   1.118 +          id = area.id
   1.119 +        }
   1.120 +        slot.put(" ")
   1.121 +        ui.tag{ content = "" }
   1.122        end }
   1.123  
   1.124        ui.container{ attr = { class = "phases" }, content = function()
   1.125 @@ -166,7 +164,7 @@
   1.126  
   1.127        end }
   1.128        
   1.129 -      slot.put("<br /")
   1.130 +      slot.put("<br />")
   1.131      end }
   1.132      
   1.133    end
     2.1 --- a/app/main/initiative/_list_element.lua	Sat Mar 03 17:30:16 2012 +0100
     2.2 +++ b/app/main/initiative/_list_element.lua	Sun Mar 04 14:18:41 2012 +0100
     2.3 @@ -10,7 +10,7 @@
     2.4      then 
     2.5        ui.field.rank{ attr = { class = "rank" }, value = initiative.rank, eligible = initiative.eligible }
     2.6      else
     2.7 -      slot.put('<img src="null.png" width="28" height="1" />')
     2.8 +      ui.image{ static = "icons/16/script.png" }
     2.9      end
    2.10    end }
    2.11  
     3.1 --- a/app/main/member/_area_list.lua	Sat Mar 03 17:30:16 2012 +0100
     3.2 +++ b/app/main/member/_area_list.lua	Sun Mar 04 14:18:41 2012 +0100
     3.3 @@ -1,37 +1,59 @@
     3.4  local units = app.session.member.units_with_voting_right
     3.5  local member = param.get("member", "table")
     3.6  for i, unit in ipairs(units) do
     3.7 +  local trustee_member = Member:new_selector()
     3.8 +    :join("delegation", nil, { "delegation.unit_id = ? AND delegation.truster_id = ?", unit.id, member.id })
     3.9 +    :optional_object_mode()
    3.10 +    :exec()
    3.11 +  
    3.12    local areas_selector = Area:new_selector()
    3.13      :join("membership", nil, { "membership.area_id = area.id AND membership.member_id = ?", member.id })
    3.14      :add_where{ "area.unit_id = ?", unit.id }
    3.15      :add_order_by("area.member_weight DESC")
    3.16    
    3.17    local area_count = areas_selector:count()
    3.18 -  local class = "heading"
    3.19 -  if area_count > 0 then
    3.20 -    class = class .. " member_area_list"
    3.21 -  end
    3.22 -  ui.link{
    3.23 -    attr = { class = class },
    3.24 -    text = unit.name,
    3.25 -    module = "unit", view = "show", id = unit.id
    3.26 -  }
    3.27 +  
    3.28 +  ui.container{ attr = { class = "member_area_list" }, content = function()
    3.29 +    ui.container{ attr = { class = "unit_head" }, content = function()
    3.30 +      ui.link{
    3.31 +        text = unit.name,
    3.32 +        module = "unit", view = "show", id = unit.id
    3.33 +      }
    3.34  
    3.35 -  if area_count > 0 then
    3.36 -    execute.view{
    3.37 -      module = "area", view = "_list",
    3.38 -      params = { areas_selector = areas_selector }
    3.39 -    }
    3.40 -  else
    3.41 -    ui.tag{ content = _"You have voting privileges for this unit, but you are not member of any of its areas." }
    3.42 -    slot.put(" ")
    3.43 -    ui.link{
    3.44 -      text = _"Show all areas of this unit",
    3.45 -      module = "unit", view = "show", id = unit.id
    3.46 -    }
    3.47 -   end
    3.48 -  slot.put("<br />")
    3.49 -  slot.put("<br />")
    3.50 +      if trustee_member then
    3.51 +        local text = _("Unit delegated to '#{name}'", { name = trustee_member.name })
    3.52 +        ui.image{
    3.53 +          attr = { class = "delegation_arrow", alt = text, title = text },
    3.54 +          static = "delegation_arrow_24_horizontal.png"
    3.55 +        }
    3.56 +        execute.view{
    3.57 +          module = "member_image",
    3.58 +          view = "_show",
    3.59 +          params = {
    3.60 +            member = trustee_member,
    3.61 +            image_type = "avatar",
    3.62 +            show_dummy = true,
    3.63 +            class = "micro_avatar",
    3.64 +            popup_text = text
    3.65 +          }
    3.66 +        }
    3.67 +      end
    3.68 +    end }
    3.69 +
    3.70 +    if area_count > 0 then
    3.71 +      execute.view{
    3.72 +        module = "area", view = "_list",
    3.73 +        params = { areas_selector = areas_selector, hide_membership = true }
    3.74 +      }
    3.75 +    else
    3.76 +      ui.tag{ content = _"You have voting privileges for this unit, but you are not member of any of its areas." }
    3.77 +      slot.put(" ")
    3.78 +      ui.link{
    3.79 +        text = _"Show all areas of this unit",
    3.80 +        module = "unit", view = "show", id = unit.id
    3.81 +      }
    3.82 +    end
    3.83 +  end }
    3.84    
    3.85  end
    3.86  
     4.1 --- a/static/style.css	Sat Mar 03 17:30:16 2012 +0100
     4.2 +++ b/static/style.css	Sun Mar 04 14:18:41 2012 +0100
     4.3 @@ -842,22 +842,29 @@
     4.4   * Area list
     4.5   */
     4.6  
     4.7 -.area_list {
     4.8 +.member_area_list {
     4.9 +  margin-bottom: 2ex;
    4.10 +}
    4.11 +
    4.12 +.member_area_list .unit_head {
    4.13 +  font-size: 120%;
    4.14 +  font-weight: bold;
    4.15 +  line-height: 200%;
    4.16 +}
    4.17 +
    4.18 +.member_area_list .unit_delegatee {
    4.19 +  float: left;
    4.20  }
    4.21  
    4.22  .area_list .area {
    4.23    line-height: 28px;
    4.24 +  clear: both;
    4.25  }
    4.26  
    4.27  .area_list .area img {
    4.28    vertical-align: middle;
    4.29  }
    4.30  
    4.31 -.area_list .area .info {
    4.32 -  float: left;
    4.33 -  clear: both;
    4.34 -}
    4.35 -
    4.36  .area_list .area .bar {
    4.37    float: left;
    4.38    padding-top: 6px
    4.39 @@ -874,20 +881,9 @@
    4.40    font-weight: bold;
    4.41  }
    4.42  
    4.43 -@media screen and (max-width: 480px) {
    4.44 -  .area_list .area .name {
    4.45 -    clear: left;
    4.46 -    display: block;
    4.47 -    float: left;
    4.48 -    margin-left: 0px;
    4.49 -  }
    4.50 -  .area_list .area .phases {
    4.51 -    margin-bottom: 2ex;
    4.52 -  }
    4.53 -}
    4.54 -
    4.55  .area_list .area .phases {
    4.56    float: right;
    4.57 +  margin-bottom: 2ex;
    4.58  }
    4.59  
    4.60  .area_list .area .phases div {
    4.61 @@ -896,6 +892,18 @@
    4.62    text-align: right;
    4.63  }
    4.64  
    4.65 +@media screen and (max-width: 480px) {
    4.66 +  .area_list .area .name {
    4.67 +    xdisplay: block;
    4.68 +    xfloat: left;
    4.69 +  }
    4.70 +  .area_list .area .bar,
    4.71 +  .area_list .area .membership,
    4.72 +  .area_list .area .delegatee {
    4.73 +    display: none;
    4.74 +  }
    4.75 +}
    4.76 +
    4.77  /*************************************************************************
    4.78   * Issues
    4.79   */

Impressum / About Us