Permalink
Browse files

moved js into change_list.js

  • Loading branch information...
1 parent f48d11d commit 217def34bb0f156fd855f472b29caa7c8b27bbea @andrewschoen committed Dec 18, 2011
View
14 cms/static/cms/js/change_list.js
@@ -36,7 +36,7 @@
theme_name: "default",
a_class: "title"
},
- cookies : MENU_COOKIES,
+ cookies : false,
callback: {
beforemove : function(what, where, position, tree) {
item_id = what.id.split("page_")[1];
@@ -269,6 +269,18 @@
e.stopPropagation();
return false;
}
+
+ // lazy load descendants on tree open
+ if(jtarget.hasClass("closed")) {
+ // only load them once
+ if($(jtarget).find('ul > li').length == 0) {
+ var pageId = $(jtarget).attr("id").split("page_")[1];
+
+ $.get(admin_base_url + "cms/page/" + pageId + "/load-nav/", {}, function(r, status) {
+ $(jtarget).children('ul').append(r);
+ });
+ }
+ }
if(jtarget.hasClass("move-target")) {
if(jtarget.hasClass("left")){
View
17 cms/static/cms/js/libs/lazyloadmenu.js
@@ -1,17 +0,0 @@
-(function($) {
- $(function() {
- admin_base_url = document.URL.split("/cms/page/")[0] + "/";
- $(".tree-default li").click(function(event) {
- var target = event.target;
- var page_id = $(target).attr("id").split("page_")[1];
- var load_nav_url = admin_base_url + "cms/page/" + page_id + "/load-nav/";
- if($(target).hasClass("closed")) {
- if($(target).children('ul').children('li').length == 0) {
- $.get(load_nav_url, {}, function(r, status) {
- $(target).children('ul').append(r);
- });
- }
- }
- });
- });
-})(jQuery.noConflict());
View
8 cms/templates/admin/cms/page/change_list.html
@@ -12,13 +12,6 @@
{% block coltype %}flex{% endblock %}
{% block extrahead %}
-<script type="text/javascript">
- {% if CMS_LAZY_LOAD_MENU %}
- MENU_COOKIES = false;
- {% else %}
- MENU_COOKIES = true;
- {% endif %}
-</script>
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}cms/css/pages.css"/>
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}cms/jstree/tree_component.css" />
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}cms/css/jquery.dialog.css" />
@@ -41,7 +34,6 @@
<script type="text/javascript" src="{{ STATIC_URL }}cms/js/libs/classy.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}cms/js/plugins/cms.base.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}cms/js/change_list.js"></script>
-<script type="text/javascript" src="{{ STATIC_URL }}cms/js/libs/lazyloadmenu.js"></script>
{% if cl.is_filtered %}

0 comments on commit 217def3

Please sign in to comment.