commit
59a6e03da2
@ -53,3 +53,4 @@ h2. Contact
|
||||
Feel free to contact me at didier at nocoffee dot fr.
|
||||
|
||||
Copyright (c) 2011 NoCoffee, released under the MIT license
|
||||
...
|
||||
|
@ -53,6 +53,7 @@ javascripts:
|
||||
- public/javascripts/admin/account.js
|
||||
pages:
|
||||
- public/javascripts/admin/pages.js
|
||||
- public/javascripts/admin/plugins/menu_toggler.js
|
||||
edit_page:
|
||||
- public/javascripts/admin/plugins/tiny_mce/tinymce.js
|
||||
- public/javascripts/admin/editable_elements.js
|
||||
|
@ -1,21 +1,7 @@
|
||||
$(document).ready(function() {
|
||||
|
||||
// open / close folder
|
||||
$('#pages-list ul.folder img.toggler').click(function(e) {
|
||||
var toggler = $(this);
|
||||
var children = toggler.parent().find('> ul.folder');
|
||||
if (children.is(':visible')) {
|
||||
children.slideUp('fast', function() {
|
||||
toggler.attr('src', toggler.attr('src').replace('open', 'closed'));
|
||||
$.cookie(children.attr('id'), 'none');
|
||||
});
|
||||
} else {
|
||||
children.slideDown('fast', function() {
|
||||
toggler.attr('src', toggler.attr('src').replace('closed', 'open'));
|
||||
$.cookie(children.attr('id'), 'block');
|
||||
});
|
||||
}
|
||||
});
|
||||
$('#pages-list ul.folder img.toggler').toggleMe();
|
||||
|
||||
// sortable folder items
|
||||
$('#pages-list ul.folder').sortable({
|
||||
|
41
public/javascripts/admin/plugins/menu_toggler.js
Normal file
41
public/javascripts/admin/plugins/menu_toggler.js
Normal file
@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Version 1.0
|
||||
* Init and deploy childs on menu (admin)
|
||||
* Benjamin Athlan - Bewcultures
|
||||
*/
|
||||
$.fn.toggleMe = function(settings) {
|
||||
|
||||
settings = $.extend({
|
||||
}, settings);
|
||||
|
||||
function toggle(element){
|
||||
var children = $(element).parent().find('> ul.folder');
|
||||
|
||||
children.each(function(){
|
||||
if ($(this).is(':visible')) {
|
||||
$(this).slideUp('fast', function() {
|
||||
element.attr('src', element.attr('src').replace('open', 'closed'));
|
||||
$.cookie($(this).attr('id'), 'none');
|
||||
});
|
||||
} else {
|
||||
$(this).slideDown('fast', function() {
|
||||
element.attr('src', element.attr('src').replace('closed', 'open'));
|
||||
$.cookie($(this).attr('id'), 'block');
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return this.each(function(){
|
||||
toggle($(this));
|
||||
|
||||
$(this).bind("click", function(){
|
||||
// console.log(this);
|
||||
toggle($(this));
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user