start swapping out prototype for jquery
This commit is contained in:
parent
93cd19cfe7
commit
aa1f0d86bd
|
@ -44,9 +44,7 @@ function __comicpress_init() {
|
||||||
$comicpress = ComicPress::get_instance();
|
$comicpress = ComicPress::get_instance();
|
||||||
$comicpress->init();
|
$comicpress->init();
|
||||||
|
|
||||||
if (is_admin()) {
|
$comicpress_admin = new ComicPressAdmin();
|
||||||
$comicpress_admin = new ComicPressAdmin();
|
$comicpress_admin->init();
|
||||||
$comicpress_admin->init();
|
$comicpress_admin->handle_update();
|
||||||
$comicpress_admin->handle_update();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,56 +89,52 @@ var CategoryGroupings = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
CategoryGroupings.highlight_child_levels = function(e) {
|
CategoryGroupings.highlight_child_levels = function(e) {
|
||||||
$$('.category-group-holder input[type=checkbox]').each(function(cb) {
|
(function($) {
|
||||||
cb.disabled = false;
|
$('.category-group-holder input[type=checkbox]').attr('disabled', false);
|
||||||
});
|
|
||||||
|
|
||||||
$$('.category-group-holder li').each(function(li) {
|
$('.category-group-holder li')
|
||||||
var all_cb = li.select('input[type=checkbox]');
|
.removeClass('selected')
|
||||||
var cb = all_cb.shift();
|
.each(function() {
|
||||||
li.removeClassName('selected');
|
if ($(this).find('input[type=checkbox]:first').is('*:checked')) {
|
||||||
if (cb && cb.checked) {
|
$(this).addClass('selected').find('input[type=checkbox]').not("*:first").attr('disabled', true);
|
||||||
all_cb.each(function(ncb) {
|
}
|
||||||
ncb.disabled = true;
|
});
|
||||||
});
|
|
||||||
li.addClassName('selected');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$$('.category-group-holder').each(function(cgh) {
|
$('.category-group-holder').each(function() {
|
||||||
var all_off = true;
|
$(this).find('.empty-group-warning')[($(this).find('input:checked').length == 0) ? 'show' : 'hide'](250);
|
||||||
cgh.select('input[type=checkbox]').each(function(c) {
|
|
||||||
if (c.checked) { all_off = false; }
|
|
||||||
});
|
});
|
||||||
cgh.select('.empty-group-warning').pop()[all_off ? 'show' : 'hide']();
|
}(jQuery))
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CategoryGroupings.setup_editors = function() {
|
CategoryGroupings.setup_editors = function() {
|
||||||
$$('.category-group-holder input[type=checkbox], .category-group-holder label').each(function(cb) {
|
(function($) {
|
||||||
cb.stopObserving('click');
|
$('.category-group-holder input[type=checkbox], .category-group-holder label')
|
||||||
cb.observe('click', CategoryGroupings.highlight_child_levels);
|
.unbind('click')
|
||||||
});
|
.click(CategoryGroupings.highlight_child_levels);
|
||||||
|
}(jQuery))
|
||||||
}
|
}
|
||||||
|
|
||||||
CategoryGroupings.setup = function() {
|
CategoryGroupings.setup = function() {
|
||||||
CategoryGroupings.setup_editors();
|
CategoryGroupings.setup_editors();
|
||||||
CategoryGroupings.highlight_child_levels();
|
CategoryGroupings.highlight_child_levels();
|
||||||
|
|
||||||
$('add-new-category-group').observe('click', function(e) {
|
(function($) {
|
||||||
Event.stop(e);
|
$('#add-new-category-group').click(function() {
|
||||||
new Ajax.Updater('category-groups-holder', ComicPressAdmin.ajax_uri, {
|
$.post(
|
||||||
method: 'get',
|
ComicPressAdmin.ajax_uri,
|
||||||
parameters: {
|
{
|
||||||
'cp[_nonce]': ComicPressAdmin.nonce,
|
'cp[_nonce]': ComicPressAdmin.nonce,
|
||||||
'cp[action]': 'get-new-category-group-editor',
|
'cp[action]': 'get-new-category-group-editor',
|
||||||
'cp[_action_nonce]': ComicPressAdmin.category_group_editor_nonce
|
'cp[_action_nonce]': ComicPressAdmin.category_group_editor_nonce
|
||||||
},
|
},
|
||||||
onComplete: function() {
|
function(data) {
|
||||||
CategoryGroupings.setup_editors();
|
$('#category-groups-holder').append(data);
|
||||||
},
|
CategoryGroupings.setup_editors();
|
||||||
insertion: 'bottom'
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
});
|
}(jQuery));
|
||||||
}
|
}
|
||||||
}())
|
}())
|
||||||
|
|
|
@ -77,6 +77,7 @@ class ComicPressTagBuilderTest extends PHPUnit_Framework_TestCase {
|
||||||
/**
|
/**
|
||||||
* @dataProvider providerTestBuilder
|
* @dataProvider providerTestBuilder
|
||||||
*/
|
*/
|
||||||
|
// TODO same_category
|
||||||
function testStorylineBuilder($instructions, $expected_dbi_call, $expects_setup_postdata = false) {
|
function testStorylineBuilder($instructions, $expected_dbi_call, $expects_setup_postdata = false) {
|
||||||
global $post, $wp_test_expectations;
|
global $post, $wp_test_expectations;
|
||||||
$post = 'current-post';
|
$post = 'current-post';
|
||||||
|
|
Loading…
Reference in New Issue