Update handling for preferences

This commit is contained in:
Omar Roth
2019-03-28 13:43:40 -05:00
parent eee973fe86
commit 388e58bf1e
4 changed files with 63 additions and 90 deletions

View File

@@ -9,6 +9,17 @@ macro add_mapping(mapping)
DB.mapping({{mapping}})
end
macro json_mapping(mapping)
def initialize({{*mapping.keys.map { |id| "@#{id}".id }}})
end
def to_a
return [{{*mapping.keys.map { |id| "@#{id}".id }}}]
end
JSON.mapping({{mapping}})
end
macro templated(filename, template = "template")
render "src/invidious/views/#{{{filename}}}.ecr", "src/invidious/views/#{{{template}}}.ecr"
end