liquid_feedback_frontend
view app/main/index/index.lua @ 1486:00ce64d26e9e
Fixed redirection after registration without redirect params
| author | bsw | 
|---|---|
| date | Sun Nov 04 19:32:13 2018 +0100 (2018-11-04) | 
| parents | 32cc544d5a5b | 
| children | 2a0d86117d54 | 
 line source
     1 if not app.session:has_access("anonymous") then
     2   slot.put("<br />      Closed user group, please login.<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />")
     3   return
     4 end
     6 local unit_id = request.get_param{ name = "unit" }
     7 local area_id = request.get_param{ name = "area" }
     9 if unit_id == "all" then
    10   unit_id = nil
    11 end
    13 if area_id == "all" then
    14   area_id = nil
    15 end
    17 local unit
    18 local area
    20 if unit_id then
    21   unit = Unit:by_id(unit_id)
    22 end
    24 if area_id then
    25   area = Area:by_id(area_id)
    26 end
    28 ui.grid{ content = function()
    29   ui.cell_main{ content = function()
    31     execute.view{ module = "index", view = "_sidebar_motd_public" }
    33     execute.view{ module = "issue", view = "_list" }
    34   end }
    36   ui.cell_sidebar{ content = function()
    37     execute.view{ module = "index", view = "_sidebar_motd" }
    38     if app.session.member then
    39       execute.view{ module = "index", view = "_sidebar_notifications" }
    40     end
    41     if config.firstlife then
    42       ui.container{ attr = { class = "map mdl-special-card mdl-shadow--2dp pos-before-main" }, content = function()
    43         ui.tag{ tag = "iframe", attr = { src = config.firstlife.areaviewer_url .. "?" .. config.firstlife.coordinates .. "&domain=" .. request.get_absolute_baseurl(), class = "map" }, content = "" }
    44       end }
    45     end
    46     if config.map then
    47       local initiatives = Initiative:new_selector():exec()
    48       local geo_objects = {}
    49       for i, initiative in ipairs(initiatives) do
    50         if initiative.location and initiative.location.coordinates then
    51           local geo_object = {
    52             lon = initiative.location.coordinates[1],
    53             lat = initiative.location.coordinates[2],
    54             label = "i" .. initiative.id,
    55             description = slot.use_temporary(function()
    56               ui.link{ module = "initiative", view = "show", id = initiative.id, text = initiative.display_name }
    57             end),
    58             type = "initiative"
    59           }
    60           table.insert(geo_objects, geo_object)
    61         end
    62       end
    63       if ontomap_get_instances then
    64         local instances = ontomap_get_instances()
    65         for i, instance in ipairs(instances) do
    66           table.insert(geo_objects, instance)
    67         end
    68       end
    69       ui.container{ attr = { class = "map mdl-special-card mdl-shadow--2dp pos-before-main" }, content = function()
    70         ui.map(geo_objects)  
    71       end }
    72     end
    73     if config.logo then
    74       config.logo()
    75     end
    76     if area then
    77       execute.view{ module = "area", view = "_sidebar_whatcanido", params = { area = area } }
    78     elseif unit then
    79       execute.view{ module = "unit", view = "_sidebar_whatcanido", params = { unit = unit } }
    80     else
    81       execute.view{ module = "index", view = "_sidebar_whatcanido" }
    82     end
    84     execute.view { module = "index", view = "_sidebar_members" }
    86   end }
    87 end }
