1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-08-03 19:57:57 +02:00

Pages Plugin: general js refactoring

This commit is contained in:
Awilum
2012-11-17 20:49:02 +02:00
parent 02f9f7f01a
commit 580ff98951
3 changed files with 45 additions and 32 deletions

View File

@@ -0,0 +1,36 @@
if (typeof $.monstra == 'undefined') $.monstra = {};
$.monstra.pages = {
init: function() {
this.pagesExpandProcess();
},
pageExpand: function(slug, expand, token) {
$.ajax({
type:"post",
data:"slug="+slug+"&expand="+expand+"&token="+token,
url: $('form input[name="siteurl"]').val()
});
},
pagesExpandProcess: function() {
$(".parent").click(function() {
if ($(this).html() == "-") {
$('[rel="children_' + $(this).attr('rel')+'"]').hide();
$(this).html("+");
$.monstra.pages.pageExpand($(this).attr("rel"), "1", $(this).attr("token"));
} else {
$('[rel="children_' + $(this).attr('rel')+'"]').show();
$(this).html("-");
$.monstra.pages.pageExpand($(this).attr("rel"), "0", $(this).attr("token"));
}
});
}
};
$(document).ready(function(){
$.monstra.pages.init();
});