From: Jason Woofenden Date: Fri, 1 Jan 2016 20:40:05 +0000 (-0500) Subject: can choose page layouts, edit sidebar, etc X-Git-Url: https://jasonwoof.com/gitweb/?p=wfpl-cms.git;a=commitdiff_plain;h=829a67d41aacdf529455c0f315665c407ad5d35b can choose page layouts, edit sidebar, etc --- diff --git a/admin_pages.html b/admin_pages.html index e6630f5..72252ad 100644 --- a/admin_pages.html +++ b/admin_pages.html @@ -213,11 +213,11 @@ }); } }); - function make_wysiwyg(name) { + function make_wysiwyg(name, bodyid_postfix) { CKEDITOR.replace(name, { 'contentsCss': 'css.css?m=~css.css mtime~', 'allowedContent': true, - bodyId: '~$basename~' + '_wysiwyg_' + name, + bodyId: '~$basename~' + '_wysiwyg_' + (bodyid_postfix ? bodyid_postfix : name), 'stylesSet': [ { name: 'Paragraph', element: 'p'}, { name: 'Page Headline', element: 'h1'}, @@ -249,6 +249,43 @@ ] }); } + window.admin_pages_cur_layout = null + function admin_pages_layout(layout) { + if (layout === undefined) { + layout = document.getElementById('layout').value + } + if (typeof layout === 'string') { + layout = parseInt(layout); + } + console.log(layout); + if (layout === window.admin_pages_cur_layout) { + return; + } + // hide/show sidebar editor + if (layout === 0) { + document.getElementById('sidebar_editor').style.display = 'none' + } else { + document.getElementById('sidebar_editor').style.display = 'block' + } + // remove existing ckeditors + if (window.admin_pages_cur_layout !== null) { + for (name in CKEDITOR.instances) { + CKEDITOR.instances[name].destroy(); + } + } + // create ckeditors + if (layout === 0) { + make_wysiwyg('content', 'content_full_main'); + } else if (layout === 1) { + make_wysiwyg('content', 'content_with_sidebar_main'); + make_wysiwyg('sidebar_content', 'content_with_sidebar_sidebar_plain'); + } else { + make_wysiwyg('content', 'content_with_sidebar_main'); + make_wysiwyg('sidebar_content', 'content_with_sidebar_sidebar_bordered'); + } + + window.admin_pages_cur_layout = layout + } @@ -279,6 +316,9 @@
(If you'd like this page to appear in the navigation with a shorter title.)
+
Page Template/Layout
+
+
Page Contents
-
+
+ + + + - -
+ + + +
+