site-libsoc/Server/app/resources/basic/BasicController.jl

106 lines
2.8 KiB
Julia
Raw Normal View History

2023-06-15 01:41:54 +07:00
module BasicController
2023-07-30 17:04:15 +07:00
using Genie, Genie.Renderer, Genie.Renderer.Html, Genie.Requests, GenieAuthentication
2023-06-15 01:41:54 +07:00
using JSON3
using SearchLight
using Server.DatabaseSupport, Server.TemplateEditor
controller = "basic"
dict_layouts = Dict(
2023-08-17 18:30:35 +07:00
:landing => generate_layout_html("main",controller,"landing",css=["landing"],libraries=["Leaflet"],preload=[Dict("path"=>"/img/crowd.webp","type"=>"image")]),
2023-06-24 04:39:41 +07:00
:manifesto => generate_layout_html("main",controller,"manifesto"),
2023-06-24 20:44:16 +07:00
:join_us => generate_layout_html("main",controller,"join_us",libraries=["Leaflet"]),
2023-07-04 23:21:15 +07:00
:compass => generate_layout_html("main",controller,"compass"),
2023-06-15 01:41:54 +07:00
)
2023-07-04 18:38:42 +07:00
#---Page info-----------------------------------------------------
2023-06-15 01:41:54 +07:00
2023-07-04 18:38:42 +07:00
const landing_info = Dict(
"en" => Dict(
:title => "LibSoc - A Global Network of Libertarian Socialists",
:description => ""
),
"ru" => Dict(
:title => "LibSoc - Глобальная сеть либертарных социалистов",
:description => ""
),
)
const manifesto_info = Dict(
"en" => Dict(
:title => "LibSoc - Manifesto",
:description => ""
),
"ru" => Dict(
:title => "LibSoc - Манифест",
:description => ""
)
)
const join_us_info = Dict(
"en" => Dict(
:title => "LibSoc - Manifesto",
:description => ""
),
"ru" => Dict(
:title => "LibSoc - Присоединяйся",
:description => ""
),
)
2023-07-04 23:21:15 +07:00
const compass_info = Dict(
"en" => Dict(
:title => "LibSoc - Political Compass",
:description => ""
),
"ru" => Dict(
:title => "LibSoc - Политический компас",
:description => ""
)
)
2023-07-04 18:38:42 +07:00
function get_locale()
data = payload()
if :locale in keys(data)
return data[:locale]
else
return "en"
end
end
#---Functions---------------------------------------------------------
2023-06-15 01:41:54 +07:00
function landing()
2023-07-04 18:38:42 +07:00
locale = get_locale()
2023-06-15 01:41:54 +07:00
html(:basic,:landing, layout = dict_layouts[:landing], context = @__MODULE__,
2023-07-04 18:38:42 +07:00
title = landing_info[locale][:title],
description = landing_info[locale][:description]
2023-06-15 01:41:54 +07:00
)
end
2023-06-24 04:39:41 +07:00
function manifesto()
2023-07-04 18:38:42 +07:00
locale = get_locale()
2023-06-24 04:39:41 +07:00
html(:basic,:manifesto, layout = dict_layouts[:manifesto], context = @__MODULE__,
2023-07-04 18:38:42 +07:00
title = manifesto_info[locale][:title],
description = manifesto_info[locale][:description]
2023-06-24 04:39:41 +07:00
)
end
2023-07-04 23:21:15 +07:00
function political_compass()
locale = get_locale()
html(:basic,:compass, layout = dict_layouts[:compass], context = @__MODULE__,
title = compass_info[locale][:title],
description = compass_info[locale][:description]
)
end
2023-07-28 21:49:29 +07:00
function join_us()
locale = get_locale()
html(:basic,:join_us, layout = dict_layouts[:join_us], context = @__MODULE__,
title = join_us_info[locale][:title],
description = join_us_info[locale][:description]
)
end
2023-07-21 21:38:02 +07:00
end