liquid_feedback_frontend
view app/main/index/index.lua @ 742:b8b205e65c6d
Optical enhancements
| author | bsw | 
|---|---|
| date | Thu Jun 28 22:26:26 2012 +0200 (2012-06-28) | 
| parents | ae14bf355868 | 
| children | ea2449916c12 | 
 line source
     1 if app.session.member_id then
     2   util.help("index.index", _"Home")
     4   execute.view{
     5     module = "index", view = "_index_member"
     6   }
     8 elseif config.public_access then
     9   if config.motd_public then
    10     local help_text = config.motd_public
    11     ui.container{
    12       attr = { class = "wiki motd" },
    13       content = function()
    14         slot.put(format.wiki_text(help_text))
    15       end
    16     }
    17   end
    19   local open_issues_selector = Issue:new_selector()
    20     :add_where("issue.closed ISNULL")
    21     :add_order_by("coalesce(issue.fully_frozen + issue.voting_time, issue.half_frozen + issue.verification_time, issue.accepted + issue.discussion_time, issue.created + issue.admission_time) - now()")
    23   local closed_issues_selector = Issue:new_selector()
    24     :add_where("issue.closed NOTNULL")
    25     :add_order_by("issue.closed DESC")
    28   local tabs = {
    29     module = "index",
    30     view = "index"
    31   }
    33   tabs[#tabs+1] = {
    34     name = "units",
    35     label = _"Units",
    36     module = "unit",
    37     view = "_list"
    38   }
    40   tabs[#tabs+1] = {
    41     name = "timeline",
    42     label = _"Latest events",
    43     module = "event",
    44     view = "_list",
    45     params = { global = true }
    46   }
    48   tabs[#tabs+1] = {
    49     name = "open",
    50     label = _"Open issues",
    51     module = "issue",
    52     view = "_list",
    53     params = {
    54       for_state = "open",
    55       issues_selector = open_issues_selector
    56     }
    57   }
    58   tabs[#tabs+1] = {
    59     name = "closed",
    60     label = _"Closed issues",
    61     module = "issue",
    62     view = "_list",
    63     params = {
    64       for_state = "closed",
    65       issues_selector = closed_issues_selector
    66     }
    67   }
    68   ui.tabs(tabs)
    70 else
    72   if config.motd_public then
    73     local help_text = config.motd_public
    74     ui.container{
    75       attr = { class = "wiki motd" },
    76       content = function()
    77         slot.put(format.wiki_text(help_text))
    78       end
    79     }
    80   end
    82   ui.tag{ tag = "p", content = _"Closed user group, please login to participate." }
    84   ui.form{
    85   attr = { class = "login" },
    86   module = 'index',
    87   action = 'login',
    88   routing = {
    89     ok = {
    90       mode   = 'redirect',
    91       module = param.get("redirect_module") or "index",
    92       view = param.get("redirect_view") or "index",
    93       id = param.get("redirect_id"),
    94     },
    95     error = {
    96       mode   = 'forward',
    97       module = 'index',
    98       view   = 'login',
    99     }
   100   },
   101   content = function()
   102     ui.field.text{
   103       attr = { id = "username_field" },
   104       label     = _'login name',
   105       html_name = 'login',
   106       value     = ''
   107     }
   108     ui.script{ script = 'document.getElementById("username_field").focus();' }
   109     ui.field.password{
   110       label     = _'Password',
   111       html_name = 'password',
   112       value     = ''
   113     }
   114     ui.submit{
   115       text = _'Login'
   116     }
   117   end
   118 }
   120 end
