From e6ebc011f255596f09fec40f69049514d52bebef Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Sat, 30 Jul 2016 14:21:14 -0400 Subject: add tabs to site-add, refactor textarea handling, and fix site_id post edit dialogs --- src/guff/views/dialogs/admin/site-add.cr | 24 +++ src/guff/views/dialogs/admin/site.cr | 4 +- src/views/dialogs/admin/site-add.ecr | 292 ++++++++++++++++++------------- 3 files changed, 192 insertions(+), 128 deletions(-) (limited to 'src') diff --git a/src/guff/views/dialogs/admin/site-add.cr b/src/guff/views/dialogs/admin/site-add.cr index 894a34a..c124457 100644 --- a/src/guff/views/dialogs/admin/site-add.cr +++ b/src/guff/views/dialogs/admin/site-add.cr @@ -1,5 +1,29 @@ require "./site" class Guff::Views::Dialogs::Admin::SiteAdd < Guff::Views::Dialogs::Admin::Site + TABS = [{ + :id => "content", + :css => "active", + :icon => "fa-pencil", + :name => "Content", + :text => "View content tab.", + }, { + :id => "theme", + :css => "", + :icon => "fa-eye", + :name => "Theme", + :text => "View theme tab.", + }, { + :id => "other", + :css => "", + :icon => "fa-ellipsis-h", + :name => "Other", + :text => "View other tab.", + }] + + private def tabs + super("site-add", TABS) + end + ECR.def_to_s("src/views/dialogs/admin/site-add.ecr") end diff --git a/src/guff/views/dialogs/admin/site.cr b/src/guff/views/dialogs/admin/site.cr index 1b6419b..c03cd0a 100644 --- a/src/guff/views/dialogs/admin/site.cr +++ b/src/guff/views/dialogs/admin/site.cr @@ -1,5 +1,5 @@ class Guff::Views::Dialogs::Admin::Site < Guff::Views::HTMLView - TEMPLATES = { + OPTION_TEMPLATES = { y: "", n: "", } @@ -15,7 +15,7 @@ class Guff::Views::Dialogs::Admin::Site < Guff::Views::HTMLView } }.map { |row| tmpl_id = (row[:slug] == "default") ? :y : :n - TEMPLATES[tmpl_id] % %i{id slug name}.map { |k| row[k] } + OPTION_TEMPLATES[tmpl_id] % %i{id slug name}.map { |k| row[k] } }.join("") end end diff --git a/src/views/dialogs/admin/site-add.ecr b/src/views/dialogs/admin/site-add.ecr index aae2f70..86fd7df 100644 --- a/src/views/dialogs/admin/site-add.ecr +++ b/src/views/dialogs/admin/site-add.ecr @@ -1,5 +1,5 @@