diff options
Diffstat (limited to 'src/guff/views/dialogs/admin/site.cr')
-rw-r--r-- | src/guff/views/dialogs/admin/site.cr | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/guff/views/dialogs/admin/site.cr b/src/guff/views/dialogs/admin/site.cr new file mode 100644 index 0000000..1b6419b --- /dev/null +++ b/src/guff/views/dialogs/admin/site.cr @@ -0,0 +1,21 @@ +class Guff::Views::Dialogs::Admin::Site < Guff::Views::HTMLView + TEMPLATES = { + y: "<option value='%s' data-slug='%s' selected='selected'>%s</option>", + n: "<option value='%s' data-slug='%s'>%s</option>", + } + + private def theme_options + @context.models.theme.all.map { |row| + { + id: row["theme_id"], + slug: row["theme_slug"], + name: "%s (%s)" % %w{name version}.map { |k| + row["theme_#{k}"] + }, + } + }.map { |row| + tmpl_id = (row[:slug] == "default") ? :y : :n + TEMPLATES[tmpl_id] % %i{id slug name}.map { |k| row[k] } + }.join("") + end +end |