Commit 9dcfa4fb authored by Chris Fiege's avatar Chris Fiege
Browse files

WIP: Contact-Info: Allow user to share contact-info on status page

With this change we allow our node operators to publish their contact
details on the status page.
parent 7647fcd4
Pipeline #2222 failed with stages
in 35 minutes and 41 seconds
......@@ -12,6 +12,20 @@ return function(form, uci)
)
local s = form:section(Section, nil, help)
local publish = s:option(Flag, "publish", translate("Publish contact info on noode-info page"))
publish.default=uci:get_bool("parker","owner","publish")
function publish:write(data)
uci:section("parker", "owner", "owner")
uci:set("parker", "owner", "publish", data)
local owner = uci:get_first("gluon-node-info", "owner")
if data then
local contact = uci:get("parker", "owner", "contact")
uci:set("gluon-node-info", owner, "contact", contact)
else
uci:set("gluon-node-info", owner, "contact", "")
end
end
local o = s:option(Value, "contact", pkg_i18n.translate("Contact info"),
site_i18n._translate("gluon-config-mode:contact-note") or pkg_i18n.translate("e.g. E-mail or phone number"))
o.default = uci:get("parker", "owner", "contact")
......@@ -20,6 +34,14 @@ return function(form, uci)
function o:write(data)
uci:section("parker","owner","owner")
uci:set("parker", "owner", "contact", data)
local owner = uci:get_first("gluon-node-info", "owner")
local publish = uci:get_bool("parker", "owner", "publish")
if publish then
uci:set("gluon-node-info", owner, "contact", data)
else
uci:set("gluon-node-info", owner, "contact", "")
end
end
return {'parker'}
......
......@@ -102,6 +102,9 @@
<h2><%:Overview%></h2>
<dl>
<dt><%:Node name%></dt><dd><%| nodeinfo.hostname %></dd>
<% if nodeinfo.owner and nodeinfo.owner.contact then -%>
<dt><%:Contact%></dt><dd><%| nodeinfo.owner.contact %></dd>
<%- end %>
<% if nodeinfo.location then -%>
<dt><%:Location%></dt>
<dd><a href="geo:<%| nodeinfo.location.latitude %>,<%| nodeinfo.location.longitude %>">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment