merging from ui update branch

pull/3/head
Dave Cranwell 2014-02-05 12:19:20 +00:00
rodzic 04953427c8
commit 46840b2c2f
15 zmienionych plików z 209 dodań i 111 usunięć

Wyświetl plik

@ -28,12 +28,36 @@
height:50px;
}
img{
z-index:2;
position:relative;
.border-radius(100%);
border:0;
}
&:hover{
&:hover:before{
color:@color-teal;
border-color:@color-teal;
}
&.small{
vertical-align:middle;
margin:0 0.5em;
width:25px;
height:25px;
&:before{
color:@color-teal;
border-color:@color-teal;
margin:1px 0 0 1px;
width:22px;
height:22px;
line-height:22px;
border-width:1px;
font-size:1em;
}
img{
border:0;
}
&:hover:before{
color:@color-grey-3;
border-color:@color-grey-3;
}
}
}

Wyświetl plik

@ -13,7 +13,7 @@ form {
fieldset{
border:0;
padding:2em 0;
padding:0 0 2em 0;
margin:0;
/* position:relative; See if we can get away without this */
}
@ -71,10 +71,6 @@ input, textarea, select, .richtext, .tagit{
}
}
.full .richtext{
border:0;
}
input[type=radio],input[type=checkbox]{
.border-radius(0);
cursor:pointer;
@ -288,7 +284,7 @@ input[type=submit], input[type=reset], input[type=button], .button, button{
.border-radius(2px);
li{
background-color: @color-grey-3;
background-color: @color-grey-2;
float:left;
cursor:pointer;
margin-right:1px;

Wyświetl plik

@ -326,7 +326,6 @@ ul.listing{
}
}
.pagination{
text-align:center;
p{
@ -349,6 +348,12 @@ ul.listing{
}
}
.listing.full-width + .pagination{
margin-top: 3em;
border-top: 1px dashed #d9d9d9;
padding:2em 50px 0 50px;
}
@media screen and (min-width: @breakpoint-mobile){
.listing{
&.horiz > li{

Wyświetl plik

@ -29,6 +29,7 @@ body{
color:@color-text-base;
overflow-x: hidden;
position: relative;
background:@color-grey-5;
&.reordering{
overflow:visible;
@ -387,20 +388,27 @@ header{
margin:0;
}
.left, .right{
width:50%;
}
.left{
float:left;
width:50%;
.hasform &:first-child{
padding-bottom:0.5em;
float:none;
}
}
.second{
clear:both;
.col{
float:left;
margin-right:2em;
}
.search-bar input{
width:auto;
}
.right{
text-align:right;
float:right;
}
@ -414,6 +422,9 @@ header{
&.merged.no-border{
padding-bottom:0;
}
&.hasform h1{
margin-top:0.2em;
}
}
.page-explorer header{
@ -428,8 +439,7 @@ footer{
background: rgba(0,0,0,0.7);
position:fixed;
bottom:0;
height:3.4em;
padding:0.3em;
padding:0.5em;
width:90%;
margin:0 5%;
color:white;
@ -458,10 +468,11 @@ footer{
line-height:3.5em;
font-size:0.85em;
span{
p{
margin:0;
margin-right:@grid-gutter-width;
}
white-space: nowrap;
}
}
}
@ -661,9 +672,7 @@ footer, .logo{
border-top:0;
background-color:none;
padding-top:0;
}
}
#nav-toggle{
display:none;
@ -779,24 +788,17 @@ footer, .logo{
}
@media screen and (min-width: @breakpoint-desktop-larger){
body{
margin:0;
background:#DDD;
}
.wrapper{
background-color:@color-grey-5;
/*background-color:@color-grey-5;*/
max-width:@breakpoint-desktop-larger;
margin:0 auto;
border-right:1px solid @color-grey-4;
}
.nav-wrapper{
position:relative;
left:auto;
.box-shadow(inset -6px 0px 4px 0px rgba(0, 0, 0, 0.2));
.inner{
background:@color-grey-1;
.box-shadow(inset -6px 0px 4px 0px rgba(0, 0, 0, 0.2));
}
}

Wyświetl plik

@ -1,8 +1,8 @@
@import "../variables.less";
@import "../mixins.less";
@import "../grid.less";
.page-editor .content{
padding-bottom:5em;
.page-editor .content-wrapper{
margin-bottom:10em;
}
.object{
background:url(/static/wagtailadmin/images/bg-editor-diag.svg);
@ -60,7 +60,7 @@
> h2, &.single-field label{
-webkit-font-smoothing: auto;
.border-radius(2px);
background-color:lighten(@color-grey-4, 5%);
background-color:@color-grey-3; // lighten(@color-grey-4, 5%);
text-transform:uppercase;
padding:0.9em 0 0.9em 4em;
font-size:1em;
@ -74,15 +74,19 @@
z-index:1;
&:before{
content:"";
font-family:verdant;
text-transform:none;
content:"q";
text-align:center;
display:block;
position:absolute;
z-index:2;
font-size:2em;
top:0px;
height:3.2em;
line-height:1.7em;
left:0px;
width:3.3em;
/*background-color:@color-grey-3;*/
width:1.7em;
opacity:0.15;
padding:0;
margin:0;
cursor:pointer;
@ -133,18 +137,18 @@
.pull-padding(2);
font-family:Bitter, Georgia, serif;
.border-radius(0px);
border:0;
padding-top:2em;
padding-bottom:2em;
font-size:1.2em;
line-height:1.6em;
border-width:0 1px;
}
.richtext{
padding-top:3em; /* to provide space for editor buttons */
}
.error-message{
.nice-padding();
padding-bottom:2em;
@ -269,8 +273,7 @@
&.full{
fieldset{
.column(11);
margin-left:-50px;
margin-right:-50px;
padding-left:0;
padding-right:0;
}

Wyświetl plik

@ -1,16 +1,21 @@
@import "../variables.less";
@import "../mixins.less";
.hallotoolbar{
position:absolute;
left:50px;
z-index:5;
margin-top:3em;
margin-left:4px;
}
.hallotoolbar.affixed{
position:fixed;
margin-left:140px;
margin-top:0;
}
.hallotoolbar button{
.border-radius(0);
}
.richtext {
min-height:50px;
@ -142,7 +147,7 @@
}
@media screen and (min-width: @breakpoint-desktop-larger){
.hallotoolbar{
/* .hallotoolbar{
margin:0 auto;
position:absolute;
left:-@menu-width;
@ -153,5 +158,5 @@
.hallotoolbar.affixed{
position:fixed;
margin:0 auto;
}
}*/
}

Wyświetl plik

@ -1,6 +1,6 @@
{% extends "wagtailadmin/base.html" %}
{% load page_permissions %}
{% load gravatar %}
{% block titletag %}Editing {{ page.title }}{% endblock %}
{% block bodyclass %}menu-explorer page-editor{% endblock %}
@ -16,13 +16,6 @@
</div>
</header>
{% if errors_debug %}
<!--
Error messages:
{{ errors_debug }}
-->
{% endif %}
<form id="page-edit-form" action="{% url 'wagtailadmin_pages_edit' page.id %}" method="POST">
{% csrf_token %}
{{ edit_handler.render_form_content }}
@ -53,15 +46,17 @@
</li>
<li class="meta">
<span class="modified">
<p class="modified">
{% if page.get_latest_revision %}
Last modified: {{ page.get_latest_revision.created_at }}
{% if page.get_latest_revision.user %}
by {{ page.get_latest_revision.user.get_full_name|default:page.get_latest_revision.user.username }}
{% if request.user.email %}
<span class="avatar small icon icon-user"><img src="{% gravatar_url page.get_latest_revision.user.email 25 %}" /></span>
{% endif %}
{% endif %}
{% endif %}
</span>
</p>
</li>
</ul>
</footer>

Wyświetl plik

@ -1,26 +1,25 @@
<header class="nice-padding {% if merged %}merged{% endif %} {% if tabbed %}tab-merged{% endif %} {% if search_form %}hasform{% endif %}">
<div class="row row-flush">
<div class="left col{% if search_form and add_link %}6{% else %}9{% endif %}">
<h1>{{ title }} <span>{{ subtitle }}</span></h1>
<div class="row">
<div class="left">
<div class="col">
<h1>{{ title }} <span>{{ subtitle }}</span></h1>
</div>
{% if search_form %}
<form class="col search-bar" action="{% url search_url %}" method="get">
<ul class="fields">
{% for field in search_form %}
{% include "wagtailadmin/shared/field_as_li.html" with field=field %}
{% endfor %}
<li class="submit"><input type="submit" value="Search" /></li>
</ul>
</form>
{% endif %}
</div>
<div class="second col{% if search_form and add_link %}6{% else %}3{% endif %}">
<div class="right">
{% if add_link %}
<div class="right col3 addbutton">
<div class="addbutton">
<a href="{% url add_link %}" class="button bicolor icon icon-plus">{{ add_text }}</a>
</div>
{% endif %}
{% if search_form %}
<div class="left col6">
<form class="search-bar" action="{% url search_url %}" method="get">
<ul class="fields">
{% for field in search_form %}
{% include "wagtailadmin/shared/field_as_li.html" with field=field %}
{% endfor %}
<li class="submit"><input type="submit" value="Search" /></li>
</ul>
</form>
</div>
{% endif %}
</div>
</div>
</header>

Wyświetl plik

@ -10,7 +10,7 @@
{% elif is_ajax %}
{% else %}
<a href="{% url linkurl %}?p={{ items.previous_page_number }}" class="icon icon-arrow-left">Previous</a>
<a href="{% url linkurl %}?p={{ items.previous_page_number }}&ordering={{ ordering }}" class="icon icon-arrow-left">Previous</a>
{% endif %}
{% endif %}
</li>
@ -21,7 +21,7 @@
{% elif is_searching %}
<a href="{% url linkurl %}?q={{ search_query|urlencode }}&amp;p={{ items.next_page_number }}" class="icon icon-arrow-right-after">Next</a>
{% else %}
<a href="{% url linkurl %}?p={{ items.next_page_number }}" class="icon icon-arrow-right-after">Next</a>
<a href="{% url linkurl %}?p={{ items.next_page_number }}&ordering={{ ordering }}" class="icon icon-arrow-right-after">Next</a>
{% endif %}
{% endif %}
</li>

Wyświetl plik

@ -14,8 +14,9 @@ import urllib, hashlib
register = template.Library()
class GravatarUrlNode(template.Node):
def __init__(self, email):
def __init__(self, email, size=50):
self.email = template.Variable(email)
self.size = size
def render(self, context):
try:
@ -24,7 +25,7 @@ class GravatarUrlNode(template.Node):
return ''
default = "blank"
size = 50
size = self.size
gravatar_url = "//www.gravatar.com/avatar/" + hashlib.md5(email.lower()).hexdigest() + "?"
gravatar_url += urllib.urlencode({'s':str(size), 'd':default})
@ -33,10 +34,6 @@ class GravatarUrlNode(template.Node):
@register.tag
def gravatar_url(parser, token):
try:
tag_name, email = token.split_contents()
bits = token.split_contents()
except ValueError:
raise template.TemplateSyntaxError, "%r tag requires a single argument" % token.contents.split()[0]
return GravatarUrlNode(email)
return GravatarUrlNode(*bits[1:])

Wyświetl plik

@ -4,9 +4,27 @@
<col width="16%" />
<thead>
<tr class="table-headers">
<th>Title</th>
<th>
Title
{% if not is_searching %}
{% if ordering == "title" %}
<a href="{% url 'verdantdocs_index' %}" class="icon icon-arrow-down-after teal"></a>
{% else %}
<a href="{% url 'verdantdocs_index' %}?ordering=title" class="icon icon-arrow-down-after"></a>
{% endif %}
{% endif %}
</th>
<th>File</th>
<th>Uploaded</th>
<th>
Uploaded
{% if not is_searching %}
{% if ordering == "-created_at" %}
<a href="{% url 'verdantdocs_index' %}" class="icon icon-arrow-down-after teal"></a>
{% else %}
<a href="{% url 'verdantdocs_index' %}?ordering=-created_at" class="icon icon-arrow-down-after"></a>
{% endif %}
{% endif %}
</th>
</tr>
</thead>
<tbody>

Wyświetl plik

@ -1,8 +1,6 @@
{% if documents %}
{% if is_searching %}
<h2>{{ documents|length }} match{{ documents|pluralize:"es" }}</h2>
{% else %}
<h2>Latest documents</h2>
<h2>{{ paginator.count }} match{{ paginator|pluralize:"es" }}</h2>
{% endif %}
{% include "wagtaildocs/documents/list.html" %}

Wyświetl plik

@ -17,7 +17,7 @@ def index(request):
is_searching = False
if 'q' in request.GET:
form = SearchForm(request.GET, placeholder_sufffix="documents")
form = SearchForm(request.GET, placeholder_suffix="documents")
if form.is_valid():
q = form.cleaned_data['q']
@ -39,6 +39,16 @@ def index(request):
documents = documents.filter(uploaded_by_user=request.user)
form = SearchForm(placeholder_suffix="documents")
if 'ordering' in request.GET:
ordering = request.GET['ordering']
if ordering in ['title', '-created_at']:
if ordering != '-created_at':
documents = documents.order_by(ordering)
else:
ordering = '-created_at'
if not is_searching:
paginator = Paginator(documents, 20)
@ -51,12 +61,14 @@ def index(request):
if request.is_ajax():
return render(request, "wagtaildocs/documents/results.html", {
'ordering':ordering,
'documents': documents,
'is_searching': is_searching,
'search_query': q,
})
else:
return render(request, "wagtaildocs/documents/index.html", {
'ordering':ordering,
'search_form': form,
'documents': documents,
'popular_tags': Document.popular_tags(),

Wyświetl plik

@ -1,30 +1,52 @@
{% extends "wagtailadmin/base.html" %}
{% load gravatar %}
{% block titletag %}Users{% endblock %}
{% block bodyclass %}menu-users{% endblock %}
{% block content %}
{% include "wagtailadmin/shared/header.html" with title="Users" merged=1 add_link="wagtailusers_create" add_text="Add a user" %}
{% include "wagtailadmin/shared/header.html" with title="Users" add_link="verdantusers_create" add_text="Add a user" %}
<table class="listing full-width">
<thead>
<tr>
<th class="name">Name</a></th>
<th class="username">Username</th>
<th class="level">Level</th>
<th class="status">Status</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<div class="nice-padding">
<table class="listing">
<thead>
<tr>
<td class="title">
<h2><a href="{% url 'wagtailusers_edit' user.id %}">{{ user.get_full_name|default:user.username }}</a></h2>
</td>
<td class="username">{{ user.username }}</td>
<td class="level">{% if user.is_superuser %}Admin{% endif %}</td>
<td class="status"><div class="status-tag {% if user.is_active %}primary{% endif %}">{% if user.is_active %}Active{% else %}Inactive{% endif %}</div></td>
</li>
{% endfor %}
</tbody>
</table>
<th class="name">
Name
{% if ordering == "name" %}
<a href="{% url 'wagtailusers_index' %}" class="icon icon-arrow-down-after teal"></a>
{% else %}
<a href="{% url 'wagtailusers_index' %}?ordering=name" class="icon icon-arrow-down-after"></a>
{% endif %}
</th>
<th class="username">
Username
{% if ordering == "username" %}
<a href="{% url 'wagtailusers_index' %}" class="icon icon-arrow-down-after teal"></a>
{% else %}
<a href="{% url 'wagtailusers_index' %}?ordering=username" class="icon icon-arrow-down-after"></a>
{% endif %}
</th>
<th class="level">Level</th>
<th class="status">Status</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td class="title">
<h2>
<span class="avatar small icon icon-user"><img src="{% gravatar_url user.email 25 %}" /></span>
<a href="{% url 'wagtailusers_edit' user.id %}">{{ user.get_full_name|default:user.username }}</a>
</h2>
</td>
<td class="username">{{ user.username }}</td>
<td class="level">{% if user.is_superuser %}Admin{% endif %}</td>
<td class="status"><div class="status-tag {% if user.is_active %}primary{% endif %}">{% if user.is_active %}Active{% else %}Inactive{% endif %}</div></td>
</li>
{% endfor %}
</tbody>
</table>
{% include "wagtailadmin/shared/pagination_nav.html" with items=users linkurl="wagtailusers_index" %}
</div>
{% endblock %}

Wyświetl plik

@ -1,16 +1,38 @@
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth.models import User
from django.contrib.auth.decorators import permission_required
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.contrib import messages
from wagtail.wagtailusers.forms import UserCreationForm, UserEditForm
@permission_required('auth.change_user')
def index(request):
p = request.GET.get("p", 1)
users = User.objects.order_by('last_name', 'first_name')
if 'ordering' in request.GET:
ordering = request.GET['ordering']
if ordering in ['name', 'username']:
if ordering != 'name':
users = users.order_by(ordering)
else:
ordering = 'name'
paginator = Paginator(users, 20)
try:
users = paginator.page(p)
except PageNotAnInteger:
users = paginator.page(1)
except EmptyPage:
users = paginator.page(paginator.num_pages)
return render(request, 'wagtailusers/index.html', {
'users': users,
'ordering': ordering,
})
@permission_required('auth.change_user')