# HG changeset patch # User bsw # Date 1632815038 -7200 # Node ID 4a5a79a37db11ae8e70f0abdd1e4e113319af148 # Parent c33916811ca760fe20aec02ead2c28f68fb6c299 Render links in unit and area description, updated layout of unit and area box diff -r c33916811ca7 -r 4a5a79a37db1 app/main/index/_head.lua --- a/app/main/index/_head.lua Tue Sep 28 09:29:34 2021 +0200 +++ b/app/main/index/_head.lua Tue Sep 28 09:43:58 2021 +0200 @@ -28,13 +28,17 @@ ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function() ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function() ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = unit.name } - if unit.description and #(unit.description) > 0 then - ui.container{ attr = { class = "mdl-card__subtitle-text" }, content = unit.description } - end - if config.render_external_reference_unit then + end } + if unit.description and #(unit.description) > 0 then + ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function() + slot.put(format.text_with_links(unit.description)) + end } + end + if config.render_external_reference_unit then + ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function() config.render_external_reference_unit(unit) - end - end } + end } + end if not (config.voting_only and config.disable_delegations) and app.session.member_id and ( @@ -80,10 +84,12 @@ if unit then ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function() ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = area.name } - if area.description and #(area.description) > 0 then - ui.container{ attr = { class = "mdl-card__subtitle-text" }, content = area.description } - end end } + if area.description and #(area.description) > 0 then + ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function() + slot.put(format.text_with_links(area.description)) + end } + end end if not (config.voting_only and config.disable_delegations) and app.session.member_id and ( app.session.member:has_voting_right_for_unit_id(area.unit_id) diff -r c33916811ca7 -r 4a5a79a37db1 env/format/text_with_links.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/env/format/text_with_links.lua Tue Sep 28 09:43:58 2021 +0200 @@ -0,0 +1,7 @@ +function format.text_with_links(value) + value = encode.html(value) + value = string.gsub(value, "http[^%s:]*://[^%s]+", function(match) + return "" .. match .. "" + end) + return value +end