mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2025-12-16 18:08:52 +00:00
Split helpers.cr into multiple files
This commit is contained in:
18
src/invidious/helpers/macros.cr
Normal file
18
src/invidious/helpers/macros.cr
Normal file
@@ -0,0 +1,18 @@
|
||||
macro add_mapping(mapping)
|
||||
def initialize({{*mapping.keys.map { |id| "@#{id}".id }}})
|
||||
end
|
||||
|
||||
def to_a
|
||||
return [{{*mapping.keys.map { |id| "@#{id}".id }}}]
|
||||
end
|
||||
|
||||
DB.mapping({{mapping}})
|
||||
end
|
||||
|
||||
macro templated(filename)
|
||||
render "src/invidious/views/#{{{filename}}}.ecr", "src/invidious/views/layout.ecr"
|
||||
end
|
||||
|
||||
macro rendered(filename)
|
||||
render "src/invidious/views/#{{{filename}}}.ecr"
|
||||
end
|
||||
Reference in New Issue
Block a user