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