mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-03 11:25:29 -04:00
Pass in admin information when rendering all pages
This commit is contained in:
parent
b7c0515af7
commit
1d4237d687
12
src/util.cr
12
src/util.cr
@ -3,7 +3,17 @@ require "big"
|
|||||||
IMGS_PER_PAGE = 5
|
IMGS_PER_PAGE = 5
|
||||||
|
|
||||||
macro layout(name)
|
macro layout(name)
|
||||||
render "src/views/#{{{name}}}.ecr", "src/views/layout.ecr"
|
begin
|
||||||
|
cookie = env.request.cookies.find { |c| c.name == "token" }
|
||||||
|
is_admin = false
|
||||||
|
unless cookie.nil?
|
||||||
|
is_admin = @context.storage.verify_admin cookie.value
|
||||||
|
end
|
||||||
|
render "src/views/#{{{name}}}.ecr", "src/views/layout.ecr"
|
||||||
|
rescue e
|
||||||
|
message = e.to_s
|
||||||
|
render "message"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
macro send_img(env, img)
|
macro send_img(env, img)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user