From e7e574a556b699395d98d32b56fe7f5492b2463c Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Thu, 28 Jul 2016 22:46:02 -0400 Subject: populate import/export settings pane --- data/assets/js/admin/tabs/import.js | 17 +++++ src/guff/views/pages/admin.cr | 1 + src/guff/views/panes/settings/import.cr | 10 +++ src/views/panes/settings/import.ecr | 124 +++++++++++++++++++++++++++++++- 4 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 data/assets/js/admin/tabs/import.js diff --git a/data/assets/js/admin/tabs/import.js b/data/assets/js/admin/tabs/import.js new file mode 100644 index 0000000..2d5bd7f --- /dev/null +++ b/data/assets/js/admin/tabs/import.js @@ -0,0 +1,17 @@ +jQuery(function($) { + "use strict"; + + $('#import-posts').click(function() { + alert('TODO: import'); + + // stop event + return false; + }); + + $('#export-posts').click(function() { + alert('TODO: export posts'); + + // stop event + return false; + }); +}); diff --git a/src/guff/views/pages/admin.cr b/src/guff/views/pages/admin.cr index 16d3eb0..dd8537d 100644 --- a/src/guff/views/pages/admin.cr +++ b/src/guff/views/pages/admin.cr @@ -22,6 +22,7 @@ class Guff::Views::Pages::Admin < Guff::Views::HTMLView assets/js/dropdown.js assets/js/admin/tabs/posts.js assets/js/admin/tabs/files.js + assets/js/admin/tabs/import.js assets/js/admin/tabs/users.js assets/js/admin/tabs/themes.js assets/js/admin/dialogs/user-add.js diff --git a/src/guff/views/panes/settings/import.cr b/src/guff/views/panes/settings/import.cr index 244dba3..6406de6 100644 --- a/src/guff/views/panes/settings/import.cr +++ b/src/guff/views/panes/settings/import.cr @@ -1,3 +1,13 @@ class Guff::Views::Panes::Settings::Import < Guff::Views::HTMLView + OPTION = "" + + private 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 + ECR.def_to_s("src/views/panes/settings/import.ecr") end diff --git a/src/views/panes/settings/import.ecr b/src/views/panes/settings/import.ecr index fe8e94f..5201e77 100644 --- a/src/views/panes/settings/import.ecr +++ b/src/views/panes/settings/import.ecr @@ -5,12 +5,134 @@ >
+ + + Import Blog Posts +

- TODO: import + This panel allows you to import blog posts.

+ +

+ Use the file input field below to select an input + WXR + file, select a destination site, then press the "Import Blog + Posts" button to import your blog posts. +

+ +
+ + + + +

+ Source file (in WXR format) containing blog posts. +

+
+ +
+ + + + +

+ Destination site for imported blog posts. +

+
+ + +
+
+ +
+
+ + + Export Blog Posts + +
+ +
+

+ This panel allows you to export blog posts. +

+ +

+ Choose a source site, then click the "Export Blog Posts" button + below to export blog posts in + WXR format. +

+ +
+ + + + +

+ Source site of blog posts to export. +

+
+ +
-- cgit v1.2.3