liquid_feedback_frontend
view app/main/member/_sidebar_whatcanido.lua @ 1199:6b1f01c31092
Updated host config for Moonbridge 1.0
| author | bsw | 
|---|---|
| date | Tue Jun 23 19:48:56 2015 +0200 (2015-06-23) | 
| parents | 904f6807f7fa | 
| children | 554b739f86d6 | 
 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 util.is_profile_field_locked(app.session.member, "notify_email") then
    73         pages[#pages+1] = { view = "settings_email",          text = _"change your notification email address" }
    74       end
    75       if not util.is_profile_field_locked(app.session.member, "name") then
    76         pages[#pages+1] = { view = "settings_name",           text = _"change your screen name" }
    77       end
    78       if not util.is_profile_field_locked(app.session.member, "login") then
    79         pages[#pages+1] = { view = "settings_login",          text = _"change your login" }
    80       end
    81       if not util.is_profile_field_locked(app.session.member, "password") then
    82         pages[#pages+1] = { view = "settings_password",       text = _"change your password" }
    83       end
    84       pages[#pages+1] = { view = "developer_settings",      text = _"developer settings" }
    86       if config.download_dir then
    87         pages[#pages+1] = { module = "index", view = "download",      text = _"database download" }
    88       end
    90       ui.tag{ tag = "ul", attr = { class = "ul" }, content = function()
    91         for i, page in ipairs(pages) do
    92           ui.tag{ tag = "li", content = function()
    93             ui.link{
    94               module = page.module or "member",
    95               view = page.view,
    96               text = page.text
    97             }
    98           end }
    99         end
   100       end }
   101     end )
   103     ui.sidebarSection( function()
   104       ui.heading { level = 3, content = _"I want to logout" }
   105       ui.tag{ tag = "ul", attr = { class = "ul" }, content = function()
   106         ui.tag{ tag = "li", content = function()
   107           ui.link{
   108             text   = _"logout",
   109             module = 'index',
   110             action = 'logout',
   111             routing = {
   112               default = {
   113                 mode = "redirect",
   114                 module = "index",
   115                 view = "index"
   116               }
   117             }
   118           }
   119         end }
   120       end }
   121     end )
   123     ui.sidebarSection( function()
   124       ui.heading { level = 3, content = _"I want to change the interface language" }
   125       ui.tag{ tag = "ul", attr = { class = "ul" }, content = function()
   126         for i, lang in ipairs(config.enabled_languages) do
   128           local langcode
   130           locale.do_with({ lang = lang }, function()
   131             langcode = _("[Name of Language]")
   132           end)
   134           ui.tag{ tag = "li", content = function()
   135             ui.link{
   136               content = _('Select language "#{langcode}"', { langcode = langcode }),
   137               module = "index",
   138               action = "set_lang",
   139               params = { lang = lang },
   140               routing = {
   141                 default = {
   142                   mode = "redirect",
   143                   module = request.get_module(),
   144                   view = request.get_view(),
   145                   id = request.get_id_string(),
   146                   params = request.get_param_strings()
   147                 }
   148               }
   149             }
   150           end }
   151         end
   152       end }
   153     end )
   154   elseif app.session.member_id and not (member.id == app.session.member.id) then
   156     ui.sidebarSection( function ()
   158       local contact = Contact:by_pk(app.session.member.id, member.id)
   159       if not contact then
   160         ui.heading { level = 3, content = _"I want to save this member as contact (i.e. to use as delegatee)" }
   161         ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
   162           ui.tag { tag = "li", content = function ()
   163             ui.link{
   164               text    = _"add to my list of public contacts",
   165               module  = "contact",
   166               action  = "add_member",
   167               id      = member.id,
   168               params = { public = true },
   169               routing = {
   170                 default = {
   171                   mode = "redirect",
   172                   module = request.get_module(),
   173                   view = request.get_view(),
   174                   id = request.get_id_string(),
   175                   params = request.get_param_strings()
   176                 }
   177               }
   178             }
   179           end }
   180           ui.tag { tag = "li", content = function ()
   181             ui.link{
   182               text    = _"add to my list of private contacts",
   183               module  = "contact",
   184               action  = "add_member",
   185               id      = member.id,
   186               routing = {
   187                 default = {
   188                   mode = "redirect",
   189                   module = request.get_module(),
   190                   view = request.get_view(),
   191                   id = request.get_id_string(),
   192                   params = request.get_param_strings()
   193                 }
   194               }
   195             }
   196           end }
   197         end }
   198       elseif contact.public then
   199         ui.heading { level = 3, content = _"You saved this member as contact (i.e. to use as delegatee) and others can see it" }
   200         ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
   201           ui.tag { tag = "li", content = function ()
   202             ui.link{
   203               text   = _"make this contact private",
   204               module = "contact",
   205               action = "add_member",
   206               id     = contact.other_member_id,
   207               params = { public = false },
   208               routing = {
   209                 default = {
   210                   mode = "redirect",
   211                   module = request.get_module(),
   212                   view = request.get_view(),
   213                   id = request.get_id_string(),
   214                   params = request.get_param_strings()
   215                 }
   216               }
   217             }
   218           end }
   219           ui.tag { tag = "li", content = function ()
   220             ui.link{
   221               text   = _"remove from my contact list",
   222               module = "contact",
   223               action = "remove_member",
   224               id     = contact.other_member_id,
   225               routing = {
   226                 default = {
   227                   mode = "redirect",
   228                   module = request.get_module(),
   229                   view = request.get_view(),
   230                   id = request.get_id_string(),
   231                   params = request.get_param_strings()
   232                 }
   233               }
   234             }
   235           end }
   236         end }
   237       else
   238         ui.heading { level = 3, content = _"You saved this member as contact (i.e. to use as delegatee)" }
   239         ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
   240           ui.tag { tag = "li", content = function ()
   241             ui.link{
   242               text   = _"make this contact public",
   243               module = "contact",
   244               action = "add_member",
   245               id     = contact.other_member_id,
   246               params = { public = true },
   247               routing = {
   248                 default = {
   249                   mode = "redirect",
   250                   module = request.get_module(),
   251                   view = request.get_view(),
   252                   id = request.get_id_string(),
   253                   params = request.get_param_strings()
   254                 }
   255               }
   256             }
   257           end }
   258           ui.tag { tag = "li", content = function ()
   259             ui.link{
   260               text   = _"remove from my contact list",
   261               module = "contact",
   262               action = "remove_member",
   263               id     = contact.other_member_id,
   264               routing = {
   265                 default = {
   266                   mode = "redirect",
   267                   module = request.get_module(),
   268                   view = request.get_view(),
   269                   id = request.get_id_string(),
   270                   params = request.get_param_strings()
   271                 }
   272               }
   273             }
   274           end }
   275         end }
   276       end
   277     end )
   279     ui.sidebarSection( function()
   280       local ignored_member = IgnoredMember:by_pk(app.session.member.id, member.id)
   281       if not ignored_member then
   282         ui.heading { level = 3, content = _"I do not like to hear from this member" }
   283         ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
   284           ui.tag { tag = "li", content = function ()
   285             ui.link{
   286               attr = { class = "interest" },
   287               text    = _"block this member",
   288               module  = "member",
   289               action  = "update_ignore_member",
   290               id      = member.id,
   291               routing = {
   292                 default = {
   293                   mode = "redirect",
   294                   module = request.get_module(),
   295                   view = request.get_view(),
   296                   id = request.get_id_string(),
   297                   params = request.get_param_strings()
   298                 }
   299               }
   300             }
   301           end }
   302         end }
   303       else
   304         ui.heading { level = 3, content = _"You blocked this member (i.e. you will not be notified about this members actions)" }
   305         ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
   306           ui.tag { tag = "li", content = function ()
   307             ui.link{
   308               text   = _"unblock member",
   309               module = "member",
   310               action = "update_ignore_member",
   311               id     = member.id,
   312               params = { delete = true },
   313               routing = {
   314                 default = {
   315                   mode = "redirect",
   316                   module = request.get_module(),
   317                   view = request.get_view(),
   318                   id = request.get_id_string(),
   319                   params = request.get_param_strings()
   320                 }
   321               }
   322             }
   323           end }
   324         end }
   325       end
   326     end )
   327   end
   328 end )
