Author: batiste.bieler
Date: Thu Apr 23 08:19:50 2009
New Revision: 474
Modified:
trunk/pages/admin/__init__.py
trunk/pages/admin/views.py
trunk/pages/media/pages/javascript/change_form.js
trunk/pages/media/pages/javascript/change_list.js
trunk/pages/templates/admin/pages/page/change_list_table.html
trunk/pages/templates/admin/pages/page/menu.html
Log:
Apply the from issue 94
Modified: trunk/pages/admin/__init__.py
==============================================================================
--- trunk/pages/admin/__init__.py (original)
+++ trunk/pages/admin/__init__.py Thu Apr 23 08:19:50 2009
@@ -95,8 +95,12 @@
return sub_menu(request, unquote(url[:-9]))
elif url.endswith('/move-page'):
return self.move_page(request, unquote(url[:-10]))
- elif url.endswith('/change-status'):
- return change_status(request, unquote(url[:-14]))
+ elif url.endswith('/change-status-draft'):
+ return change_status(request, unquote(url[:-20]), Page.DRAFT)
+ elif url.endswith('/change-status-published'):
+ return change_status(request, unquote(url[:-24]),
Page.PUBLISHED)
+ elif url.endswith('/change-status-hidden'):
+ return change_status(request, unquote(url[:-21]), Page.HIDDEN)
return super(PageAdmin, self).__call__(request, url)
def i18n_javascript(self, request):
Modified: trunk/pages/admin/views.py
==============================================================================
--- trunk/pages/admin/views.py (original)
+++ trunk/pages/admin/views.py Thu Apr 23 08:19:50 2009
@@ -8,18 +8,14 @@
from pages.utils import get_placeholders, auto_render
-def change_status(request, page_id):
+def change_status(request, page_id, status):
"""
Switch the status of a page
"""
if request.method == 'POST':
page = Page.objects.get(pk=page_id)
- if page.status in (Page.DRAFT, Page.HIDDEN):
- page.status = Page.PUBLISHED
- page.save()
- elif page.status == Page.PUBLISHED:
- page.status = Page.DRAFT
- page.save()
+ page.status = status
+ page.save()
return HttpResponse(unicode(page.status))
raise Http404
change_status = staff_member_required(change_status)
Modified: trunk/pages/media/pages/javascript/change_form.js
==============================================================================
--- trunk/pages/media/pages/javascript/change_form.js (original)
+++ trunk/pages/media/pages/javascript/change_form.js Thu Apr 23 08:19:50
2009
@@ -21,7 +21,9 @@
});
}
});
- document.getElementById("id_title").focus();
+ titleelem = document.getElementById("id_title")
+ if (titleelem)
+ titleelem.focus();
var template = $.query.get('template');
if(template) {
$('#id_template').find("option").each(function() {
Modified: trunk/pages/media/pages/javascript/change_list.js
==============================================================================
--- trunk/pages/media/pages/javascript/change_list.js (original)
+++ trunk/pages/media/pages/javascript/change_list.js Thu Apr 23 08:19:50
2009
@@ -110,23 +110,6 @@
return false;
}
- if(jtarget.hasClass("publish-checkbox")) {
- var p = jtarget.attr("name").split("status-")[1];
- // if I don't put data in the post, django doesn't get it
- $.post(p+"/change-status/", {1:1}, function(val) {
- var img = $('img', jtarget.parent())[0];
- if(val=="0") {
- jtarget.attr("checked", "");
- img.src = img.src.replace("-yes.gif", "-no.gif");
- } else {
- jtarget.attr("checked", "checked");
- img.src = img.src.replace("-no.gif", "-yes.gif");
- }
- jtarget.attr("value", val);
- });
- return true;
- }
-
if(jtarget.hasClass("move-target")) {
if(jtarget.hasClass("left"))
var position = "left";
@@ -184,6 +167,38 @@
return false;
};
+ return true;
+ });
+ $('#changelist').change(function(e) {
+ var target = e.target;
+ var jtarget = $(target);
+ if(jtarget.hasClass("publish-select")) {
+ var p = jtarget.attr("name").split("status-")[1];
+ var img = $('img', jtarget.parent())[0];
+ img.src = img.src.replace("-yes.gif", "-unknown.gif");
+ img.src = img.src.replace("-no.gif", "-unknown.gif");
+ img.alt = "Busy";
+ index = target.selectedIndex;
+
+ if (index == 0)
+ statusopt = "draft";
+ else if (index == 1)
+ statusopt = "published";
+ else if (index == 2)
+ statusopt = "hidden";
+
+ // if I don't put data in the post, django doesn't get it
+ $.post(p+"/change-status-"+statusopt+"/", {1:1}, function(val)
{
+ // the first option is Draft
+ if(index==0) {
+ img.src = img.src.replace("-unknown.gif", "-no.gif");
+ } else {
+ img.src = img.src.replace("-unknown.gif", "-yes.gif");
+ }
+ });
+ return true;
+ }
+
return true;
});
});
Modified: trunk/pages/templates/admin/pages/page/change_list_table.html
==============================================================================
--- trunk/pages/templates/admin/pages/page/change_list_table.html
(original)
+++ trunk/pages/templates/admin/pages/page/change_list_table.html Thu Apr
23 08:19:50 2009
@@ -2,7 +2,7 @@
<table cellspacing="0" id="page-list">
<thead>
<tr>
-<th style="width:35%">{% trans "title" %}</th>
+<th style="text-align:left;width:35%">{% trans "title" %}</th>
<th>{% trans "quick actions" %}</th>
<th>{% trans "translations" %}</th>
<th>{% trans "published" %}</th>
Modified: trunk/pages/templates/admin/pages/page/menu.html
==============================================================================
--- trunk/pages/templates/admin/pages/page/menu.html (original)
+++ trunk/pages/templates/admin/pages/page/menu.html Thu Apr 23 08:19:50
2009
@@ -2,7 +2,7 @@
{% if has_permission %}
<tr id="page-row-{{ page.id }}" class="child-of-{{ page.parent_id }}">
-<td style="padding-left:{{ page.margin_level }}em">
+<td style="text-align:left;padding-left:{{ page.margin_level }}em">
<span id="move-target-{{ page.id }}" class="move-target-container">
<a href="#" class="move-target left" title="{% trans "as left
sibling"%}"><img alt="" src="{%
admin_media_prefix %}img/admin/arrow-up.gif"/></a> |
<a href="#" class="move-target right" title="{% trans "as right
sibling"%}"><img alt="" src="{%
admin_media_prefix %}img/admin/arrow-down.gif"/></a></a> |
@@ -29,17 +29,19 @@
{% endfor %}
</td>
<td>
-{% ifequal page.status page.PUBLISHED %}
- <label>
- <img alt="True" src="{%
admin_media_prefix %}img/admin/icon-yes.gif"/>
- <input type="checkbox" class="publish-checkbox" name="status-{{
page.id }}" checked="checked" value="1" />
- </label>
+
+{% ifequal page.status page.DRAFT %}
+ <img alt="False" src="{% admin_media_prefix %}img/admin/icon-no.gif" />
{% else %}
- <label>
- <img alt="False" src="{%
admin_media_prefix %}img/admin/icon-no.gif" />
- <input type="checkbox" class="publish-checkbox" name="status-{{
page.id }}" value="0" />
- </label>
+ <img alt="True" src="{% admin_media_prefix %}img/admin/icon-yes.gif"/>
{% endifequal %}
+
+ <select class="publish-select" name="select-status-{{ page.id }}">
+ <option {% ifequal page.status page.DRAFT %}selected="selected"{%
endifequal %}>{% trans "Draft" %}</option>
+ <option {% ifequal page.status
page.PUBLISHED %}selected="selected"{% endifequal %}>{% trans "In
navigation" %}</option>
+ <option {% ifequal page.status page.HIDDEN %}selected="selected"{%
endifequal %}>{% trans "Hidden" %}</option>
+ </select>
+
</td>
<td>
{{ page.get_template }}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pinax-updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pinax-updates?hl=en
-~----------~----~----~----~------~----~------~--~---