updates to edit page

This commit is contained in:
Dave Cranwell 2014-06-19 12:25:53 +01:00
commit 59e161ad9d
6 changed files with 56 additions and 26 deletions

View file

@ -140,6 +140,10 @@ def extract_panel_definitions_from_model_class(model, exclude=None):
return panels
def set_page_edit_handler(page_class, handlers):
page_class.handlers = handlers
class EditHandler(object):
"""
Abstract class providing sensible default behaviours for objects implementing
@ -326,10 +330,11 @@ class BaseObjectList(BaseCompositeEditHandler):
template = "wagtailadmin/edit_handlers/object_list.html"
def ObjectList(children, heading=""):
def ObjectList(children, heading="", classes=""):
return type('_ObjectList', (BaseObjectList,), {
'children': children,
'heading': heading,
'classes': classes
})

View file

@ -6,9 +6,6 @@ form {
margin:0;
padding:0;
}
li{
@include row();
}
}
fieldset{
@ -451,6 +448,7 @@ li.focused > .help{
}
.fields li{
@include row();
padding-top:0.5em;
padding-bottom:1.2em;
}

View file

@ -96,7 +96,6 @@
.icon-unlocked:before {
content: "p";
}
.icon-doc-full-inverse:before {
content: "r";
}

View file

@ -1,32 +1,31 @@
.tab-nav{
@include clearfix();
@include row();
padding:0;
background:$color-grey-4;
overflow:hidden;
li{
list-style-type:none;
width:48%;
width:33%;
float:left;
padding:0;
position:relative;
&:before,&:after{
display:none;
}
margin-right:1px;
}
a{
@include transition(border-color 0.2s ease);
background-color:lighten($color-teal-darker, 3%);
outline:none;
line-height:3em;
text-transform:uppercase;
font-weight:700;
font-size:1.2em;
text-decoration:none;
display:block;
padding:0 20px;
padding:0.7em;
padding-bottom:1em;
margin-bottom:-0.3em;
color:white;
border-top:0.3em solid lighten($color-teal-darker, 3%);
border-bottom:1px solid transparent;
&:hover{
color:white;
@ -45,7 +44,6 @@
min-width:0.9em;
color:white;
background:$color-red;
content:attr(data-count);
padding:0 0.3em;
line-height:1.4em;
@ -61,10 +59,21 @@
border-top:0.3em solid $color-grey-1;
}
li.settings a{
&:before{
font-family:wagtail;
vertical-align:middle;
text-transform:none;
content:"w";
margin-right:0.5em;
font-size:1.2em;
}
}
/* For cases where tab-nav should merge with header */
&.merged{
background-color:$color-header-bg;
margin-top:0;
background-color:$color-header-bg;
}
}
.tab-content{
@ -79,14 +88,32 @@
}
@media screen and (min-width: $breakpoint-mobile){
.tab-nav li{
width:auto;
padding:0;
margin-left:0.7em;
}
.tab-nav{
/* For cases where tab-nav should merge with header */
&.merged{
background-color:$color-header-bg;
}
.tab-nav a{
padding:0 50px;
li{
width:auto;
padding:0;
margin-left:0.7em;
&.tab-right{
float:right;
margin-right:0.7em;
}
}
a{
padding-left:$desktop-nice-padding - 10;
padding-right:$desktop-nice-padding - 10;
}
li.settings a{
padding-left:2em;
padding-right:2em;
}
}
.modal-content .tab-nav li{

View file

@ -1,12 +1,12 @@
<ul class="tab-nav merged">
{% for child in self.children %}
<li class="{% if forloop.first %}active{% endif %}"><a href="#{{ child.heading|slugify }}" class="{% if forloop.first %}active{% endif %}">{{ child.heading }}</a></li>
<li class="{{ child.classes }} {% if forloop.first %}active{% endif %}"><a href="#{{ child.heading|slugify }}" class="{% if forloop.first %}active{% endif %}">{{ child.heading }}</a></li>
{% endfor %}
</ul>
<div class="tab-content">
{% for child in self.children %}
<section id="{{ child.heading|slugify }}" class="{% if forloop.first %}active{% endif %}">
<section id="{{ child.heading|slugify }}" class="{{ child.classes }} {% if forloop.first %}active{% endif %}">
{{ child.render_as_object }}
</section>
{% endfor %}

View file

@ -581,7 +581,8 @@ def get_page_edit_handler(page_class):
if page_class not in PAGE_EDIT_HANDLERS:
PAGE_EDIT_HANDLERS[page_class] = TabbedInterface([
ObjectList(page_class.content_panels, heading='Content'),
ObjectList(page_class.promote_panels, heading='Promote')
ObjectList(page_class.promote_panels, heading='Promote'),
ObjectList(page_class.settings_panels, heading='Settings', classes="tab-right settings")
])
return PAGE_EDIT_HANDLERS[page_class]