diff --git a/classes/ComicPressAdmin.inc b/classes/ComicPressAdmin.inc index ac04a6c..a3d809d 100644 --- a/classes/ComicPressAdmin.inc +++ b/classes/ComicPressAdmin.inc @@ -135,11 +135,11 @@ class ComicPressAdmin { function _render_admin_storyline_tree($node, $parent_id = "0") { foreach ($node as $category_id => $children) { $category = get_category($category_id); - echo '
'; + echo '
'; echo '' . $category->name . ''; if (is_array($children)) { echo '
'; - $this->_render_admin_storyline_tree($children, $parent_id . '/' . $category_id); + $this->_render_admin_storyline_tree($children, $parent_id . '-' . $category_id); echo '
'; } echo '
'; @@ -235,9 +235,6 @@ class ComicPressAdmin { * Update ComicPress options. */ function handle_update_comicpress_options($info) { - foreach (array('helpers') as $type) { - $this->comicpress->comicpress_options[$type] = array(); - } foreach ($this->comicpress->comicpress_options as $option => $value) { if (isset($info[$option])) { switch ($option) { @@ -281,11 +278,6 @@ class ComicPressAdmin { } break; // @codeCoverageIgnoreStart - case 'helpers': - foreach ($info[$option] as $type => $set) { - $this->comicpress->comicpress_options[$option][$type] = true; - } - break; case 'storyline_order': $storyline = new ComicPressStoryline(); $storyline->normalize($info[$option]); @@ -328,6 +320,18 @@ class ComicPressAdmin { } } + function handle_update_get_new_image_type_editor($info) { + $type = substr(md5(rand()), 0, 6); + $info = array( + 'dimensions' => '100x100', + 'default' => false, + 'name' => 'New Type' + ); + + require_once('partials/_image-type-editor.inc'); + exit(0); + } + /** * Update the zoom slider info. * @param $info The browser input. diff --git a/classes/partials/options-admin.inc b/classes/partials/options-admin.inc index e343183..060b9f8 100644 --- a/classes/partials/options-admin.inc +++ b/classes/partials/options-admin.inc @@ -1,17 +1,19 @@

-
+

- -
- _render_admin_storyline_tree(reset($storyline->get_simple_storyline())) - ?> + +
+
+ _render_admin_storyline_tree(reset($storyline->get_simple_storyline())) + ?> +

Categories page)', 'comicpress') ?>

@@ -25,11 +27,13 @@
- Add a new image type + [+] Add a new image type
- +
+ +
diff --git a/css/cp-admin.css b/css/cp-admin.css index 6829e84..7007171 100644 --- a/css/cp-admin.css +++ b/css/cp-admin.css @@ -8,7 +8,13 @@ .cp-category-info span { cursor: move; - color: #004 + color: #33a; + font-size: 18px; + line-height: 22px +} + +.cp-category-info span:hover { + color: #46d; } #ordering-zoom-slider-holder { @@ -94,3 +100,10 @@ font-weight: bold; color: #aaa } + +#add-new-image-type { + font-size: 16px; + line-height: 16px; + display: block; + margin-bottom: 10px; +} \ No newline at end of file diff --git a/js/Storyline.js b/js/Storyline.js index 4b26337..0f3d855 100644 --- a/js/Storyline.js +++ b/js/Storyline.js @@ -3,10 +3,10 @@ var ComicImageTypes = {}; (function() { Storyline.get_order = function() { - var order = [] + var order = []; $$('#storyline-sorter .cp-category-info').each(function(info) { - var matches = info.id.match(/category_([0-9\/]+)/); - if (matches) { order.push(matches[1]); } + var matches = info.id.match(/category_([0-9\-]+)/); + if (matches) { order.push(matches[1].replace(/\-/g,'/')); } }); $$('input[name*=storyline_order]').pop().value = order.join(','); }; @@ -33,6 +33,20 @@ var ComicImageTypes = {}; }); }); }); + + Storyline.get_order(); + }; + + ComicImageTypes.setup_checkboxes = function() { + var checkboxes = $$('input[name*=default][name*=image_types]'); + checkboxes.each(function(c) { + c.stopObserving('change'); + c.observe('change', function(e) { + checkboxes.each(function(ch) { + if (e.target != ch) { ch.checked = false; } + }); + }); + }); }; ComicImageTypes.setup = function() { @@ -41,7 +55,7 @@ var ComicImageTypes = {}; if (closer) { closer.observe('click', function(e) { Event.stop(e); - if (confirm('Are you sure? Your templates may break after deleting this image type')) { + if (confirm('Are you sure? Your templates may break after deleting this image type.')) { new Effect.Fade(ith, { from: 1, to: 0, @@ -54,14 +68,7 @@ var ComicImageTypes = {}; } }); - var checkboxes = $$('input[name*=default][name*=image_types]'); - checkboxes.each(function(c) { - c.observe('change', function(e) { - checkboxes.each(function(ch) { - if (e.target != ch) { ch.checked = false; } - }); - }); - }); + ComicImageTypes.setup_checkboxes(); $('add-new-image-type').observe('click', function(e) { Event.stop(e); @@ -69,9 +76,12 @@ var ComicImageTypes = {}; method: 'get', parameters: { 'cp[_nonce]': ComicPressAdmin.nonce, - 'cp[ + 'cp[action]': 'get-new-image-type-editor' }, - insertion: 'bottom' + insertion: 'bottom', + onComplete: function() { + ComicImageTypes.setup_checkboxes(); + } }); }); };