def describe(self, viewer=None):
return _("%(user)s created a new page titled %(page)s") % {
- 'user': self.hyperlink(self.user.get_profile_url(), self.friendly_username(viewer, self.user)),
- 'page': self.hyperlink(self.node.get_absolute_url(), self.node.title)
+ 'user': self.hyperlink(self.user.get_profile_url(), self.friendly_username(viewer, self.user)),
+ 'page': self.hyperlink(self.node.get_absolute_url(), self.node.title)
}
class EditPageAction(ActionProxy):
title = data.pop('title')
body = data.pop('content')
- if (title != self.node.title) and (body != self.node.body):
+ if (title != self.node.title) or (body != self.node.body):
self.node.create_revision(self.user, title=title, body=body)
self.node.extra = data
def describe(self, viewer=None):
return _("%(user)s edited the page titled %(page)s") % {
- 'user': self.hyperlink(self.user.get_profile_url(), self.friendly_username(viewer, self.user)),
- 'page': self.hyperlink(self.node.get_absolute_url(), self.node.title)
+ 'user': self.hyperlink(self.user.get_profile_url(), self.friendly_username(viewer, self.user)),
+ 'page': self.hyperlink(self.node.get_absolute_url(), self.node.title)
}
class PublishAction(ActionProxy):
def describe(self, viewer=None):
return _("%(user)s published a new page titled %(page)s") % {
- 'user': self.hyperlink(self.user.get_profile_url(), self.friendly_username(viewer, self.user)),
- 'page': self.hyperlink(self.node.get_absolute_url(), self.node.title)
+ 'user': self.hyperlink(self.user.get_profile_url(), self.friendly_username(viewer, self.user)),
+ 'page': self.hyperlink(self.node.get_absolute_url(), self.node.title)
}
-{% load extra_tags %}
-{% load i18n %}
+{% load extra_tags extra_filters i18n %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<li><a href="{% url admin_set allsets.sidebar.name %}">{{ allsets.sidebar.title }}</a></li>
<li>
<a href="{% url admin_set allsets.css.name %}">{{ allsets.css.title }}</a>
- {% if "css" in unsaved %}<img width="12" height="12" src="{{ settings.ADMIN_MEDIA_PREFIX }}img/admin/icon_alert.gif" alt="{% trans "Unsaved changes" %}" />{% endif %}
+ {% if "css"|contained_in:unsaved %}<img width="12" height="12" src="{{ settings.ADMIN_MEDIA_PREFIX }}img/admin/icon_alert.gif" alt="{% trans "Unsaved changes" %}" />{% endif %}
</li>
<li>
<a href="{% url admin_set allsets.headandfoot.name %}">{{ allsets.headandfoot.title }}</a>
- {% if "headandfoot" in unsaved %}<img width="12" height="12" src="{{ settings.ADMIN_MEDIA_PREFIX }}img/admin/icon_alert.gif" alt="{% trans "Unsaved changes" %}" />{% endif %}
+ {% if "headandfoot"|contained_in:unsaved %}<img width="12" height="12" src="{{ settings.ADMIN_MEDIA_PREFIX }}img/admin/icon_alert.gif" alt="{% trans "Unsaved changes" %}" />{% endif %}
</li>
<li>
<a href="{% url admin_set allsets.head.name %}">{{ allsets.head.title }}</a>
- {% if "head" in unsaved %}<img width="12" height="12" src="{{ settings.ADMIN_MEDIA_PREFIX }}img/admin/icon_alert.gif" alt="{% trans "Unsaved changes" %}" />{% endif %}
+ {% if "head"|contained_in:unsaved %}<img width="12" height="12" src="{{ settings.ADMIN_MEDIA_PREFIX }}img/admin/icon_alert.gif" alt="{% trans "Unsaved changes" %}" />{% endif %}
</li>
</ul>
</div>
{% for set in othersets %}
<li>
<a href="{% url admin_set set.name %}">{{ set.title }}</a>
- {% if set.name in unsaved %}<img width="12" height="12" src="{{ settings.ADMIN_MEDIA_PREFIX }}img/admin/icon_alert.gif" alt="{% trans "Unsaved changes" %}" />{% endif %}
+ {% if set.name|contained_in:unsaved %}<img width="12" height="12" src="{{ settings.ADMIN_MEDIA_PREFIX }}img/admin/icon_alert.gif" alt="{% trans "Unsaved changes" %}" />{% endif %}
</li>
{% endfor %}
</ul>
{% extends basetemplate %}
-{% load i18n %}
+{% load i18n extra_filters %}
{% block subtitle %}{% trans "Editing page" %}{% endblock %}
{% block pagename %}
<tr>
<th></th>
<td>
- <input id="submit" name="submit" type="submit" value="{% trans "Save" %}" />
+ {% if page %}
+ <input id="submit" name="submit" type="submit" value="{% trans "Edit" %}" />
+ {% else %}
+ <input id="submit" name="submit" type="submit" value="{% trans "Save" %}" />
+ {% endif %}
{% if published %}
<input id="unpublish" name="unpublish" type="submit" value="{% trans "Unpublish" %}" />
{% else %}
<input id="submit" name="submit" type="submit" value="{% trans "Save" %}" onclick="this.form.target=''; return true;" />\r
{% if form.set.can_preview %}\r
<input id="preview" name="preview" type="submit" value="{% trans "Preview" %}" onclick="this.form.target='_blank'; return true;" />\r
- {% if form.set.name in unsaved %}\r
+ {% if form.set.name|contained_in:unsaved %}\r
<input id="reset" name="reset" type="submit" value="{% trans "Reset Changes" %}" onclick="this.form.target=''; return true;" />\r
{% endif %}\r
{% endif %}\r
def can_edit_post(user, post):
return user.can_edit_post(post)
-
+
@register.filter
def cnprog_intword(number):
try:
return previewing[setting.name]
return setting.value
+
+
+@register.filter
+def contained_in(item, container):
+ return item in container
\ No newline at end of file