From 1d4c4b147d6b55600a55ede3942f94d52cfb7457 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Fri, 29 Jul 2016 14:35:15 -0400 Subject: add tabs to edit dialogs --- src/guff/views/dialogs/admin/blog-edit.cr | 30 +++ src/guff/views/dialogs/admin/page-edit.cr | 24 ++ src/guff/views/dialogs/admin/post-edit.cr | 10 + src/guff/views/dialogs/admin/project-edit.cr | 48 ++++ src/views/dialogs/admin/blog-edit.ecr | 274 +++++++++++-------- src/views/dialogs/admin/page-edit.ecr | 291 +++++++++++++------- src/views/dialogs/admin/project-edit.ecr | 381 ++++++++++++++++++++------- 7 files changed, 751 insertions(+), 307 deletions(-) (limited to 'src') diff --git a/src/guff/views/dialogs/admin/blog-edit.cr b/src/guff/views/dialogs/admin/blog-edit.cr index c45c1b5..ed5d11d 100644 --- a/src/guff/views/dialogs/admin/blog-edit.cr +++ b/src/guff/views/dialogs/admin/blog-edit.cr @@ -1,5 +1,35 @@ require "./post-edit" class Guff::Views::Dialogs::Admin::BlogEdit < Guff::Views::Dialogs::Admin::PostEdit + TABS = [{ + :id => "content", + :css => "active", + :icon => "fa-pencil", + :name => "Content", + :text => "View content tab.", + }, { + :id => "category", + :css => "", + :icon => "fa-list-ul", + :name => "Category", + :text => "View category tab.", + }, { + :id => "dates", + :css => "", + :icon => "fa-calendar-o", + :name => "Dates", + :text => "View dates tab.", + }, { + :id => "media", + :css => "", + :icon => "fa-video-camera", + :name => "Media", + :text => "View media tab.", + }] + + private def tabs + super("blog-edit", TABS) + end + ECR.def_to_s("src/views/dialogs/admin/blog-edit.ecr") end diff --git a/src/guff/views/dialogs/admin/page-edit.cr b/src/guff/views/dialogs/admin/page-edit.cr index 1df8b30..10ad2b8 100644 --- a/src/guff/views/dialogs/admin/page-edit.cr +++ b/src/guff/views/dialogs/admin/page-edit.cr @@ -1,6 +1,30 @@ require "./post-edit" class Guff::Views::Dialogs::Admin::PageEdit < Guff::Views::Dialogs::Admin::PostEdit + 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 => "dates", + :css => "", + :icon => "fa-calendar-o", + :name => "Dates", + :text => "View dates tab.", + }] + + private def tabs + super("page-edit", TABS) + end + OPTION = "" private def theme_options diff --git a/src/guff/views/dialogs/admin/post-edit.cr b/src/guff/views/dialogs/admin/post-edit.cr index abaaa50..7398c17 100644 --- a/src/guff/views/dialogs/admin/post-edit.cr +++ b/src/guff/views/dialogs/admin/post-edit.cr @@ -22,4 +22,14 @@ class Guff::Views::Dialogs::Admin::PostEdit < Guff::Views::HTMLView end end end + + OPTION = "" + + protected def site_options + @site_options ||= String.build do |io| + @context.models.site.get_sites.each do |row| + io << OPTION % %w{site_id name}.map { |key| h(row[key]) } + end + end + end end diff --git a/src/guff/views/dialogs/admin/project-edit.cr b/src/guff/views/dialogs/admin/project-edit.cr index 0a229b3..521fbbb 100644 --- a/src/guff/views/dialogs/admin/project-edit.cr +++ b/src/guff/views/dialogs/admin/project-edit.cr @@ -1,5 +1,53 @@ require "./post-edit" class Guff::Views::Dialogs::Admin::ProjectEdit < Guff::Views::Dialogs::Admin::PostEdit + TABS = [{ + :id => "content", + :css => "active", + :icon => "fa-pencil", + :name => "Content", + :text => "View content tab.", + }, { + :id => "repo", + :css => "", + :icon => "fa-code-fork", + :name => "Repository", + :text => "View repository tab.", + }, { + :id => "releases", + :css => "hidden", + :icon => "fa-code-fork", + :name => "Releases", + :text => "View releases tab.", + }, { + :id => "dates", + :css => "hidden", + :icon => "fa-calendar-o", + :name => "Dates", + :text => "View dates tab.", + }] + + private def tabs + super("project-edit", TABS) + end + + REPO_TABS = [{ + :id => "releases", + :css => "active", + :icon => "fa-code-fork", + :name => "Releases", + :text => "View releases.", + }, { + :id => "update-log", + :css => "", + :icon => "fa-list-ul", + :name => "Update Log", + :text => "View update log.", + }] + + private def repo_tabs + tabs("project-edit-repo", REPO_TABS) + end + ECR.def_to_s("src/views/dialogs/admin/project-edit.ecr") end diff --git a/src/views/dialogs/admin/blog-edit.ecr b/src/views/dialogs/admin/blog-edit.ecr index bbe946f..53c0073 100644 --- a/src/views/dialogs/admin/blog-edit.ecr +++ b/src/views/dialogs/admin/blog-edit.ecr @@ -20,120 +20,184 @@