Skip to content
This repository
Browse code

update tree location

  • Loading branch information...
commit a704219fedb5e452eb1198b75a0b608a27458b73 1 parent bd0a089
Angelo Dini authored January 18, 2013
2  cms/admin/pageadmin.py
@@ -1093,7 +1093,7 @@ def descendants(self, request, page_id):
1093 1093
         """
1094 1094
         page = get_object_or_404(Page, pk=page_id)
1095 1095
         return admin_utils.render_admin_menu_item(request, page,
1096  
-                template="admin/cms/page/lazy_menu.html")
  1096
+                template="admin/cms/page/tree/lazy_menu.html")
1097 1097
 
1098 1098
     @create_on_success
1099 1099
     def add_plugin(self, request):
8  cms/templates/admin/cms/page/lazy_child_menu.html
... ...
@@ -1,8 +0,0 @@
1  
-{% load cms_admin i18n adminmedia %}{% with page.get_descendant_count as has_children %}<li id="page_{{page.pk}}" class="{% if cl.is_filtered %}leaf{% endif %}{% if forloop.last %} last{% endif %}{% if has_move_page_permission %} moveable{% endif %}{% if has_children %} closed{% endif %}"{% if metadata %} mdata="{{ metadata }}{% endif %}" rel="{% ifequal page.level 0 %}topnode{% else %}node{% endifequal %}">
2  
-    
3  
-    {% include 'admin/cms/page/menu_item.html' %}
4  
-    
5  
-    {% if has_children %}<ul{% if page.last %} class="last"{% endif %}>
6  
-    </ul>{% endif %}
7  
-</li>
8  
-{%  endwith %}
6  cms/templates/admin/cms/page/lazy_menu.html
... ...
@@ -1,6 +0,0 @@
1  
-{% load cms_admin i18n adminmedia %}
2  
-    {% with page.children.all as children %}
3  
-        {% for child in children %}
4  
-            {% show_lazy_admin_menu child %}
5  
-        {% endfor %}
6  
-    {% endwith %}
18  cms/templates/admin/cms/page/menu.html
... ...
@@ -1,18 +0,0 @@
1  
-{% load cms_admin i18n adminmedia %}<li id="page_{{page.pk}}" class="{% if cl.is_filtered %}leaf{% endif %}{% if has_move_page_permission %} moveable{% endif %}"{% if metadata %} mdata="{{ metadata }}{% endif %}" rel="{% ifequal page.level 0 %}topnode{% else %}node{% endifequal %}">
2  
-	
3  
-	{% include 'admin/cms/page/menu_item.html' %}
4  
-	
5  
-	{% with page.childrens as children %}
6  
-		{% if children %}
7  
-        <ul{% if page.last %} class="last"{% endif %}>
8  
-            {% if page.id in open_menu_trees %}
9  
-            {% for child in children %}
10  
-                {% show_admin_menu child %}
11  
-            {% endfor %}
12  
-            {% endif %}
13  
-        </ul>
14  
-        {% endif %}
15  
-	{% endwith %}
16  
-</li>
17  
-
18  
-
8  cms/templates/admin/cms/page/tree/lazy_child_menu.html
... ...
@@ -0,0 +1,8 @@
  1
+{% load cms_admin i18n adminmedia %}{% with page.get_descendant_count as has_children %}
  2
+<li id="page_{{page.pk}}" class="{% if cl.is_filtered %}leaf{% endif %}{% if forloop.last %} last{% endif %}{% if has_move_page_permission %} moveable{% endif %}{% if has_children %} closed{% endif %}"{% if metadata %} mdata="{{ metadata }}{% endif %}" rel="{% ifequal page.level 0 %}topnode{% else %}node{% endifequal %}">
  3
+	{% include "admin/cms/page/tree/menu_item.html" %}
  4
+	{% if has_children %}
  5
+	<ul{% if page.last %} class="last"{% endif %}></ul>
  6
+	{% endif %}
  7
+</li>
  8
+{%  endwith %}
6  cms/templates/admin/cms/page/tree/lazy_menu.html
... ...
@@ -0,0 +1,6 @@
  1
+{% load cms_admin i18n adminmedia %}
  2
+{% with page.children.all as children %}
  3
+	{% for child in children %}
  4
+		{% show_lazy_admin_menu child %}
  5
+	{% endfor %}
  6
+{% endwith %}
19  cms/templates/admin/cms/page/tree/menu.html
... ...
@@ -0,0 +1,19 @@
  1
+{% load cms_admin i18n adminmedia %}
  2
+{% comment %}
  3
+- This template is used within the pagetree as the root for the menu-items
  4
+{% endcomment %}
  5
+
  6
+<li id="page_{{page.pk}}" class="{% if cl.is_filtered %}leaf{% endif %}{% if has_move_page_permission %} moveable{% endif %}"{% if metadata %} mdata="{{ metadata }}{% endif %}" rel="{% ifequal page.level 0 %}topnode{% else %}node{% endifequal %}">
  7
+	{% include "admin/cms/page/tree/menu_item.html" %}
  8
+	{% with page.childrens as children %}
  9
+	{% if children %}
  10
+	<ul{% if page.last %} class="last"{% endif %}>
  11
+		{% if page.id in open_menu_trees %}
  12
+			{% for child in children %}
  13
+				{% show_admin_menu child %}
  14
+			{% endfor %}
  15
+		{% endif %}
  16
+	</ul>
  17
+	{% endif %}
  18
+	{% endwith %}
  19
+</li>
63  cms/templates/admin/cms/page/menu_item.html → cms/templates/admin/cms/page/tree/menu_item.html
... ...
@@ -1,4 +1,8 @@
1 1
 {% load cms_admin i18n adminmedia %}
  2
+{% comment %}
  3
+- This template is used within the pagetree as the menu-items for the menu
  4
+{% endcomment %}
  5
+
2 6
 <div class="cont{% if CMS_MODERATOR %} moderatorstate{{ page_moderator_state.state }}{% endif %}">
3 7
 	<div class="col1">
4 8
 		{% if has_change_permission %}
@@ -22,15 +26,21 @@
22 26
 
23 27
 		{% if page.soft_root or page.is_home %}<div class="col-softroot"><span class="icon softroot-icon" title="{% if page.soft_root %}{% trans 'softroot' %}{% else %}{% trans 'home' %}{% endif %}"></span></div>{% endif %}
24 28
 
25  
-		<div class="col-language">{% for lang in page.get_languages|in_filtered:site_languages %}
26  
-			{% if has_change_permission %}<a href="{{ url }}{{ page.id }}/?language={{ lang }}" title="{% blocktrans with lang|upper as language %}Edit this page in {{ language }} {% endblocktrans %}">{{ lang }}</a>
27  
-			{% else %}{{ lang|upper }}
  29
+		<div class="col-language">
  30
+		{% for lang in page.get_languages|in_filtered:site_languages %}
  31
+			{% if has_change_permission %}
  32
+				<a href="{{ url }}{{ page.id }}/?language={{ lang }}" title="{% blocktrans with lang|upper as language %}Edit this page in {{ language }} {% endblocktrans %}">{{ lang }}</a>
  33
+			{% else %}
  34
+				{{ lang|upper }}
28 35
 			{% endif %}
29 36
 			{% if not forloop.last %} | {% endif %}
30  
-		{% endfor %}</div>
  37
+		{% endfor %}
  38
+		</div>
31 39
 
32  
-		<div class="col-actions">{% if not filtered %}
33  
-			{% if has_move_page_permission %}<a href="#" class="move" title="{% trans "Cut" %}" id="move-link-{{ page.id }}"><span>{% trans "cut" %}</span></a>{% endif %}{% endif %}
  40
+		<div class="col-actions">
  41
+			{% if not filtered %}
  42
+				{% if has_move_page_permission %}<a href="#" class="move" title="{% trans "Cut" %}" id="move-link-{{ page.id }}"><span>{% trans "cut" %}</span></a>{% endif %}
  43
+			{% endif %}
34 44
 			{% if has_change_permission %}<a href="#" class="copy" title="{% trans "Copy" %}" id="copy-link-{{ page.id }}"><span>{% trans "copy" %}</span></a>{% endif %}
35 45
 
36 46
 			{% if has_add_page_permission and has_add_on_same_level_permission %}
@@ -51,22 +61,27 @@
51 61
 			</label>
52 62
 		</div>
53 63
 
54  
-		{% if CMS_MODERATOR %}<div class="col-moderator">
55  
-			{% if has_moderate_permission %}{% for value, title, active, css_class in page|moderator_choices:user %}<input type="checkbox" class="moderator-checkbox hidden copy-{{ css_class }}"{% if active %} checked="checked"{% endif %} value="{{ value }}" title="{{ title }}"/>
56  
-			{% endfor %}{% endif %}
57  
-		</div>{% endif %}
58  
-
59  
-
60  
-		{% if CMS_MODERATOR %}<div class="col-draft">
  64
+		{% if CMS_MODERATOR %}
  65
+		<div class="col-moderator">
  66
+			{% if has_moderate_permission %}
  67
+				{% for value, title, active, css_class in page|moderator_choices:user %}
  68
+					<input type="checkbox" class="moderator-checkbox hidden copy-{{ css_class }}"{% if active %} checked="checked"{% endif %} value="{{ value }}" title="{{ title }}"/>
  69
+				{% endfor %}
  70
+			{% endif %}
  71
+		</div>
  72
+		<div class="col-draft">
61 73
 			{% if moderator_should_approve %}<a href="./{{ page.id }}/approve/" class="icon approve" title="{% trans 'Approve directly' %}"></a>{% endif %}
62 74
 			<span class="state">{{ page_moderator_state.label }}</span>
63 75
 			<a href="./{{ page.id }}/preview/" class="icon selector-add viewpage" id="view-page-{{page.id}}"><span>{% trans "view" %}</span></a>
64  
-		</div>{% endif %}
  76
+		</div>
  77
+		{% endif %}
65 78
 
66 79
 		<div class="col-published">
67 80
 			{% if has_publish_permission %}
68  
-				{% if page.published %}<input type="checkbox" class="publish-checkbox" name="status-{{ page.id }}" checked="checked" value="1" title="{% trans 'Unpublish' %}"/>
69  
-				{% else %}<input type="checkbox" class="publish-checkbox" name="status-{{ page.id }}" value="0" title="{% trans 'Publish' %}"/>
  81
+				{% if page.published %}
  82
+					<input type="checkbox" class="publish-checkbox" name="status-{{ page.id }}" checked="checked" value="1" title="{% trans 'Unpublish' %}"/>
  83
+				{% else %}
  84
+					<input type="checkbox" class="publish-checkbox" name="status-{{ page.id }}" value="0" title="{% trans 'Publish' %}"/>
70 85
 				{% endif %}
71 86
 			{% endif %}
72 87
 
@@ -82,14 +97,14 @@
82 97
 		<div class="col-published">{{ page.publication_end_date|date:"Y-m-d" }}</div>
83 98
 		<div class="col-view-perms">{{ page|is_restricted:request }}</div>
84 99
 
85  
-
86  
-		{% if CMS_MODERATOR %}<div class="col-lastchange">
87  
-			{% for state in page.last_page_states %}<span class="icon state-icon {{ state.css_class }}" title="{{ state.get_action_display }}"></span>
88  
-			{% endfor %}
89  
-
90  
-
91  
-		</div>{% endif %}
  100
+		{% if CMS_MODERATOR %}
  101
+		<div class="col-lastchange">
  102
+		{% for state in page.last_page_states %}
  103
+			<span class="icon state-icon {{ state.css_class }}" title="{{ state.get_action_display }}"></span>
  104
+		{% endfor %}
  105
+		</div>
  106
+		{% endif %}
92 107
 
93 108
 		<div class="col-creator">{{ page.changed_by }}</div>
94 109
 	</div>
95  
-</div>
  110
+</div>
4  cms/templatetags/cms_admin.py
@@ -23,7 +23,7 @@
23 23
 
24 24
 class ShowAdminMenu(InclusionTag):
25 25
     name = 'show_admin_menu'
26  
-    template = 'admin/cms/page/menu.html'
  26
+    template = 'admin/cms/page/tree/menu.html'
27 27
     
28 28
     options = Options(
29 29
         Argument('page')
@@ -56,7 +56,7 @@ def get_context(self, context, page):
56 56
 
57 57
 class ShowLazyAdminMenu(InclusionTag):
58 58
     name = 'show_lazy_admin_menu'
59  
-    template = 'admin/cms/page/lazy_child_menu.html'
  59
+    template = 'admin/cms/page/tree/lazy_child_menu.html'
60 60
     
61 61
     options = Options(
62 62
         Argument('page')
2  cms/utils/admin.py
@@ -85,7 +85,7 @@ def render_admin_menu_item(request, page, template=None):
85 85
     must be reloaded over ajax.
86 86
     """
87 87
     if not template:
88  
-        template = "admin/cms/page/menu_item.html"
  88
+        template = "admin/cms/page/tree/menu_item.html"
89 89
 
90 90
     if not page.pk:
91 91
         return HttpResponse(NOT_FOUND_RESPONSE) # Not found - tree will remove item

0 notes on commit a704219

Please sign in to comment.
Something went wrong with that request. Please try again.