liquid_feedback_frontend
view app/main/member/_sidebar_whatcanido.lua @ 1045:701a5cf6b067
Imported LiquidFeedback Frontend 3.0 branch
| author | bsw | 
|---|---|
| date | Thu Jul 10 01:19:48 2014 +0200 (2014-07-10) | 
| parents | |
| children | 58f48a8a202a | 
 line source
     1 local member = param.get("member", "table")
     3 ui.sidebar( "tab-whatcanido", function()
     5   if not member.active then
     6     ui.container{ attr = { class = "sidebarSection" }, content = function()
     7       slot.put(" · ")
     8       ui.tag{
     9         attr = { class = "interest deactivated_member_info" },
    10         content = _"This member is inactive"
    11       }
    12     end }   
    13   end
    15   if member.locked then
    16     ui.container{ attr = { class = "sidebarSection" }, content = function()
    17       slot.put(" · ")
    18       ui.tag{
    19         attr = { class = "interest deactivated_member_info" },
    20         content = _"This member is locked"
    21       }
    22     end }   
    23   end
    26   ui.sidebarHeadWhatCanIDo()
    28   if member.id == app.session.member_id and not app.session.needs_delegation_check then
    29     ui.sidebarSection( function()
    30       ui.heading { level = 3, content = _"I want to customize my profile" }
    31       ui.tag{ tag = "ul", attr = { class = "ul" }, content = function()
    32         ui.tag{ tag = "li", content = function()
    33           ui.link{
    34             content = _"edit profile data",
    35             module  = "member",
    36             view    = "edit"
    37           }
    38         end }
    39         ui.tag{ tag = "li", content = function()
    40           ui.link{
    41             content = _"change avatar/photo",
    42             module  = "member",
    43             view    = "edit_images"
    44           }
    45         end }
    46       end }
    47     end )
    48     --[[
    49     ui.sidebarSection( function()
    50       ui.heading { level = 3, content = _"I want to manage my saved contacts" }
    51       ui.tag{ tag = "ul", attr = { class = "ul" }, content = function()
    52         ui.tag{ tag = "li", content = function()
    54           ui.link{
    55             content = _"show saved contacts",
    56             module = 'contact',
    57             view   = 'list'
    58           }
    60         end }
    61       end }
    62     end )
    63     --]]
    65     ui.sidebarSection( function()
    67       ui.heading { level = 3, content = _"I want to change account settings" }
    69       local pages = {}
    71       pages[#pages+1] = { view = "settings_notification", text = _"notification settings" }
    72       if not config.locked_profile_fields.notify_email then
    73         pages[#pages+1] = { view = "settings_email",          text = _"change your notification email address" }
    74       end
    75       if not config.locked_profile_fields.name then
    76         pages[#pages+1] = { view = "settings_name",           text = _"change your screen name" }
    77       end
    78       if not config.locked_profile_fields.login then
    79         pages[#pages+1] = { view = "settings_login",          text = _"change your login" }
    80       end
    81       pages[#pages+1] = { view = "settings_password",       text = _"change your password" }
    82       pages[#pages+1] = { view = "developer_settings",      text = _"developer settings" }
    84       if config.download_dir then
    85         pages[#pages+1] = { module = "index", view = "download",      text = _"database download" }
    86       end
    88       ui.tag{ tag = "ul", attr = { class = "ul" }, content = function()
    89         for i, page in ipairs(pages) do
    90           ui.tag{ tag = "li", content = function()
    91             ui.link{
    92               module = page.module or "member",
    93               view = page.view,
    94               text = page.text
    95             }
    96           end }
    97         end
    98       end }
    99     end )
   101     ui.sidebarSection( function()
   102       ui.heading { level = 3, content = _"I want to logout" }
   103       ui.tag{ tag = "ul", attr = { class = "ul" }, content = function()
   104         ui.tag{ tag = "li", content = function()
   105           ui.link{
   106             text   = _"logout",
   107             module = 'index',
   108             action = 'logout',
   109             routing = {
   110               default = {
   111                 mode = "redirect",
   112                 module = "index",
   113                 view = "index"
   114               }
   115             }
   116           }
   117         end }
   118       end }
   119     end )
   121     ui.sidebarSection( function()
   122       ui.heading { level = 3, content = _"I want to change the interface language" }
   123       ui.tag{ tag = "ul", attr = { class = "ul" }, content = function()
   124         for i, lang in ipairs(config.enabled_languages) do
   126           local langcode
   128           locale.do_with({ lang = lang }, function()
   129             langcode = _("[Name of Language]")
   130           end)
   132           ui.tag{ tag = "li", content = function()
   133             ui.link{
   134               content = _('Select language "#{langcode}"', { langcode = langcode }),
   135               module = "index",
   136               action = "set_lang",
   137               params = { lang = lang },
   138               routing = {
   139                 default = {
   140                   mode = "redirect",
   141                   module = request.get_module(),
   142                   view = request.get_view(),
   143                   id = param.get_id_cgi(),
   144                   params = param.get_all_cgi()
   145                 }
   146               }
   147             }
   148           end }
   149         end
   150       end }
   151     end )
   152   elseif app.session.member_id and not (member.id == app.session.member.id) then
   154     ui.sidebarSection( function ()
   156       local contact = Contact:by_pk(app.session.member.id, member.id)
   157       if not contact then
   158         ui.heading { level = 3, content = _"I want to save this member as contact (i.e. to use as delegatee)" }
   159         ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
   160           ui.tag { tag = "li", content = function ()
   161             ui.link{
   162               text    = _"add to my list of public contacts",
   163               module  = "contact",
   164               action  = "add_member",
   165               id      = member.id,
   166               params = { public = true },
   167               routing = {
   168                 default = {
   169                   mode = "redirect",
   170                   module = request.get_module(),
   171                   view = request.get_view(),
   172                   id = param.get_id_cgi(),
   173                   params = param.get_all_cgi()
   174                 }
   175               }
   176             }
   177           end }
   178           ui.tag { tag = "li", content = function ()
   179             ui.link{
   180               text    = _"add to my list of private contacts",
   181               module  = "contact",
   182               action  = "add_member",
   183               id      = member.id,
   184               routing = {
   185                 default = {
   186                   mode = "redirect",
   187                   module = request.get_module(),
   188                   view = request.get_view(),
   189                   id = param.get_id_cgi(),
   190                   params = param.get_all_cgi()
   191                 }
   192               }
   193             }
   194           end }
   195         end }
   196       elseif contact.public then
   197         ui.heading { level = 3, content = _"You saved this member as contact (i.e. to use as delegatee) and others can see it" }
   198         ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
   199           ui.tag { tag = "li", content = function ()
   200             ui.link{
   201               text   = _"make this contact private",
   202               module = "contact",
   203               action = "add_member",
   204               id     = contact.other_member_id,
   205               params = { public = false },
   206               routing = {
   207                 default = {
   208                   mode = "redirect",
   209                   module = request.get_module(),
   210                   view = request.get_view(),
   211                   id = param.get_id_cgi(),
   212                   params = param.get_all_cgi()
   213                 }
   214               }
   215             }
   216           end }
   217           ui.tag { tag = "li", content = function ()
   218             ui.link{
   219               text   = _"remove from my contact list",
   220               module = "contact",
   221               action = "remove_member",
   222               id     = contact.other_member_id,
   223               routing = {
   224                 default = {
   225                   mode = "redirect",
   226                   module = request.get_module(),
   227                   view = request.get_view(),
   228                   id = param.get_id_cgi(),
   229                   params = param.get_all_cgi()
   230                 }
   231               }
   232             }
   233           end }
   234         end }
   235       else
   236         ui.heading { level = 3, content = _"You saved this member as contact (i.e. to use as delegatee)" }
   237         ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
   238           ui.tag { tag = "li", content = function ()
   239             ui.link{
   240               text   = _"make this contact public",
   241               module = "contact",
   242               action = "add_member",
   243               id     = contact.other_member_id,
   244               params = { public = true },
   245               routing = {
   246                 default = {
   247                   mode = "redirect",
   248                   module = request.get_module(),
   249                   view = request.get_view(),
   250                   id = param.get_id_cgi(),
   251                   params = param.get_all_cgi()
   252                 }
   253               }
   254             }
   255           end }
   256           ui.tag { tag = "li", content = function ()
   257             ui.link{
   258               text   = _"remove from my contact list",
   259               module = "contact",
   260               action = "remove_member",
   261               id     = contact.other_member_id,
   262               routing = {
   263                 default = {
   264                   mode = "redirect",
   265                   module = request.get_module(),
   266                   view = request.get_view(),
   267                   id = param.get_id_cgi(),
   268                   params = param.get_all_cgi()
   269                 }
   270               }
   271             }
   272           end }
   273         end }
   274       end
   275     end )
   277     ui.sidebarSection( function()
   278       local ignored_member = IgnoredMember:by_pk(app.session.member.id, member.id)
   279       if not ignored_member then
   280         ui.heading { level = 3, content = _"I do not like to hear from this member" }
   281         ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
   282           ui.tag { tag = "li", content = function ()
   283             ui.link{
   284               attr = { class = "interest" },
   285               text    = _"block this member",
   286               module  = "member",
   287               action  = "update_ignore_member",
   288               id      = member.id,
   289               routing = {
   290                 default = {
   291                   mode = "redirect",
   292                   module = request.get_module(),
   293                   view = request.get_view(),
   294                   id = param.get_id_cgi(),
   295                   params = param.get_all_cgi()
   296                 }
   297               }
   298             }
   299           end }
   300         end }
   301       else
   302         ui.heading { level = 3, content = _"You blocked this member (i.e. you will not be notified about this members actions)" }
   303         ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
   304           ui.tag { tag = "li", content = function ()
   305             ui.link{
   306               text   = _"unblock member",
   307               module = "member",
   308               action = "update_ignore_member",
   309               id     = member.id,
   310               params = { delete = true },
   311               routing = {
   312                 default = {
   313                   mode = "redirect",
   314                   module = request.get_module(),
   315                   view = request.get_view(),
   316                   id = param.get_id_cgi(),
   317                   params = param.get_all_cgi()
   318                 }
   319               }
   320             }
   321           end }
   322         end }
   323       end
   324     end )
   325   end
   326 end )
