# HG changeset patch
# User jbe
# Date 1643900242 -3600
# Node ID b01d9920371ba1f6d025b7d7de96bd42b26ca716
# Parent 27d2a7609cc162b630098647f1853d441a392ecd# Parent 7d000a357704270c7000703d6089db2bf3be47ea
merge
diff -r 27d2a7609cc1 -r b01d9920371b INSTALL.html
--- a/INSTALL.html Thu Feb 03 15:54:23 2022 +0100
+++ b/INSTALL.html Thu Feb 03 15:57:22 2022 +0100
@@ -20,6 +20,7 @@
bmake
lsb-release
imagemagick
+sassc
If you're using any other Linux distribution or BSD system, install the
diff -r 27d2a7609cc1 -r b01d9920371b INSTALL.mkd
--- a/INSTALL.mkd Thu Feb 03 15:54:23 2022 +0100
+++ b/INSTALL.mkd Thu Feb 03 15:57:22 2022 +0100
@@ -21,6 +21,7 @@
* bmake
* lsb-release
* imagemagick
+ * sassc
If you're using any other Linux distribution or BSD system, install the
necessary software components accordingly.
diff -r 27d2a7609cc1 -r b01d9920371b app/main/_filter/20_session.lua
--- a/app/main/_filter/20_session.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/_filter/20_session.lua Thu Feb 03 15:57:22 2022 +0100
@@ -66,4 +66,13 @@
}
end
+app.single_unit_id = config.single_unit_id
+
+if app.session.member then
+ local member_single_unit_id = app.session.member:get_single_unit_id() or config.single_unit_id
+ if member_single_unit_id then
+ app.single_unit_id = member_single_unit_id
+ end
+end
+
execute.inner()
diff -r 27d2a7609cc1 -r b01d9920371b app/main/_filter/21_auth.lua
--- a/app/main/_filter/21_auth.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/_filter/21_auth.lua Thu Feb 03 15:57:22 2022 +0100
@@ -22,6 +22,8 @@
or view == "403"
or view == "404"
or view == "405"
+ or view == "usage_terms" and config.use_terms_public_access == true
+ or view == "privacy" and config.privacy_policy_public_access == true
) then
auth_needed = false
end
@@ -61,8 +63,6 @@
module == "index" and view == "index"
or module == "area" and view == "show"
or module == "unit" and view == "show"
- or module == "policy" and view == "show"
- or module == "policy" and view == "list"
or module == "issue" and view == "show"
or module == "issue" and view == "history"
or module == "initiative" and view == "show"
@@ -73,6 +73,7 @@
or module == "file" and view == "show.jpg"
or module == "index" and view == "search"
or module == "index" and view == "usage_terms"
+ or module == "index" and view == "privacy"
or module == "help" and view == "introduction"
or module == "style"
then
@@ -113,8 +114,8 @@
end
if app.session:has_access("anonymous") and not app.session.member_id and auth_needed and module == "index" and view == "index" then
- if config.single_unit_id then
- request.redirect{ module = "unit", view = "show", id = config.single_unit_id }
+ if app.single_unit_id then
+ request.redirect{ module = "unit", view = "show", id = app.single_unit_id }
else
request.redirect{ module = "unit", view = "list" }
end
@@ -137,14 +138,22 @@
error("array type params not implemented")
end
end
- request.redirect{
- module = 'index', view = 'login', params = {
- redirect_module = module,
- redirect_view = view,
- redirect_id = param.get_id(),
- redirect_params = params
+ if config.login and config.login.method == "oauth2" then
+ request.redirect{
+ module = "oauth2_client",
+ view = "redirect",
+ params = { provider = config.login.provider }
}
- }
+ else
+ request.redirect{
+ module = 'index', view = 'login', params = {
+ redirect_module = module,
+ redirect_view = view,
+ redirect_id = param.get_id(),
+ redirect_params = params
+ }
+ }
+ end
elseif auth_needed and app.session.member.locked then
trace.debug("Member locked.")
request.redirect{ module = 'index', view = 'login' }
diff -r 27d2a7609cc1 -r b01d9920371b app/main/_filter_view/30_navigation.lua
--- a/app/main/_filter_view/30_navigation.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/_filter_view/30_navigation.lua Thu Feb 03 15:57:22 2022 +0100
@@ -70,10 +70,9 @@
ui.tag{ tag = "i", attr = { class = "material-icons", ["aria-hidden"] = "true", role="presentation" }, content = "exit_to_app" }
slot.put(" ")
ui.tag{ attr = { class = "mdl-layout--large-screen-only" }, content = function()
- ui.tag{ content = _"Login" }
+ ui.tag{ content = _"Login [button]" }
end }
end,
- text = _"Login",
attr = { class = "mdl-navigation__link" }
}
if config.login and config.login.method == "oauth2" then
@@ -116,6 +115,10 @@
end)
end
+if config.survey and request.get_module() ~= "survey" then
+ execute.view{ module = "survey", view = "_notification" }
+end
+
-- show notifications about things the user should take care of
--[[
if app.session.member then
@@ -152,16 +155,25 @@
view = 'about'
}
end }
- if not config.extra_footer_func then
- if config.use_terms and app.session.member then
+ if not config.extra_footer_func and (config.use_terms_public_access or app.session.member)then
+ if config.use_terms then
ui.tag{ tag = "li", content = function()
ui.link{
- text = _"Use terms",
+ text = config.use_terms_linktext or _"Use terms",
module = 'index',
view = 'usage_terms'
}
end }
end
+ if config.privacy_policy then
+ ui.tag{ tag = "li", content = function()
+ ui.link{
+ text = config.privacy_policy_linktext or _"Privacy policy",
+ module = 'index',
+ view = 'privacy'
+ }
+ end }
+ end
end
if config.extra_footer_func then
config.extra_footer_func()
diff -r 27d2a7609cc1 -r b01d9920371b app/main/_layout/default.html
--- a/app/main/_layout/default.html Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/_layout/default.html Thu Feb 03 15:57:22 2022 +0100
@@ -4,8 +4,8 @@
-
-
+
+
diff -r 27d2a7609cc1 -r b01d9920371b app/main/_prefork/10_init.lua
--- a/app/main/_prefork/10_init.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/_prefork/10_init.lua Thu Feb 03 15:57:22 2022 +0100
@@ -38,7 +38,7 @@
end
if config.notification_digest_template == nil then
- config.notification_digest_template = "Hello #{name},\n\nthis is your personal digest.\n\n#{digest}\n"
+ config.notification_digest_template = _"Hello #{name},\n\nthis is your personal digest.\n\n#{digest}\n"
end
if config.member_image_content_type == nil then
@@ -272,7 +272,7 @@
listen{
{
proto = "interval",
- name = "send_pending_notifications",
+ name = "mirror_firstlife_groups",
delay = 5,
handler = function()
firstlife_mirror_groups()
diff -r 27d2a7609cc1 -r b01d9920371b app/main/admin/cancel_issue.lua
--- a/app/main/admin/cancel_issue.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/admin/cancel_issue.lua Thu Feb 03 15:57:22 2022 +0100
@@ -10,30 +10,57 @@
ui.titleAdmin(_"Cancel issue")
-ui.form{
- module = "admin",
- action = "cancel_issue",
- id = id,
- attr = { class = "vertical section" },
- content = function()
-
- ui.sectionHead( function()
- ui.heading { level = 1, content = _("Cancel issue ##{id}", { id = issue.id }) }
- end )
+ui.grid{ content = function()
+
+ ui.cell_main{ content = function()
+ 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 = _"public administrative notice:" }
+ end }
+ ui.container{ attr = { class = "mdl-card__content" }, content = function()
- ui.sectionRow( function()
+ ui.form{
+ module = "admin",
+ action = "cancel_issue",
+ id = id,
+ attr = { class = "vertical section" },
+ content = function()
+
+ ui.sectionRow( function()
+ ui.field.text{ name = "admin_notice", multiline = true }
+ ui.tag{
+ tag = "input",
+ attr = {
+ type = "submit",
+ class = "mdl-button mdl-js-button mdl-button--raised",
+ value = _"cancel issue now"
+ }
+ }
+ slot.put(" ")
+ ui.link {
+ attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
+ module = "admin", view = "index", content = _"do nothing"
+ }
+ end )
+ end
+ }
+ end }
+ end }
+ end }
+
+ ui.cell_sidebar{ content = function()
+
+ 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 = _("Issue ##{id}", { id = issue.id }) }
+ end }
execute.view{ module = "initiative", view = "_list", params = {
issue = issue,
initiatives = issue.initiatives
} }
- end )
-
- ui.sectionRow( function()
- ui.field.text{ label = _"public administrative notice:", name = "admin_notice", multiline = true }
- ui.submit{ text = _"cancel issue now" }
- slot.put(" ")
- ui.link { module = "admin", view = "index", content = "go back to safety" }
- end )
- end
-}
+ end }
+ end }
+
+end }
+
diff -r 27d2a7609cc1 -r b01d9920371b app/main/admin/index.lua
--- a/app/main/admin/index.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/admin/index.lua Thu Feb 03 15:57:22 2022 +0100
@@ -1,8 +1,11 @@
local inactive = param.get("inactive", atom.boolean)
+local inactive_policies = param.get("inactive_policies", atom.boolean)
+
+
local units = Unit:get_flattened_tree{ include_inactive = inactive, include_hidden = true }
-local policies = Policy:build_selector{ active = not inactive }:exec()
+local policies = Policy:build_selector{ active = not inactive_policies }:exec()
--local policies = Policy:build_selector{}:add_order_by("index"):exec()
ui.titleAdmin()
@@ -46,21 +49,28 @@
ui.tag { tag = "li", content = function ()
ui.link { module = "admin", view = "area_show", params = { unit_id = unit.id }, content = _"+ add new subject area" }
end }
- slot.put("
")
end }
end
}
end
-
- slot.put("
")
- ui.link { module = "admin", view = "unit_edit", content = _"Create new unit" }
- slot.put("
")
- slot.put("
")
+ end }
+
+ ui.container{ attr = { class = "mdl-card__actions mdl-card--border" }, content = function()
+ ui.link {
+ attr = { class = "mdl-button mdl-js-button" },
+ module = "admin", view = "unit_edit", content = _"Create new unit"
+ }
if (not inactive) then
- ui.link { module = "admin", view = "index", params = { inactive = true }, content = _"Show inactive" }
+ ui.link {
+ attr = { class = "mdl-button mdl-js-button" },
+ module = "admin", view = "index", params = { inactive = true }, content = _"Show inactive"
+ }
else
- ui.link { module = "admin", view = "index", content = _"Hide inactive" }
+ ui.link {
+ attr = { class = "mdl-button mdl-js-button" },
+ module = "admin", view = "index", content = _"Hide inactive"
+ }
end
end }
@@ -74,27 +84,23 @@
ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Members" }
end }
ui.container{ attr = { class = "mdl-card__content" }, content = function()
- ui.tag { tag = "ul", attr = { class = "ul" }, content = function()
- ui.tag { tag = "li", content = function()
- ui.form{
- module = "admin", view = "member_list",
- content = function()
-
- ui.field.text{ container_attr = { style = "display: inline-block;" }, label = _"search", name = "search" }
-
- ui.submit{ value = _"search" }
-
- end
- }
- end }
- end }
- ui.sidebarSection( "moreLink", function()
- ui.link{
- text = _"Register new member",
- module = "admin",
- view = "member_edit"
- }
- end )
+ ui.form{
+ module = "admin", view = "member_list",
+ content = function()
+ ui.field.text{ container_attr = { style = "display: inline-block;" }, label = _"search", name = "search" }
+ slot.put(" ")
+ ui.submit{ value = _"OK" }
+ end
+ }
+ end }
+
+ ui.container{ attr = { class = "mdl-card__actions mdl-card--border" }, content = function()
+ ui.link{
+ attr = { class = "mdl-button mdl-js-button" },
+ text = _"Add member",
+ module = "admin",
+ view = "member_edit"
+ }
end }
end }
@@ -115,17 +121,26 @@
end }
end
end }
+ end }
+ ui.container{ attr = { class = "mdl-card__actions mdl-card--border" }, content = function()
ui.link{
- text = _"Create new policy",
+ attr = { class = "mdl-button mdl-js-button" },
+ text = _"Add policy",
module = "admin",
view = "policy_show"
}
slot.put(" ")
- if (not inactive) then
- ui.link { module = "admin", view = "index", params = { inactive = true }, content = _"Show inactive" }
+ if (not inactive_policies) then
+ ui.link {
+ attr = { class = "mdl-button mdl-js-button" },
+ module = "admin", view = "index", params = { inactive_policies = true }, content = _"Show inactive"
+ }
else
- ui.link { module = "admin", view = "index", content = _"Hide inactive" }
+ ui.link {
+ attr = { class = "mdl-button mdl-js-button" },
+ module = "admin", view = "index", content = _"Hide inactive"
+ }
end
end }
end }
@@ -158,12 +173,9 @@
module = "admin",
view = "cancel_issue",
content = function()
- ui.tag { tag = "ul", attr = { class = "ul" }, content = function()
- ui.tag { tag = "li", content = function()
- ui.field.text{ container_attr = { style = "display: inline-block;" }, label = _"Issue #", name = "id" }
- ui.submit{ text = _"cancel issue" }
- end }
- end }
+ ui.field.text{ container_attr = { style = "display: inline-block;" }, label = _"Issue #", name = "id" }
+ slot.put(" ")
+ ui.submit{ text = _"OK" }
end
}
end }
diff -r 27d2a7609cc1 -r b01d9920371b app/main/admin/member_edit.lua
--- a/app/main/admin/member_edit.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/admin/member_edit.lua Thu Feb 03 15:57:22 2022 +0100
@@ -12,8 +12,8 @@
end
end
-local function field_boolean(id, name, checked, label)
- ui.container{ content = function()
+local function field_boolean(id, name, checked, label, depth)
+ ui.container{ attr = { style = "margin-left: " .. (depth -1) * 24 .. "px;" }, content = function()
ui.tag{ tag = "label", attr = {
class = "mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect",
["for"] = id
@@ -45,16 +45,7 @@
ui.titleAdmin(_"Member")
-local units_selector = Unit:new_selector()
-
-if member then
- units_selector
- :left_join("privilege", nil, { "privilege.member_id = ? AND privilege.unit_id = unit.id", member.id })
- :add_field("privilege.voting_right", "voting_right")
- :add_order_by("unit.name")
-end
-
-local units = units_selector:exec()
+local units = Unit:get_flattened_tree{ include_inactive = inactive, include_hidden = true, member_id = member and member.id }
ui.grid{ content = function()
@@ -104,7 +95,7 @@
end
for i, unit in ipairs(units) do
- field_boolean("checkbox_unit_" .. unit.id, "unit_" .. unit.id, unit.voting_right, unit.name)
+ field_boolean("checkbox_unit_" .. unit.id, "unit_" .. unit.id, unit.voting_right, unit.name, unit.depth)
end
slot.put("
")
diff -r 27d2a7609cc1 -r b01d9920371b app/main/admin/newsletter_edit.lua
--- a/app/main/admin/newsletter_edit.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/admin/newsletter_edit.lua Thu Feb 03 15:57:22 2022 +0100
@@ -40,7 +40,7 @@
end
ui.field.text{ label = _"Date", name = "published" }
ui.field.select{
- label = "Recipient",
+ label = _"Recipient",
name = "unit_id",
foreign_records = units,
foreign_id = "id",
diff -r 27d2a7609cc1 -r b01d9920371b app/main/admin/policy_show.lua
--- a/app/main/admin/policy_show.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/admin/policy_show.lua Thu Feb 03 15:57:22 2022 +0100
@@ -107,13 +107,13 @@
id = policy.id,
content = function()
- field("index", "Index (for sorting)", hint and "1" or nil)
+ field("index", _"Index (for sorting)", hint and "1" or nil)
ui.field.boolean{ label = _"Active?", name = "active", value = hint and true or nil }
- field("name", "Name")
+ field("name", _"Name")
ui.field.text{ label = _"Description", name = "description", multiline = true }
- ui.field.text{ label = _"Hint", readonly = true,
+ ui.field.text{ label = "", readonly = true,
value = _"Interval format:" .. " 3 mons 2 weeks 1 day 10:30:15" }
diff -r 27d2a7609cc1 -r b01d9920371b app/main/admin/unit_edit.lua
--- a/app/main/admin/unit_edit.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/admin/unit_edit.lua Thu Feb 03 15:57:22 2022 +0100
@@ -11,7 +11,12 @@
}
for i, unit in ipairs(Unit:get_flattened_tree()) do
- units[#units+1] = { id = unit.id, name = unit.name }
+ local name = ""
+ for j = 2, unit.depth do
+ name = name .. utf8.char(160).. utf8.char(160).. utf8.char(160).. utf8.char(160)
+ end
+ local name = name .. unit.name
+ units[#units+1] = { id = unit.id, name = name }
end
ui.grid{ content = function()
diff -r 27d2a7609cc1 -r b01d9920371b app/main/agent/_action/accept.lua
--- a/app/main/agent/_action/accept.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/agent/_action/accept.lua Thu Feb 03 15:57:22 2022 +0100
@@ -3,24 +3,19 @@
local agent = Agent:by_pk(controlled_id, app.session.member_id)
if not agent then
- print("A")
return false
end
if agent.accepted ~= nil then
- print("B")
return false
end
if param.get("rejected") then
- print("C")
agent.accepted = false
elseif param.get("accepted") then
- print("D")
agent.accepted = true
else
- print("E")
return false
end
-print("F")
+
agent:save()
diff -r 27d2a7609cc1 -r b01d9920371b app/main/api/member.lua
--- a/app/main/api/member.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/api/member.lua Thu Feb 03 15:57:22 2022 +0100
@@ -54,6 +54,23 @@
selector:add_where{ "name ILIKE ? OR identification ILIKE ?", search, search }
end
+if app.scopes.read_profiles then
+ local profile_lookups = false
+ for i, field in ipairs(config.member_profile_fields) do
+ if field.api_lookup then
+ local value = param.get("profile_" .. field.id)
+ if value then
+ selector:add_where{ "member_profile.profile->>? = ?", field.id, value }
+ profile_lookups = true
+ end
+ end
+ end
+ if profile_lookups then
+ selector:join("member_profile", nil, "member_profile.member_id = member.id")
+ end
+end
+
+
local members = selector:exec()
local r = json.object()
r.result = execute.chunk{ module = "api", chunk = "_member", params = {
diff -r 27d2a7609cc1 -r b01d9920371b app/main/api/profile.lua
--- a/app/main/api/profile.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/api/profile.lua Thu Feb 03 15:57:22 2022 +0100
@@ -17,6 +17,12 @@
if value ~= nil and (field.type == "string" or field.type == "text") and json.type(value) ~= "string" then
return util.api_error(400, "Bad Request", "string_expected", "JSON encoded string value expected")
end
+ if field.validate_func then
+ local success = field.validate_func(field, fields)
+ if not success then
+ return util.api_error(403, "Forbidden", "validation_failure", "Request could not be validated")
+ end
+ end
profile.profile[field.id] = value
end
end
diff -r 27d2a7609cc1 -r b01d9920371b app/main/area/_head.lua
--- a/app/main/area/_head.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/area/_head.lua Thu Feb 03 15:57:22 2022 +0100
@@ -2,19 +2,21 @@
ui.title ( function ()
- -- unit link
- ui.link {
- attr = { class = "unit" },
- content = function()
- ui.tag{ attr = { class = "name" }, content = area.unit.name }
- end,
- module = "index", view = "index",
- params = { unit = area.unit_id }
- }
+ if not app.single_unit_id then
+ -- unit link
+ ui.link {
+ attr = { class = "unit" },
+ content = function()
+ ui.tag{ attr = { class = "name" }, content = area.unit.name }
+ end,
+ module = "index", view = "index",
+ params = { unit = area.unit_id }
+ }
- ui.tag { attr = { class = "spacer" }, content = function()
- slot.put ( " » " )
- end }
+ ui.tag { attr = { class = "spacer" }, content = function()
+ slot.put ( " » " )
+ end }
+ end
ui.tag{ content = area.name }
diff -r 27d2a7609cc1 -r b01d9920371b app/main/area/_list_entry.lua
--- a/app/main/area/_list_entry.lua Thu Feb 03 15:54:23 2022 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-local area = param.get("area", "table")
-local member = param.get("member", "table")
-
-ui.container{ attr = { class = "area" }, content = function()
-
- execute.view{ module = "area", view = "_head", params = { area = area, hide_unit = true, show_content = true, member = member } }
-
- ui.container{ attr = { class = "content" }, content = function()
- ui.tag{ content = _"Issues:" }
- slot.put(" ")
- ui.link{
- module = "area", view = "show", id = area.id, params = { tab = "open", filter = "new" },
- text = _("#{count} new", { count = area.issues_new_count })
- }
- slot.put(" · ")
- ui.link{
- module = "area", view = "show", id = area.id, params = { tab = "open", filter = "accepted" },
- text = _("#{count} in discussion", { count = area.issues_discussion_count })
- }
- slot.put(" · ")
- ui.link{
- module = "area", view = "show", id = area.id, params = { tab = "open", filter = "half_frozen" },
- text = _("#{count} in verification", { count = area.issues_frozen_count })
- }
- slot.put(" · ")
- ui.link{
- module = "area", view = "show", id = area.id, params = { tab = "open", filter = "frozen" },
- text = _("#{count} in voting", { count = area.issues_voting_count })
- }
- slot.put(" · ")
- ui.link{
- module = "area", view = "show", id = area.id, params = { tab = "closed", filter = "finished" },
- text = _("#{count} finished", { count = area.issues_finished_count })
- }
- slot.put(" · ")
- ui.link{
- module = "area", view = "show", id = area.id, params = { tab = "closed", filter = "canceled" },
- text = _("#{count} canceled", { count = area.issues_canceled_count })
- }
- end }
-
-end }
diff -r 27d2a7609cc1 -r b01d9920371b app/main/area/_sidebar_whatcanido.lua
--- a/app/main/area/_sidebar_whatcanido.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/area/_sidebar_whatcanido.lua Thu Feb 03 15:57:22 2022 +0100
@@ -71,32 +71,21 @@
ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
ui.tag { tag = "li", content = function ()
ui.tag { content = function ()
- ui.tag{ content = _"Edit your global " }
+ local text = _"Edit your global notification settings to receive updates by email."
+ local text_pre, text_link, text_post = string.match(text, "([^<]*)([^<]+)([^<]*)")
+ ui.tag{ content = text_pre }
ui.link {
module = "member", view = "settings_notification",
params = { return_to = "area", return_to_area_id = area.id },
- text = _"notification settings"
+ text = text_link
}
- ui.tag{ content = _" to receive updates by email" }
+ ui.tag{ content = text_post }
end }
end }
end }
end }
end
- if app.session.member:has_voting_right_for_unit_id ( area.unit_id ) then
- ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
- ui.tag{ content = _"I want to vote" }
- ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
- ui.tag { tag = "li", content = _"check the issues on the right, and click on 'Vote now' to vote on an issue which is in voting phase." }
- end }
- end }
- end
-
- if app.session.member and not app.session.member:has_voting_right_for_unit_id(area.unit_id) then
- ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = _"You are not entitled to vote in this unit" }
- end
-
if app.session.member and app.session.member:has_voting_right_for_unit_id(area.unit_id) then
if not config.disable_delegations then
@@ -175,16 +164,27 @@
end }
end }
end
-
+ end
+ if app.session.member:has_voting_right_for_unit_id ( area.unit_id ) then
+ ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
+ ui.tag{ content = _"I want to vote" }
+ ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
+ ui.tag { tag = "li", content = _"check the issues on the right, and click on 'Vote now' to vote on an issue which is in voting phase." }
+ end }
+ end }
end
else
ui.container { attr = { class = "mdl-card__content mdl-card--border" }, content = function ()
- ui.tag{ content = _"You are not entitled to vote in this unit" }
- ui.tag{ tag = "ul", content = function()
- ui.tag{ tag = "li", content = function()
- ui.link{ module = "index", view = "login", content = _"Login" }
+ if not app.session.member_id then
+ ui.tag{ content = _"Login to participate" }
+ ui.tag{ tag = "ul", content = function()
+ ui.tag{ tag = "li", content = function()
+ ui.link{ module = "index", view = "login", content = _"Login [button]" }
+ end }
end }
- end }
+ else
+ ui.tag{ content = _"You are not entitled to vote in this unit" }
+ end
end }
end
end }
diff -r 27d2a7609cc1 -r b01d9920371b app/main/contact/list.lua
--- a/app/main/contact/list.lua Thu Feb 03 15:54:23 2022 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-local contacts_selector = Contact:build_selector{
- member_id = app.session.member_id,
- order = "name"
-}
-
-ui.title(_"Contacts")
-
-ui.grid{ content = function()
- ui.cell_main{ content = function()
-
- 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 = _"Contacts" }
- end }
- ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
-
-
- ui.paginate{
- selector = contacts_selector,
- content = function()
- local contacts = contacts_selector:exec()
- if #contacts == 0 then
- ui.field.text{ value = _"You didn't save any member as contact yet." }
- else
- ui.list{
- attr = { class = "mdl-data-table mdl-js-data-table mdl-shadow--2dp" },
- records = contacts,
- columns = {
- {
- label = _"Name",
- content = function(record)
- ui.link{
- text = record.other_member.name,
- module = "member",
- view = "show",
- id = record.other_member_id
- }
- end
- },
- {
- label = _"Published",
- content = function(record)
- ui.field.boolean{ value = record.public }
- end
- },
- {
- content = function(record)
- if record.public then
- ui.link{
- attr = { class = "action" },
- text = _"Hide",
- module = "contact",
- action = "add_member",
- id = record.other_member_id,
- params = { public = false },
- routing = {
- default = {
- mode = "redirect",
- module = request.get_module(),
- view = request.get_view(),
- id = request.get_id_string(),
- params = request.get_param_strings()
- }
- }
- }
- else
- ui.link{
- attr = { class = "action" },
- text = _"Publish",
- module = "contact",
- action = "add_member",
- id = record.other_member_id,
- params = { public = true },
- routing = {
- default = {
- mode = "redirect",
- module = request.get_module(),
- view = request.get_view(),
- id = request.get_id_string(),
- params = request.get_param_strings()
- }
- }
- }
- end
- end
- },
- {
- content = function(record)
- ui.link{
- attr = { class = "action" },
- text = _"Remove",
- module = "contact",
- action = "remove_member",
- id = record.other_member_id,
- routing = {
- default = {
- mode = "redirect",
- module = request.get_module(),
- view = request.get_view(),
- id = request.get_id_string(),
- params = request.get_param_strings()
- }
- }
- }
- end
- },
- }
- }
- end
- end
- }
-
- end }
- end }
- end }
-end }
diff -r 27d2a7609cc1 -r b01d9920371b app/main/delegation/show.lua
--- a/app/main/delegation/show.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/delegation/show.lua Thu Feb 03 15:57:22 2022 +0100
@@ -156,12 +156,12 @@
local unit_delegation = Delegation:by_pk(app.session.member_id, issue.area.unit_id)
if unit_delegation then
delegate_name = unit_delegation.trustee.name
- scope = config.single_unit_id and _"global" or _"unit"
+ scope = app.single_unit_id and _"global" or _"unit"
end
end
local text_apply
local text_abandon
- if config.single_unit_id then
+ if app.single_unit_id then
text_apply = _("Apply global or area delegation for this issue (Currently: #{delegate_name} [#{scope}])", { delegate_name = delegate_name, scope = scope })
text_abandon = _"Abandon unit and area delegations for this issue"
else
@@ -179,11 +179,11 @@
local unit_delegation = Delegation:by_pk(app.session.member_id, area.unit_id)
if unit_delegation then
delegate_name = unit_delegation.trustee.name
- scope = config.single_unit_id and _"global" or _"unit"
+ scope = app.single_unit_id and _"global" or _"unit"
end
local text_apply
local text_abandon
- if config.single_unit_id then
+ if app.single_unit_id then
text_apply = _("Apply global delegation for this area (Currently: #{delegate_name} [#{scope}])", { delegate_name = delegate_name, scope = scope })
text_abandon = _"Abandon global delegation for this area"
else
diff -r 27d2a7609cc1 -r b01d9920371b app/main/draft/new.lua
--- a/app/main/draft/new.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/draft/new.lua Thu Feb 03 15:57:22 2022 +0100
@@ -72,6 +72,12 @@
return false
end
+if not initiative and not issue and #(area.allowed_policies) < 1 then
+ slot.put_into("error", _"Subject area configuration invalid. Please contact the administrator.")
+ return false
+end
+
+
ui.form{
record = draft,
attr = { class = "vertical section", enctype = 'multipart/form-data' },
@@ -128,13 +134,14 @@
-- -------- PREVIEW
if param.get("preview") and slot.get_content("error") == "" then
ui.sectionRow( function()
- if not issue and not initiative then
+ if not issue and not initiative and #area.allowed_policies > 1 then
ui.container { content = policy and policy.name or "" }
+ slot.put("
")
end
if param.get("free_timing") then
ui.container { content = param.get("free_timing") }
+ slot.put("
")
end
- slot.put("
")
ui.field.hidden{ name = "policy_id", value = param.get("policy_id") }
ui.field.hidden{ name = "name", value = param.get("name") }
if config.initiative_abstract then
@@ -253,14 +260,21 @@
tmp[#tmp+1] = allowed_policy
end
end
- ui.container{ content = _"Please choose a policy for the new issue:" }
- ui.field.select{
- name = "policy_id",
- foreign_records = tmp,
- foreign_id = "id",
- foreign_name = "name",
- value = param.get("policy_id", atom.integer) or area.default_policy and area.default_policy.id
- }
+ if #area.allowed_policies > 1 then
+ ui.container{ content = _"Please choose a policy for the new issue:" }
+ ui.field.select{
+ name = "policy_id",
+ foreign_records = tmp,
+ foreign_id = "id",
+ foreign_name = "name",
+ value = param.get("policy_id", atom.integer) or area.default_policy and area.default_policy.id
+ }
+ else
+ ui.field.hidden{
+ name = "policy_id",
+ value = area.allowed_policies[1].id
+ }
+ end
if policy and policy.free_timeable then
local available_timings
if config.free_timing and config.free_timing.available_func then
diff -r 27d2a7609cc1 -r b01d9920371b app/main/help/introduction.lua
--- a/app/main/help/introduction.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/help/introduction.lua Thu Feb 03 15:57:22 2022 +0100
@@ -5,30 +5,39 @@
ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
ui.container{ attr = { class = "mdl-card__title mdl-card--has-fab mdl-card--border" }, content = function ()
- ui.heading { attr = { class = "mdl-card__title-text" }, level = 1, content = _"Quick guide" }
+ ui.heading { attr = { class = "mdl-card__title-text" }, level = 1, content = function()
+ if config.quick_guide and config.quick_guide.title then
+ slot.put(config.quick_guide.title)
+ else
+ ui.tag{ content = _"Quick guide" }
+ end
+ end }
end }
ui.container { attr = { class = "draft mdl-card__content mdl-card--border" }, content = function()
- ui.heading{ level = 2, content = _"Initiatives and issues" }
- ui.tag{ tag = "p", content = _"[introduction] iniatives and issues" }
- ui.heading{ level = 2, content = _"Subject areas" }
- ui.tag{ tag = "p", content = _"[introduction] subject areas" }
- ui.heading{ level = 2, content = _"Organizational units" }
- ui.tag{ tag = "p", content = _"[introduction] organizational units" }
- ui.heading{ level = 2, content = _"Rules of procedure" }
- ui.tag{ tag = "p", content = _"[introduction] rules of procedure" }
- ui.heading{ level = 2, content = _"Admission phase" }
- ui.tag{ tag = "p", content = _"[introduction] phase 1 admission" }
- ui.heading{ level = 2, content = _"Discussion phase" }
- ui.tag{ tag = "p", content = _"[introduction] phase 2 discussion" }
- ui.heading{ level = 2, content = _"Verification phase" }
- ui.tag{ tag = "p", content = _"[introduction] phase 3 verification" }
- ui.heading{ level = 2, content = _"Voting phase" }
- ui.tag{ tag = "p", content = _"[introduction] phase 4 voting" }
- ui.heading{ level = 2, content = _"Vote delegation" }
- ui.tag{ tag = "p", content = _"[introduction] vote delegation" }
- ui.heading{ level = 2, content = _"Preference voting" }
- ui.tag{ tag = "p", content = _"[introduction] preference voting" }
-
+ if config.quick_guide and config.quick_guide.content then
+ slot.put(config.quick_guide.content)
+ else
+ ui.heading{ level = 2, content = _"Initiatives and issues" }
+ ui.tag{ tag = "p", content = _"[introduction] iniatives and issues" }
+ ui.heading{ level = 2, content = _"Subject areas" }
+ ui.tag{ tag = "p", content = _"[introduction] subject areas" }
+ ui.heading{ level = 2, content = _"Organizational units" }
+ ui.tag{ tag = "p", content = _"[introduction] organizational units" }
+ ui.heading{ level = 2, content = _"Rules of procedure" }
+ ui.tag{ tag = "p", content = _"[introduction] rules of procedure" }
+ ui.heading{ level = 2, content = _"Admission phase" }
+ ui.tag{ tag = "p", content = _"[introduction] phase 1 admission" }
+ ui.heading{ level = 2, content = _"Discussion phase" }
+ ui.tag{ tag = "p", content = _"[introduction] phase 2 discussion" }
+ ui.heading{ level = 2, content = _"Verification phase" }
+ ui.tag{ tag = "p", content = _"[introduction] phase 3 verification" }
+ ui.heading{ level = 2, content = _"Voting phase" }
+ ui.tag{ tag = "p", content = _"[introduction] phase 4 voting" }
+ ui.heading{ level = 2, content = _"Vote delegation" }
+ ui.tag{ tag = "p", content = _"[introduction] vote delegation" }
+ ui.heading{ level = 2, content = _"Preference voting" }
+ ui.tag{ tag = "p", content = _"[introduction] preference voting" }
+ end
end }
end }
end }
diff -r 27d2a7609cc1 -r b01d9920371b app/main/index/_head.lua
--- a/app/main/index/_head.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/index/_head.lua Thu Feb 03 15:57:22 2022 +0100
@@ -1,4 +1,4 @@
-local unit_id = config.single_unit_id or request.get_param{ name = "unit" }
+local unit_id = config.single_unit_id or request.get_param{ name = "unit" } or app.single_unit_id
local area_id = config.single_area_id or request.get_param{ name = "area" }
local initiative = param.get("initiative", "table")
@@ -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 27d2a7609cc1 -r b01d9920371b app/main/index/_not_voted_issues.lua
--- a/app/main/index/_not_voted_issues.lua Thu Feb 03 15:54:23 2022 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-local areas = param.get("areas", "table")
-
-if #areas > 0 then
- ui.container{
- attr = { style = "font-weight: bold;" },
- content = _"Current votings in areas you are member of and issues you are interested in:"
- }
-
- ui.list{
- records = areas,
- columns = {
- {
- name = "name"
- },
- {
- content = function(record)
- if record.is_member and record.issues_to_vote_count > 0 then
- ui.link{
- content = function()
- if record.issues_to_vote_count > 1 then
- slot.put(_("#{issues_to_vote_count} issue(s)", { issues_to_vote_count = record.issues_to_vote_count }))
- else
- slot.put(_("One issue"))
- end
- end,
- module = "area",
- view = "show",
- id = record.id,
- params = {
- tab = "open",
- filter = "frozen",
- filter_interest = "any",
- filter_voting = "not_voted"
- }
- }
- else
- slot.put(_"Not a member")
- end
- end
- },
- {
- content = function(record)
- if record.interested_issues_to_vote_count > 0 then
- ui.link{
- content = function()
- if record.interested_issues_to_vote_count > 1 then
- slot.put(_("#{interested_issues_to_vote_count} issue(s) you are interested in", { interested_issues_to_vote_count = record.interested_issues_to_vote_count }))
- else
- slot.put(_"One issue you are interested in")
- end
- end,
- module = "area",
- view = "show",
- id = record.id,
- params = {
- tab = "open",
- filter = "frozen",
- filter_interest = "issue",
- filter_voting = "not_voted"
- }
- }
- end
- end
- },
- }
- }
-end
diff -r 27d2a7609cc1 -r b01d9920371b app/main/index/_sidebar_motd_intern_top.lua
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/main/index/_sidebar_motd_intern_top.lua Thu Feb 03 15:57:22 2022 +0100
@@ -0,0 +1,12 @@
+if app.session.member and config.motd_intern_top then
+ ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
+ ui.container{ attr = { class = "mdl-card__content" }, content = function()
+ ui.container{
+ attr = { class = "motd" },
+ content = function()
+ slot.put(config.motd_intern_top)
+ end
+ }
+ end }
+ end }
+end
diff -r 27d2a7609cc1 -r b01d9920371b app/main/index/_sidebar_motd_public.lua
--- a/app/main/index/_sidebar_motd_public.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/index/_sidebar_motd_public.lua Thu Feb 03 15:57:22 2022 +0100
@@ -5,3 +5,11 @@
end }
end }
end
+
+if not app.session.member and config.motd_only_public then
+ ui.container{ attr = { class = "mdl-special-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
+ ui.container{ attr = { class = "mdl-card__content" }, content = function()
+ slot.put(config.motd_only_public)
+ end }
+ end }
+end
diff -r 27d2a7609cc1 -r b01d9920371b app/main/index/_sidebar_whatcanido.lua
--- a/app/main/index/_sidebar_whatcanido.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/index/_sidebar_whatcanido.lua Thu Feb 03 15:57:22 2022 +0100
@@ -30,6 +30,14 @@
end
end }
end }
+ if not config.voting_only and app.session.member.has_initiative_right then
+ ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
+ ui.tag{ content = _"I want to start a new initiative" }
+ ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
+ ui.tag { tag = "li", content = _"open the appropriate subject area for your issue and follow the instruction on that page." }
+ end }
+ end }
+ end
if app.session.member.has_voting_right then
ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
ui.tag{ content = _"I want to vote" }
@@ -46,15 +54,7 @@
end }
end
end
- if not config.voting_only and app.session.member.has_initiative_right then
- ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
- ui.tag{ content = _"I want to start a new initiative" }
- ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
- ui.tag { tag = "li", content = _"open the appropriate subject area for your issue and follow the instruction on that page." }
- end }
- end }
- end
- if not config.single_unit_id then
+ if not config.single_unit_id and not config.do_not_show_other_units_link then
ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
ui.tag{ content = _"I want to take a look at other organizational units" }
ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
@@ -83,10 +83,10 @@
end
if not app.session.member then
ui.container { attr = { class = "mdl-card__content mdl-card--border" }, content = function ()
- ui.tag{ content = _"You are not entitled to vote in this unit" }
+ ui.tag{ content = _"Login to participate" }
ui.tag{ tag = "ul", content = function()
ui.tag{ tag = "li", content = function()
- ui.link{ module = "index", view = "login", content = _"Login" }
+ ui.link{ module = "index", view = "login", content = _"Login [button]" }
end }
end }
end }
@@ -94,22 +94,26 @@
if not config.voting_only then
ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
ui.tag{ content = _"I want to learn more about LiquidFeedback" }
- ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
- ui.tag { tag = "li", content = function()
- ui.link { module = "help", view = "introduction", content = _"structured discussion" }
- end }
- ui.tag { tag = "li", content = function()
- ui.link { module = "help", view = "introduction", content = _"4 phases of a decision" }
- end }
- if not config.disable_delegations then
+ if config.quick_guide and config.quick_guide.links then
+ ui.container{ content = config.quick_guide.links }
+ else
+ ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
+ ui.tag { tag = "li", content = function()
+ ui.link { module = "help", view = "introduction", content = _"structured discussion" }
+ end }
ui.tag { tag = "li", content = function()
- ui.link { module = "help", view = "introduction", content = _"vote delegation" }
+ ui.link { module = "help", view = "introduction", content = _"4 phases of a decision" }
end }
- end
- ui.tag { tag = "li", content = function()
- ui.link { module = "help", view = "introduction", content = _"preference voting" }
- end }
- end }
+ if not config.disable_delegations then
+ ui.tag { tag = "li", content = function()
+ ui.link { module = "help", view = "introduction", content = _"vote delegation" }
+ end }
+ end
+ ui.tag { tag = "li", content = function()
+ ui.link { module = "help", view = "introduction", content = _"preference voting" }
+ end }
+ end }
+ end
end }
end
end }
diff -r 27d2a7609cc1 -r b01d9920371b app/main/index/confirm_notify_email.lua
--- a/app/main/index/confirm_notify_email.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/index/confirm_notify_email.lua Thu Feb 03 15:57:22 2022 +0100
@@ -1,29 +1,48 @@
ui.title(_"Email address confirmation")
-ui.section(function()
-
- ui.sectionHead(function()
-
- ui.form{
- attr = { class = "vertical" },
- module = "index",
- action = "confirm_notify_email",
- routing = {
- ok = {
- mode = "redirect",
+ui.grid{ content = function()
+ ui.cell_full{ content = function()
+ ui.container { attr = { class = "mdl-card mdl-shadow--2dp mdl-card__fullwidth" }, 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 = _"Email address confirmation" }
+ end }
+ ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
+ ui.form{
+ attr = { class = "vertical" },
module = "index",
- view = "index"
+ action = "confirm_notify_email",
+ routing = {
+ ok = {
+ mode = "redirect",
+ module = "index",
+ view = "index"
+ }
+ },
+ content = function()
+ local secret = param.get("secret")
+ if secret then
+ ui.field.hidden{
+ name = "secret",
+ value = secret
+ }
+ else
+ ui.field.text{
+ label = _"Confirmation code",
+ name = "secret"
+ }
+ end
+ ui.tag{
+ tag = "input",
+ attr = {
+ type = "submit",
+ class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored",
+ value = _'Confirm'
+ }
+ }
+ end
}
- },
- content = function()
- ui.field.text{
- label = _"Confirmation code",
- name = "secret",
- value = param.get("secret")
- }
- ui.submit{ text = _"Confirm" }
- end
- }
- end)
-end)
\ No newline at end of file
+ end }
+ end }
+ end }
+end }
diff -r 27d2a7609cc1 -r b01d9920371b app/main/index/index.lua
--- a/app/main/index/index.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/index/index.lua Thu Feb 03 15:57:22 2022 +0100
@@ -26,9 +26,14 @@
if area_id then
area = Area:by_id(area_id)
- if not area or area.unit_id ~= unit.id then
- execute.view { module = "index", view = "404" }
- request.set_status("404 Not Found")
+ if not area or (unit and area.unit_id ~= unit.id) then
+ request.redirect{
+ external = encode.url{
+ module = "index", view = "index", params = {
+ unit = unit_id
+ }
+ }
+ }
return
end
area:load_delegation_info_once_for_member_id(app.session.member_id)
@@ -45,11 +50,17 @@
ui.cell_main{ content = function()
execute.view{ module = "index", view = "_sidebar_motd_public" }
+ if not unit_id and not area_id then
+ execute.view{ module = "index", view = "_sidebar_motd_intern_top" }
+ end
execute.view{ module = "issue", view = "_list" }
end }
ui.cell_sidebar{ content = function()
+ if not unit and not area and config.logo_startpage then
+ config.logo_startpage()
+ end
execute.view{ module = "index", view = "_head" }
execute.view{ module = "index", view = "_sidebar_motd" }
diff -r 27d2a7609cc1 -r b01d9920371b app/main/index/initiator_invites.lua
--- a/app/main/index/initiator_invites.lua Thu Feb 03 15:54:23 2022 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-local initiatives_selector = Initiator:selector_for_invites(app.session.member_id)
-
-ui.title(_"Initiatives that invited you to become initiator:")
-
-if initiatives_selector:count() > 0 then
- execute.view{
- module = "initiative",
- view = "_list",
- params = { initiatives_selector = initiatives_selector }
- }
-else
- ui.field.text{ value = _"You are currently not invited to any initiative." }
-end
\ No newline at end of file
diff -r 27d2a7609cc1 -r b01d9920371b app/main/index/login.lua
--- a/app/main/index/login.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/index/login.lua Thu Feb 03 15:57:22 2022 +0100
@@ -5,8 +5,8 @@
end
}
-ui.title(_"Login")
-app.html_title.title = _"Login"
+ui.title(_"Login [headline]")
+app.html_title.title = _"Login [headline]"
ui.container{ attr = { class = "mdl-grid" }, content = function()
ui.container{ attr = { class = "mdl-cell mdl-cell--12-col" }, content = function()
@@ -14,7 +14,7 @@
execute.view{ module = "index", view = "_lang_chooser" }
- ui.heading{ level = 1, content = _"Login" }
+ ui.heading{ level = 1, content = _"Login [headline]" }
local redirect_params = {}
local redirect_params_string = param.get("redirect_params")
@@ -80,7 +80,7 @@
attr = {
type = "submit",
class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored",
- value = _'Login'
+ value = _"Login [button]"
}
}
slot.put(" ")
diff -r 27d2a7609cc1 -r b01d9920371b app/main/index/privacy.lua
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/main/index/privacy.lua Thu Feb 03 15:57:22 2022 +0100
@@ -0,0 +1,24 @@
+if not config.privacy_policy then
+ return execute.view { module = "index", view = "404" }
+end
+
+ui.title(config.privacy_policy_headline or _"Privacy policy")
+
+ui.grid{ content = function()
+ ui.cell_main{ content = function()
+ ui.container { attr = { class = "mdl-card mdl-shadow--2dp mdl-card__fullwidth" }, 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 = function()
+ ui.tag{ content = config.privacy_policy_headline or _"Privacy policy" }
+ if config.privacy_policy_subheadline then
+ slot.put("
")
+ ui.tag{ attr = { style = "font-size: 75%;" }, content = config.privacy_policy_subheadline }
+ end
+ end }
+ end }
+ ui.container{ attr = { class = "mdl-card__content draft" }, content = function()
+ slot.put(config.privacy_policy)
+ end }
+ end }
+ end }
+end }
diff -r 27d2a7609cc1 -r b01d9920371b app/main/index/reset_password.lua
--- a/app/main/index/reset_password.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/index/reset_password.lua Thu Feb 03 15:57:22 2022 +0100
@@ -101,11 +101,11 @@
content = _'Please enter your new password twice.'
}
ui.field.password{
- label = "New password",
+ label = _"New password",
name = "password1"
}
ui.field.password{
- label = "New password (repeat)",
+ label = _"Repeat new password",
name = "password2"
}
diff -r 27d2a7609cc1 -r b01d9920371b app/main/index/usage_terms.lua
--- a/app/main/index/usage_terms.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/index/usage_terms.lua Thu Feb 03 15:57:22 2022 +0100
@@ -1,19 +1,24 @@
-ui.title(_"Terms of use")
-
-ui.section( function()
+if not config.use_terms then
+ return execute.view { module = "index", view = "404" }
+end
- ui.sectionHead( function()
- ui.heading { level = 1, content = _"Terms of use" }
- end )
-
- ui.sectionRow( function()
+ui.title(config.use_terms_headline or _"Terms of use")
- ui.container{
- attr = { class = "wiki use_terms" },
- content = function()
+ui.grid{ content = function()
+ ui.cell_main{ content = function()
+ ui.container { attr = { class = "mdl-card mdl-shadow--2dp mdl-card__fullwidth" }, 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 = function()
+ ui.tag{ content = config.use_terms_headline or _"Terms of use" }
+ if config.use_terms_subheadline then
+ slot.put("
")
+ ui.tag{ attr = { style = "font-size: 75%;" }, content = config.use_terms_subheadline }
+ end
+ end }
+ end }
+ ui.container{ attr = { class = "mdl-card__content draft" }, content = function()
slot.put(config.use_terms)
- end
- }
-
- end )
-end )
\ No newline at end of file
+ end }
+ end }
+ end }
+end }
diff -r 27d2a7609cc1 -r b01d9920371b app/main/initiative/_list.lua
--- a/app/main/initiative/_list.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/initiative/_list.lua Thu Feb 03 15:57:22 2022 +0100
@@ -40,7 +40,9 @@
text = _"Competing initiatives in pairwise comparison to best initiative:"
end
end
- if group == "not_admitted" and initiative.issue.state ~= "canceled_no_initiative_admitted" then
+ if group == "not_admitted" and initiative.issue.state == "canceled_issue_not_accepted" then
+ text = _"Failed 1st quorum"
+ elseif group == "not_admitted" and initiative.issue.state ~= "canceled_no_initiative_admitted" then
text = _("Competing initiatives failed the 2nd quorum (#{num}/#{den}):", {
num = initiative.issue.policy.initiative_quorum_num,
den = initiative.issue.policy.initiative_quorum_den
diff -r 27d2a7609cc1 -r b01d9920371b app/main/initiative/_list_element.lua
--- a/app/main/initiative/_list_element.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/initiative/_list_element.lua Thu Feb 03 15:57:22 2022 +0100
@@ -6,21 +6,6 @@
local position = param.get("position", atom.number)
-if initiative.vote_grade ~= nil then
- if initiative.vote_grade > 0 then
- local text = _"voted yes"
- ui.container{ attr = { class = "mdl-list__item-avatar positive" }, content = function()
- ui.tag{ tag = "i", attr = { class = "material-icons", title = text }, content = "thumb_up" }
- end }
- elseif initiative.vote_grade == 0 then
- elseif initiative.vote_grade < 0 then
- local text = _"voted no"
- ui.container{ attr = { class = "mdl-list__item-avatar negative" }, content = function()
- ui.tag{ tag = "i", attr = { class = "material-icons", title = text }, content = "thumb_down" }
- end }
- end
-end
-
local class = "initiative mdl-list__item-primary-content"
if initiative.rank == 1 then
class = class .. " rank1"
@@ -41,6 +26,20 @@
ui.container {
attr = { class = "initiative_name" },
content = function()
+ if initiative.vote_grade ~= nil then
+ if initiative.vote_grade > 0 then
+ local text = _"voted yes"
+ ui.container{ attr = { class = "mdl-list__item-avatar positive" }, content = function()
+ ui.tag{ tag = "i", attr = { class = "material-icons", title = text }, content = "thumb_up" }
+ end }
+ elseif initiative.vote_grade == 0 then
+ elseif initiative.vote_grade < 0 then
+ local text = _"voted no"
+ ui.container{ attr = { class = "mdl-list__item-avatar negative" }, content = function()
+ ui.tag{ tag = "i", attr = { class = "material-icons", title = text }, content = "thumb_down" }
+ end }
+ end
+ end
if not for_member and app.session.member then
if initiative.member_info.supported then
if initiative.member_info.satisfied then
@@ -104,7 +103,7 @@
if initiative.positive_votes ~= nil then
- local result_text
+ local result_text = ""
if issue.voter_count == 0 then
result_text = _("No votes (0)", { result = result })
@@ -135,11 +134,11 @@
no_count = initiative.negative_votes,
no_percent = format.percent_floor(initiative.negative_votes, issue.voter_count)
})
-
+
end
ui.container { attr = { class = "result" }, content = result_text }
-
+
end
end }
diff -r 27d2a7609cc1 -r b01d9920371b app/main/initiative/_sidebar_policies.lua
--- a/app/main/initiative/_sidebar_policies.lua Thu Feb 03 15:54:23 2022 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-local area = param.get("area", "table")
-
-ui.sidebar ( "tab-whatcanido", function ()
- ui.sidebarHead( function()
- ui.heading { level = 2, content = _"Available policies" }
- end )
- execute.view { module = "policy", view = "_list", params = {
- for_area = area
- } }
-end )
\ No newline at end of file
diff -r 27d2a7609cc1 -r b01d9920371b app/main/initiative/_sidebar_state.lua
--- a/app/main/initiative/_sidebar_state.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/initiative/_sidebar_state.lua Thu Feb 03 15:57:22 2022 +0100
@@ -23,7 +23,7 @@
elseif initiative.rank then
head_text = _("Rejected (rank #{rank})", { rank = initiative.rank })
else
- head_text = _"Rejected"
+ head_text = _"Rejected [initiative]"
end
ui.heading { level = 1, content = head_text }
diff -r 27d2a7609cc1 -r b01d9920371b app/main/initiative/_sidebar_wikisyntax.lua
--- a/app/main/initiative/_sidebar_wikisyntax.lua Thu Feb 03 15:54:23 2022 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-if config.enforce_formatting_engine ~= 'markdown2' then
- return
-end
-
-ui.sidebar( "tab-whatcanido", function()
- ui.sidebarHead( function()
- ui.heading { level = 2, content = _"Formatting help" }
- end )
- ui.sidebarSection( function ()
- ui.heading { level = 3, content = _"Paragraphs" }
- ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
- ui.tag { tag = "li", content = function ()
- ui.tag { content = _"Separate each paragraph with at least one blank line" }
- end }
- end }
-
- ui.heading { level = 3, content = _"Headlines" }
- ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
- ui.tag { tag = "li", content = function ()
- ui.tag { content = _"Underline main headlines with ===" }
- end }
- ui.tag { tag = "li", content = function ()
- ui.tag { content = _"Underline sub headlines with ---" }
- end }
- end }
-
- ui.heading { level = 3, content = _"Emphasis" }
- ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
- ui.tag { tag = "li", content = function ()
- ui.tag { content = _"Put *asterisks* or around a phrase to make it italic" }
- end }
- ui.tag { tag = "li", content = function ()
- ui.tag { content = _"Put **double asterisks** around a phrase to make it bold" }
- end }
- end }
-
- ui.heading { level = 3, content = _"Lists" }
- ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
- ui.tag { tag = "li", content = function ()
- ui.tag { content = _"Lists must be preceeded and followed by at least one blank line" }
- end }
- ui.tag { tag = "li", content = function ()
- ui.tag { content = _"Put a hypen (-) or asterisk (*) followed by a space in front of each item" }
- end }
- ui.tag { tag = "li", content = function ()
- ui.tag { content = _"For numbered items use a digit (e.g. 1) followed by a dot (.) and a space" }
- end }
- ui.tag { tag = "li", content = function ()
- ui.tag { content = _"Indent sub items with spaces" }
- end }
- end }
-
- ui.heading { level = 3, content = _"Links" }
- ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
- ui.tag { tag = "li", content = function ()
- ui.tag { content = _"Use [Text](http://example.com/) for links" }
- end }
- end }
-
- end )
-end )
diff -r 27d2a7609cc1 -r b01d9920371b app/main/initiative/_suggestions.lua
--- a/app/main/initiative/_suggestions.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/initiative/_suggestions.lua Thu Feb 03 15:57:22 2022 +0100
@@ -6,7 +6,7 @@
if direct_supporter then
- ui.tag{ tag = "dialog", attr = { id = "rating_dialog" }, content = function ()
+ ui.tag{ tag = "div", attr = { id = "rating_dialog", class = "hidden" }, content = function ()
local opinion = {}
ui.form {
@@ -112,7 +112,7 @@
ui.tag{
tag = "input",
attr = {
- onclick = "document.getElementById('rating_dialog').close(); return false;",
+ onclick = "document.getElementById('rating_dialog').classList.add('hidden'); return false;",
type = "submit",
class = "mdl-button mdl-js-button",
value = _"cancel"
@@ -133,214 +133,228 @@
attr = { class = "section suggestions" },
content = function ()
- if # ( initiative.suggestions ) > 0 then
-
- ui.heading {
- level = 1,
- content = _("Suggestions for improvement (#{count})", { count = # ( initiative.suggestions ) } )
+ ui.heading {
+ level = 1,
+ content = _("Suggestions for improvement (#{count})", { count = # ( initiative.suggestions ) } )
+ }
+
+ ui.container { content = _"written and rated by the supportes of this initiative to improve the proposal and its reasons" }
+
+ if app.session.member_id and initiative.member_info.supported and not active_trustee_id then
+ ui.link {
+ attr = {
+ style = "margin-top: 1ex;",
+ class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored",
+ },
+ module = "suggestion", view = "new", params = {
+ initiative_id = initiative.id
+ },
+ content = _"write a new suggestion"
}
- ui.container { content = _"written and rated by the supportes of this initiative to improve the proposal and its reasons" }
- slot.put("
")
-
- for i, suggestion in ipairs(initiative.suggestions) do
-
- local opinion = Opinion:by_pk(app.session.member_id, suggestion.id)
+ end
+
+ slot.put("
")
+
+ for i, suggestion in ipairs(initiative.suggestions) do
+
+ local opinion = Opinion:by_pk(app.session.member_id, suggestion.id)
- local class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp not-folded"
- if suggestion.id == param.get("suggestion_id", atom.number) then
- class = class .. " highlighted"
- end
- if member and not initiative.issue.fully_frozen and not initiative.issue.closed and initiative.member_info.supported then
- class = class .. " rateable"
- end
+ local class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp not-folded"
+ if suggestion.id == param.get("suggestion_id", atom.number) then
+ class = class .. " highlighted"
+ end
+ if member and not initiative.issue.fully_frozen and not initiative.issue.closed and initiative.member_info.supported then
+ class = class .. " rateable"
+ end
+
+ ui.link { attr = { name = "s" .. suggestion.id }, text = "" }
+ ui.tag { tag = "div", attr = { class = class, id = "s" .. suggestion.id }, content = function ()
+ ui.tag{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
+ ui.heading { level = 2,
+ attr = { class = "mdl-card__title-text" },
+ content = function()
+ ui.tag{ content = format.string(suggestion.name, {
+ truncate_at = 160, truncate_suffix = true })
+ }
+ end
+ }
+ end }
+
+
+
+ ui.container{ attr = { class = "suggestion-content" }, content = function()
- ui.link { attr = { name = "s" .. suggestion.id }, text = "" }
- ui.tag { tag = "div", attr = { class = class, id = "s" .. suggestion.id }, content = function ()
- ui.tag{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
- ui.heading { level = 2,
- attr = { class = "mdl-card__title-text" },
- content = function()
- ui.tag{ content = format.string(suggestion.name, {
- truncate_at = 160, truncate_suffix = true })
+ ui.container {
+ attr = { class = "mdl-card__content mdl-card--border suggestionInfo" },
+ content = function ()
+
+ if app.session:has_access("authors_pseudonymous") then
+ ui.tag{ content = _"by" }
+ slot.put(" ")
+ ui.link{
+ module = "member", view = "show", id = suggestion.author_id,
+ content = suggestion.author.name
}
end
- }
- end }
+
+ execute.view{
+ module = "suggestion", view = "_collective_rating", params = {
+ suggestion = suggestion
+ }
+ }
-
-
- ui.container{ attr = { class = "suggestion-content" }, content = function()
-
- ui.container {
- attr = { class = "mdl-card__content mdl-card--border suggestionInfo" },
- content = function ()
+ end
+ }
- if app.session:has_access("authors_pseudonymous") then
- ui.tag{ content = _"by" }
- slot.put(" ")
- ui.link{
- module = "member", view = "show", id = suggestion.author_id,
- content = suggestion.author.name
- }
- end
-
- execute.view{
- module = "suggestion", view = "_collective_rating", params = {
- suggestion = suggestion
- }
+ ui.container {
+ attr = { class = "mdl-card__content suggestion-text draft" },
+ content = function ()
+ slot.put ( suggestion:get_content( "html" ) )
+
+ ui.container { attr = { class = "floatx-right" }, content = function()
+
+ ui.link {
+ attr = {
+ class = "mdl-button mdl-js-button mdl-button--icon suggestion-more",
+ onclick = "document.querySelector('#s" .. suggestion.id .. "').classList.remove('folded');document.querySelector('#s" .. suggestion.id .. "').classList.add('unfolded'); return false;"
+ },
+ content = function()
+ ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "expand_more" }
+ end
}
-
- end
- }
- ui.container {
- attr = { class = "mdl-card__content suggestion-text draft" },
- content = function ()
- slot.put ( suggestion:get_content( "html" ) )
+ ui.link {
+ attr = {
+ class = "mdl-button mdl-js-button mdl-button--icon suggestion-less",
+ onclick = "document.querySelector('#s" .. suggestion.id .. "').classList.add('folded');document.querySelector('#s" .. suggestion.id .. "').classList.remove('unfolded'); return false;"
+ },
+ content = function()
+ ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "expand_less" }
+ end
+ }
+ --[[
+ ui.link{
+ attr = { class = "mdl-button" },
+ content = _"Details",
+ module = "suggestion", view = "show", id = suggestion.id
+ }
+ --]]
+ end }
+
+ end
+ }
+
+ end }
+
+ ui.container { attr = { class = "mdl-card__actions mdl-card--border" }, content = function()
- ui.container { attr = { class = "floatx-right" }, content = function()
-
- ui.link {
- attr = {
- class = "mdl-button mdl-js-button mdl-button--icon suggestion-more",
- onclick = "document.querySelector('#s" .. suggestion.id .. "').classList.remove('folded');document.querySelector('#s" .. suggestion.id .. "').classList.add('unfolded'); return false;"
- },
- content = function()
- ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "expand_more" }
- end
- }
-
- ui.link {
- attr = {
- class = "mdl-button mdl-js-button mdl-button--icon suggestion-less",
- onclick = "document.querySelector('#s" .. suggestion.id .. "').classList.add('folded');document.querySelector('#s" .. suggestion.id .. "').classList.remove('unfolded'); return false;"
- },
- content = function()
- ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "expand_less" }
- end
- }
- --[[
- ui.link{
- attr = { class = "mdl-button" },
- content = _"Details",
- module = "suggestion", view = "show", id = suggestion.id
- }
- --]]
- end }
-
+ if direct_supporter then
+ ui.container{ attr = { class = "suggestion_rating_info" }, content = function()
+ ui.tag{ attr = { id = "s" .. suggestion.id .. "_rating_text" }, content = function()
+ local text_opinion = ""
+ if opinion then
+ local text_template
+ if
+ (opinion.degree > 0 and not opinion.fulfilled)
+ or (opinion.degree < 0 and opinion.fulfilled)
+ then
+ text_template = _"#{opinion} but #{implemented}"
+ else
+ text_template = _"#{opinion} and #{implemented}"
+ end
+ if opinion.degree == 2 then
+ text_opinion = _"must"
+ elseif opinion.degree == 1 then
+ text_opinion = _"should"
+ elseif opinion.degree == 0 then
+ text_opinion = _"neutral"
+ elseif opinion.degree == -1 then
+ text_opinion = _"should not"
+ elseif opinion.degree == -2 then
+ text_opinion = _"must not"
+ end
+ local text_implemented = ""
+ if opinion.fulfilled then
+ text_implemented = _"is implemented"
+ else
+ text_implemented = _"is not implemented"
+ end
+ ui.tag { content = _(text_template, {
+ opinion = text_opinion,
+ implemented = text_implemented
+ }) }
+ end
+ end }
+ local id = "s" .. suggestion.id .. "_rating_icon"
+ if opinion and (
+ (opinion.degree > 0 and not opinion.fulfilled)
+ or (opinion.degree < 0 and opinion.fulfilled)
+ )
+ then
+ slot.put(" ")
+ if math.abs(opinion.degree) > 1 then
+ ui.icon("warning", "red", id)
+ else
+ ui.icon("warning", nil, id)
+ end
+ elseif opinion then
+ slot.put(" ")
+ ui.icon("done", nil, id)
+ else
+ slot.put(" ")
+ ui.icon("blank", nil, id)
+ end
+ end }
+
+ ui.tag{
+ tag = "a",
+ attr = {
+ id = "s" .. suggestion.id .. "_rate_button",
+ class = "mdl-button",
+ onclick = "rateSuggestion(" .. suggestion.id .. ", " .. (opinion and opinion.degree or 0) .. ", " .. (opinion and (opinion.fulfilled and "true" or "false") or "null") .. ");return false;"
+ },
+ content = function()
+ if opinion then
+ ui.tag { content = _"update rating" }
+ else
+ ui.tag { content = _"rate suggestion" }
+ end
end
}
-
- end }
-
- ui.container { attr = { class = "mdl-card__actions mdl-card--border" }, content = function()
+ end
+
+ ui.link{
+ attr = { class = "mdl-button" },
+ content = _"Details",
+ module = "suggestion", view = "show", id = suggestion.id
+ }
- if direct_supporter then
- ui.container{ attr = { class = "suggestion_rating_info" }, content = function()
- ui.tag{ attr = { id = "s" .. suggestion.id .. "_rating_text" }, content = function()
- local text = ""
- if opinion then
- if opinion.degree == 2 then
- text = _"must"
- elseif opinion.degree == 1 then
- text = _"should"
- elseif opinion.degree == 0 then
- text = _"neutral"
- elseif opinion.degree == -1 then
- text = _"should not"
- elseif opinion.degree == -2 then
- text = _"must not"
- end
- ui.tag { content = text }
- slot.put ( " " )
- if
- (opinion.degree > 0 and not opinion.fulfilled)
- or (opinion.degree < 0 and opinion.fulfilled)
- then
- ui.tag{ content = _"but" }
- else
- ui.tag{ content = _"and" }
- end
- slot.put ( " " )
- local text = ""
- if opinion.fulfilled then
- text = _"is implemented"
- else
- text = _"is not implemented"
- end
- ui.tag { content = text }
- end
- end }
- local id = "s" .. suggestion.id .. "_rating_icon"
- if opinion and (
- (opinion.degree > 0 and not opinion.fulfilled)
- or (opinion.degree < 0 and opinion.fulfilled)
- )
- then
- slot.put(" ")
- if math.abs(opinion.degree) > 1 then
- ui.icon("warning", "red", id)
- else
- ui.icon("warning", nil, id)
- end
- elseif opinion then
- slot.put(" ")
- ui.icon("done", nil, id)
- else
- slot.put(" ")
- ui.icon("blank", nil, id)
- end
- end }
-
- ui.link{
- attr = {
- id = "s" .. suggestion.id .. "_rate_button",
- class = "mdl-button",
- onclick = "rateSuggestion(" .. suggestion.id .. ", " .. (opinion and opinion.degree or 0) .. ", " .. (opinion and (opinion.fulfilled and "true" or "false") or "null") .. ");return false;"
- },
- content = function()
- if opinion then
- ui.tag { content = _"update rating" }
- else
- ui.tag { content = _"rate suggestion" }
- end
- end
- }
- end
-
- ui.link{
- attr = { class = "mdl-button" },
- content = _"Details",
- module = "suggestion", view = "show", id = suggestion.id
+ end }
+ ui.script{ script = [[
+ var rateSuggestionRateText = "]] .. _"rate suggestion" .. [[";
+ var rateSuggestionUpdateRatingText = "]] .. _"update rating" .. [[";
+ var rateSuggestionAndText = "]] .. _"#{opinion} and #{implemented}" .. [[";
+ var rateSuggestionButText = "]] .. _"#{opinion} but #{implemented}" .. [[";
+ var rateSuggestionDegreeTexts = {
+ "-2": "]] .. _"must not" .. [[",
+ "-1": "]] .. _"should not" .. [[",
+ "1": "]] .. _"should" .. [[",
+ "2": "]] .. _"must" .. [["
+ }
+ var rateSuggestionFulfilledText = "]] .. _"is implemented" .. [[";
+ var rateSuggestionNotFulfilledText = "]] .. _"is not implemented" .. [[";
+ window.addEventListener("load", function() {
+ var textEl = document.querySelector('#s]] .. suggestion.id .. [[ .suggestion-content');
+ var height = textEl.clientHeight;
+ if (height > 250) {
+ document.querySelector('#s]] .. suggestion.id .. [[').classList.add('folded');
}
+ });
+ ]] }
+
+ end }
- end }
- ui.script{ script = [[
- var rateSuggestionRateText = "]] .. _"rate suggestion" .. [[";
- var rateSuggestionUpdateRatingText = "]] .. _"update rating" .. [[";
- var rateSuggestionDegreeTexts = {
- "-2": "]] .. _"must not" .. [[",
- "-1": "]] .. _"should not" .. [[",
- "1": "]] .. _"should" .. [[",
- "2": "]] .. _"must" .. [["
- }
- var rateSuggestionAndText = "]] .. _"and" .. [[";
- var rateSuggestionButText = "]] .. _"but" .. [[";
- var rateSuggestionFulfilledText = "]] .. _"is implemented" .. [[";
- var rateSuggestionNotFulfilledText = "]] .. _"is not implemented" .. [[";
- window.addEventListener("load", function() {
- var textEl = document.querySelector('#s]] .. suggestion.id .. [[ .suggestion-content');
- var height = textEl.clientHeight;
- if (height > 250) {
- document.querySelector('#s]] .. suggestion.id .. [[').classList.add('folded');
- }
- });
- ]] }
-
- end }
-
- end -- for i, suggestion
-
- end -- if #initiative.suggestions > 0
+ end -- for i, suggestion
+
end
}
diff -r 27d2a7609cc1 -r b01d9920371b app/main/initiative/history.lua
--- a/app/main/initiative/history.lua Thu Feb 03 15:54:23 2022 +0100
+++ b/app/main/initiative/history.lua Thu Feb 03 15:57:22 2022 +0100
@@ -39,7 +39,7 @@
{
content = function(record)
slot.put('