liquid_feedback_frontend

diff app/main/admin/area_list.lua @ 0:3bfb2fcf7ab9

Version alpha1
author bsw/jbe
date Wed Nov 18 12:00:00 2009 +0100 (2009-11-18)
parents
children 46351752814f
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/app/main/admin/area_list.lua	Wed Nov 18 12:00:00 2009 +0100
     1.3 @@ -0,0 +1,62 @@
     1.4 +local show_not_in_use = param.get("show_not_in_use", atom.boolean)
     1.5 +
     1.6 +local selector = Area:new_selector()
     1.7 +if show_not_in_use then
     1.8 +  selector:add_where("NOT active")
     1.9 +else
    1.10 +  selector:add_where("active")
    1.11 +end
    1.12 +
    1.13 +local areas = selector:exec()
    1.14 +
    1.15 +slot.put_into("title", _"Area list")
    1.16 +
    1.17 +if app.session.member.admin then
    1.18 +  slot.select("actions", function()
    1.19 +    if show_not_in_use then
    1.20 +      ui.link{
    1.21 +        attr = { class = { "admin_only" } },
    1.22 +        text = _"Show areas in use",
    1.23 +        module = "admin",
    1.24 +        view = "area_list"
    1.25 +      }
    1.26 +    else
    1.27 +      ui.link{
    1.28 +        attr = { class = { "admin_only" } },
    1.29 +        text = _"Create new area",
    1.30 +        module = "admin",
    1.31 +        view = "area_show"
    1.32 +      }
    1.33 +      ui.link{
    1.34 +        attr = { class = { "admin_only" } },
    1.35 +        text = _"Show areas not in use",
    1.36 +        module = "admin",
    1.37 +        view = "area_list",
    1.38 +        params = { show_not_in_use = true }
    1.39 +      }
    1.40 +    end
    1.41 +  end)
    1.42 +end
    1.43 +
    1.44 +ui.list{
    1.45 +  records = areas,
    1.46 +  columns = {
    1.47 +    {
    1.48 +      label = _"Area",
    1.49 +      name = "name"
    1.50 +    },
    1.51 +    {
    1.52 +      content = function(record)
    1.53 +        if app.session.member.admin then
    1.54 +          ui.link{
    1.55 +            attr = { class = { "action admin_only" } },
    1.56 +            text = _"Edit",
    1.57 +            module = "admin",
    1.58 +            view = "area_show",
    1.59 +            id = record.id
    1.60 +          }
    1.61 +        end
    1.62 +      end
    1.63 +    }
    1.64 +  }
    1.65 +}
    1.66 \ No newline at end of file

Impressum / About Us