liquid_feedback_frontend
view app/main/index/index.lua @ 529:5ca9de94cb13
Delegation preview when setting delegation, optical enhancements, typos fixed
| author | bsw | 
|---|---|
| date | Sun May 20 19:43:01 2012 +0200 (2012-05-20) | 
| parents | 63d6549cc00b | 
| children | 3e4f6534bb15 | 
 line source
     1 if app.session.member_id then
     2   util.help("index.index", _"Home")
     4   execute.view{
     5     module = "member",
     6     view = "_show",
     7     params = {
     8       member = app.session.member,
     9       show_as_homepage = true
    10     }
    11   }
    13 elseif config.public_access then
    14   if config.motd_public then
    15     local help_text = config.motd_public
    16     ui.container{
    17       attr = { class = "wiki motd" },
    18       content = function()
    19         slot.put(format.wiki_text(help_text))
    20       end
    21     }
    22   end
    24   local open_issues_selector = Issue:new_selector()
    25     :add_where("issue.closed ISNULL")
    26     :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()")
    28   local closed_issues_selector = Issue:new_selector()
    29     :add_where("issue.closed NOTNULL")
    30     :add_order_by("issue.closed DESC")
    33   local tabs = {
    34     module = "index",
    35     view = "index"
    36   }
    38   tabs[#tabs+1] = {
    39     name = "units",
    40     label = _"Units",
    41     module = "unit",
    42     view = "_list"
    43   }
    45   tabs[#tabs+1] = {
    46     name = "timeline",
    47     label = _"Events",
    48     module = "event",
    49     view = "_list",
    50     params = { global = true }
    51   }
    53   tabs[#tabs+1] = {
    54     name = "open",
    55     label = _"Open issues",
    56     module = "issue",
    57     view = "_list",
    58     params = {
    59       for_state = "open",
    60       issues_selector = open_issues_selector
    61     }
    62   }
    63   tabs[#tabs+1] = {
    64     name = "closed",
    65     label = _"Closed issues",
    66     module = "issue",
    67     view = "_list",
    68     params = {
    69       for_state = "closed",
    70       issues_selector = closed_issues_selector
    71     }
    72   }
    73   ui.tabs(tabs)
    75 else
    77   if config.motd_public then
    78     local help_text = config.motd_public
    79     ui.container{
    80       attr = { class = "wiki motd" },
    81       content = function()
    82         slot.put(format.wiki_text(help_text))
    83       end
    84     }
    85   end
    87   ui.tag{ tag = "p", content = _"Closed user group, please login to participate." }
    89   ui.form{
    90   attr = { class = "login" },
    91   module = 'index',
    92   action = 'login',
    93   routing = {
    94     ok = {
    95       mode   = 'redirect',
    96       module = param.get("redirect_module") or "index",
    97       view = param.get("redirect_view") or "index",
    98       id = param.get("redirect_id"),
    99     },
   100     error = {
   101       mode   = 'forward',
   102       module = 'index',
   103       view   = 'login',
   104     }
   105   },
   106   content = function()
   107     ui.field.text{
   108       attr = { id = "username_field" },
   109       label     = _'login name',
   110       html_name = 'login',
   111       value     = ''
   112     }
   113     ui.script{ script = 'document.getElementById("username_field").focus();' }
   114     ui.field.password{
   115       label     = _'Password',
   116       html_name = 'password',
   117       value     = ''
   118     }
   119     ui.submit{
   120       text = _'Login'
   121     }
   122   end
   123 }
   125 end
