liquid_feedback_frontend

diff app/main/member/show.lua @ 564:418b590fa9ed

Optical enhancements, cleanup
author bsw
date Tue Jun 19 22:44:18 2012 +0200 (2012-06-19)
parents 5ca9de94cb13
children 2ad52d0067eb
line diff
     1.1 --- a/app/main/member/show.lua	Tue Jun 19 22:39:57 2012 +0200
     1.2 +++ b/app/main/member/show.lua	Tue Jun 19 22:44:18 2012 +0200
     1.3 @@ -7,50 +7,99 @@
     1.4  app.html_title.title = member.name
     1.5  app.html_title.subtitle = _("Member")
     1.6  
     1.7 -slot.select("title", function()
     1.8 -  execute.view{
     1.9 -    module = "member_image",
    1.10 -    view = "_show",
    1.11 -    params = {
    1.12 -      member = member,
    1.13 -      image_type = "avatar"
    1.14 -    }
    1.15 -  }
    1.16 -end)
    1.17 -
    1.18 -slot.put_into("title", encode.html(_"Member '#{member}'":gsub("#{member}", member.name)))
    1.19 -
    1.20 -slot.select("actions", function()
    1.21 -  ui.link{
    1.22 -    content = function()
    1.23 -      slot.put(encode.html(_"Show member history"))
    1.24 -    end,
    1.25 -    module  = "member",
    1.26 -    view    = "history",
    1.27 -    id      = member.id
    1.28 +slot.select("head", function()
    1.29 +  ui.container{
    1.30 +    attr = { class = "title" },
    1.31 +    content = _("Member '#{member}'", { member =  member.name })
    1.32    }
    1.33 -  if not member.active then
    1.34 -    ui.tag{
    1.35 -      tag = "div",
    1.36 -      attr = { class = "interest deactivated_member_info" },
    1.37 -      content = _"This member is deactivated."
    1.38 +
    1.39 +  ui.container{ attr = { class = "actions" }, content = function()
    1.40 +
    1.41 +    if member.id == app.session.member_id then
    1.42 +      ui.link{
    1.43 +        content = function()
    1.44 +          slot.put(encode.html(_"Edit profile"))
    1.45 +        end,
    1.46 +        module  = "member",
    1.47 +        view    = "edit"
    1.48 +      }
    1.49 +      slot.put(" · ")
    1.50 +      ui.link{
    1.51 +        content = function()
    1.52 +          slot.put(encode.html(_"Upload avatar/photo"))
    1.53 +        end,
    1.54 +        module  = "member",
    1.55 +        view    = "edit_images"
    1.56 +      }
    1.57 +      slot.put(" · ")
    1.58 +    end
    1.59 +    ui.link{
    1.60 +      content = function()
    1.61 +        slot.put(encode.html(_"Show member history"))
    1.62 +      end,
    1.63 +      module  = "member",
    1.64 +      view    = "history",
    1.65 +      id      = member.id
    1.66      }
    1.67 -    slot.put(" ")
    1.68 -  end
    1.69 -  if not (member.id == app.session.member.id) then
    1.70 +    if not member.active then
    1.71 +      slot.put(" · ")
    1.72 +      ui.tag{
    1.73 +        attr = { class = "interest deactivated_member_info" },
    1.74 +        content = _"This member is deactivated."
    1.75 +      }
    1.76 +    end
    1.77 +    if not (member.id == app.session.member.id) then
    1.78 +      slot.put(" · ")
    1.79 +      --TODO performance
    1.80 +      local contact = Contact:by_pk(app.session.member.id, member.id)
    1.81 +      if contact then
    1.82 +        ui.link{
    1.83 +          text   = _"Remove from contacts",
    1.84 +          module = "contact",
    1.85 +          action = "remove_member",
    1.86 +          id     = contact.other_member_id,
    1.87 +          routing = {
    1.88 +            default = {
    1.89 +              mode = "redirect",
    1.90 +              module = request.get_module(),
    1.91 +              view = request.get_view(),
    1.92 +              id = param.get_id_cgi(),
    1.93 +              params = param.get_all_cgi()
    1.94 +            }
    1.95 +          }
    1.96 +        }
    1.97 +      elseif member.activated then
    1.98 +        ui.link{
    1.99 +          text    = _"Add to my contacts",
   1.100 +          module  = "contact",
   1.101 +          action  = "add_member",
   1.102 +          id      = member.id,
   1.103 +          routing = {
   1.104 +            default = {
   1.105 +              mode = "redirect",
   1.106 +              module = request.get_module(),
   1.107 +              view = request.get_view(),
   1.108 +              id = param.get_id_cgi(),
   1.109 +              params = param.get_all_cgi()
   1.110 +            }
   1.111 +          }
   1.112 +        }
   1.113 +      end
   1.114 +    end
   1.115 +    local ignored_member = IgnoredMember:by_pk(app.session.member.id, member.id)
   1.116      slot.put(" · ")
   1.117 -    --TODO performance
   1.118 -    local contact = Contact:by_pk(app.session.member.id, member.id)
   1.119 -    if contact then
   1.120 -      ui.container{
   1.121 +    if ignored_member then
   1.122 +      ui.tag{
   1.123          attr = { class = "interest" },
   1.124 -        content = _"You have saved this member as contact."
   1.125 +        content = _"You have ignored this member"
   1.126        }
   1.127 +      slot.put(" · ")
   1.128        ui.link{
   1.129 -        text   = _"Remove from contacts",
   1.130 -        module = "contact",
   1.131 -        action = "remove_member",
   1.132 -        id     = contact.other_member_id,
   1.133 +        text   = _"Stop ignoring member",
   1.134 +        module = "member",
   1.135 +        action = "update_ignore_member",
   1.136 +        id     = member.id,
   1.137 +        params = { delete = true },
   1.138          routing = {
   1.139            default = {
   1.140              mode = "redirect",
   1.141 @@ -63,9 +112,10 @@
   1.142        }
   1.143      elseif member.activated then
   1.144        ui.link{
   1.145 -        text    = _"Add to my contacts",
   1.146 -        module  = "contact",
   1.147 -        action  = "add_member",
   1.148 +        attr = { class = "interest" },
   1.149 +        text    = _"Ignore member",
   1.150 +        module  = "member",
   1.151 +        action  = "update_ignore_member",
   1.152          id      = member.id,
   1.153          routing = {
   1.154            default = {
   1.155 @@ -78,49 +128,7 @@
   1.156          }
   1.157        }
   1.158      end
   1.159 -  end
   1.160 -  local ignored_member = IgnoredMember:by_pk(app.session.member.id, member.id)
   1.161 -  slot.put(" · ")
   1.162 -  if ignored_member then
   1.163 -    ui.container{
   1.164 -      attr = { class = "interest" },
   1.165 -      content = _"You have ignored this member"
   1.166 -    }
   1.167 -    slot.put(" · ")
   1.168 -    ui.link{
   1.169 -      text   = _"Stop ignoring member",
   1.170 -      module = "member",
   1.171 -      action = "update_ignore_member",
   1.172 -      id     = member.id,
   1.173 -      params = { delete = true },
   1.174 -      routing = {
   1.175 -        default = {
   1.176 -          mode = "redirect",
   1.177 -          module = request.get_module(),
   1.178 -          view = request.get_view(),
   1.179 -          id = param.get_id_cgi(),
   1.180 -          params = param.get_all_cgi()
   1.181 -        }
   1.182 -      }
   1.183 -    }
   1.184 -  elseif member.activated then
   1.185 -    ui.link{
   1.186 -      attr = { class = "interest" },
   1.187 -      text    = _"Ignore member",
   1.188 -      module  = "member",
   1.189 -      action  = "update_ignore_member",
   1.190 -      id      = member.id,
   1.191 -      routing = {
   1.192 -        default = {
   1.193 -          mode = "redirect",
   1.194 -          module = request.get_module(),
   1.195 -          view = request.get_view(),
   1.196 -          id = param.get_id_cgi(),
   1.197 -          params = param.get_all_cgi()
   1.198 -        }
   1.199 -      }
   1.200 -    }
   1.201 -  end
   1.202 +  end }
   1.203  end)
   1.204  
   1.205  util.help("member.show", _"Member page")

Impressum / About Us