liquid_feedback_frontend
annotate app/main/admin/area_list.lua @ 722:b1ba5d237b6d
Optical improvements
author | bsw |
---|---|
date | Wed Jun 27 22:19:49 2012 +0200 (2012-06-27) |
parents | bc6934411019 |
children |
rev | line source |
---|---|
bsw@263 | 1 local unit_id = param.get("unit_id", atom.integer) |
bsw@263 | 2 local unit = Unit:by_id(unit_id) |
bsw@263 | 3 |
bsw@193 | 4 local show_not_in_use = param.get("show_not_in_use", atom.boolean) or false |
bsw/jbe@0 | 5 |
bsw@263 | 6 local areas = Area:build_selector{ unit_id = unit_id, active = not show_not_in_use }:exec() |
bsw/jbe@0 | 7 |
bsw/jbe@0 | 8 |
bsw@595 | 9 ui.title(_("Area list of '#{unit_name}'", { unit_name = unit.name })) |
bsw/jbe@0 | 10 |
bsw@193 | 11 |
bsw@595 | 12 ui.actions(function() |
bsw@263 | 13 |
bsw@193 | 14 if show_not_in_use then |
bsw@193 | 15 ui.link{ |
bsw@193 | 16 text = _"Show areas in use", |
bsw@193 | 17 module = "admin", |
bsw@263 | 18 view = "area_list", |
bsw@263 | 19 params = { unit_id = unit_id } |
bsw@193 | 20 } |
bsw@193 | 21 |
bsw@193 | 22 else |
bsw@193 | 23 ui.link{ |
bsw@193 | 24 text = _"Create new area", |
bsw@193 | 25 module = "admin", |
bsw@263 | 26 view = "area_show", |
bsw@263 | 27 params = { unit_id = unit_id } |
bsw@193 | 28 } |
bsw@595 | 29 |
bsw@595 | 30 slot.put(" · ") |
bsw@595 | 31 |
bsw@193 | 32 ui.link{ |
bsw@193 | 33 text = _"Show areas not in use", |
bsw@193 | 34 module = "admin", |
bsw@193 | 35 view = "area_list", |
bsw@263 | 36 params = { show_not_in_use = true, unit_id = unit_id } |
bsw@193 | 37 } |
bsw@193 | 38 end |
bsw@193 | 39 |
bsw@193 | 40 end) |
bsw@193 | 41 |
bsw/jbe@0 | 42 |
bsw/jbe@0 | 43 ui.list{ |
bsw/jbe@0 | 44 records = areas, |
bsw/jbe@0 | 45 columns = { |
bsw@193 | 46 |
bsw@193 | 47 { label = _"Area", name = "name" }, |
bsw@193 | 48 |
bsw@193 | 49 { content = function(record) |
bsw/jbe@0 | 50 if app.session.member.admin then |
bsw/jbe@0 | 51 ui.link{ |
bsw/jbe@0 | 52 attr = { class = { "action admin_only" } }, |
bsw/jbe@0 | 53 text = _"Edit", |
bsw/jbe@0 | 54 module = "admin", |
bsw/jbe@0 | 55 view = "area_show", |
bsw/jbe@0 | 56 id = record.id |
bsw/jbe@0 | 57 } |
bsw/jbe@0 | 58 end |
bsw/jbe@0 | 59 end |
bsw/jbe@0 | 60 } |
bsw@193 | 61 |
bsw/jbe@0 | 62 } |
bsw/jbe@0 | 63 } |