manager: move page options to the sidebar (#10940)
This commit is contained in:
parent
e03cb0846c
commit
84111b3b15
|
@ -1,5 +1,5 @@
|
|||
# combo - content management system
|
||||
# Copyright (C) 2014 Entr'ouvert
|
||||
# Copyright (C) 2014-2016 Entr'ouvert
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Affero General Public License as published
|
||||
|
@ -32,7 +32,8 @@ class PageForm(forms.ModelForm):
|
|||
templates = [(x[0], x[1]['name']) for x in settings.COMBO_PUBLIC_TEMPLATES.items()]
|
||||
templates = [x for x in templates if self.template_exists(x[0])]
|
||||
templates.sort(lambda x, y: cmp(x[1], y[1]))
|
||||
self.fields['template_name'].widget = forms.Select(choices=templates)
|
||||
if 'template_name' in self.fields:
|
||||
self.fields['template_name'].widget = forms.Select(choices=templates)
|
||||
|
||||
def template_exists(self, template):
|
||||
try:
|
||||
|
@ -49,10 +50,12 @@ class PageForm(forms.ModelForm):
|
|||
raise ValidationError(_('Slug must be unique'), code='unique')
|
||||
return value
|
||||
|
||||
|
||||
class PageEditForm(PageForm):
|
||||
class Meta:
|
||||
model = Page
|
||||
exclude = ('order', 'public', 'groups')
|
||||
fields = ('title', 'slug')
|
||||
|
||||
|
||||
class PageVisibilityForm(forms.ModelForm):
|
||||
class Meta:
|
||||
|
@ -60,5 +63,17 @@ class PageVisibilityForm(forms.ModelForm):
|
|||
fields = ('public', 'groups')
|
||||
|
||||
|
||||
class PageSelectTemplateForm(PageForm):
|
||||
class Meta:
|
||||
model = Page
|
||||
fields = ('template_name',)
|
||||
|
||||
|
||||
class PageEditRedirectionForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Page
|
||||
fields = ('redirect_url',)
|
||||
|
||||
|
||||
class SiteImportForm(forms.Form):
|
||||
site_json = forms.FileField(_('Site Export File'))
|
||||
|
|
|
@ -12,6 +12,10 @@ div#page-content {
|
|||
min-height: 5em;
|
||||
}
|
||||
|
||||
div.page-options label {
|
||||
display: block;
|
||||
}
|
||||
|
||||
div.placeholder {
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
|
@ -45,10 +49,11 @@ div.cell-list > div.toggled > div {
|
|||
div.cell h3 {
|
||||
background: #fafafa;
|
||||
margin: 0;
|
||||
padding: 1ex;
|
||||
padding: 1ex 1ex 1ex 0;
|
||||
min-width: 10em;
|
||||
color: #222;
|
||||
font-weight: normal;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
div.cell h3 span.additional-label {
|
||||
|
@ -301,3 +306,12 @@ ul.multisort li {
|
|||
padding: 1ex;
|
||||
background: white;
|
||||
}
|
||||
|
||||
p.hint::before {
|
||||
content: "\f05a ";
|
||||
font-family: FontAwesome;
|
||||
}
|
||||
|
||||
p.hint {
|
||||
color: #aaa;
|
||||
}
|
||||
|
|
|
@ -21,15 +21,31 @@
|
|||
|
||||
{% block content %}
|
||||
|
||||
<div id="meta">
|
||||
<label>{% trans 'Current template:' %} </label> {{ object.get_template_display_name }}
|
||||
/
|
||||
<label>{% trans 'Visibility:' %} </label> {{ object.visibility }}
|
||||
(<a rel="popup" href="{% url 'combo-manager-page-visibility' pk=object.id %}">{% trans 'change' %}</a>)
|
||||
</div>
|
||||
|
||||
<div id="sidebar">
|
||||
|
||||
<div class="page-options">
|
||||
<h2>{% trans 'Parameters' %}</h2>
|
||||
|
||||
<p>
|
||||
<label>{% trans 'Template:' %}</label>
|
||||
{{ object.get_template_display_name }}
|
||||
(<a rel="popup" href="{% url 'combo-manager-page-select-template' pk=object.id %}">{% trans 'change' %}</a>)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label>{% trans 'Visibility:' %}</label>
|
||||
{{ object.visibility }}
|
||||
(<a rel="popup" href="{% url 'combo-manager-page-visibility' pk=object.id %}">{% trans 'change' %}</a>)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label>{% trans 'Redirection:' %}</label>
|
||||
{% if object.redirect_url %}{{ object.redirect_url }}{% else %}<i>{% trans 'none' %}</i>{% endif %}
|
||||
(<a rel="popup" href="{% url 'combo-manager-page-edit-redirection' pk=object.id %}">{% trans 'change' %}</a>)
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="available-cells">
|
||||
<h2>{% trans 'Available cells' %}</h2>
|
||||
<ul>
|
||||
|
@ -61,14 +77,6 @@
|
|||
</div> <!-- #sidebar -->
|
||||
|
||||
<div id="page-content">
|
||||
{% if object.redirect_url %}
|
||||
<div>
|
||||
<h2>Redirection</h2>
|
||||
<p id="redirection">
|
||||
{% trans 'This page redirects to:' %} <a href="{{ object.redirect_url }}">{{ object.redirect_url }}</a>.
|
||||
</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div id="placeholders"
|
||||
data-cell-order-url="{% url 'combo-manager-cell-order' page_pk=object.id %}"
|
||||
|
|
|
@ -29,8 +29,12 @@ urlpatterns = patterns('combo.views',
|
|||
name='combo-manager-page-view'),
|
||||
url(r'^pages/(?P<pk>\w+)/edit$', views.page_edit,
|
||||
name='combo-manager-page-edit'),
|
||||
url(r'^pages/(?P<pk>\w+)/template$', views.page_select_template,
|
||||
name='combo-manager-page-select-template'),
|
||||
url(r'^pages/(?P<pk>\w+)/visibility$', views.page_visibility,
|
||||
name='combo-manager-page-visibility'),
|
||||
url(r'^pages/(?P<pk>\w+)/redirection$', views.page_edit_redirection,
|
||||
name='combo-manager-page-edit-redirection'),
|
||||
url(r'^pages/(?P<pk>\w+)/delete$', views.page_delete,
|
||||
name='combo-manager-page-delete'),
|
||||
url(r'^pages/(?P<pk>\w+)/export$', views.page_export,
|
||||
|
|
|
@ -35,7 +35,8 @@ from combo.data.models import Page, CellBase, UnlockMarkerCell
|
|||
from combo.data.library import get_cell_class
|
||||
from combo import plugins
|
||||
|
||||
from .forms import PageForm, PageEditForm, PageVisibilityForm, SiteImportForm
|
||||
from .forms import (PageForm, PageEditForm, PageVisibilityForm, SiteImportForm,
|
||||
PageEditRedirectionForm, PageSelectTemplateForm)
|
||||
|
||||
|
||||
class HomepageView(ListView):
|
||||
|
@ -105,6 +106,19 @@ class PageEditView(UpdateView):
|
|||
|
||||
page_edit = PageEditView.as_view()
|
||||
|
||||
|
||||
class PageSelectTemplateView(PageEditView):
|
||||
form_class = PageSelectTemplateForm
|
||||
|
||||
page_select_template = PageSelectTemplateView.as_view()
|
||||
|
||||
|
||||
class PageEditRedirectionView(PageEditView):
|
||||
form_class = PageEditRedirectionForm
|
||||
|
||||
page_edit_redirection = PageEditRedirectionView.as_view()
|
||||
|
||||
|
||||
class PageVisibilityView(PageEditView):
|
||||
form_class = PageVisibilityForm
|
||||
|
||||
|
|
Loading…
Reference in New Issue