From bff93d5b6a46e6c996e43dc4d669a4514da87cc6 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Thu, 28 Jul 2016 02:10:45 -0400 Subject: refactor dialog and pane templates --- src/guff/handlers.cr | 2 +- src/guff/views/admin-page.cr | 177 ++++++++ src/guff/views/admin/dialogs/blog-edit.cr | 5 - src/guff/views/admin/dialogs/page-edit.cr | 24 -- src/guff/views/admin/dialogs/post-edit.cr | 16 - src/guff/views/admin/dialogs/project-edit.cr | 5 - src/guff/views/admin/dialogs/user-add.cr | 5 - src/guff/views/admin/dialogs/user-edit.cr | 5 - src/guff/views/admin/dialogs/user.cr | 11 - src/guff/views/admin/page.cr | 199 --------- src/guff/views/dialogs/admin/blog-edit.cr | 5 + src/guff/views/dialogs/admin/page-edit.cr | 24 ++ src/guff/views/dialogs/admin/post-edit.cr | 16 + src/guff/views/dialogs/admin/project-edit.cr | 5 + src/guff/views/dialogs/admin/user-add.cr | 5 + src/guff/views/dialogs/admin/user-edit.cr | 5 + src/guff/views/dialogs/admin/user.cr | 11 + src/guff/views/panes/admin/files.cr | 5 + src/guff/views/panes/admin/home.cr | 5 + src/guff/views/panes/admin/pane.cr | 7 + src/guff/views/panes/admin/posts.cr | 36 ++ src/views/admin-page.ecr | 268 ++++++++++++ src/views/admin/dialogs/blog-edit.ecr | 166 -------- src/views/admin/dialogs/page-edit.ecr | 175 -------- src/views/admin/dialogs/project-edit.ecr | 179 -------- src/views/admin/dialogs/user-add.ecr | 164 -------- src/views/admin/dialogs/user-edit.ecr | 178 -------- src/views/admin/page.ecr | 588 --------------------------- src/views/dialogs/admin/blog-edit.ecr | 166 ++++++++ src/views/dialogs/admin/page-edit.ecr | 175 ++++++++ src/views/dialogs/admin/project-edit.ecr | 179 ++++++++ src/views/dialogs/admin/user-add.ecr | 164 ++++++++ src/views/dialogs/admin/user-edit.ecr | 178 ++++++++ src/views/panes/admin/files.ecr | 124 ++++++ src/views/panes/admin/home.ecr | 21 + src/views/panes/admin/posts.ecr | 175 ++++++++ 36 files changed, 1752 insertions(+), 1721 deletions(-) create mode 100644 src/guff/views/admin-page.cr delete mode 100644 src/guff/views/admin/dialogs/blog-edit.cr delete mode 100644 src/guff/views/admin/dialogs/page-edit.cr delete mode 100644 src/guff/views/admin/dialogs/post-edit.cr delete mode 100644 src/guff/views/admin/dialogs/project-edit.cr delete mode 100644 src/guff/views/admin/dialogs/user-add.cr delete mode 100644 src/guff/views/admin/dialogs/user-edit.cr delete mode 100644 src/guff/views/admin/dialogs/user.cr delete mode 100644 src/guff/views/admin/page.cr create mode 100644 src/guff/views/dialogs/admin/blog-edit.cr create mode 100644 src/guff/views/dialogs/admin/page-edit.cr create mode 100644 src/guff/views/dialogs/admin/post-edit.cr create mode 100644 src/guff/views/dialogs/admin/project-edit.cr create mode 100644 src/guff/views/dialogs/admin/user-add.cr create mode 100644 src/guff/views/dialogs/admin/user-edit.cr create mode 100644 src/guff/views/dialogs/admin/user.cr create mode 100644 src/guff/views/panes/admin/files.cr create mode 100644 src/guff/views/panes/admin/home.cr create mode 100644 src/guff/views/panes/admin/pane.cr create mode 100644 src/guff/views/panes/admin/posts.cr create mode 100644 src/views/admin-page.ecr delete mode 100644 src/views/admin/dialogs/blog-edit.ecr delete mode 100644 src/views/admin/dialogs/page-edit.ecr delete mode 100644 src/views/admin/dialogs/project-edit.ecr delete mode 100644 src/views/admin/dialogs/user-add.ecr delete mode 100644 src/views/admin/dialogs/user-edit.ecr delete mode 100644 src/views/admin/page.ecr create mode 100644 src/views/dialogs/admin/blog-edit.ecr create mode 100644 src/views/dialogs/admin/page-edit.ecr create mode 100644 src/views/dialogs/admin/project-edit.ecr create mode 100644 src/views/dialogs/admin/user-add.ecr create mode 100644 src/views/dialogs/admin/user-edit.ecr create mode 100644 src/views/panes/admin/files.ecr create mode 100644 src/views/panes/admin/home.ecr create mode 100644 src/views/panes/admin/posts.ecr diff --git a/src/guff/handlers.cr b/src/guff/handlers.cr index a44140a..2670f89 100644 --- a/src/guff/handlers.cr +++ b/src/guff/handlers.cr @@ -215,7 +215,7 @@ module Guff::Handlers context.response.headers["x-frame-options"] = "SAMEORIGIN" context.response.content_type = "text/html; charset=utf-8" context.response.status_code = 200 - Views::Admin::PageView.new(@context).to_s(context.response) + Views::AdminPageView.new(@context).to_s(context.response) else call_next(context) end diff --git a/src/guff/views/admin-page.cr b/src/guff/views/admin-page.cr new file mode 100644 index 0000000..aaa5104 --- /dev/null +++ b/src/guff/views/admin-page.cr @@ -0,0 +1,177 @@ +require "./html" +require "./dialogs/*" +require "./panes/*" + +class Guff::Views::AdminPageView < Guff::Views::HTMLView + TITLE = "Guff Admin" + + POST_TYPES = { + blog: { + id: "blog", + name: "Blog Post", + icon: "fa-sticky-note-o", + }, + + page: { + id: "page", + name: "Page", + icon: "fa-file-text-o", + }, + + project: { + id: "project", + name: "Project", + icon: "fa-cube", + }, + } + + TABS = { + "admin" => [{ + :id => "home", + :css => "active", + :icon => "fa-home", + :name => "Home", + :text => "View home tab.", + }, { + :id => "posts", + :css => "", + :icon => "fa-cubes", + :name => "Posts", + :text => "Manage blog, pages, and projects.", + }, { + :id => "files", + :css => "", + :icon => "fa-files-o", + :name => "Files", + :text => "Manage files.", + }, { + :id => "settings", + :css => "", + :icon => "fa-cogs", + :name => "Settings", + :text => "Configure settings.", + }], + + "settings" => [{ + :id => "general", + :css => "active", + :icon => "fa-cog", + :name => "General", + :text => "Manage general settings.", + }, { + :id => "backups", + :css => "", + :icon => "fa-archive", + :name => "Backups", + :text => "Manage backups.", + }, { + :id => "import", + :css => "", + :icon => "fa-upload", + :name => "Import / Export", + :text => "Import and export posts.", + }, { + :id => "sites", + :css => "", + :icon => "fa-sitemap", + :name => "Sites", + :text => "Manage sites and domains.", + }, { + :id => "themes", + :css => "", + :icon => "fa-eye", + :name => "Themes", + :text => "Manage themes.", + }, { + :id => "users", + :css => "", + :icon => "fa-users", + :name => "Users", + :text => "Manage users and permissions.", + }], + } + + NEW_POST_MENU_ITEM = " +
  • + + + %s + +
  • + " + + TEMPLATES = { + :option => " + + ", + + :new_post_button => " + + + Create + + + + + ", + + :state_button => " + + + %s + + ", + } + + def tabs(id : String) + super(id, TABS[id]) + end + + private def new_post_button + TEMPLATES[:new_post_button] + end + + private def page_data + { post_types: POST_TYPES}.to_json + end + + private def dialogs + String.build do |io| + io << Dialogs::Admin::UserAdd.new(@context) + io << Dialogs::Admin::UserEdit.new(@context) + io << Dialogs::Admin::BlogEdit.new(@context) + io << Dialogs::Admin::PageEdit.new(@context) + io << Dialogs::Admin::ProjectEdit.new(@context) + end + end + + private def admin_panes + String.build do |io| + io << Panes::Admin::Home.new(@context) + io << Panes::Admin::Posts.new(@context) + io << Panes::Admin::Files.new(@context) + end + end + + ECR.def_to_s("src/views/admin-page.ecr") +end diff --git a/src/guff/views/admin/dialogs/blog-edit.cr b/src/guff/views/admin/dialogs/blog-edit.cr deleted file mode 100644 index 409b8d3..0000000 --- a/src/guff/views/admin/dialogs/blog-edit.cr +++ /dev/null @@ -1,5 +0,0 @@ -require "./post-edit" - -class Guff::Views::Admin::Dialogs::BlogEdit < Guff::Views::Admin::Dialogs::PostEdit - ECR.def_to_s("src/views/admin/dialogs/blog-edit.ecr") -end diff --git a/src/guff/views/admin/dialogs/page-edit.cr b/src/guff/views/admin/dialogs/page-edit.cr deleted file mode 100644 index 138691d..0000000 --- a/src/guff/views/admin/dialogs/page-edit.cr +++ /dev/null @@ -1,24 +0,0 @@ -require "./post-edit" - -class Guff::Views::Admin::Dialogs::PageEdit < Guff::Views::Admin::Dialogs::PostEdit - private def theme_options - tmpl = Guff::Views::Admin::PageView::TEMPLATES[:option] - - [{ - "id" => "site-default", - "name" => "Site Default", - }].concat(@context.models.theme.all.map { |row| - { - "id" => row["theme_id"], - "name" => "%s (%s)" % %w{ - name - version - }.map { |k| row["theme_#{k}"] }, - } - }).map { |row| - tmpl % %w{id name}.map { |k| row[k] } - }.join("") - end - - ECR.def_to_s("src/views/admin/dialogs/page-edit.ecr") -end diff --git a/src/guff/views/admin/dialogs/post-edit.cr b/src/guff/views/admin/dialogs/post-edit.cr deleted file mode 100644 index f817d5c..0000000 --- a/src/guff/views/admin/dialogs/post-edit.cr +++ /dev/null @@ -1,16 +0,0 @@ -class Guff::Views::Admin::Dialogs::PostEdit < Guff::Views::HTMLView - protected def state_buttons - tmpl = Guff::Views::Admin::PageView::TEMPLATES[:state_button] - - @state_buttons ||= String.build do |io| - @context.models.state.get_states.each do |row| - io << tmpl % [ - h(row["name"]), - h(row["state"]), - h(row["icon"]), - h(row["name"]) - ] - end - end - end -end diff --git a/src/guff/views/admin/dialogs/project-edit.cr b/src/guff/views/admin/dialogs/project-edit.cr deleted file mode 100644 index 0db1f11..0000000 --- a/src/guff/views/admin/dialogs/project-edit.cr +++ /dev/null @@ -1,5 +0,0 @@ -require "./post-edit" - -class Guff::Views::Admin::Dialogs::ProjectEdit < Guff::Views::Admin::Dialogs::PostEdit - ECR.def_to_s("src/views/admin/dialogs/project-edit.ecr") -end diff --git a/src/guff/views/admin/dialogs/user-add.cr b/src/guff/views/admin/dialogs/user-add.cr deleted file mode 100644 index 1a404fe..0000000 --- a/src/guff/views/admin/dialogs/user-add.cr +++ /dev/null @@ -1,5 +0,0 @@ -require "./user" - -class Guff::Views::Admin::Dialogs::UserAdd < Guff::Views::Admin::Dialogs::User - ECR.def_to_s("src/views/admin/dialogs/user-add.ecr") -end diff --git a/src/guff/views/admin/dialogs/user-edit.cr b/src/guff/views/admin/dialogs/user-edit.cr deleted file mode 100644 index 27789b7..0000000 --- a/src/guff/views/admin/dialogs/user-edit.cr +++ /dev/null @@ -1,5 +0,0 @@ -require "./user" - -class Guff::Views::Admin::Dialogs::UserEdit < Guff::Views::Admin::Dialogs::User - ECR.def_to_s("src/views/admin/dialogs/user-edit.ecr") -end diff --git a/src/guff/views/admin/dialogs/user.cr b/src/guff/views/admin/dialogs/user.cr deleted file mode 100644 index 4dea3cf..0000000 --- a/src/guff/views/admin/dialogs/user.cr +++ /dev/null @@ -1,11 +0,0 @@ -class Guff::Views::Admin::Dialogs::User < Guff::Views::HTMLView - protected def role_options - tmpl = Guff::Views::Admin::PageView::TEMPLATES[:option] - - @role_options ||= String.build do |io| - @context.models.role.get_roles.each do |row| - io << tmpl % %w{role name}.map { |key| h(row[key]) } - end - end - end -end diff --git a/src/guff/views/admin/page.cr b/src/guff/views/admin/page.cr deleted file mode 100644 index fe37ce5..0000000 --- a/src/guff/views/admin/page.cr +++ /dev/null @@ -1,199 +0,0 @@ -require "../html" -require "./dialogs/*" - -class Guff::Views::Admin::PageView < Guff::Views::HTMLView - TITLE = "Guff Admin" - - POST_TYPES = { - blog: { - id: "blog", - name: "Blog Post", - icon: "fa-sticky-note-o", - }, - - page: { - id: "page", - name: "Page", - icon: "fa-file-text-o", - }, - - project: { - id: "project", - name: "Project", - icon: "fa-cube", - }, - } - - TABS = { - "admin" => [{ - :id => "home", - :css => "active", - :icon => "fa-home", - :name => "Home", - :text => "View home tab.", - }, { - :id => "posts", - :css => "", - :icon => "fa-cubes", - :name => "Posts", - :text => "Manage blog, pages, and projects.", - }, { - :id => "files", - :css => "", - :icon => "fa-files-o", - :name => "Files", - :text => "Manage files.", - }, { - :id => "settings", - :css => "", - :icon => "fa-cogs", - :name => "Settings", - :text => "Configure settings.", - }], - - "settings" => [{ - :id => "general", - :css => "active", - :icon => "fa-cog", - :name => "General", - :text => "Manage general settings.", - }, { - :id => "backups", - :css => "", - :icon => "fa-archive", - :name => "Backups", - :text => "Manage backups.", - }, { - :id => "import", - :css => "", - :icon => "fa-upload", - :name => "Import / Export", - :text => "Import and export posts.", - }, { - :id => "sites", - :css => "", - :icon => "fa-sitemap", - :name => "Sites", - :text => "Manage sites and domains.", - }, { - :id => "themes", - :css => "", - :icon => "fa-eye", - :name => "Themes", - :text => "Manage themes.", - }, { - :id => "users", - :css => "", - :icon => "fa-users", - :name => "Users", - :text => "Manage users and permissions.", - }], - } - - NEW_POST_MENU_ITEM = " -
  • - - - %s - -
  • - " - - TEMPLATES = { - :option => " - - ", - - :new_post_button => " - - - Create - - - - - ", - - :state_button => " - - - %s - - ", - } - - def tabs(id : String) - super(id, TABS[id]) - end - - private def new_post_button - TEMPLATES[:new_post_button] - end - - private def authors_menu_items - @context.models.user.get_users.map do |row| - { - :id => row["user_id"], - :name => row["name"], - :text => "Show author \"%s\"." % [row["name"]], - } - end - end - - private def sites_menu_items - @context.models.site.get_sites.map do |row| - { - :id => row["site_id"], - :name => row["name"], - :text => "Show site \"%s\"." % [row["name"]], - } - end - end - - private def states_menu_items - @context.models.state.get_states.map do |row| - { - :id => row["state"], - :name => row["name"], - :icon => row["icon"], - :text => "Show state \"%s\"." % [row["name"]], - } - end - end - - private def page_data - { post_types: POST_TYPES}.to_json - end - - private def dialogs - String.build do |io| - io << Dialogs::UserAdd.new(@context) - io << Dialogs::UserEdit.new(@context) - io << Dialogs::BlogEdit.new(@context) - io << Dialogs::PageEdit.new(@context) - io << Dialogs::ProjectEdit.new(@context) - end - end - - ECR.def_to_s("src/views/admin/page.ecr") -end diff --git a/src/guff/views/dialogs/admin/blog-edit.cr b/src/guff/views/dialogs/admin/blog-edit.cr new file mode 100644 index 0000000..c45c1b5 --- /dev/null +++ b/src/guff/views/dialogs/admin/blog-edit.cr @@ -0,0 +1,5 @@ +require "./post-edit" + +class Guff::Views::Dialogs::Admin::BlogEdit < Guff::Views::Dialogs::Admin::PostEdit + 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 new file mode 100644 index 0000000..363ee00 --- /dev/null +++ b/src/guff/views/dialogs/admin/page-edit.cr @@ -0,0 +1,24 @@ +require "./post-edit" + +class Guff::Views::Dialogs::Admin::PageEdit < Guff::Views::Dialogs::Admin::PostEdit + private def theme_options + tmpl = Guff::Views::AdminPageView::TEMPLATES[:option] + + [{ + "id" => "site-default", + "name" => "Site Default", + }].concat(@context.models.theme.all.map { |row| + { + "id" => row["theme_id"], + "name" => "%s (%s)" % %w{ + name + version + }.map { |k| row["theme_#{k}"] }, + } + }).map { |row| + tmpl % %w{id name}.map { |k| row[k] } + }.join("") + end + + ECR.def_to_s("src/views/dialogs/admin/page-edit.ecr") +end diff --git a/src/guff/views/dialogs/admin/post-edit.cr b/src/guff/views/dialogs/admin/post-edit.cr new file mode 100644 index 0000000..640580e --- /dev/null +++ b/src/guff/views/dialogs/admin/post-edit.cr @@ -0,0 +1,16 @@ +class Guff::Views::Dialogs::Admin::PostEdit < Guff::Views::HTMLView + protected def state_buttons + tmpl = Guff::Views::AdminPageView::TEMPLATES[:state_button] + + @state_buttons ||= String.build do |io| + @context.models.state.get_states.each do |row| + io << tmpl % [ + h(row["name"]), + h(row["state"]), + h(row["icon"]), + h(row["name"]) + ] + end + end + end +end diff --git a/src/guff/views/dialogs/admin/project-edit.cr b/src/guff/views/dialogs/admin/project-edit.cr new file mode 100644 index 0000000..0a229b3 --- /dev/null +++ b/src/guff/views/dialogs/admin/project-edit.cr @@ -0,0 +1,5 @@ +require "./post-edit" + +class Guff::Views::Dialogs::Admin::ProjectEdit < Guff::Views::Dialogs::Admin::PostEdit + ECR.def_to_s("src/views/dialogs/admin/project-edit.ecr") +end diff --git a/src/guff/views/dialogs/admin/user-add.cr b/src/guff/views/dialogs/admin/user-add.cr new file mode 100644 index 0000000..38a248a --- /dev/null +++ b/src/guff/views/dialogs/admin/user-add.cr @@ -0,0 +1,5 @@ +require "./user" + +class Guff::Views::Dialogs::Admin::UserAdd < Guff::Views::Dialogs::Admin::User + ECR.def_to_s("src/views/dialogs/admin/user-add.ecr") +end diff --git a/src/guff/views/dialogs/admin/user-edit.cr b/src/guff/views/dialogs/admin/user-edit.cr new file mode 100644 index 0000000..cd73500 --- /dev/null +++ b/src/guff/views/dialogs/admin/user-edit.cr @@ -0,0 +1,5 @@ +require "./user" + +class Guff::Views::Dialogs::Admin::UserEdit < Guff::Views::Dialogs::Admin::User + ECR.def_to_s("src/views/dialogs/admin/user-edit.ecr") +end diff --git a/src/guff/views/dialogs/admin/user.cr b/src/guff/views/dialogs/admin/user.cr new file mode 100644 index 0000000..fbb71da --- /dev/null +++ b/src/guff/views/dialogs/admin/user.cr @@ -0,0 +1,11 @@ +class Guff::Views::Dialogs::Admin::User < Guff::Views::HTMLView + protected def role_options + tmpl = Guff::Views::AdminPageView::TEMPLATES[:option] + + @role_options ||= String.build do |io| + @context.models.role.get_roles.each do |row| + io << tmpl % %w{role name}.map { |key| h(row[key]) } + end + end + end +end diff --git a/src/guff/views/panes/admin/files.cr b/src/guff/views/panes/admin/files.cr new file mode 100644 index 0000000..adcda26 --- /dev/null +++ b/src/guff/views/panes/admin/files.cr @@ -0,0 +1,5 @@ +require "./pane" + +class Guff::Views::Panes::Admin::Files < Guff::Views::Panes::Admin::Pane + ECR.def_to_s("src/views/panes/admin/files.ecr") +end diff --git a/src/guff/views/panes/admin/home.cr b/src/guff/views/panes/admin/home.cr new file mode 100644 index 0000000..b5be8c2 --- /dev/null +++ b/src/guff/views/panes/admin/home.cr @@ -0,0 +1,5 @@ +require "./pane" + +class Guff::Views::Panes::Admin::Home < Guff::Views::Panes::Admin::Pane + ECR.def_to_s("src/views/panes/admin/home.ecr") +end diff --git a/src/guff/views/panes/admin/pane.cr b/src/guff/views/panes/admin/pane.cr new file mode 100644 index 0000000..eba64d8 --- /dev/null +++ b/src/guff/views/panes/admin/pane.cr @@ -0,0 +1,7 @@ +require "../../html" + +class Guff::Views::Panes::Admin::Pane < Guff::Views::HTMLView + protected def new_post_button + Guff::Views::AdminPageView::TEMPLATES[:new_post_button] + end +end diff --git a/src/guff/views/panes/admin/posts.cr b/src/guff/views/panes/admin/posts.cr new file mode 100644 index 0000000..13f51ce --- /dev/null +++ b/src/guff/views/panes/admin/posts.cr @@ -0,0 +1,36 @@ +require "./pane" + +class Guff::Views::Panes::Admin::Posts < Guff::Views::Panes::Admin::Pane + private def authors_menu_items + @context.models.user.get_users.map do |row| + { + :id => row["user_id"], + :name => row["name"], + :text => "Show author \"%s\"." % [row["name"]], + } + end + end + + private def sites_menu_items + @context.models.site.get_sites.map do |row| + { + :id => row["site_id"], + :name => row["name"], + :text => "Show site \"%s\"." % [row["name"]], + } + end + end + + private def states_menu_items + @context.models.state.get_states.map do |row| + { + :id => row["state"], + :name => row["name"], + :icon => row["icon"], + :text => "Show state \"%s\"." % [row["name"]], + } + end + end + + ECR.def_to_s("src/views/panes/admin/posts.ecr") +end diff --git a/src/views/admin-page.ecr b/src/views/admin-page.ecr new file mode 100644 index 0000000..5b9f352 --- /dev/null +++ b/src/views/admin-page.ecr @@ -0,0 +1,268 @@ + + + + + <%= h(TITLE) %> + + <%= + styles %w{ + assets/font-awesome-4.5.0/css/font-awesome.min.css + assets/bootstrap-3.3.6/css/bootstrap.min.css + assets/bootstrap-3.3.6/css/bootstrap-theme.min.css + assets/css/admin.css + } + %> + + + + + +
    +
    + + +
    + <%= admin_panes %> + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    + +
    +

    + TODO: general settings +

    +
    +
    +
    + +
    +
    +
    + +
    + + + +
    + + + Loading... + +
    +
    +
    + +
    +
    +
    +
    + +
    +

    + TODO: themes +

    +
    +
    +
    + +
    +
    +
    +
    + +
    +

    + TODO: sites settings +

    +
    +
    +
    + +
    +
    +
    +
    + +
    +

    + TODO: backups +

    +
    +
    +
    + +
    +
    +
    +
    + +
    +

    + TODO: import +

    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + <%= dialogs %> + + + + + <%= + scripts %w{ + assets/jquery-2.2.1.min.js + assets/luigi-template-0.4.1.min.js + assets/js/util.js + assets/bootstrap-3.3.6/js/bootstrap.min.js + assets/ckeditor-4.5.8-custom/ckeditor.js + assets/js/search-field.js + assets/js/dropdown.js + assets/js/admin/tabs/users.js + assets/js/admin/tabs/posts.js + assets/js/admin/tabs/files.js + assets/js/admin/dialogs/user-add.js + assets/js/admin/dialogs/user-edit.js + assets/js/admin/dialogs/post-edit.js + assets/js/admin/dialogs/blog-edit.js + assets/js/admin/dialogs/page-edit.js + assets/js/admin/dialogs/project-edit.js + } + %> + diff --git a/src/views/admin/dialogs/blog-edit.ecr b/src/views/admin/dialogs/blog-edit.ecr deleted file mode 100644 index bbe946f..0000000 --- a/src/views/admin/dialogs/blog-edit.ecr +++ /dev/null @@ -1,166 +0,0 @@ - diff --git a/src/views/admin/dialogs/page-edit.ecr b/src/views/admin/dialogs/page-edit.ecr deleted file mode 100644 index c0b30e8..0000000 --- a/src/views/admin/dialogs/page-edit.ecr +++ /dev/null @@ -1,175 +0,0 @@ - diff --git a/src/views/admin/dialogs/project-edit.ecr b/src/views/admin/dialogs/project-edit.ecr deleted file mode 100644 index 59c89d4..0000000 --- a/src/views/admin/dialogs/project-edit.ecr +++ /dev/null @@ -1,179 +0,0 @@ - diff --git a/src/views/admin/dialogs/user-add.ecr b/src/views/admin/dialogs/user-add.ecr deleted file mode 100644 index 198ab69..0000000 --- a/src/views/admin/dialogs/user-add.ecr +++ /dev/null @@ -1,164 +0,0 @@ - diff --git a/src/views/admin/dialogs/user-edit.ecr b/src/views/admin/dialogs/user-edit.ecr deleted file mode 100644 index e0e39c2..0000000 --- a/src/views/admin/dialogs/user-edit.ecr +++ /dev/null @@ -1,178 +0,0 @@ - diff --git a/src/views/admin/page.ecr b/src/views/admin/page.ecr deleted file mode 100644 index c9c8a24..0000000 --- a/src/views/admin/page.ecr +++ /dev/null @@ -1,588 +0,0 @@ - - - - - <%= h(TITLE) %> - - <%= - styles %w{ - assets/font-awesome-4.5.0/css/font-awesome.min.css - assets/bootstrap-3.3.6/css/bootstrap.min.css - assets/bootstrap-3.3.6/css/bootstrap-theme.min.css - assets/css/admin.css - } - %> - - - - - -
    -
    - - -
    -
    -
    -
    -
    -
    <%= - new_post_button - %>
    -
    -
    - -
    -

    - TODO: home -

    -
    -
    -
    - -
    -
    -
    -
    -
    <%= - new_post_button - %>
    - -
    -    -
    - -
    <%= - dropdown( - id: "posts-filter-type", - css: "posts-filter-menu", - - name: "Type", - text: "Filter posts by type.", - - icon: "", - default: "all", - - items: [{ - :id => "all", - :name => "All", - :text => "Show all types.", - }, { - :type => "divider", - }] + %i{blog page project}.map { |id| - name = POST_TYPES[id][:name] - - { - :id => POST_TYPES[id][:id], - :name => name, - :icon => POST_TYPES[id][:icon], - :text => "Show #{name}s.", - } - } - ) - %>
    - -
    <%= - dropdown( - id: "posts-filter-state", - css: "posts-filter-menu", - - name: "State", - text: "Filter by post state.", - - icon: "", - default: "default", - - items: [{ - :id => "default", - :name => "Default", - :text => "Show drafts and posted items.", - }, { - :type => "divider", - }].concat(states_menu_items), - ) - %>
    - -
    <%= - dropdown( - id: "posts-filter-site", - css: "posts-filter-menu", - - name: "Site", - text: "Filter by site.", - - icon: "", - default: "all", - - items: [{ - :id => "all", - :name => "All", - :text => "Show all sites.", - }, { - :type => "divider", - }].concat(sites_menu_items), - ) - %>
    - -
    <%= - dropdown( - id: "posts-filter-user", - css: "posts-filter-menu", - - name: "Author", - text: "Filter by author.", - - icon: "", - default: "all", - - items: [{ - :id => "all", - :name => "All", - :text => "Show all authors.", - }, { - :type => "divider", - }].concat(authors_menu_items), - ) - %>
    - -
    - - - -
    - - -
    -
    - - - - - - - - - - - - - - - - - - -
     NameSiteSlugAuthorCreatedPosted
    -
    -
    - -
    -
    - - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    - -
    -

    - TODO: general settings -

    -
    -
    -
    - -
    -
    -
    - -
    - - - -
    - - - Loading... - -
    -
    -
    - -
    -
    -
    -
    - -
    -

    - TODO: themes -

    -
    -
    -
    - -
    -
    -
    -
    - -
    -

    - TODO: sites settings -

    -
    -
    -
    - -
    -
    -
    -
    - -
    -

    - TODO: backups -

    -
    -
    -
    - -
    -
    -
    -
    - -
    -

    - TODO: import -

    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - <%= dialogs %> - - - - - <%= - scripts %w{ - assets/jquery-2.2.1.min.js - assets/luigi-template-0.4.1.min.js - assets/js/util.js - assets/bootstrap-3.3.6/js/bootstrap.min.js - assets/ckeditor-4.5.8-custom/ckeditor.js - assets/js/search-field.js - assets/js/dropdown.js - assets/js/admin/tabs/users.js - assets/js/admin/tabs/posts.js - assets/js/admin/tabs/files.js - assets/js/admin/dialogs/user-add.js - assets/js/admin/dialogs/user-edit.js - assets/js/admin/dialogs/post-edit.js - assets/js/admin/dialogs/blog-edit.js - assets/js/admin/dialogs/page-edit.js - assets/js/admin/dialogs/project-edit.js - } - %> - diff --git a/src/views/dialogs/admin/blog-edit.ecr b/src/views/dialogs/admin/blog-edit.ecr new file mode 100644 index 0000000..bbe946f --- /dev/null +++ b/src/views/dialogs/admin/blog-edit.ecr @@ -0,0 +1,166 @@ + diff --git a/src/views/dialogs/admin/page-edit.ecr b/src/views/dialogs/admin/page-edit.ecr new file mode 100644 index 0000000..c0b30e8 --- /dev/null +++ b/src/views/dialogs/admin/page-edit.ecr @@ -0,0 +1,175 @@ + diff --git a/src/views/dialogs/admin/project-edit.ecr b/src/views/dialogs/admin/project-edit.ecr new file mode 100644 index 0000000..59c89d4 --- /dev/null +++ b/src/views/dialogs/admin/project-edit.ecr @@ -0,0 +1,179 @@ + diff --git a/src/views/dialogs/admin/user-add.ecr b/src/views/dialogs/admin/user-add.ecr new file mode 100644 index 0000000..198ab69 --- /dev/null +++ b/src/views/dialogs/admin/user-add.ecr @@ -0,0 +1,164 @@ + diff --git a/src/views/dialogs/admin/user-edit.ecr b/src/views/dialogs/admin/user-edit.ecr new file mode 100644 index 0000000..e0e39c2 --- /dev/null +++ b/src/views/dialogs/admin/user-edit.ecr @@ -0,0 +1,178 @@ + diff --git a/src/views/panes/admin/files.ecr b/src/views/panes/admin/files.ecr new file mode 100644 index 0000000..d5c4f0d --- /dev/null +++ b/src/views/panes/admin/files.ecr @@ -0,0 +1,124 @@ +
    +
    + + +
    +
    +
    +
    + +
    +
    +
    +
    diff --git a/src/views/panes/admin/home.ecr b/src/views/panes/admin/home.ecr new file mode 100644 index 0000000..af19b78 --- /dev/null +++ b/src/views/panes/admin/home.ecr @@ -0,0 +1,21 @@ +
    +
    +
    +
    +
    <%= + new_post_button + %>
    +
    +
    + +
    +

    + TODO: home +

    +
    +
    +
    diff --git a/src/views/panes/admin/posts.ecr b/src/views/panes/admin/posts.ecr new file mode 100644 index 0000000..5e6571d --- /dev/null +++ b/src/views/panes/admin/posts.ecr @@ -0,0 +1,175 @@ +
    +
    +
    +
    +
    <%= + new_post_button + %>
    + +
    +    +
    + +
    <%= + dropdown( + id: "posts-filter-type", + css: "posts-filter-menu", + + name: "Type", + text: "Filter posts by type.", + + icon: "", + default: "all", + + items: [{ + :id => "all", + :name => "All", + :text => "Show all types.", + }, { + :type => "divider", + }] + %i{blog page project}.map { |id| + # get post type + post_type = Guff::Views::AdminPageView::POST_TYPES[id] + + { + :id => post_type[:id], + :name => post_type[:name], + :icon => post_type[:icon], + :text => "Show #{post_type[:name]}s.", + } + } + ) + %>
    + +
    <%= + dropdown( + id: "posts-filter-state", + css: "posts-filter-menu", + + name: "State", + text: "Filter by post state.", + + icon: "", + default: "default", + + items: [{ + :id => "default", + :name => "Default", + :text => "Show drafts and posted items.", + }, { + :type => "divider", + }].concat(states_menu_items), + ) + %>
    + +
    <%= + dropdown( + id: "posts-filter-site", + css: "posts-filter-menu", + + name: "Site", + text: "Filter by site.", + + icon: "", + default: "all", + + items: [{ + :id => "all", + :name => "All", + :text => "Show all sites.", + }, { + :type => "divider", + }].concat(sites_menu_items), + ) + %>
    + +
    <%= + dropdown( + id: "posts-filter-user", + css: "posts-filter-menu", + + name: "Author", + text: "Filter by author.", + + icon: "", + default: "all", + + items: [{ + :id => "all", + :name => "All", + :text => "Show all authors.", + }, { + :type => "divider", + }].concat(authors_menu_items), + ) + %>
    + +
    + + + +
    + + +
    +
    + + + + + + + + + + + + + + + + + + +
     NameSiteSlugAuthorCreatedPosted
    +
    +
    -- cgit v1.2.3