2023-07-28 21:49:29 +07:00
|
|
|
module CommunesController
|
|
|
|
|
2023-07-30 17:04:15 +07:00
|
|
|
using Genie, Genie.Renderer, Genie.Renderer.Html, Genie.Requests, GenieAuthentication
|
2023-07-28 21:49:29 +07:00
|
|
|
using JSON3
|
|
|
|
using SearchLight
|
|
|
|
using Server.DatabaseSupport, Server.TemplateEditor
|
|
|
|
|
|
|
|
controller = "communes"
|
|
|
|
dict_layouts = Dict(
|
|
|
|
:communes => generate_layout_html("main",controller,"communes",libraries=["Leaflet"]),
|
|
|
|
:communes_add => generate_layout_html("main",controller,"communes_add",libraries=["Leaflet"]),
|
|
|
|
)
|
|
|
|
|
|
|
|
#---Page info-----------------------------------------------------
|
|
|
|
|
|
|
|
const communes_info = Dict(
|
|
|
|
"en" => Dict(
|
|
|
|
:title => "LibSoc - Communes",
|
|
|
|
:description => ""
|
|
|
|
),
|
|
|
|
"ru" => Dict(
|
|
|
|
:title => "LibSoc - Коммуны",
|
|
|
|
:description => ""
|
2023-10-09 19:38:04 +07:00
|
|
|
),
|
2023-10-09 23:27:30 +07:00
|
|
|
"fr" => Dict(
|
2023-10-09 19:38:04 +07:00
|
|
|
:title => "LibSoc - Communes",
|
|
|
|
:description => ""
|
2023-07-28 21:49:29 +07:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
function get_locale()
|
|
|
|
data = payload()
|
|
|
|
if :locale in keys(data)
|
|
|
|
return data[:locale]
|
|
|
|
else
|
|
|
|
return "en"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
#---Functions---------------------------------------------------------
|
|
|
|
|
|
|
|
function communes()
|
|
|
|
locale = get_locale()
|
|
|
|
html(:communes,:communes, layout = dict_layouts[:communes], context = @__MODULE__,
|
|
|
|
title = communes_info[locale][:title],
|
|
|
|
description = communes_info[locale][:description]
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
function communes_add()
|
|
|
|
locale = get_locale()
|
|
|
|
html(:communes,:communes_add, layout = dict_layouts[:communes_add], context = @__MODULE__,
|
|
|
|
title = communes_info[locale][:title],
|
|
|
|
description = communes_info[locale][:description]
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
function communes_add_post()
|
|
|
|
data = jsonpayload()
|
|
|
|
insert_into_table("communes_requests",data)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|