liquid_feedback_frontend
view app/main/index/index.lua @ 397:6cfdb2e5d3d4
Force render of members statement after it got changed
| author | bsw | 
|---|---|
| date | Wed Mar 07 12:29:15 2012 +0100 (2012-03-07) | 
| parents | 9109900edad6 | 
| children | 699b9fa7bc36 | 
 line source
     1 slot.select("title", function()
     2   if app.session.member then
     3     execute.view{
     4       module = "member_image",
     5       view = "_show",
     6       params = {
     7         member = app.session.member,
     8         image_type = "avatar"
     9       }
    10     }
    11   end
    12 end)
    14 slot.select("title", function()
    15   ui.container{
    16     attr = { class = "lang_chooser" },
    17     content = function()
    18       for i, lang in ipairs{"en", "de", "eo"} do
    19         ui.link{
    20           content = function()
    21             ui.image{
    22               static = "lang/" .. lang .. ".png",
    23               attr = { style = "margin-left: 0.5em;", alt = lang }
    24             }
    25           end,
    26           text = _('Select language "#{langcode}"', { langcode = lang }),
    27           module = "index",
    28           action = "set_lang",
    29           params = { lang = lang },
    30           routing = {
    31             default = {
    32               mode = "redirect",
    33               module = request.get_module(),
    34               view = request.get_view(),
    35               id = param.get_id_cgi(),
    36               params = param.get_all_cgi()
    37             }
    38           }
    39         }
    40       end
    41     end
    42   }
    43 end)
    45 slot.put_into("title", encode.html(config.app_title))
    47 if app.session.member_id then
    48   util.help("index.index", _"Home")
    50   execute.view{
    51     module = "member",
    52     view = "_show",
    53     params = {
    54       member = app.session.member,
    55       show_as_homepage = true
    56     }
    57   }
    59 elseif config.public_access then
    60   if config.motd_public then
    61     local help_text = config.motd_public
    62     ui.container{
    63       attr = { class = "wiki motd" },
    64       content = function()
    65         slot.put(format.wiki_text(help_text))
    66       end
    67     }
    68   end
    70   execute.view{ module = "unit", view = "_list" }
    72 else
    74   if config.motd_public then
    75     local help_text = config.motd_public
    76     ui.container{
    77       attr = { class = "wiki motd" },
    78       content = function()
    79         slot.put(format.wiki_text(help_text))
    80       end
    81     }
    82   end
    84   ui.tag{ tag = "p", content = _"Closed user group, please login to participate." }
    86   ui.form{
    87   attr = { class = "login" },
    88   module = 'index',
    89   action = 'login',
    90   routing = {
    91     ok = {
    92       mode   = 'redirect',
    93       module = param.get("redirect_module") or "index",
    94       view = param.get("redirect_view") or "index",
    95       id = param.get("redirect_id"),
    96     },
    97     error = {
    98       mode   = 'forward',
    99       module = 'index',
   100       view   = 'login',
   101     }
   102   },
   103   content = function()
   104     ui.field.text{
   105       attr = { id = "username_field" },
   106       label     = _'login name',
   107       html_name = 'login',
   108       value     = ''
   109     }
   110     ui.script{ script = 'document.getElementById("username_field").focus();' }
   111     ui.field.password{
   112       label     = _'Password',
   113       html_name = 'password',
   114       value     = ''
   115     }
   116     ui.submit{
   117       text = _'Login'
   118     }
   119   end
   120 }
   122 end
