liquid_feedback_frontend
view app/main/index/index.lua @ 536:53b4890461a5
Added tag v2.beta5 for changeset 62923420b7f8
| author | jbe | 
|---|---|
| date | Tue May 22 03:06:00 2012 +0200 (2012-05-22) | 
| parents | ba310961ba34 | 
| children | 63d6549cc00b | 
 line source
     1 execute.view{ module = "index", view = "_lang_chooser" }
     3 slot.put_into("title", encode.html(config.app_title))
     5 if app.session.member_id then
     6   util.help("index.index", _"Home")
     8   execute.view{
     9     module = "member",
    10     view = "_show",
    11     params = {
    12       member = app.session.member,
    13       show_as_homepage = true
    14     }
    15   }
    17 elseif config.public_access then
    18   if config.motd_public then
    19     local help_text = config.motd_public
    20     ui.container{
    21       attr = { class = "wiki motd" },
    22       content = function()
    23         slot.put(format.wiki_text(help_text))
    24       end
    25     }
    26   end
    28   local open_issues_selector = Issue:new_selector()
    29     :add_where("issue.closed ISNULL")
    30     :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()")
    32   local closed_issues_selector = Issue:new_selector()
    33     :add_where("issue.closed NOTNULL")
    34     :add_order_by("issue.closed DESC")
    37   local tabs = {
    38     module = "index",
    39     view = "index"
    40   }
    42   tabs[#tabs+1] = {
    43     name = "units",
    44     label = _"Units",
    45     module = "unit",
    46     view = "_list"
    47   }
    49   tabs[#tabs+1] = {
    50     name = "timeline",
    51     label = _"Events",
    52     module = "event",
    53     view = "_list",
    54     params = { global = true }
    55   }
    57   tabs[#tabs+1] = {
    58     name = "open",
    59     label = _"Open issues",
    60     module = "issue",
    61     view = "_list",
    62     params = {
    63       for_state = "open",
    64       issues_selector = open_issues_selector
    65     }
    66   }
    67   tabs[#tabs+1] = {
    68     name = "closed",
    69     label = _"Closed issues",
    70     module = "issue",
    71     view = "_list",
    72     params = {
    73       for_state = "closed",
    74       issues_selector = closed_issues_selector
    75     }
    76   }
    78   ui.tabs(tabs)
    80 else
    82   if config.motd_public then
    83     local help_text = config.motd_public
    84     ui.container{
    85       attr = { class = "wiki motd" },
    86       content = function()
    87         slot.put(format.wiki_text(help_text))
    88       end
    89     }
    90   end
    92   ui.tag{ tag = "p", content = _"Closed user group, please login to participate." }
    94   ui.form{
    95   attr = { class = "login" },
    96   module = 'index',
    97   action = 'login',
    98   routing = {
    99     ok = {
   100       mode   = 'redirect',
   101       module = param.get("redirect_module") or "index",
   102       view = param.get("redirect_view") or "index",
   103       id = param.get("redirect_id"),
   104     },
   105     error = {
   106       mode   = 'forward',
   107       module = 'index',
   108       view   = 'login',
   109     }
   110   },
   111   content = function()
   112     ui.field.text{
   113       attr = { id = "username_field" },
   114       label     = _'login name',
   115       html_name = 'login',
   116       value     = ''
   117     }
   118     ui.script{ script = 'document.getElementById("username_field").focus();' }
   119     ui.field.password{
   120       label     = _'Password',
   121       html_name = 'password',
   122       value     = ''
   123     }
   124     ui.submit{
   125       text = _'Login'
   126     }
   127   end
   128 }
   130 end
