liquid_feedback_frontend
changeset 1209:fede09736f2b
Added support for external references
author | bsw |
---|---|
date | Sat Jul 18 16:20:30 2015 +0200 (2015-07-18) |
parents | 24f4c23f76ff |
children | 7e48d429389f |
files | app/main/admin/_action/area_update.lua app/main/admin/_action/unit_update.lua app/main/admin/area_show.lua app/main/admin/unit_edit.lua app/main/draft/show.lua app/main/initiative/history.lua app/main/initiative/show.lua config/example.lua |
line diff
1.1 --- a/app/main/admin/_action/area_update.lua Sat Jul 18 15:58:39 2015 +0200 1.2 +++ b/app/main/admin/_action/area_update.lua Sat Jul 18 16:20:30 2015 +0200 1.3 @@ -1,6 +1,6 @@ 1.4 local area = Area:by_id(param.get_id()) or Area:new() 1.5 1.6 -param.update(area, "unit_id", "name", "description", "active") 1.7 +param.update(area, "unit_id", "name", "description", "external_reference", "active") 1.8 1.9 if #area.name < 1 then 1.10 slot.select("error", function()
2.1 --- a/app/main/admin/_action/unit_update.lua Sat Jul 18 15:58:39 2015 +0200 2.2 +++ b/app/main/admin/_action/unit_update.lua Sat Jul 18 16:20:30 2015 +0200 2.3 @@ -1,5 +1,5 @@ 2.4 local unit = Unit:by_id(param.get_id()) or Unit:new() 2.5 2.6 -param.update(unit, "parent_id", "name", "description", "active") 2.7 +param.update(unit, "parent_id", "name", "description", "external_reference", "active") 2.8 2.9 unit:save()
3.1 --- a/app/main/admin/area_show.lua Sat Jul 18 15:58:39 2015 +0200 3.2 +++ b/app/main/admin/area_show.lua Sat Jul 18 16:20:30 2015 +0200 3.3 @@ -48,6 +48,7 @@ 3.4 ui.field.text{ label = _"Unit", value = area.unit.name, readonly = true } 3.5 ui.field.text{ label = _"Name", name = "name" } 3.6 ui.field.text{ label = _"Description", name = "description", multiline = true } 3.7 + ui.field.text{ label = _"External reference", name = "external_reference" } 3.8 ui.field.select{ label = _"Default Policy", name = "default_policy", 3.9 value=area.default_policy and area.default_policy.id or "-1", 3.10 foreign_records = def_policy,
4.1 --- a/app/main/admin/unit_edit.lua Sat Jul 18 15:58:39 2015 +0200 4.2 +++ b/app/main/admin/unit_edit.lua Sat Jul 18 16:20:30 2015 +0200 4.3 @@ -39,6 +39,7 @@ 4.4 } 4.5 ui.field.text{ label = _"Name", name = "name" } 4.6 ui.field.text{ label = _"Description", name = "description", multiline = true } 4.7 + ui.field.text{ label = _"External reference", name = "external_reference" } 4.8 ui.field.boolean{ label = _"Active?", name = "active" } 4.9 4.10 slot.put("<br />")
5.1 --- a/app/main/draft/show.lua Sat Jul 18 15:58:39 2015 +0200 5.2 +++ b/app/main/draft/show.lua Sat Jul 18 16:20:30 2015 +0200 5.3 @@ -41,6 +41,12 @@ 5.4 ui.heading { level = 2, content = _("Draft revision #{id}", { id = draft.id } ) } 5.5 end) 5.6 5.7 + if config.render_external_reference and config.render_external_reference.draft then 5.8 + config.render_external_reference.draft(draft, function (callback) 5.9 + ui.sectionRow(callback) 5.10 + end) 5.11 + end 5.12 + 5.13 ui.sectionRow( function() 5.14 5.15 execute.view{
6.1 --- a/app/main/initiative/history.lua Sat Jul 18 15:58:39 2015 +0200 6.2 +++ b/app/main/initiative/history.lua Sat Jul 18 16:20:30 2015 +0200 6.3 @@ -95,6 +95,17 @@ 6.4 } 6.5 end 6.6 6.7 + if config.render_external_reference and config.render_external_reference.draft then 6.8 + columns[#columns+1] = { 6.9 + label = _"external reference", 6.10 + content = function(draft) 6.11 + config.render_external_reference.draft(draft, function (callback) 6.12 + callback() 6.13 + end) 6.14 + end 6.15 + } 6.16 + end 6.17 + 6.18 ui.list{ 6.19 records = initiative.drafts, 6.20 columns = columns
7.1 --- a/app/main/initiative/show.lua Sat Jul 18 15:58:39 2015 +0200 7.2 +++ b/app/main/initiative/show.lua Sat Jul 18 16:20:30 2015 +0200 7.3 @@ -137,8 +137,13 @@ 7.4 end 7.5 end 7.6 end 7.7 + 7.8 + if config.render_external_reference and config.render_external_reference.initiative then 7.9 + config.render_external_reference.initiative(initiative, function (callback) 7.10 + ui.sectionRow(callback) 7.11 + end) 7.12 + end 7.13 7.14 - 7.15 ui.sectionRow( function () 7.16 ui.container { 7.17 attr = { class = "draft" },
8.1 --- a/config/example.lua Sat Jul 18 15:58:39 2015 +0200 8.2 +++ b/config/example.lua Sat Jul 18 16:20:30 2015 +0200 8.3 @@ -255,6 +255,25 @@ 8.4 } 8.5 8.6 8.7 +-- External references 8.8 +-- ------------------------------------------------------------------------ 8.9 +-- Rendering of external references 8.10 + 8.11 +--[[ 8.12 +config.render_external_reference = { 8.13 + draft = function(draft, wrapper) 8.14 + wrapper(function() 8.15 + ui.tag{ content = draft.external_reference) 8.16 + end) 8.17 + end, 8.18 + initiative = function(initiative, wrapper) 8.19 + wrapper(function() 8.20 + ui.tag{ content = initiative.external_reference) 8.21 + end) 8.22 + end 8.23 +end 8.24 +--]] 8.25 + 8.26 -- Admin logger 8.27 -- ------------------------------------------------------------------------ 8.28 -- Logging administrative activities