Merge branch 'master' into page-copy-ui

Conflicts:
	wagtail/wagtailadmin/views/pages.py
This commit is contained in:
Karl Hobley 2014-07-03 14:04:39 +01:00
commit 5221abeecf
209 changed files with 5175 additions and 1484 deletions

View file

@ -1,10 +1,12 @@
# Python releases to test
language: python
# Test matrix
python:
- 2.7
# Django releases
- 2.7
- 3.2
- 3.4
env:
- DJANGO_VERSION=Django==1.6.2
- DJANGO_VERSION=Django==1.6.5
#- DJANGO_VERSION=Django==1.7.0
# Services
services:
- redis-server

View file

@ -4,6 +4,11 @@ Changelog
0.4 (xx.xx.20xx)
~~~~~~~~~~~~~~~~
* ElasticUtils/pyelasticsearch swapped for elasticsearch-py
* Python 3.2, 3.3 and 3.4 support
* Added scheduled publishing
* Added frontend cache invalidator
* Added sitemap generator
* Added notification preferences
* Added 'original' as a resizing rule supported by the 'image' tag
* Hallo.js updated to version 1.0.4
* Snippets are now ordered alphabetically
@ -14,13 +19,23 @@ Changelog
* Added styleguide (mainly for wagtail developers)
* Aesthetic improvements to preview experience
* 'image' tag now accepts extra keyword arguments to be output as attributes on the img tag
* Login screen redirects to dashboard if user is already logged in
* Renamed some template tag libraries
* Any extra arguments given to serve are now passed through to get_context and get_template
* Added an 'attrs' property to image rendition objects to output src, width, height and alt attributes all in one go
* Added 'construct_whitelister_element_rules' hook for customising the HTML whitelist used when saving rich text fields
* Added 'in_menu' and 'not_in_menu' methods to PageQuerySet
* Added 'get_next_siblings' and 'get_prev_siblings' to Page
* Added init_new_page signal
* Added page_published signal
* Added copy method to Page to allow copying of pages
* Fix: Animated GIFs are now coalesced before resizing
* Fix: Wand backend clones images before modifying them
* Fix: Admin breadcrumb now positioned correctly on mobile
* Fix: Page chooser breadcrumb now updates the chooser modal instead of linking to Explorer
* Fix: Embeds - Fixed crash when no HTML field is sent back from the embed provider
* Fix: Multiple sites with same hostname but different ports are now allowed
* Fix: No longer possible to create multiple sites with is_default_site = True
0.3.1 (03.06.2014)
~~~~~~~~~~~~~~~~~~

View file

@ -2,7 +2,7 @@
:target: https://travis-ci.org/torchbox/wagtail
.. image:: https://coveralls.io/repos/torchbox/wagtail/badge.png?branch=master&zxcv1
:target: https://coveralls.io/r/torchbox/wagtail?branch=master
:target: https://coveralls.io/r/torchbox/wagtail?branch=master
.. image:: https://pypip.in/v/wagtail/badge.png?zxcv
:target: https://crate.io/packages/wagtail/
@ -24,7 +24,9 @@ Wagtail is a Django content management system built originally for the `Royal Co
* Support for tree-based content organisation
* Optional preview->submit->approve workflow
* Fast out of the box. `Varnish <https://www.varnish-cache.org/>`_-friendly if you need it
* Excellent test coverage
* A simple `form builder <http://docs.wagtail.io/en/latest/form_builder.html>`_
* Optional `static site generation <http://docs.wagtail.io/en/latest/static_site_generation.html>`_
* Excellent `test coverage <https://coveralls.io/r/torchbox/wagtail?branch=master>`_
Find out more at `wagtail.io <http://wagtail.io/>`_.
@ -35,16 +37,25 @@ Getting started
* To get you up and running quickly, we've provided a demonstration site with all the configuration in place, at `github.com/torchbox/wagtaildemo <https://github.com/torchbox/wagtaildemo/>`_; see the `README <https://github.com/torchbox/wagtaildemo/blob/master/README.md>`_ for installation instructions.
* See the `Getting Started <http://wagtail.readthedocs.org/en/latest/gettingstarted.html#getting-started>`_ docs for installation (with the demo app) on a fresh Debian/Ubuntu box with production-ready dependencies, on OS X and on a Vagrant box.
* `Serafeim Papastefanos <https://github.com/spapas>`_ has written a `tutorial <http://spapas.github.io/2014/02/13/wagtail-tutorial/>`_ with all the steps to build a simple Wagtail site from scratch.
* We've also provided a skeletal django-template to get started on a blank site: https://github.com/torchbox/wagtail-template
Documentation
~~~~~~~~~~~~~
Available at `wagtail.readthedocs.org <http://wagtail.readthedocs.org/>`_. and always being updated.
Available at `wagtail.readthedocs.org <http://wagtail.readthedocs.org/>`_ and always being updated.
Compatibility
~~~~~~~~~~~~~
Wagtail supports Django 1.6.2+ on Python 2.6 and 2.7. Django 1.7 and Python 3 support are in progress.
Wagtail supports Django 1.6.2+ on Python 2.6, 2.7, 3.2, 3.3 and 3.4.
Django 1.7 support is in progress pending further release candidate testing.
Wagtail's dependencies are summarised at `requirements.io <https://requires.io/github/torchbox/wagtail/requirements>`_.
Contributing
~~~~~~~~~~~~
If you're a Python or Django developer, fork the repo and get stuck in! Send us a useful pull request and we'll post you a `t-shirt <https://twitter.com/WagtailCMS/status/432166799464210432/photo/1>`_. Our immediate priorities are better docs, more tests, internationalisation and localisation.
If you're a Python or Django developer, fork the repo and get stuck in!
We suggest you start by checking the `Help develop me! <https://github.com/torchbox/wagtail/issues?labels=Help+develop+me%21>`_ label.
Send us a useful pull request and we'll post you a `t-shirt <https://twitter.com/WagtailCMS/status/432166799464210432/photo/1>`_.

View file

@ -1,9 +1,15 @@
For Django developers
=====================
.. contents:: Contents
:local:
.. note::
This documentation is currently being written.
Overview
~~~~~~~~
Wagtail requires a little careful setup to define the types of content that you want to present through your website. The basic unit of content in Wagtail is the ``Page``, and all of your page-level content will inherit basic webpage-related properties from it. But for the most part, you will be defining content yourself, through the construction of Django models using Wagtail's ``Page`` as a base.
Wagtail organizes content created from your models in a tree, which can have any structure and combination of model objects in it. Wagtail doesn't prescribe ways to organize and interrelate your content, but here we've sketched out some strategies for organizing your models.
@ -203,7 +209,6 @@ Methods:
* get_context
* get_template
* is_navigable
* get_other_siblings
* get_ancestors
* get_descendants
* get_siblings
@ -269,6 +274,7 @@ not_type(self, model):
return self.get_query_set().not_type(model)
.. _wagtail_site_admin:
Site
~~~~
@ -278,3 +284,13 @@ Django's built-in admin interface provides the way to map a "site" (hostname or
Access this by going to ``/django-admin/`` and then "Home Wagtailcore Sites." To try out a development site, add a single site with the hostname ``localhost`` at port ``8000`` and map it to one of the pieces of content you have created.
Wagtail's developers plan to move the site settings into the Wagtail admin interface.
.. _redirects:
Redirects
~~~~~~~~~
Wagtail provides a simple interface for creating arbitrary redirects to and from any URL.
.. image:: ../images/screen_wagtail_redirects.png

View file

@ -1,7 +1,8 @@
For Front End developers
========================
.. contents::
.. contents:: Contents
:local:
========================
Overview
@ -90,6 +91,9 @@ In addition to Django's standard tags and filters, Wagtail provides some of its
Images (tag)
~~~~~~~~~~~~
.. versionchanged:: 0.4
The 'image_tags' tags library was renamed to 'wagtailimages_tags'
The ``image`` tag inserts an XHTML-compatible ``img`` element into the page, setting its ``src``, ``width``, ``height`` and ``alt``. See also :ref:`image_tag_alt`.
The syntax for the tag is thus::
@ -100,7 +104,7 @@ For example:
.. code-block:: django
{% load image %}
{% load wagtailimages_tags %}
...
{% image self.photo width-400 %}
@ -205,7 +209,7 @@ No validation is performed on attributes add in this way by the developer. It's
Wagtail can assign the image data to another object using Django's ``as`` syntax:
.. code-block:: django
{% image self.photo width-400 as tmp_photo %}
<img src="{{ tmp_photo.src }}" width="{{ tmp_photo.width }}"
@ -227,13 +231,16 @@ You can also use the ``attrs`` property as a shorthand to output the ``src``, ``
Rich text (filter)
~~~~~~~~~~~~~~~~~~
.. versionchanged:: 0.4
The 'rich_text' tags library was renamed to 'wagtailcore_tags'
This filter takes a chunk of HTML content and renders it as safe HTML in the page. Importantly it also expands internal shorthand references to embedded images and links made in the Wagtail editor into fully-baked HTML ready for display.
Only fields using ``RichTextField`` need this applied in the template.
.. code-block:: django
{% load rich_text %}
{% load wagtailcore_tags %}
...
{{ self.body|richtext }}
@ -269,6 +276,9 @@ Wagtail embeds and images are included at their full width, which may overflow t
Internal links (tag)
~~~~~~~~~~~~~~~~~~~~
.. versionchanged:: 0.4
The 'pageurl' tags library was renamed to 'wagtailcore_tags'
pageurl
--------
@ -276,7 +286,7 @@ Takes a Page object and returns a relative URL (``/foo/bar/``) if within the sam
.. code-block:: django
{% load pageurl %}
{% load wagtailcore_tags %}
...
<a href="{% pageurl self.blog_page %}">
@ -287,7 +297,7 @@ Takes any ``slug`` as defined in a page's "Promote" tab and returns the URL for
.. code-block:: django
{% load slugurl %}
{% load wagtailcore_tags %}
...
<a href="{% slugurl self.your_slug %}">

View file

@ -1,28 +1,26 @@
Editing API
Defining models with the Editing API
===========
.. note::
This documentation is currently being written.
Wagtail provides a highly-customizable editing interface consisting of several components:
* **Fields** — built-in content types to augment the basic types provided by Django.
* **Fields** — built-in content types to augment the basic types provided by Django
* **Panels** — the basic editing blocks for fields, groups of fields, and related object clusters
* **Choosers** — interfaces for finding related objects in a ForeignKey relationship
Configuring your models to use these components will shape the Wagtail editor to your needs. Wagtail also provides an API for injecting custom CSS and Javascript for further customization, including extending the hallo.js rich text editor.
Configuring your models to use these components will shape the Wagtail editor to your needs. Wagtail also provides an API for injecting custom CSS and JavaScript for further customization, including extending the hallo.js rich text editor.
There is also an Edit Handler API for creating your own Wagtail editor components.
Defining Panels
~~~~~~~~~~~~~~~
A "panel" is the basic editing block in Wagtail. Wagtail will automatically pick the appropriate editing widget for most Django field types, you just need to add a panel for each field you want to show in the Wagtail page editor, in the order you want them to appear.
A "panel" is the basic editing block in Wagtail. Wagtail will automatically pick the appropriate editing widget for most Django field types; implementors just need to add a panel for each field they want to show in the Wagtail page editor, in the order they want them to appear.
There are three types of panels:
There are four basic types of panels:
``FieldPanel( field_name, classname=None )``
This is the panel used for basic Django field types. ``field_name`` is the name of the class property used in your model definition. ``classname`` is a string of optional CSS classes given to the panel which are used in formatting and scripted interactivity. By default, panels are formatted as inset fields. The CSS class ``full`` can be used to format the panel so it covers the full width of the Wagtail page editor. The CSS class ``title`` can be used to mark a field as the source for auto-generated slug strings.
@ -30,10 +28,21 @@ There are three types of panels:
``MultiFieldPanel( children, heading="", classname=None )``
This panel condenses several ``FieldPanel`` s or choosers, from a list or tuple, under a single ``heading`` string.
``InlinePanel( base_model, relation_name, panels=None, label='', help_text='' )``
``InlinePanel( base_model, relation_name, panels=None, classname=None, label='', help_text='' )``
This panel allows for the creation of a "cluster" of related objects over a join to a separate model, such as a list of related links or slides to an image carousel. This is a very powerful, but tricky feature which will take some space to cover, so we'll skip over it for now. For a full explanation on the usage of ``InlinePanel``, see :ref:`inline_panels`.
Wagtail provides a tabbed interface to help organize panels. ``content_panels`` is the main tab, used for the meat of your model content. The other, ``promote_panels``, is suggested for organizing metadata about the content, such as SEO information and other machine-readable information. Since you're writing the panel definitions, you can organize them however you want.
``FieldRowPanel( children, classname=None)``
This panel is purely aesthetic. It creates a columnar layout in the editing interface, where each of the child Panels appears alongside each other rather than below. Use of FieldRowPanel particularly helps reduce the "snow-blindness" effect of seeing so many fields on the page, for complex models. It also improves the perceived association between fields of a similar nature. For example if you created a model representing an "Event" which had a starting date and ending date, it may be intuitive to find the start and end date on the same "row".
FieldRowPanel should be used in combination with ``col*`` classnames added to each of the child Panels of the FieldRowPanel. The Wagtail editing interface is layed out using a grid system, in which the maximum width of the editor is 12 columns wide. Classes ``col1``-``col12`` can be applied to each child of a FieldRowPanel. The class ``col3`` will ensure that field appears 3 columns wide or a quarter the width. ``col4`` would cause the field to be 4 columns wide, or a third the width.
**(In addition to these four, there are also Chooser Panels, detailed below.)**
Wagtail provides a tabbed interface to help organize panels. Three such tabs are provided:
* ``content_panels`` is the main tab, used for the bulk of your model's fields.
* ``promote_panels`` is suggested for organizing fields regarding the promotion of the page around the site and the Internet. For example, a field to dictate whether the page should show in site-wide menus, descriptive text that should appear in site search results, SEO-friendly titles, OpenGraph meta tag content and other machine-readable information.
* ``settings_panels`` is essentially for non-copy fields. By default it contains the page's scheduled publishing fields. Other suggested fields could include a field to switch between one layout/style and another.
Let's look at an example of a panel definition:
@ -55,7 +64,10 @@ Let's look at an example of a panel definition:
ExamplePage.content_panels = [
FieldPanel('title', classname="full title"),
FieldPanel('body', classname="full"),
FieldPanel('date'),
FieldRowPanel([
FieldPanel('start_date', classname="col3"),
FieldPanel('end_date', classname="col3"),
]),
ImageChooserPanel('splash_image'),
DocumentChooserPanel('free_download'),
PageChooserPanel('related_page'),
@ -119,7 +131,7 @@ One of the features of Wagtail is a unified image library, which you can access
on_delete=models.SET_NULL,
related_name='+'
)
BookPage.content_panels = [
ImageChooserPanel('cover'),
# ...
@ -225,7 +237,7 @@ Snippets are vanilla Django models you create yourself without a Wagtail-provide
on_delete=models.SET_NULL,
related_name='+'
)
BookPage.content_panels = [
SnippetChooserPanel('advert', Advert),
# ...
@ -254,6 +266,12 @@ Titles
Use ``classname="title"`` to make Page's built-in title field stand out with more vertical padding.
Col*
------
Fields within a ``FieldRowPanel`` can have their width dictated in terms of the number of columns it should span. The ``FieldRowPanel`` is always considered to be 12 columns wide regardless of browser size or the nesting of ``FieldRowPanel`` in any other type of panel. Specify a number of columns thus: ``col3``, ``col4``, ``col6`` etc (up to 12). The resulting width with be *relative* to the full width of the ``FieldRowPanel``.
Required Fields
---------------
@ -346,9 +364,9 @@ The ``RelatedLink`` class is a vanilla Django abstract model. The ``BookPageRela
For another example of using model clusters, see :ref:`tagging`
For more on ``django-modelcluster``, visit `the django-modelcluster github project page`_ ).
For more on ``django-modelcluster``, visit `the django-modelcluster github project page`_.
.. _the django-modelcluster github page: https://github.com/torchbox/django-modelcluster
.. _the django-modelcluster github project page: https://github.com/torchbox/django-modelcluster
.. _extending_wysiwyg:
@ -366,11 +384,9 @@ hallo.js plugin names are prefixed with the ``"IKS."`` namespace, but the ``name
For information on developing custom hallo.js plugins, see the project's page: https://github.com/bergie/hallo
Edit Handler API
~~~~~~~~~~~~~~~~
Admin Hooks
-----------
@ -380,7 +396,7 @@ Registering functions with a Wagtail hook follows the following pattern:
.. code-block:: python
from wagtail.wagtailadmin import hooks
from wagtail.wagtailcore import hooks
hooks.register('hook', function)
@ -393,7 +409,7 @@ Where ``'hook'`` is one of the following hook strings and ``function`` is a func
.. code-block:: python
from wagtail.wagtailadmin import hooks
from wagtail.wagtailcore import hooks
class UserbarPuppyLinkItem(object):
def render(self, request):
@ -414,7 +430,7 @@ Where ``'hook'`` is one of the following hook strings and ``function`` is a func
from django.utils.safestring import mark_safe
from wagtail.wagtailadmin import hooks
from wagtail.wagtailcore import hooks
class WelcomePanel(object):
order = 50
@ -440,7 +456,7 @@ Where ``'hook'`` is one of the following hook strings and ``function`` is a func
from django.http import HttpResponse
from wagtail.wagtailadmin import hooks
from wagtail.wagtailcore import hooks
def do_after_page_create(request, page):
return HttpResponse("Congrats on making content!", content_type="text/plain")
@ -468,7 +484,7 @@ Where ``'hook'`` is one of the following hook strings and ``function`` is a func
from django.http import HttpResponse
from django.conf.urls import url
from wagtail.wagtailadmin import hooks
from wagtail.wagtailcore import hooks
def admin_view( request ):
return HttpResponse( \
@ -484,13 +500,13 @@ Where ``'hook'`` is one of the following hook strings and ``function`` is a func
.. _construct_main_menu:
``construct_main_menu``
Add, remove, or alter ``MenuItem`` objects from the Wagtail admin menu. The callable passed to this hook must take a ``request`` object and a list of ``menu_items``; it must return a list of menu items. New items can be constructed from the ``MenuItem`` class by passing in: a ``label`` which will be the text in the menu item, the URL of the admin page you want the menu item to link to (usually by calling ``reverse()`` on the admin view you've set up), CSS class ``name`` applied to the wrapping ``<li>`` of the menu item as ``"menu-{name}"``, CSS ``classnames`` which are used to give the link an icon, and an ``order`` integer which determine's the item's place in the menu.
Add, remove, or alter ``MenuItem`` objects from the Wagtail admin menu. The callable passed to this hook must take a ``request`` object and a list of ``menu_items``; it must return a list of menu items. New items can be constructed from the ``MenuItem`` class by passing in: a ``label`` which will be the text in the menu item, the URL of the admin page you want the menu item to link to (usually by calling ``reverse()`` on the admin view you've set up), CSS class ``name`` applied to the wrapping ``<li>`` of the menu item as ``"menu-{name}"``, CSS ``classnames`` which are used to give the link an icon, and an ``order`` integer which determine's the item's place in the menu.
.. code-block:: python
from django.core.urlresolvers import reverse
from wagtail.wagtailadmin import hooks
from wagtail.wagtailcore import hooks
from wagtail.wagtailadmin.menu import MenuItem
def construct_main_menu(request, menu_items):
@ -510,7 +526,7 @@ Where ``'hook'`` is one of the following hook strings and ``function`` is a func
from django.utils.html import format_html, format_html_join
from django.conf import settings
from wagtail.wagtailadmin import hooks
from wagtail.wagtailcore import hooks
def editor_js():
js_files = [
@ -538,7 +554,7 @@ Where ``'hook'`` is one of the following hook strings and ``function`` is a func
from django.utils.html import format_html
from django.conf import settings
from wagtail.wagtailadmin import hooks
from wagtail.wagtailcore import hooks
def editor_css():
return format_html('<link rel="stylesheet" href="' \
@ -558,7 +574,7 @@ Where ``'hook'`` is one of the following hook strings and ``function`` is a func
.. code-block:: python
from wagtail.wagtailadmin import hooks
from wagtail.wagtailcore import hooks
from wagtail.wagtailcore.whitelist import attribute_rule, check_url, allow_without_attributes
def whitelister_element_rules():
@ -611,4 +627,3 @@ Custom Choosers
Tests
-----

View file

@ -1,3 +1,6 @@
.. _inserting_videos:
Inserting videos into body content
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -9,4 +12,4 @@ As well as inserting videos into a carousel, Wagtail's rich text fields allow yo
.. image:: ../../images/screen21_video_in_editor.png
* A placeholder with the name of the video and a screenshot will be inserted into the text area. Clicking the X in the top corner will remove the video.
* A placeholder with the name of the video and a screenshot will be inserted into the text area. Clicking the X in the top corner will remove the video.

View file

@ -1,3 +1,6 @@
.. _form_builder:
Form builder
============

View file

@ -0,0 +1,102 @@
Frontend cache purging
======================
Many websites use a frontend cache such as Varnish, Squid or Cloudflare to gain extra performance. The downside of using a frontend cache though is that they don't respond well to updating content and will often keep an old version of a page cached after it has been updated.
This document describes how to configure Wagtail to purge old versions of pages from a frontend cache whenever a page gets updated.
Setting it up
~~~~~~~~~~~~~
Firstly, add ``"wagtail.contrib.wagtailfrontendcache"`` to your INSTALLED_APPS:
.. code-block:: python
INSTALLED_APPS = [
...
"wagtail.contrib.wagtailfrontendcache"
]
The ``wagtailfrontendcache`` module provides a set of signal handlers which will automatically purge the cache whenever a page is published or deleted. You should register these somewhere at the top of your ``urls.py`` file:
.. code-block:: python
# urls.py
from wagtail.contrib.wagtailfrontendcache.signal_handlers import register_signal_handlers
register_signal_handlers()
You then need to set the ``WAGTAILFRONTENDCACHE_LOCATION`` setting to the URL of your Varnish/Squid cache server. This must be a direct connection to the server and cannot go through another proxy. By default, this is set to ``http://127.0.0.1:8000`` which is very likely incorrect.
Finally, make sure you have configured your frontend cache to accept PURGE requests:
- `Varnish <https://www.varnish-cache.org/docs/3.0/tutorial/purging.html>`_
- `Squid <http://wiki.squid-cache.org/SquidFaq/OperatingSquid#How_can_I_purge_an_object_from_my_cache.3F>`_
Advanced useage
~~~~~~~~~~~~~~~
Purging more than one URL per page
----------------------------------
By default, Wagtail will only purge one URL per page. If your page has more than one URL to be purged, you will need to override the ``get_cached_paths`` method on your page type.
.. code-block:: python
class BlogIndexPage(Page):
def get_blog_items(self):
# This returns a Django paginator of blog items in this section
return Paginator(self.get_children().live().type(BlogPage), 10)
def get_cached_paths(self):
# Yield the main URL
yield '/'
# Yield one URL per page in the paginator to make sure all pages are purged
for page_number in range(1, self.get_blog_items().num_pages):
yield '/?page=' + str(page_number)
Purging index pages
-------------------
Another problem is pages that list other pages (such as a blog index) will not be purged when a blog entry gets added, changed or deleted. You may want to purge the blog index page so the updates are added into the listing quickly.
This can be solved by using the ``purge_page_from_cache`` utility function which can be found in the ``wagtail.contrib.wagtailfrontendcache.utils`` module.
Let's take the the above BlogIndexPage as an example. We need to register a signal handler to run when one of the BlogPages get updated/deleted. This signal handler should call the ``purge_page_from_cache`` function on all BlogIndexPages that contain the BlogPage being updated/deleted.
.. code-block:: python
# models.py
from django.db.models.signals import pre_delete
from wagtail.wagtailcore.signals import page_published
from wagtail.contrib.wagtailfrontendcache.utils import purge_page_from_cache
...
def blog_page_changed(blog_page):
# Find all the live BlogIndexPages that contain this blog_page
for blog_index in BlogIndexPage.objects.live():
if blog_page in blog_index.get_blog_items().object_list:
# Purge this blog index
purge_page_from_cache(blog_index)
@register(page_published, sender=BlogPage):
def blog_published_handler(instance):
blog_page_changed(instance)
@register(pre_delete, sender=BlogPage)
def blog_deleted_handler(instance):
blog_page_changed(instance)

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View file

@ -3,12 +3,13 @@ Welcome to Wagtail's documentation
Wagtail is a modern, flexible CMS, built on Django.
It supports Django 1.6.2+ on Python 2.6 and 2.7. Django 1.7 and Python 3 support are in progress.
It supports Django 1.6.2+ on Python 2.6, 2.7, 3.2, 3.3 and 3.4. Django 1.7 support is in progress pending further release candidate testing.
.. toctree::
:maxdepth: 3
gettingstarted
settings
building_your_site/index
editing_api
snippets
@ -19,6 +20,7 @@ It supports Django 1.6.2+ on Python 2.6 and 2.7. Django 1.7 and Python 3 support
deploying
performance
static_site_generation
management_commands
contributing
support
roadmap

View file

@ -0,0 +1,52 @@
Management commands
===================
publish_scheduled_pages
-----------------------
:code:`./manage.py publish_scheduled_pages`
This command publishes or unpublishes pages that have had these actions scheduled by an editor. It is recommended to run this command once an hour.
fixtree
-------
:code:`./manage.py fixtree`
This command scans for errors in your database and attempts to fix any issues it finds.
move_pages
----------
:code:`manage.py move_pages from to`
This command moves a selection of pages from one section of the tree to another.
Options:
- **from**
This is the **id** of the page to move pages from. All descendants of this page will be moved to the destination. After the operation is complete, this page will have no children.
- **to**
This is the **id** of the page to move pages to.
update_index
------------
:code:`./manage.py update_index`
This command rebuilds the search index from scratch. It is only required when using Elasticsearch.
It is recommended to run this command once a week and at the following times:
- whenever any pages have been created through a script (after an import, for example)
- whenever any changes have been made to models or search configuration
The search may not return any results while this command is running, so avoid running it at peak times.
search_garbage_collect
----------------------
:code:`./manage.py search_garbage_collect`
Wagtail keeps a log of search queries that are popular on your website. On high traffic websites, this log may get big and you may want to clean out old search queries. This command cleans out all search query logs that are more than one week old.

603
docs/settings.rst Normal file
View file

@ -0,0 +1,603 @@
==============================
Configuring Django for Wagtail
==============================
To install Wagtail completely from scratch, create a new Django project and an app within that project. For instructions on these tasks, see `Writing your first Django app`_. Your project directory will look like the following::
myproject/
myproject/
__init__.py
settings.py
urls.py
wsgi.py
myapp/
__init__.py
models.py
tests.py
admin.py
views.py
manage.py
From your app directory, you can safely remove ``admin.py`` and ``views.py``, since Wagtail will provide this functionality for your models. Configuring Django to load Wagtail involves adding modules and variables to ``settings.py`` and urlconfs to ``urls.py``. For a more complete view of what's defined in these files, see `Django Settings`_ and `Django URL Dispatcher`_.
.. _Writing your first Django app: https://docs.djangoproject.com/en/dev/intro/tutorial01/
.. _Django Settings: https://docs.djangoproject.com/en/dev/topics/settings/
.. _Django URL Dispatcher: https://docs.djangoproject.com/en/dev/topics/http/urls/
What follows is a settings reference which skips many boilerplate Django settings. If you just want to get your Wagtail install up quickly without fussing with settings at the moment, see :ref:`complete_example_config`.
Middleware (settings.py)
~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: python
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'wagtail.wagtailcore.middleware.SiteMiddleware',
'wagtail.wagtailredirects.middleware.RedirectMiddleware',
)
Wagtail requires several common Django middleware modules to work and cover basic security. Wagtail provides its own middleware to cover these tasks:
``SiteMiddleware``
Wagtail routes pre-defined hosts to pages within the Wagtail tree using this middleware. For configuring sites, see :ref:`wagtail_site_admin`.
``RedirectMiddleware``
Wagtail provides a simple interface for adding arbitrary redirects to your site and this module makes it happen.
Apps (settings.py)
~~~~~~~~~~~~~~~~~~
.. code-block:: python
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'south',
'compressor',
'taggit',
'modelcluster',
'django.contrib.admin',
'wagtail.wagtailcore',
'wagtail.wagtailadmin',
'wagtail.wagtaildocs',
'wagtail.wagtailsnippets',
'wagtail.wagtailusers',
'wagtail.wagtailimages',
'wagtail.wagtailembeds',
'wagtail.wagtailsearch',
'wagtail.wagtailredirects',
'wagtail.wagtailforms',
'myapp', # your own app
)
Wagtail requires several Django app modules, third-party apps, and defines several apps of its own. Wagtail was built to be modular, so many Wagtail apps can be omitted to suit your needs. Your own app (here ``myapp``) is where you define your models, templates, static assets, template tags, and other custom functionality for your site.
Third-Party Apps
----------------
``south``
Used for database migrations. See `South Documentation`_.
.. _South Documentation: http://south.readthedocs.org/en/latest/
``compressor``
Static asset combiner and minifier for Django. Compressor also enables for the use of preprocessors. See `Compressor Documentation`_.
.. _Compressor Documentation: http://django-compressor.readthedocs.org/en/latest/
``taggit``
Tagging framework for Django. This is used internally within Wagtail for image and document tagging and is available for your own models as well. See :ref:`tagging` for a Wagtail model recipe or the `Taggit Documentation`_.
.. _Taggit Documentation: http://django-taggit.readthedocs.org/en/latest/index.html
``modelcluster``
Extension of Django ForeignKey relation functionality, which is used in Wagtail pages for on-the-fly related object creation. For more information, see :ref:`inline_panels` or `the django-modelcluster github project page`_.
.. _the django-modelcluster github project page: https://github.com/torchbox/django-modelcluster
``django.contrib.admin``
The Django admin module. While Wagtail will eventually provide a sites-editing interface, the Django admin is included for now to provide that functionality.
Wagtail Apps
------------
``wagtailcore``
The core functionality of Wagtail, such as the ``Page`` class, the Wagtail tree, and model fields.
``wagtailadmin``
The administration interface for Wagtail, including page edit handlers.
``wagtaildocs``
The Wagtail document content type.
``wagtailsnippets``
Editing interface for non-Page models and objects. See :ref:`Snippets`.
``wagtailusers``
User editing interface.
``wagtailimages``
The Wagtail image content type.
``wagtailembeds``
Module governing oEmbed and Embedly content in Wagtail rich text fields. See :ref:`inserting_videos`.
``wagtailsearch``
Search framework for Page content. See :ref:`search`.
``wagtailredirects``
Admin interface for creating arbitrary redirects on your site. See :ref:`redirects`.
``wagtailforms``
Models for creating forms on your pages and viewing submissions. See :ref:`form_builder`.
Settings Variables (settings.py)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Authentication
--------------
.. code-block:: python
LOGIN_URL = 'wagtailadmin_login'
LOGIN_REDIRECT_URL = 'wagtailadmin_home'
These settings variables set the Django authentication system to redirect to the Wagtail admin login. If you plan to use the Django authentication module to log in non-privileged users, you should set these variables to your own login views. See `Django User Authentication`_.
.. _Django User Authentication: https://docs.djangoproject.com/en/dev/topics/auth/
Site Name
---------
.. code-block:: python
WAGTAIL_SITE_NAME = 'Stark Industries Skunkworks'
This is the human-readable name of your Wagtail install which welcomes users upon login to the Wagtail admin.
Search
------
.. code-block:: python
# Override the search results template for wagtailsearch
WAGTAILSEARCH_RESULTS_TEMPLATE = 'myapp/search_results.html'
WAGTAILSEARCH_RESULTS_TEMPLATE_AJAX = 'myapp/includes/search_listing.html'
# Replace the search backend
WAGTAILSEARCH_BACKENDS = {
'default': {
'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch.ElasticSearch',
'INDEX': 'myapp'
}
}
The search settings customize the search results templates as well as choosing a custom backend for search. For a full explanation, see :ref:`search`.
Embeds
------
Wagtail uses the oEmbed standard with a large but not comprehensive number of "providers" (youtube, vimeo, etc.). You can also use a different embed backend by providing an Embedly key or replacing the embed backend by writing your own embed finder function.
.. code-block:: python
WAGTAILEMBEDS_EMBED_FINDER = 'myapp.embeds.my_embed_finder_function'
Use a custom embed finder function, which takes a URL and returns a dict with metadata and embeddable HTML. Refer to the ``wagtail.wagtailemebds.embeds`` module source for more information and examples.
.. code-block:: python
# not a working key, get your own!
EMBEDLY_KEY = '253e433d59dc4d2xa266e9e0de0cb830'
Providing an API key for the Embedly service will use that as a embed backend, with a more extensive list of providers, as well as analytics and other features. For more information, see `Embedly`_.
.. _Embedly: http://embed.ly/
To use Embedly, you must also install their python module:
.. code-block:: bash
$ pip install embedly
Images
------
.. code-block:: python
WAGTAILIMAGES_IMAGE_MODEL = 'myapp.MyImage'
This setting lets you provide your own image model for use in Wagtail, which might extend the built-in ``AbstractImage`` class or replace it entirely.
Email Notifications
-------------------
.. code-block:: python
WAGTAILADMIN_NOTIFICATION_FROM_EMAIL = 'wagtail@myhost.io'
Wagtail sends email notifications when content is submitted for moderation, and when the content is accepted or rejected. This setting lets you pick which email address these automatic notifications will come from. If omitted, Django will fall back to using the ``DEFAULT_FROM_EMAIL`` variable if set, and ``webmaster@localhost`` if not.
Other Django Settings Used by Wagtail
-------------------------------------
.. code-block:: python
ALLOWED_HOSTS
APPEND_SLASH
AUTH_USER_MODEL
BASE_URL
CACHES
DEFAULT_FROM_EMAIL
INSTALLED_APPS
MEDIA_ROOT
SESSION_COOKIE_DOMAIN
SESSION_COOKIE_NAME
SESSION_COOKIE_PATH
STATIC_URL
TEMPLATE_CONTEXT_PROCESSORS
USE_I18N
For information on what these settings do, see `Django Settings`_.
.. _Django Settings: https://docs.djangoproject.com/en/dev/ref/settings/
Search Signal Handlers
----------------------
.. code-block:: python
from wagtail.wagtailsearch import register_signal_handlers as wagtailsearch_register_signal_handlers
wagtailsearch_register_signal_handlers()
This loads Wagtail's search signal handlers, which need to be loaded very early in the Django life cycle. While not technically a urlconf, this is a convenient place to load them. Calling this function registers signal handlers to watch for when indexed models get saved or deleted. This allows wagtailsearch to update ElasticSearch automatically.
URL Patterns
------------
.. code-block:: python
from django.contrib import admin
from wagtail.wagtailcore import urls as wagtail_urls
from wagtail.wagtailadmin import urls as wagtailadmin_urls
from wagtail.wagtaildocs import urls as wagtaildocs_urls
from wagtail.wagtailsearch.urls import frontend as wagtailsearch_frontend_urls
admin.autodiscover()
urlpatterns = patterns('',
url(r'^django-admin/', include(admin.site.urls)),
url(r'^admin/', include(wagtailadmin_urls)),
url(r'^search/', include(wagtailsearch_frontend_urls)),
url(r'^documents/', include(wagtaildocs_urls)),
# Optional urlconf for including your own vanilla Django urls/views
url(r'', include('myapp.urls')),
# For anything not caught by a more specific rule above, hand over to
# Wagtail's serving mechanism
url(r'', include(wagtail_urls)),
)
This block of code for your project's ``urls.py`` does a few things:
* Load the vanilla Django admin interface to ``/django-admin/``
* Load the Wagtail admin and its various apps
* Dispatch any vanilla Django apps you're using other than Wagtail which require their own urlconfs (this is optional, since Wagtail might be all you need)
* Lets Wagtail handle any further URL dispatching.
That's not everything you might want to include in your project's urlconf, but it's what's necessary for Wagtail to flourish.
.. _complete_example_config:
Ready to Use Example Config Files
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
These two files should reside in your project directory (``myproject/myproject/``).
settings.py
-----------
.. code-block:: python
import os
PROJECT_ROOT = os.path.join(os.path.dirname(__file__), '..', '..')
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
# Default to dummy email backend. Configure dev/production/local backend
# as per https://docs.djangoproject.com/en/dev/topics/email/#email-backends
EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'myprojectdb',
'USER': 'postgres',
'PASSWORD': '',
'HOST': '', # Set to empty string for localhost.
'PORT': '', # Set to empty string for default.
'CONN_MAX_AGE': 600, # number of seconds database connections should persist for
}
}
# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
ALLOWED_HOSTS = []
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'Europe/London'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-gb'
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
# Note that with this set to True, Wagtail will fall back on using numeric dates
# in date fields, as opposed to 'friendly' dates like "24 Sep 2013", because
# Python's strptime doesn't support localised month names: https://code.djangoproject.com/ticket/13339
USE_L10N = False
# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = '/media/'
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'compressor.finders.CompressorFinder',
)
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'change-me'
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'wagtail.wagtailcore.middleware.SiteMiddleware',
'wagtail.wagtailredirects.middleware.RedirectMiddleware',
)
from django.conf import global_settings
TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + (
'django.core.context_processors.request',
)
ROOT_URLCONF = 'myproject.urls'
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'wagtaildemo.wsgi.application'
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'south',
'compressor',
'taggit',
'modelcluster',
'django.contrib.admin',
'wagtail.wagtailcore',
'wagtail.wagtailadmin',
'wagtail.wagtaildocs',
'wagtail.wagtailsnippets',
'wagtail.wagtailusers',
'wagtail.wagtailimages',
'wagtail.wagtailembeds',
'wagtail.wagtailsearch',
'wagtail.wagtailredirects',
'wagtail.wagtailforms',
'myapp',
)
EMAIL_SUBJECT_PREFIX = '[Wagtail] '
INTERNAL_IPS = ('127.0.0.1', '10.0.2.2')
# django-compressor settings
COMPRESS_PRECOMPILERS = (
('text/x-scss', 'django_libsass.SassCompiler'),
)
# Auth settings
LOGIN_URL = 'wagtailadmin_login'
LOGIN_REDIRECT_URL = 'wagtailadmin_home'
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
# WAGTAIL SETTINGS
# This is the human-readable name of your Wagtail install
# which welcomes users upon login to the Wagtail admin.
WAGTAIL_SITE_NAME = 'My Project'
# Override the search results template for wagtailsearch
# WAGTAILSEARCH_RESULTS_TEMPLATE = 'myapp/search_results.html'
# WAGTAILSEARCH_RESULTS_TEMPLATE_AJAX = 'myapp/includes/search_listing.html'
# Replace the search backend
#WAGTAILSEARCH_BACKENDS = {
# 'default': {
# 'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch.ElasticSearch',
# 'INDEX': 'myapp'
# }
#}
# Wagtail email notifications from address
# WAGTAILADMIN_NOTIFICATION_FROM_EMAIL = 'wagtail@myhost.io'
# If you want to use Embedly for embeds, supply a key
# (this key doesn't work, get your own!)
# EMBEDLY_KEY = '253e433d59dc4d2xa266e9e0de0cb830'
urls.py
-------
.. code-block:: python
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.views.generic.base import RedirectView
from django.contrib import admin
from django.conf import settings
import os.path
from wagtail.wagtailcore import urls as wagtail_urls
from wagtail.wagtailadmin import urls as wagtailadmin_urls
from wagtail.wagtaildocs import urls as wagtaildocs_urls
from wagtail.wagtailsearch.urls import frontend as wagtailsearch_frontend_urls
admin.autodiscover()
# Signal handlers
from wagtail.wagtailsearch import register_signal_handlers as wagtailsearch_register_signal_handlers
wagtailsearch_register_signal_handlers()
urlpatterns = patterns('',
url(r'^django-admin/', include(admin.site.urls)),
url(r'^admin/', include(wagtailadmin_urls)),
url(r'^search/', include(wagtailsearch_frontend_urls)),
url(r'^documents/', include(wagtaildocs_urls)),
# For anything not caught by a more specific rule above, hand over to
# Wagtail's serving mechanism
url(r'', include(wagtail_urls)),
)
if settings.DEBUG:
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
urlpatterns += staticfiles_urlpatterns() # tell gunicorn where static files are in dev mode
urlpatterns += static(settings.MEDIA_URL + 'images/', document_root=os.path.join(settings.MEDIA_ROOT, 'images'))
urlpatterns += patterns('',
(r'^favicon\.ico$', RedirectView.as_view(url=settings.STATIC_URL + 'myapp/images/favicon.ico'))
)

View file

@ -0,0 +1,58 @@
Sitemap generation
==================
This document describes how to create XML sitemaps for your Wagtail website using the ``wagtail.contrib.wagtailsitemaps`` module.
Basic configuration
~~~~~~~~~~~~~~~~~~~
You firstly need to add ``"wagtail.contrib.wagtailsitemaps"`` to INSTALLED_APPS in your Django settings file:
.. code-block:: python
INSTALLED_APPS = [
...
"wagtail.contrib.wagtailsitemaps",
]
Then, in urls.py, you need to add a link to the ``wagtail.contrib.wagtailsitemaps.views.sitemap`` view which generates the sitemap:
.. code-block:: python
from wagtail.contrib.wagtailsitemaps.views import sitemap
urlpatterns = patterns('',
...
url('^sitemap\.xml$', sitemap),
)
You should now be able to browse to "/sitemap.xml" and see the sitemap working. By default, all published pages in your website will be added to the site map.
Customising
~~~~~~~~~~~
URLs
----
The Page class defines a ``get_sitemap_urls`` method which you can override to customise sitemaps per page instance. This method must return a list of dictionaries, one dictionary per URL entry in the sitemap. You can exclude pages from the sitemap by returning an empty list.
Each dictionary can contain the following:
- **location** (required) - This is the full URL path to add into the sitemap.
- **lastmod** - A python date or datetime set to when the page was last modified.
- **changefreq**
- **priority**
You can add more but you will need to override the ``wagtailsitemaps/sitemap.xml`` template in order for them to be displayed in the sitemap.
Cache
-----
By default, sitemaps are cached for 100 minutes. You can change this by setting ``WAGTAILSITEMAPS_CACHE_TIMEOUT`` in your Django settings to the number of seconds you would like the cache to last for.

View file

@ -25,8 +25,19 @@ Then add ``django_medusa`` and ``wagtail.contrib.wagtailmedusa`` to ``INSTALLED_
]
Rendering
~~~~~~~~~
To render a site, run ``./manage.py staticsitegen``. This will render the entire website and place the HTML in a folder called 'medusa_output'. The static and media folders need to be copied into this folder manually after the rendering is complete. This feature inherits django-medusa's ability to render your static site to Amazon S3 or Google App Engine; see the `medusa docs <https://github.com/mtigas/django-medusa/blob/master/README.markdown>`_ for configuration details.
To test, open the 'medusa_output' folder in a terminal and run ``python -m SimpleHTTPServer``.
Advanced topics
~~~~~~~~~~~~~~~
Replacing GET parameters with custom routing
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--------------------------------------------
Pages which require GET parameters (e.g. for pagination) don't generate suitable filenames for generated HTML files so they need to be changed to use custom routing instead.
@ -51,7 +62,7 @@ For example, let's say we have a Blog Index which uses pagination. We can overri
Rendering pages which use custom routing
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----------------------------------------
For page types that override the ``route`` method, we need to let django medusa know which URLs it responds on. This is done by overriding the ``get_static_site_paths`` method to make it yield one string per URL path.
@ -72,12 +83,4 @@ For example, the BlogIndex above would need to yield one URL for each page of re
yield path
Rendering
~~~~~~~~~
To render a site, run ``./manage.py staticsitegen``. This will render the entire website and place the HTML in a folder called 'medusa_output'. The static and media folders need to be copied into this folder manually after the rendering is complete. This feature inherits django-medusa's ability to render your static site to Amazon S3 or Google App Engine; see the `medusa docs <https://github.com/mtigas/django-medusa/blob/master/README.markdown>`_ for configuration details.
To test, open the 'medusa_output' folder in a terminal and run ``python -m SimpleHTTPServer``.
.. _django medusa: https://github.com/mtigas/django-medusa

View file

@ -1,3 +1,6 @@
.. _search:
Search
======

View file

@ -1,4 +1,4 @@
# For coverage and PEP8 linting
coverage==3.7.1
flake8==2.1.0
flake8==2.2.1
mock==1.0.1

View file

@ -43,6 +43,7 @@ if not settings.configured:
STATIC_ROOT=STATIC_ROOT,
MEDIA_ROOT=MEDIA_ROOT,
USE_TZ=True,
TIME_ZONE='UTC',
STATICFILES_FINDERS=(
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'compressor.finders.CompressorFinder',
@ -85,6 +86,7 @@ if not settings.configured:
'wagtail.wagtailredirects',
'wagtail.wagtailforms',
'wagtail.contrib.wagtailstyleguide',
'wagtail.contrib.wagtailsitemaps',
'wagtail.tests',
],

View file

@ -1,5 +1,8 @@
#!/usr/bin/env python
import sys
try:
from setuptools import setup, find_packages
except ImportError:
@ -16,6 +19,32 @@ except ImportError:
pass
PY3 = sys.version_info[0] == 3
install_requires = [
"Django>=1.6.2,<1.7",
"South>=0.8.4",
"django-compressor>=1.3",
"django-libsass>=0.1",
"django-modelcluster>=0.1",
"django-taggit==0.11.2",
"django-treebeard==2.0",
"Pillow>=2.3.0",
"beautifulsoup4>=4.3.2",
"lxml>=3.3.0",
"Unidecode>=0.04.14",
"six==1.7.3",
'requests==2.3.0',
]
if not PY3:
install_requires += [
"unicodecsv>=0.9.4"
]
setup(
name='wagtail',
version='0.3.1',
@ -37,23 +66,13 @@ setup(
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Framework :: Django',
'Topic :: Internet :: WWW/HTTP :: Site Management',
],
install_requires=[
"Django>=1.6.2,<1.7",
"South>=0.8.4",
"django-compressor>=1.3",
"django-libsass>=0.1",
"django-modelcluster>=0.1",
"django-taggit==0.11.2",
"django-treebeard==2.0",
"Pillow>=2.3.0",
"beautifulsoup4>=4.3.2",
"lxml>=3.3.0",
'unicodecsv>=0.9.4',
'Unidecode>=0.04.14',
"BeautifulSoup==3.2.1", # django-compressor gets confused if we have lxml but not BS3 installed
],
install_requires=install_requires,
zip_safe=False,
)

64
tox.ini
View file

@ -1,15 +1,18 @@
[deps]
dj16=
Django>=1.6,<1.7
pyelasticsearch==0.6.1
elasticutils==0.8.2
elasticsearch==1.1.0
mock==1.0.1
[tox]
envlist =
py26-dj16-postgres,
py26-dj16-sqlite,
py27-dj16-postgres,
py27-dj16-sqlite
py27-dj16-sqlite,
py32-dj16-postgres,
py33-dj16-postgres,
py34-dj16-postgres
# mysql not currently supported
# (wagtail.wagtailimages.tests.TestImageEditView currently fails with a
@ -17,6 +20,12 @@ envlist =
# py26-dj16-mysql
# py27-dj16-mysql
# South fails with sqlite on python3, because it tries to use DryRunMigrator which uses iteritems
# py32-dj16-sqlite,
# py33-dj16-sqlite,
# py34-dj16-sqlite
[testenv]
commands=./runtests.py
@ -24,7 +33,7 @@ commands=./runtests.py
basepython=python2.6
deps =
{[deps]dj16}
psycopg2==2.5.2
psycopg2==2.5.3
setenv =
DATABASE_ENGINE=django.db.backends.postgresql_psycopg2
@ -48,7 +57,7 @@ setenv =
basepython=python2.7
deps =
{[deps]dj16}
psycopg2==2.5.2
psycopg2==2.5.3
setenv =
DATABASE_ENGINE=django.db.backends.postgresql_psycopg2
@ -67,3 +76,48 @@ deps =
setenv =
DATABASE_ENGINE=django.db.backends.mysql
DATABASE_USER=wagtail
[testenv:py32-dj16-postgres]
basepython=python3.2
deps =
{[deps]dj16}
psycopg2==2.5.3
setenv =
DATABASE_ENGINE=django.db.backends.postgresql_psycopg2
[testenv:py32-dj16-sqlite]
basepython=python3.2
deps =
{[deps]dj16}
setenv =
DATABASE_ENGINE=django.db.backends.sqlite3
[testenv:py33-dj16-postgres]
basepython=python3.3
deps =
{[deps]dj16}
psycopg2==2.5.3
setenv =
DATABASE_ENGINE=django.db.backends.postgresql_psycopg2
[testenv:py33-dj16-sqlite]
basepython=python3.3
deps =
{[deps]dj16}
setenv =
DATABASE_ENGINE=django.db.backends.sqlite3
[testenv:py34-dj16-postgres]
basepython=python3.4
deps =
{[deps]dj16}
psycopg2==2.5.3
setenv =
DATABASE_ENGINE=django.db.backends.postgresql_psycopg2
[testenv:py34-dj16-sqlite]
basepython=python3.4
deps =
{[deps]dj16}
setenv =
DATABASE_ENGINE=django.db.backends.sqlite3

View file

@ -0,0 +1,25 @@
from django.db import models
from django.db.models.signals import post_delete
from wagtail.wagtailcore.models import Page
from wagtail.wagtailcore.signals import page_published
from wagtail.contrib.wagtailfrontendcache.utils import purge_page_from_cache
def page_published_signal_handler(instance, **kwargs):
purge_page_from_cache(instance)
def post_delete_signal_handler(instance, **kwargs):
purge_page_from_cache(instance)
def register_signal_handlers():
# Get list of models that are page types
indexed_models = [model for model in models.get_models() if issubclass(model, Page)]
# Loop through list and register signal handlers for each one
for model in indexed_models:
page_published.connect(page_published_signal_handler, sender=model)
post_delete.connect(post_delete_signal_handler, sender=model)

View file

@ -0,0 +1,35 @@
import requests
from requests.adapters import HTTPAdapter
from django.conf import settings
class CustomHTTPAdapter(HTTPAdapter):
"""
Requests will always send requests to whatever server is in the netloc
part of the URL. This is a problem with purging the cache as this netloc
may point to a different server (such as an nginx instance running in
front of the cache).
This class allows us to send a purge request directly to the cache server
with the host header still set correctly. It does this by changing the "url"
parameter of get_connection to always point to the cache server. Requests
will then use this connection to purge the page.
"""
def __init__(self, cache_url):
self.cache_url = cache_url
super(CustomHTTPAdapter, self).__init__()
def get_connection(self, url, proxies=None):
return super(CustomHTTPAdapter, self).get_connection(self.cache_url, proxies)
def purge_page_from_cache(page):
# Get session
cache_server_url = getattr(settings, 'WAGTAILFRONTENDCACHE_LOCATION', 'http://127.0.0.1:8000/')
session = requests.Session()
session.mount('http://', CustomHTTPAdapter(cache_server_url))
# Purge paths from cache
for path in page.get_cached_paths():
session.request('PURGE', page.full_url + path[1:])

View file

@ -0,0 +1,21 @@
from django.template.loader import render_to_string
class Sitemap(object):
template = 'wagtailsitemaps/sitemap.xml'
def __init__(self, site):
self.site = site
def get_pages(self):
return self.site.root_page.get_descendants(inclusive=True).live().order_by('path')
def get_urls(self):
for page in self.get_pages():
for url in page.get_sitemap_urls():
yield url
def render(self):
return render_to_string(self.template, {
'urlset': self.get_urls()
})

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{% spaceless %}
{% for url in urlset %}
<url>
<loc>{{ url.location }}</loc>
{% if url.lastmod %}<lastmod>{{ url.lastmod|date:"Y-m-d" }}</lastmod>{% endif %}
{% if url.changefreq %}<changefreq>{{ url.changefreq }}</changefreq>{% endif %}
{% if url.priority %}<priority>{{ url.priority }}</priority>{% endif %}
</url>
{% endfor %}
{% endspaceless %}
</urlset>

View file

@ -0,0 +1,83 @@
from django.test import TestCase
from django.core.cache import cache
from wagtail.wagtailcore.models import Page, Site
from wagtail.tests.models import SimplePage
from .sitemap_generator import Sitemap
class TestSitemapGenerator(TestCase):
def setUp(self):
self.home_page = Page.objects.get(id=2)
self.child_page = self.home_page.add_child(instance=SimplePage(
title="Hello world!",
slug='hello-world',
live=True,
))
self.unpublished_child_page = self.home_page.add_child(instance=SimplePage(
title="Unpublished",
slug='unpublished',
live=False,
))
self.site = Site.objects.get(is_default_site=True)
def test_get_pages(self):
sitemap = Sitemap(self.site)
pages = sitemap.get_pages()
self.assertIn(self.child_page.page_ptr, pages)
self.assertNotIn(self.unpublished_child_page.page_ptr, pages)
def test_get_urls(self):
sitemap = Sitemap(self.site)
urls = [url['location'] for url in sitemap.get_urls()]
self.assertIn('/', urls) # Homepage
self.assertIn('/hello-world/', urls) # Child page
def test_render(self):
sitemap = Sitemap(self.site)
xml = sitemap.render()
# Check that a URL has made it into the xml
self.assertIn('/hello-world/', xml)
# Make sure the unpublished page didn't make it into the xml
self.assertNotIn('/unpublished/', xml)
class TestSitemapView(TestCase):
def test_sitemap_view(self):
response = self.client.get('/sitemap.xml')
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'wagtailsitemaps/sitemap.xml')
self.assertEqual(response['Content-Type'], 'text/xml; charset=utf-8')
def test_sitemap_view_cache(self):
cache_key = 'wagtail-sitemap:%d' % Site.objects.get(is_default_site=True).id
# Check that the key is not in the cache
self.assertFalse(cache.has_key(cache_key))
# Hit the view
first_response = self.client.get('/sitemap.xml')
self.assertEqual(first_response.status_code, 200)
self.assertTemplateUsed(first_response, 'wagtailsitemaps/sitemap.xml')
# Check that the key is in the cache
self.assertTrue(cache.has_key(cache_key))
# Hit the view again. Should come from the cache this time
second_response = self.client.get('/sitemap.xml')
self.assertEqual(second_response.status_code, 200)
self.assertTemplateNotUsed(second_response, 'wagtailsitemaps/sitemap.xml') # Sitemap should not be re rendered
# Check that the content is the same
self.assertEqual(first_response.content, second_response.content)

View file

@ -0,0 +1,23 @@
from django.http import HttpResponse
from django.core.cache import cache
from django.conf import settings
from .sitemap_generator import Sitemap
def sitemap(request):
cache_key = 'wagtail-sitemap:' + str(request.site.id)
sitemap_xml = cache.get(cache_key)
if not sitemap_xml:
# Rerender sitemap
sitemap = Sitemap(request.site)
sitemap_xml = sitemap.render()
cache.set(cache_key, sitemap_xml, getattr(settings, 'WAGTAILSITEMAPS_CACHE_TIMEOUT', 6000))
# Build response
response = HttpResponse(sitemap_xml)
response['Content-Type'] = "text/xml; charset=utf-8"
return response

View file

@ -42,9 +42,10 @@
<li class="color-teal">color-teal</li>
<li class="color-teal-darker">color-teal-darker</li>
<li class="color-teal-dark">color-teal-dark</li>
<li class="color-red">color-red</li>
<li class="color-orange">color-orange</li>
<li class="color-green">color-green</li>
</ul>
<ul>
<li class="color-salmon">color-salmon</li>
<li class="color-salmon-light">color-salmon-light</li>
</ul>
<ul>
<li class="color-grey-1">color-grey-1</li>
@ -54,6 +55,12 @@
<li class="color-grey-4">color-grey-4</li>
<li class="color-grey-5">color-grey-5</li>
</ul>
<ul>
<li class="color-red">color-red</li>
<li class="color-orange">color-orange</li>
<li class="color-green">color-green</li>
</ul>
</section>
<section id="typography">
@ -149,29 +156,37 @@
<section id="buttons">
<h2>Buttons</h2>
<div href="" class="button">button</div>
<a href="#" class="button">button</a>
<div href="" class="button button-secondary">button-secondary</div>
<a href="#" class="button button-secondary">button-secondary</a>
<div href="" class="button yes">yes</div>
<a href="#" class="button yes">yes</a>
<div href="" class="button no">no / serious</div>
<a href="#" class="button no">no / serious</a>
<div href="" class="button bicolor icon icon-plus">bicolor with icon</div>
<a href="#" class="button bicolor icon icon-plus">bicolor with icon</a>
<div href="" class="button button-small">button-small</div>
<a href="#" class="button button-small">button-small</a>
<div href="" class="button bicolor button-small icon icon-plus">bicolo button-small</div>
<a href="#" class="button bicolor button-small icon icon-plus">bicolo button-small</a>
<div href="" class="button button-secondary no">mixed 1</div>
<a href="#" class="button button-secondary no">mixed 1</a>
<div href="" class="button no bicolor icon icon-cog">mixed 2</div>
<a href="#" class="button no bicolor icon icon-cog">mixed 2</a>
<div class="button no bicolor icon icon-cog">button on a div</div>
<p>Buttons must have interaction possible (i.e be an input or button element) to get a suitable hover cursor</p>
<button>button</button>
<button class="button-small">small button</button>
<button class="bicolor icon icon-plus">bicolor with icon</button>
<input type="submit" class="bicolor icon icon-plus" value="bicolor only supported on button elements" />
<button class="icon icon-view">button</button>
</section>
<section id="dropdowns">
@ -191,7 +206,7 @@
<div class="col3">
<div class="dropdown dropdown-button">
<div class="button">drop down</div>
<input type="button" value="drop down" class="button" />
<div class="dropdown-toggle icon icon-arrow-down"></div>
<ul role="menu">
<li><a href="#">Items in this list do not match button width</a></li>
@ -222,6 +237,24 @@
</div>
</div>
</div>
<div class="row">
<br />
<div class="col3">
<div class="dropdown dropdown-button match-width">
<a href="#" class="button" value="drop down">Link button</a>
<div class="dropdown-toggle icon icon-arrow-down"></div>
<ul role="menu">
<li><a href="#">items should not exceed button width</a></li>
<li><a href="#">item 2</a></li>
</ul>
</div>
</div>
<div class="col3">
<button>button for comparison of height</button>
</div>
</div>
</section>
<section id="header">
@ -381,6 +414,7 @@
<li class="icon icon-warning">warning</li>
<li class="icon icon-success">success</li>
<li class="icon icon-date">date</li>
<li class="icon icon-time">time</li>
<li class="icon icon-form">form</li>
</ul>

View file

@ -1,16 +1,10 @@
from django import forms
from django.db import models
from django.shortcuts import render
from django.utils.translation import ugettext as _
from django.contrib import messages
from django.contrib.auth.decorators import permission_required
from wagtail.wagtailadmin.edit_handlers import PageChooserPanel
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
from wagtail.wagtaildocs.edit_handlers import DocumentChooserPanel
from wagtail.wagtailadmin.forms import SearchForm
from wagtail.wagtailcore.fields import RichTextField
CHOICES = (
@ -23,6 +17,7 @@ class ExampleForm(forms.Form):
url = forms.URLField(required=True)
email = forms.EmailField(max_length=254)
date = forms.DateField()
time = forms.TimeField()
select = forms.ChoiceField(choices=CHOICES)
boolean = forms.BooleanField(required=False)

View file

@ -1,14 +1,10 @@
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls import url
from django.core import urlresolvers
from django.utils.html import format_html, format_html_join
from django.utils.translation import ugettext_lazy as _
from wagtail.wagtailadmin import hooks
from wagtail.wagtailcore import hooks
from wagtail.wagtailadmin.menu import MenuItem
from wagtail.wagtailimages import urls
from . import views

View file

@ -39,7 +39,7 @@
"model": "wagtailcore.page",
"fields": {
"title": "Events",
"numchild": 3,
"numchild": 4,
"show_in_menus": true,
"live": true,
"depth": 3,
@ -194,6 +194,37 @@
"pk": 8,
"model": "tests.formpage",
"fields": {
"to_address": "to@email.com",
"from_address": "from@email.com",
"subject": "The subject"
}
},
{
"pk": 9,
"model": "wagtailcore.page",
"fields": {
"title": "Ameristralia Day",
"numchild": 0,
"show_in_menus": true,
"live": true,
"depth": 4,
"content_type": ["tests", "eventpage"],
"path": "0001000100010004",
"url_path": "/home/events/final-event/",
"slug": "final-event",
"owner": 3
}
},
{
"pk": 9,
"model": "tests.eventpage",
"fields": {
"date_from": "2015-04-22",
"audience": "public",
"location": "Ameristralia",
"body": "<p>come celebrate the independence of Ameristralia</p>",
"cost": "Free"
}
},
@ -276,6 +307,16 @@
]
}
},
{
"pk": 6,
"model": "auth.group",
"fields": {
"name": "Admin non-editors",
"permissions": [
["access_admin", "wagtailadmin", "admin"]
]
}
},
{
"pk": 1,
"model": "wagtailcore.grouppagepermission",
@ -411,6 +452,24 @@
"email": "siteeditor@example.com"
}
},
{
"pk": 6,
"model": "auth.user",
"fields": {
"username": "admin_only_user",
"first_name": "",
"last_name": "",
"is_active": true,
"is_superuser": false,
"is_staff": false,
"groups": [
["Admin non-editors"]
],
"user_permissions": [],
"password": "md5$seasalt$1e9bf2bf5606aa5c39852cc30f0f6f22",
"email": "admin_only_user@example.com"
}
},
{
"pk": 1,
@ -429,5 +488,23 @@
"page": 8,
"submit_time": "2014-01-01T12:00:00.000Z"
}
},
{
"pk": 1,
"model": "wagtaildocs.Document",
"fields": {
"title": "test document",
"created_at": "2014-01-01T12:00:00.000Z"
}
},
{
"pk": 1,
"model": "wagtailimages.Image",
"fields": {
"title": "test image",
"created_at": "2014-01-01T12:00:00.000Z",
"width": 0,
"height": 0
}
}
]

View file

@ -1,6 +1,9 @@
from django.db import models
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.utils.encoding import python_2_unicode_compatible
from modelcluster.fields import ParentalKey
from wagtail.wagtailcore.models import Page, Orderable
from wagtail.wagtailcore.fields import RichTextField
from wagtail.wagtailadmin.edit_handlers import FieldPanel, MultiFieldPanel, InlinePanel, PageChooserPanel
@ -259,6 +262,7 @@ FormPage.content_panels = [
# Snippets
@python_2_unicode_compatible
class Advert(models.Model):
url = models.URLField(null=True, blank=True)
text = models.CharField(max_length=255)
@ -268,7 +272,7 @@ class Advert(models.Model):
FieldPanel('text'),
]
def __unicode__(self):
def __str__(self):
return self.text
@ -281,18 +285,20 @@ register_snippet(Advert)
# to ensure specific [in]correct register ordering
# AlphaSnippet is registered during TestSnippetOrdering
@python_2_unicode_compatible
class AlphaSnippet(models.Model):
text = models.CharField(max_length=255)
def __unicode__(self):
def __str__(self):
return self.text
# ZuluSnippet is registered during TestSnippetOrdering
@python_2_unicode_compatible
class ZuluSnippet(models.Model):
text = models.CharField(max_length=255)
def __unicode__(self):
def __str__(self):
return self.text

View file

@ -1,4 +1,5 @@
{% load pageurl %}
{% load wagtailcore_tags %}
<!DOCTYPE HTML>
<html>
<head>

View file

@ -1,4 +1,5 @@
{% load pageurl %}
{% load wagtailcore_tags %}
<!DOCTYPE HTML>
<html>
<head>

View file

@ -1,4 +1,5 @@
{% load pageurl %}
{% load wagtailcore_tags %}
<!DOCTYPE HTML>
<html>
<head>

View file

@ -1,4 +1,4 @@
{% load pageurl %}
{% load wagtailcore_tags %}
<ul>
{% for event in events %}

View file

@ -1,4 +1,5 @@
{% load pageurl %}
{% load wagtailcore_tags %}
<!DOCTYPE HTML>
<html>
<head>

View file

@ -4,6 +4,7 @@ from wagtail.wagtailcore import urls as wagtail_urls
from wagtail.wagtailadmin import urls as wagtailadmin_urls
from wagtail.wagtaildocs import urls as wagtaildocs_urls
from wagtail.wagtailsearch.urls import frontend as wagtailsearch_frontend_urls
from wagtail.contrib.wagtailsitemaps.views import sitemap
# Signal handlers
from wagtail.wagtailsearch import register_signal_handlers as wagtailsearch_register_signal_handlers
@ -15,6 +16,8 @@ urlpatterns = patterns('',
url(r'^search/', include(wagtailsearch_frontend_urls)),
url(r'^documents/', include(wagtaildocs_urls)),
url(r'^sitemap\.xml$', sitemap),
# For anything not caught by a more specific rule above, hand over to
# Wagtail's serving mechanism
url(r'', include(wagtail_urls)),

View file

@ -1,7 +1,4 @@
from django.test import TestCase
from django.contrib.auth.models import User
from django.utils.six.moves.urllib.parse import urlparse, ParseResult
from django.http import QueryDict
# We need to make sure that we're using the same unittest library that Django uses internally
# Otherwise, we get issues with the "SkipTest" and "ExpectedFailure" exceptions being recognised as errors

View file

@ -1,4 +1,4 @@
from wagtail.wagtailadmin import hooks
from wagtail.wagtailcore import hooks
from wagtail.wagtailcore.whitelist import attribute_rule, check_url, allow_without_attributes
def editor_css():

View file

@ -1,6 +1,9 @@
from __future__ import unicode_literals
import copy
import re
import datetime
from six import string_types
from six import text_type
from taggit.forms import TagWidget
from modelcluster.forms import ClusterForm, ClusterFormMetaclass
@ -9,13 +12,10 @@ from django.template.loader import render_to_string
from django.template.defaultfilters import addslashes
from django.utils.safestring import mark_safe
from django import forms
from django.db import models
from django.forms.models import fields_for_model
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured, ValidationError
from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured
from django.core.urlresolvers import reverse
from django.conf import settings
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_lazy
from wagtail.wagtailcore.models import Page
@ -72,7 +72,7 @@ class WagtailAdminModelFormMetaclass(ClusterFormMetaclass):
new_class = super(WagtailAdminModelFormMetaclass, cls).__new__(cls, name, bases, attrs)
return new_class
WagtailAdminModelForm = WagtailAdminModelFormMetaclass('WagtailAdminModelForm', (ClusterForm,), {})
WagtailAdminModelForm = WagtailAdminModelFormMetaclass(str('WagtailAdminModelForm'), (ClusterForm,), {})
# Now, any model forms built off WagtailAdminModelForm instead of ModelForm should pick up
# the nice form fields defined in FORM_FIELD_OVERRIDES.
@ -108,7 +108,7 @@ def get_form_for_model(
# Give this new form class a reasonable name.
class_name = model.__name__ + str('Form')
form_class_attrs = {
'Meta': type('Meta', (object,), attrs)
'Meta': type(str('Meta'), (object,), attrs)
}
return WagtailAdminModelFormMetaclass(class_name, (WagtailAdminModelForm,), form_class_attrs)
@ -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
@ -183,19 +187,21 @@ class EditHandler(object):
heading = ""
help_text = ""
def object_classnames(self):
def classes(self):
"""
Additional classnames to add to the <li class="object"> when rendering this
within an ObjectList
Additional CSS classnames to add to whatever kind of object this is at output.
Subclasses of EditHandler should override this, invoking super(B, self).classes() to
append more classes specific to the situation.
"""
return ""
def field_classnames(self):
"""
Additional classnames to add to the <li> when rendering this within a
<ul class="fields">
"""
return ""
classes = []
try:
classes.append(self.classname)
except AttributeError:
pass
return classes
def field_type(self):
"""
@ -239,12 +245,12 @@ class EditHandler(object):
"""
rendered_fields = self.rendered_fields()
missing_fields_html = [
unicode(self.form[field_name])
text_type(self.form[field_name])
for field_name in self.form.fields
if field_name not in rendered_fields
]
return mark_safe(u''.join(missing_fields_html))
return mark_safe(''.join(missing_fields_html))
def render_form_content(self):
"""
@ -261,12 +267,6 @@ class BaseCompositeEditHandler(EditHandler):
"""
_widget_overrides = None
def object_classnames(self):
try:
return "multi-field " + self.classname
except (AttributeError, TypeError):
return "multi-field"
@classmethod
def widget_overrides(cls):
if cls._widget_overrides is None:
@ -304,7 +304,7 @@ class BaseCompositeEditHandler(EditHandler):
}))
def render_js(self):
return mark_safe(u'\n'.join([handler.render_js() for handler in self.children]))
return mark_safe('\n'.join([handler.render_js() for handler in self.children]))
def rendered_fields(self):
result = []
@ -319,26 +319,41 @@ class BaseTabbedInterface(BaseCompositeEditHandler):
def TabbedInterface(children):
return type('_TabbedInterface', (BaseTabbedInterface,), {'children': children})
return type(str('_TabbedInterface'), (BaseTabbedInterface,), {'children': children})
class BaseObjectList(BaseCompositeEditHandler):
template = "wagtailadmin/edit_handlers/object_list.html"
def ObjectList(children, heading=""):
return type('_ObjectList', (BaseObjectList,), {
def ObjectList(children, heading="", classname=""):
return type(str('_ObjectList'), (BaseObjectList,), {
'children': children,
'heading': heading,
'classname': classname
})
class BaseFieldRowPanel(BaseCompositeEditHandler):
template = "wagtailadmin/edit_handlers/field_row_panel.html"
def FieldRowPanel(children, classname=""):
return type(str('_FieldRowPanel'), (BaseFieldRowPanel,), {
'children': children,
'classname': classname,
})
class BaseMultiFieldPanel(BaseCompositeEditHandler):
template = "wagtailadmin/edit_handlers/multi_field_panel.html"
def classes(self):
classes = super(BaseMultiFieldPanel, self).classes()
classes.append("multi-field")
return classes
def MultiFieldPanel(children, heading="", classname=None):
return type('_MultiFieldPanel', (BaseMultiFieldPanel,), {
def MultiFieldPanel(children, heading="", classname=""):
return type(str('_MultiFieldPanel'), (BaseMultiFieldPanel,), {
'children': children,
'heading': heading,
'classname': classname,
@ -353,25 +368,23 @@ class BaseFieldPanel(EditHandler):
self.heading = self.bound_field.label
self.help_text = self.bound_field.help_text
def object_classnames(self):
try:
return "single-field " + self.classname
except (AttributeError, TypeError):
return "single-field"
def classes(self):
classes = super(BaseFieldPanel, self).classes();
if self.bound_field.field.required:
classes.append("required")
if self.bound_field.errors:
classes.append("error")
classes.append(self.field_type())
classes.append("single-field")
return classes
def field_type(self):
return camelcase_to_underscore(self.bound_field.field.__class__.__name__)
def field_classnames(self):
classname = self.field_type()
if self.bound_field.field.required:
classname += " required"
if self.bound_field.errors:
classname += " error"
return classname
object_template = "wagtailadmin/edit_handlers/field_panel_object.html"
object_template = "wagtailadmin/edit_handlers/single_field_panel.html"
def render_as_object(self):
return mark_safe(render_to_string(self.object_template, {
@ -401,8 +414,8 @@ class BaseFieldPanel(EditHandler):
return [self.field_name]
def FieldPanel(field_name, classname=None):
return type('_FieldPanel', (BaseFieldPanel,), {
def FieldPanel(field_name, classname=""):
return type(str('_FieldPanel'), (BaseFieldPanel,), {
'field_name': field_name,
'classname': classname,
})
@ -414,7 +427,7 @@ class BaseRichTextFieldPanel(BaseFieldPanel):
def RichTextFieldPanel(field_name):
return type('_RichTextFieldPanel', (BaseRichTextFieldPanel,), {
return type(str('_RichTextFieldPanel'), (BaseRichTextFieldPanel,), {
'field_name': field_name,
})
@ -470,7 +483,7 @@ class BasePageChooserPanel(BaseChooserPanel):
def target_content_type(cls):
if cls._target_content_type is None:
if cls.page_type:
if isinstance(cls.page_type, basestring):
if isinstance(cls.page_type, string_types):
# translate the passed model name into an actual model class
from django.db.models import get_model
try:
@ -505,7 +518,7 @@ class BasePageChooserPanel(BaseChooserPanel):
def PageChooserPanel(field_name, page_type=None):
return type('_PageChooserPanel', (BasePageChooserPanel,), {
return type(str('_PageChooserPanel'), (BasePageChooserPanel,), {
'field_name': field_name,
'page_type': page_type,
})
@ -588,7 +601,7 @@ class BaseInlinePanel(EditHandler):
def InlinePanel(base_model, relation_name, panels=None, label='', help_text=''):
rel = getattr(base_model, relation_name).related
return type('_InlinePanel', (BaseInlinePanel,), {
return type(str('_InlinePanel'), (BaseInlinePanel,), {
'relation_name': relation_name,
'related': rel,
'panels': panels,
@ -597,10 +610,23 @@ def InlinePanel(base_model, relation_name, panels=None, label='', help_text=''):
})
# This allows users to include the publishing panel in their own per-model override
# without having to write these fields out by hand, potentially losing 'classname'
# and therefore the associated styling of the publishing panel
def PublishingPanel():
return MultiFieldPanel([
FieldRowPanel([
FieldPanel('go_live_at'),
FieldPanel('expire_at'),
], classname="label-above"),
], ugettext_lazy('Scheduled publishing'), classname="publishing")
# Now that we've defined EditHandlers, we can set up wagtailcore.Page to have some.
Page.content_panels = [
FieldPanel('title', classname="full title"),
]
Page.promote_panels = [
MultiFieldPanel([
FieldPanel('slug'),
@ -609,3 +635,7 @@ Page.promote_panels = [
FieldPanel('search_description'),
], ugettext_lazy('Common page configuration')),
]
Page.settings_panels = [
PublishingPanel()
]

View file

@ -1,38 +1,11 @@
from django.conf import settings
try:
from importlib import import_module
except ImportError:
# for Python 2.6, fall back on django.utils.importlib (deprecated as of Django 1.7)
from django.utils.importlib import import_module
# The 'hooks' module is now part of wagtailcore.
# Imports are provided here for backwards compatibility
_hooks = {}
import warnings
# TODO: support 'register' as a decorator:
# @hooks.register('construct_main_menu')
# def construct_main_menu(menu_items):
# ...
warnings.warn(
"The wagtail.wagtailadmin.hooks module has been moved. "
"Use wagtail.wagtailcore.hooks instead.", DeprecationWarning)
def register(hook_name, fn):
if hook_name not in _hooks:
_hooks[hook_name] = []
_hooks[hook_name].append(fn)
_searched_for_hooks = False
def search_for_hooks():
global _searched_for_hooks
if not _searched_for_hooks:
for app_module in settings.INSTALLED_APPS:
try:
import_module('%s.wagtail_hooks' % app_module)
except ImportError:
continue
_searched_for_hooks = True
def get_hooks(hook_name):
search_for_hooks()
return _hooks.get(hook_name, [])
from wagtail.wagtailcore.hooks import register, get_hooks

View file

@ -1,3 +1,7 @@
from __future__ import unicode_literals
from six import text_type
from django.utils.text import slugify
from django.utils.html import format_html
@ -7,10 +11,10 @@ class MenuItem(object):
self.label = label
self.url = url
self.classnames = classnames
self.name = (name or slugify(unicode(label)))
self.name = (name or slugify(text_type(label)))
self.order = order
def render_html(self):
return format_html(
u"""<li class="menu-{0}"><a href="{1}" class="{2}">{3}</a></li>""",
"""<li class="menu-{0}"><a href="{1}" class="{2}">{3}</a></li>""",
self.name, self.url, self.classnames, self.label)

View file

@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
@ -20,7 +22,7 @@ class Migration(DataMigration):
wagtailadmin_content_type = orm['contenttypes.ContentType'].objects.create(
app_label='wagtailadmin', model='admin', name='Wagtail admin')
admin_permission = orm['auth.permission'].objects.create(
content_type=wagtailadmin_content_type, codename='access_admin', name=u'Can access Wagtail admin')
content_type=wagtailadmin_content_type, codename='access_admin', name='Can access Wagtail admin')
for group in orm['auth.group'].objects.filter(name__in=['Editors', 'Moderators']):
group.permissions.add(admin_permission)
@ -32,23 +34,23 @@ class Migration(DataMigration):
wagtailadmin_content_type.delete()
models = {
u'auth.group': {
'auth.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'contenttypes.contenttype': {
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},

View file

@ -0,0 +1,4 @@
from django.dispatch import Signal
init_new_page = Signal(providing_args=['page', 'parent'])

View file

@ -1,97 +0,0 @@
(function(jQuery) {
return jQuery.widget('IKS.halloToolbarFixed', {
toolbar: null,
options: {
parentElement: 'body',
editable: null,
toolbar: null,
affix: true,
affixTopOffset: 2
},
_create: function() {
var el, widthToAdd,
_this = this;
this.toolbar = this.options.toolbar;
this.toolbar.show();
jQuery(this.options.parentElement).append(this.toolbar);
this._bindEvents();
jQuery(window).resize(function(event) {
return _this.setPosition();
});
jQuery(window).scroll(function(event) {
return _this.setPosition();
});
if (this.options.parentElement === 'body') {
el = jQuery(this.element);
widthToAdd = parseFloat(el.css('padding-left'));
widthToAdd += parseFloat(el.css('padding-right'));
widthToAdd += parseFloat(el.css('border-left-width'));
widthToAdd += parseFloat(el.css('border-right-width'));
widthToAdd += (parseFloat(el.css('outline-width'))) * 2;
widthToAdd += (parseFloat(el.css('outline-offset'))) * 2;
return jQuery(this.toolbar).css("width", el.width() + widthToAdd);
}
},
_getPosition: function(event, selection) {
var offset, position, width;
if (!event) {
return;
}
width = parseFloat(this.element.css('outline-width'));
offset = width + parseFloat(this.element.css('outline-offset'));
return position = {
top: this.element.offset().top - this.toolbar.outerHeight() - offset,
left: this.element.offset().left - offset
};
},
_getCaretPosition: function(range) {
var newRange, position, tmpSpan;
tmpSpan = jQuery("<span/>");
newRange = rangy.createRange();
newRange.setStart(range.endContainer, range.endOffset);
newRange.insertNode(tmpSpan.get(0));
position = {
top: tmpSpan.offset().top,
left: tmpSpan.offset().left
};
tmpSpan.remove();
return position;
},
setPosition: function() {
var elementBottom, elementTop, height, offset, scrollTop, topOffset;
if (this.options.parentElement !== 'body') {
return;
}
this.toolbar.css('top', this.element.offset().top - this.toolbar.outerHeight());
if (this.options.affix) {
this.toolbar.removeClass('affixed');
scrollTop = jQuery(window).scrollTop();
offset = this.element.offset();
height = this.element.height();
topOffset = this.options.affixTopOffset;
elementTop = offset.top - (this.toolbar.height() + this.options.affixTopOffset);
elementBottom = (height - topOffset) + (offset.top - this.toolbar.height());
if (scrollTop > elementTop && scrollTop < elementBottom) {
this.toolbar.addClass('affixed');
this.toolbar.css('top', this.options.affixTopOffset);
}
} else {
}
return this.toolbar;
},
_updatePosition: function(position) {},
_bindEvents: function() {
var _this = this;
this.element.on('halloactivated', function(event, data) {
_this.setPosition();
return _this.toolbar.show();
});
return this.element.on('hallodeactivated', function(event, data) {
return _this.toolbar.hide();
});
}
});
})(jQuery);

View file

@ -1,11 +1,14 @@
"use strict";
var halloPlugins = {
'halloformat': {},
'halloheadings': {formatBlocks: ["p", "h2", "h3", "h4", "h5"]},
'hallolists': {},
'hallohr': {},
'halloreundo': {},
'hallowagtaillink': {},
'hallowagtaillink': {}
};
function registerHalloPlugin(name, opts) {
halloPlugins[name] = (opts || {});
}
@ -30,7 +33,7 @@ function makeRichTextEditable(id) {
richText.hallo({
toolbar: 'halloToolbarFixed',
toolbarcssClass: 'testy',
toolbarCssClass: (input.closest('.object').hasClass('full')) ? 'full' : '',
plugins: halloPlugins
}).bind('hallomodified', function(event, data) {
input.val(data.content);
@ -57,6 +60,7 @@ function initDateChooser(id) {
if (window.dateTimePickerTranslations) {
$('#' + id).datetimepicker({
timepicker: false,
scrollInput:false,
format: 'Y-m-d',
i18n: {
lang: window.dateTimePickerTranslations
@ -66,6 +70,7 @@ function initDateChooser(id) {
} else {
$('#' + id).datetimepicker({
timepicker: false,
scrollInput:false,
format: 'Y-m-d',
});
}
@ -75,6 +80,7 @@ function initTimeChooser(id) {
if (window.dateTimePickerTranslations) {
$('#' + id).datetimepicker({
datepicker: false,
scrollInput:false,
format: 'H:i',
i18n: {
lang: window.dateTimePickerTranslations
@ -93,6 +99,7 @@ function initDateTimeChooser(id) {
if (window.dateTimePickerTranslations) {
$('#' + id).datetimepicker({
format: 'Y-m-d H:i',
scrollInput:false,
i18n: {
lang: window.dateTimePickerTranslations
},
@ -197,7 +204,7 @@ function InlinePanel(opts) {
self.updateMoveButtonDisabledStates = function() {
if (opts.canOrder) {
forms = self.formsUl.children('li:visible');
var forms = self.formsUl.children('li:visible');
forms.each(function(i) {
$('ul.controls .inline-child-move-up', this).toggleClass('disabled', i === 0).toggleClass('enabled', i !== 0);
$('ul.controls .inline-child-move-down', this).toggleClass('disabled', i === forms.length - 1).toggleClass('enabled', i != forms.length - 1);
@ -240,7 +247,10 @@ function InlinePanel(opts) {
}
self.initChildControls(fixPrefix(opts.emptyChildFormPrefix));
if (opts.canOrder) {
$(fixPrefix('#id_' + opts.emptyChildFormPrefix + '-ORDER')).val(formCount);
/* NB form hidden inputs use 0-based index and only increment formCount *after* this function is run.
Therefore formcount and order are currently equal and order must be incremented
to ensure it's *greater* than previous item */
$(fixPrefix('#id_' + opts.emptyChildFormPrefix + '-ORDER')).val(formCount + 1);
}
self.updateMoveButtonDisabledStates();
@ -331,36 +341,65 @@ $(function() {
/* Set up behaviour of preview button */
$('.action-preview').click(function(e) {
e.preventDefault();
var $this = $(this);
var previewWindow = window.open($(this).data('placeholder'), $(this).data('windowname'));
$.ajax({
type: "POST",
url: $(this).data('action'),
data: $('#page-edit-form').serialize(),
success: function(data, textStatus, request) {
if (request.getResponseHeader('X-Wagtail-Preview') == 'ok') {
previewWindow.document.open();
previewWindow.document.write(data);
previewWindow.document.close();
} else {
previewWindow.close();
document.open();
document.write(data);
document.close();
}
},
error: function(xhr, textStatus, errorThrown) {
/* If an error occurs, display it in the preview window so that
we aren't just showing the spinner forever. We preserve the original
error output rather than giving a 'friendly' error message so that
developers can debug template errors. (On a production site, we'd
typically be serving a friendly custom 500 page anyhow.) */
previewWindow.document.open();
previewWindow.document.write(xhr.responseText);
previewWindow.document.close();
var previewWindow = window.open($this.data('placeholder'), $this.data('windowname'));
if(/MSIE/.test(navigator.userAgent)){
submitPreview.call($this, false);
} else {
previewWindow.onload = function(){
submitPreview.call($this, true);
}
});
}
function submitPreview(enhanced){
$.ajax({
type: "POST",
url: $this.data('action'),
data: $('#page-edit-form').serialize(),
success: function(data, textStatus, request) {
if (request.getResponseHeader('X-Wagtail-Preview') == 'ok') {
var pdoc = previewWindow.document;
if(enhanced){
var frame = pdoc.getElementById('preview-frame');
frame = frame.contentWindow || frame.contentDocument.document || frame.contentDocument;
frame.document.open();
frame.document.write(data);
frame.document.close();
var hideTimeout = setTimeout(function(){
pdoc.getElementById('loading-spinner-wrapper').className += 'remove';
clearTimeout(hideTimeout);
}) // just enough to give effect without adding discernible slowness
} else {
pdoc.open();
pdoc.write(data);
pdoc.close()
}
} else {
previewWindow.close();
document.open();
document.write(data);
document.close();
}
},
error: function(xhr, textStatus, errorThrown) {
/* If an error occurs, display it in the preview window so that
we aren't just showing the spinner forever. We preserve the original
error output rather than giving a 'friendly' error message so that
developers can debug template errors. (On a production site, we'd
typically be serving a friendly custom 500 page anyhow.) */
previewWindow.document.open();
previewWindow.document.write(xhr.responseText);
previewWindow.document.close();
}
});
}
});
});

View file

@ -2829,6 +2829,7 @@
} else {
}
return this.toolbar.css('left', this.element.offset().left - 2);
},
_updatePosition: function(position) {},

View file

@ -246,7 +246,7 @@
.xdsoft_calendar td.xdsoft_default,
.xdsoft_calendar td.xdsoft_current,
.xdsoft_timepicker .xdsoft_time_box > div > div.xdsoft_current{
background: $color-orange;
background: $color-salmon;
color:#fff;
font-weight: 700;
}

View file

@ -2,29 +2,19 @@
position:relative;
@include clearfix();
.dropdown-toggle{
color:white;
text-transform:uppercase;
background-color:$color-teal;
line-height:3em;
padding-left:1em;
padding-right:1em;
cursor:pointer;
&:before,
&:after{
margin:0;
}
}
input[type=button], input[type=submit], button, .button{
padding:1em 0;
input[type=submit], input[type=reset], input[type=button], button, .button{
padding:0;
display:block;
width:100%;
height:3em;
line-height:3em;
text-align:left;
padding-left:1em;
float:left;
}
input[type=submit], input[type=reset], input[type=button], button{
line-height:inherit;
}
ul{
@include unlist();
@ -41,6 +31,7 @@
border-color: rgba(255,255,255,0.2);
border-style: solid;
border-width:1px 0 0 0;
overflow:hidden;
}
a{
@ -115,25 +106,26 @@
li{
border-width:0 0 1px 0;
}
}
}
.button{
float:left;
&:hover{
background-color:$color-teal-darker;
}
}
& > .button + .dropdown-toggle{
.dropdown-toggle{
color:white;
text-transform:uppercase;
background-color:$color-teal;
line-height:2.8em;
cursor:pointer;
height:100%;
border-left:1px solid rgba(255,255,255,0.2);
position:absolute;
right:0;
height:100%;
padding:0 0.5em;
text-align:center;
&:before,
&:after{
margin:0;
}
&:before{
width:1em;
font-size:1.2rem;
@ -143,7 +135,8 @@
background-color:$color-teal-darker;
}
}
&.open > .button + .dropdown-toggle{
&.open .dropdown-toggle{
background-color:$color-teal-darker;
}
@ -193,55 +186,6 @@
}
}
h2 .dropdown{
display:inline-block;
font-size:0.7em;
margin-right:0.5em;
vertical-align:middle;
.dropdown-toggle{
padding:0.5em 0;
border-right:1px solid $color-grey-3;
/* icon */
&:before{
opacity:0.5;
padding:0.2em;
height:1.1em;
text-align:left;
}
&:hover{
background-color:$color-teal;
border-color:transparent;
}
}
&.open{
.dropdown-toggle{
background-color:$color-teal;
}
ul{
left:auto;
}
}
.dropdown-toggle:hover{
background-color:$color-grey-3;
&:before{
color:white;
opacity:1;
}
}
&.open .dropdown-toggle:before{
background-color:$color-teal;
color:white;
opacity:1;
}
}
/* Transitions */
.dropdown ul{
@include transition(opacity 0.2s linear);

View file

@ -1,3 +1,9 @@
/*
These are the generic stylings for forms of any type.
If you're styling something specific to the page editing interface,
it probably ought to go in layouts/page-editor.scss
*/
form {
ul, li{
list-style-type:none;
@ -6,9 +12,6 @@ form {
margin:0;
padding:0;
}
li{
@include row();
}
}
fieldset{
@ -55,6 +58,7 @@ input, textarea, select, .richtext, .tagit{
border: 0 !important;
margin-top:-3px !important;
margin-bottom: -2px !important;
line-height:1em !important;
}
&:hover{
@ -76,13 +80,14 @@ input, textarea, select, .richtext, .tagit{
outline:none;
}
&:after{
/* Add select arrow back on browsers where native ui has been removed */
select ~ span:after{
@include border-radius(0 6px 6px 0);
z-index:0;
position:absolute;
right:1px;
right:0px;
top:1px;
height:95%;
bottom:0px;
width:1.5em;
font-family:wagtail;
content:"q";
@ -94,12 +99,14 @@ input, textarea, select, .richtext, .tagit{
pointer-events:none;
color:$color-grey-3;
background-color:$color-fieldset-hover;
margin:0px 1px 0 0;
margin:0px 1px 1px 0;
.ie &{
display:none;
}
}
.ie &:after{
display:none;
}
}
/* radio and check boxes */
@ -166,34 +173,39 @@ input[type=checkbox]:checked:before{
color:$color-teal;
}
/* Core button style */
/* Core button style
Note that these styles include methods to render buttons the same x-browser, described here:
http://cbjdigital.com/blog/2010/08/bulletproof_css_input_button_heights */
input[type=submit], input[type=reset], input[type=button], .button, button{
font-family:Open Sans,Arial,sans-serif;
@include border-radius(3px);
width:auto;
padding:0.7em 1em;
height:2.4em;
line-height:2.4em;
padding:0 1em;
font-size:0.9em;
font-weight:normal;
vertical-align: middle;
display:inline-block;
background-color: $color-button;
border:1px solid $color-button;
color:white;
text-decoration:none;
text-transform:uppercase;
font-size:0.9em;
white-space: nowrap;
position:relative;
-webkit-font-smoothing: auto;
vertical-align: middle;
line-height:1em;
display:inline-block;
overflow:hidden;
position:relative;
font-weight:normal;
outline:none;
box-sizing:border-box;
-webkit-font-smoothing: auto;
-moz-appearance: none;
-moz-box-sizing:border-box;
&.button-small{
padding:0.55em 0.8em;
font-size:1em;
padding:0 0.8em;
height:2em;
line-height:2em;
font-size:0.85em;
}
&.button-secondary{
@ -252,7 +264,7 @@ input[type=submit], input[type=reset], input[type=button], .button, button{
left:0;
top:0;
width:2em;
line-height:2em;
line-height:1.85em;
height:100%;
text-align:center;
background-color:rgba(0,0,0,0.2);
@ -261,13 +273,12 @@ input[type=submit], input[type=reset], input[type=button], .button, button{
}
&.button-small.bicolor{
padding: 0.65em 0.8em;
padding-left:3.5em;
&:before{
width:2em;
font-size:0.9rem;
line-height:2em;
line-height:1.65em;
}
}
@ -280,21 +291,25 @@ input[type=submit], input[type=reset], input[type=button], .button, button{
}
}
button.icon{
&:before,
&:after{
line-height:0;
/* Special styles to counteract Firefox's completely unwarranted assumptions about button styles */
input[type=submit], input[type=reset], input[type=button], button{
padding:0 1em;
height: 2.4em;
line-height:inherit;
&.button-small{
height:2em;
line-height:inherit;
}
}
.multiple{
@include transition(max-height 10s ease);
padding:0;
max-height:10000px;
max-width:1024px - 50px;
overflow:hidden;
> li{
@include row();
position:relative;
background-color:white;
padding:1em 10em 1em 1.5em; /* 10em padding leaves room for controls */
@ -394,7 +409,7 @@ li.focused > .help{
opacity:1;
}
.required label:after{
.required .field > label:after{
content:"*";
color:$color-red;
font-weight:bold;
@ -415,58 +430,112 @@ li.focused > .help{
.boolean_field .help, .radio .help{
opacity:1;
}
.iconfield {
position:relative;
/*
This is expected to go on the parent of the input/select/textarea
so in most cases .input
*/
.iconfield, /* generic */
.date_field,
.time_field,
.date_time_field,
.url_field{
.input{
position:relative;
&:before, &:after{
font-family:wagtail;
position:absolute;
top:0.5em;
line-height:100%;
font-size:2em;
color:$color-grey-3;
}
&:before{
left:0.3em;
}
&:after{
right:0.5em;
}
}
input:not([type=radio]), input:not([type=checkbox]), input:not([type=submit]), input:not([type=button]){
padding-left:2.5em;
}
&:before, &:after{
font-family:wagtail;
position:absolute;
top:0.4em;
font-size:1.4em;
color:$color-grey-3;
}
&:before{
left:0.5em;
}
&:after{
right:0.5em;
/* smaller fields required slight repositioning of icons */
&.field-small{
.input{
&:before, &:after{
font-size:1.3rem; /* REMs are necessary here because IE doesn't treat generated content correctly */
top:0.3em;
}
&:before{
left:0.5em;
}
&:after{
right:0.5em;
}
}
}
/* special case for search spinners */
&.icon-spinner:after{
color:$color-teal;
opacity:0.8;
font-size:20px;
width:20px;
height:20px;
line-height:23px;
text-align:center;
top:0.3em;
}
}
.fields li{
.date_field,
.date_time_field{
.input:before{
@extend .icon-date:before;
}
}
.time_field{
.input:before{
@extend .icon-time:before;
}
}
.url_field{
.input:before{
@extend .icon-link:before;
}
}
/* This is specifically for model that are a generated set of checkboxes/radios */
.model_multiple_choice_field .input li,
.choice_field .input li{
label{
display:block;
width:auto;
float:none;
}
}
.fields > li,
.field-col{
@include clearfix();
padding-top:0.5em;
padding-bottom:1.2em;
}
.field-content .input li{
label{
width:auto;
float:none;
}
.field-row{
@include clearfix();
/* negative margin the bottom so it doesn't add too much space */
margin-bottom:-1.2em;
}
.input{
clear:both;
}
/* field sizing */
/* field sizing and alignment */
.field-small{
input, textarea, select, .richtext, .tagit{
@ -550,11 +619,6 @@ ul.inline li:first-child, li.inline:first-child{
.chosen { display: none; }
.unchosen { display: block; }
}
input[type=button]{
font-size:0.85em;
padding:0.5em 0.5em;
}
}
/* standard way of doing a chooser where the chosen object's title is overlayed */
@ -652,7 +716,7 @@ ul.tagit li.tagit-choice-editable{
/* search-bars */
.search-bar{
.required label:after{
.required .field > label:after{
display:none;
}
}
@ -674,6 +738,7 @@ input[type=submit], input[type=reset], input[type=button], .button, button{
padding-top:1.2em;
padding-left:0;
.choice_field &,
.model_multiple_choice_field &,
.boolean_field &,
.model_choice_field &,
@ -681,26 +746,62 @@ input[type=submit], input[type=reset], input[type=button], .button, button{
.file_field &{
padding-top:0;
}
}
.boolean_field &{
padding-bottom:0;
.label-above{
.field > label{
display:block;
padding:0 0 0.8em 0;
float:none;
width:auto;
}
}
input[type=submit], input[type=reset], input[type=button], .button, button{
font-size:0.95em;
padding:0.75em 1.4em;
padding:0 1.4em;
height: 3em;
line-height:3em;
&.button-small{
height:2.3em;
line-height:2.2em;
}
&.bicolor{
padding-left:3.5em;
padding-left:3.7em;
&:before{
width:2.2em;
line-height:2.15em;
width:2em;
line-height:2.2em;
font-size:1.1rem;
}
}
&.button-small.bicolor{
line-height:2.3em;
&:before{
line-height:1.85em;
}
}
}
/* Special styles to counteract Firefox's completely unwarranted assumptions about button styles */
input[type=submit], input[type=reset], input[type=button], button{
line-height:inherit;
&.button-small, &.bicolor,
&.button-small.bicolor{
line-height:inherit;
}
&.button-small{
height:2.3em;
}
}
.help{
opacity:1;
}
@ -712,8 +813,14 @@ input[type=submit], input[type=reset], input[type=button], .button, button{
@include row();
}
.field-col{
float:left;
padding-left:0 !important;
}
.field-content{
@include column(10);
padding-right:0;
}
padding-left:0;
}
}

View file

@ -97,13 +97,6 @@ header{
}
}
/* mozilla specific hack */
@-moz-document url-prefix() {
.iconfield.icon-spinner:after{
line-height:20px;
}
}
.page-explorer header{
margin-bottom:0;
padding-bottom:0em;

View file

@ -96,7 +96,6 @@
.icon-unlocked:before {
content: "p";
}
.icon-doc-full-inverse:before {
content: "r";
}
@ -210,9 +209,9 @@
}
.icon-spinner:after{
width:1em;
animation: spin 1s infinite;
-webkit-animation: spin 1s infinite;
-moz-animation: spin 1s infinite;
animation: spin 0.5s infinite linear;
-webkit-animation: spin 0.5s infinite linear;
-moz-animation: spin 0.5s infinite linear;
content:"1";
}
.icon-pick:before{
@ -221,8 +220,10 @@
.icon-redirect:before{
content:"3";
}
/* Credit: Icon made by Zurb from Flaticon.com */
.icon-view:before{
content:"4"; /* Credit: Icon made by Zurb from Flaticon.com */
content:"4";
vertical-align:-4.5px;
font-size:1.3rem;
}
.icon-collapse-down:before{
@ -234,6 +235,9 @@
.icon-date:before{
content:"7";
}
.icon-time:before{
content:"8";
}
.icon-success:before{
content:"9";
}
@ -246,6 +250,7 @@
.icon-form:before{
content:"$";
}
.icon.text-replace{
font-size:0em;
line-height:0;

View file

@ -179,7 +179,6 @@ ul.listing{
@include clearfix();
margin-top:0.8em;
text-transform:uppercase;
font-size:0.85em;
margin-bottom:-0.5em;
a{
@ -197,7 +196,7 @@ ul.listing{
.button{
color:$color-teal;
border-color:$color-grey-3;
background:transparent;
background:white;
&:hover{
border-color:$color-teal;
@ -327,13 +326,11 @@ ul.listing{
opacity:0.7;
}
}
a{
color:auto;
}
.actions{
margin-top:1em;
}
.button{
background-color:transparent;
color:white;
border-color:$color-teal-darker;

View file

@ -1,32 +1,30 @@
.tab-nav{
@include clearfix();
@include row();
padding:0;
background:$color-grey-4;
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;
color:white;
border-top:0.3em solid lighten($color-teal-darker, 3%);
border-bottom:1px solid transparent;
max-height:1.2em;
overflow:hidden;
&:hover{
color:white;
@ -45,7 +43,6 @@
min-width:0.9em;
color:white;
background:$color-red;
content:attr(data-count);
padding:0 0.3em;
line-height:1.4em;
@ -61,10 +58,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 +87,27 @@
}
@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;
}
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

@ -394,11 +394,6 @@ footer{
.actions{
width:250px;
margin-right:$grid-gutter-width/2;
.button{
padding-top:1em;
padding-bottom:1em;
}
}
.meta{

View file

@ -1,6 +1,29 @@
{
"IcoMoonType": "selection",
"icons": [
{
"icon": {
"paths": [
"M632.913 707.493l-173.647-173.649v-232.782h105.469v189.094l142.759 142.757zM512 90.125c-232.995 0-421.875 188.88-421.875 421.875s188.88 421.875 421.875 421.875 421.875-188.88 421.875-421.875-188.88-421.875-421.875-421.875zM512 828.406c-174.747 0-316.406-141.659-316.406-316.406s141.659-316.406 316.406-316.406c174.747 0 316.406 141.659 316.406 316.406s-141.659 316.406-316.406 316.406z"
],
"tags": [
"clock",
"time",
"schedule"
],
"grid": 16
},
"properties": {
"id": 72,
"order": 9,
"prevSize": 32,
"code": 56,
"name": "clock",
"ligatures": ""
},
"setIdx": 0,
"iconIdx": 72
},
{
"icon": {
"paths": [
@ -20,7 +43,7 @@
"name": "lock39copy",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 0
},
{
@ -42,7 +65,7 @@
"name": "lock39-open",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 1
},
{
@ -63,7 +86,7 @@
"name": "form",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 2
},
{
@ -82,7 +105,7 @@
"name": "uni61",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 3
},
{
@ -101,7 +124,7 @@
"name": "uni62",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 4
},
{
@ -120,7 +143,7 @@
"name": "uni63",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 5
},
{
@ -139,7 +162,7 @@
"name": "uni64",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 6
},
{
@ -158,7 +181,7 @@
"name": "uni65",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 7
},
{
@ -177,7 +200,7 @@
"name": "uni66",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 8
},
{
@ -196,7 +219,7 @@
"name": "uni67",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 9
},
{
@ -215,7 +238,7 @@
"name": "uni69",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 10
},
{
@ -234,7 +257,7 @@
"name": "uni6A",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 11
},
{
@ -253,7 +276,7 @@
"name": "uni6B",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 12
},
{
@ -272,7 +295,7 @@
"name": "uni6C",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 13
},
{
@ -291,7 +314,7 @@
"name": "uni6E",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 14
},
{
@ -310,7 +333,7 @@
"name": "uni68",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 15
},
{
@ -329,7 +352,7 @@
"name": "uni6F",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 16
},
{
@ -348,7 +371,7 @@
"name": "uni71",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 17
},
{
@ -367,7 +390,7 @@
"name": "uni72",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 18
},
{
@ -386,7 +409,7 @@
"name": "uni73",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 19
},
{
@ -405,7 +428,7 @@
"name": "uni74",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 20
},
{
@ -424,7 +447,7 @@
"name": "uni75",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 21
},
{
@ -443,7 +466,7 @@
"name": "uni76",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 22
},
{
@ -462,7 +485,7 @@
"name": "uni77",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 23
},
{
@ -481,7 +504,7 @@
"name": "uni78",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 24
},
{
@ -500,7 +523,7 @@
"name": "uni7A",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 25
},
{
@ -519,7 +542,7 @@
"name": "uni41",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 26
},
{
@ -538,7 +561,7 @@
"name": "uni42",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 27
},
{
@ -557,7 +580,7 @@
"name": "uni44",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 28
},
{
@ -576,7 +599,7 @@
"name": "uni43",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 29
},
{
@ -595,7 +618,7 @@
"name": "uni45",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 30
},
{
@ -614,7 +637,7 @@
"name": "uni46",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 31
},
{
@ -633,7 +656,7 @@
"name": "uni47",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 32
},
{
@ -652,7 +675,7 @@
"name": "uni48",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 33
},
{
@ -671,7 +694,7 @@
"name": "uni49",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 34
},
{
@ -690,7 +713,7 @@
"name": "uni4A",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 35
},
{
@ -709,7 +732,7 @@
"name": "uni4B",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 36
},
{
@ -728,7 +751,7 @@
"name": "uni4C",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 37
},
{
@ -747,7 +770,7 @@
"name": "uni4D",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 38
},
{
@ -766,7 +789,7 @@
"name": "uni4E",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 39
},
{
@ -785,7 +808,7 @@
"name": "uni4F",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 40
},
{
@ -804,7 +827,7 @@
"name": "uni50",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 41
},
{
@ -823,7 +846,7 @@
"name": "uni51",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 42
},
{
@ -842,7 +865,7 @@
"name": "uni79",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 43
},
{
@ -861,7 +884,7 @@
"name": "uni52",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 44
},
{
@ -880,7 +903,7 @@
"name": "uni54",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 45
},
{
@ -899,7 +922,7 @@
"name": "uni57",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 46
},
{
@ -918,7 +941,7 @@
"name": "uni58",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 47
},
{
@ -937,7 +960,7 @@
"name": "uni59",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 48
},
{
@ -956,7 +979,7 @@
"name": "uni5A",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 49
},
{
@ -975,7 +998,7 @@
"name": "uni56",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 50
},
{
@ -994,7 +1017,7 @@
"name": "uni31",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 51
},
{
@ -1013,7 +1036,7 @@
"name": "uni55",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 52
},
{
@ -1032,7 +1055,7 @@
"name": "uni33",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 53
},
{
@ -1051,7 +1074,7 @@
"name": "uni32",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 54
},
{
@ -1070,7 +1093,7 @@
"name": "uni35",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 55
},
{
@ -1089,7 +1112,7 @@
"name": "uni36",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 56
},
{
@ -1108,7 +1131,7 @@
"name": "uni30",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 57
},
{
@ -1127,7 +1150,7 @@
"name": "uni3F",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 58
},
{
@ -1146,7 +1169,7 @@
"name": "uni21",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 59
},
{
@ -1165,7 +1188,7 @@
"name": "uni39",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 60
},
{
@ -1184,7 +1207,7 @@
"name": "uni53",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 61
},
{
@ -1203,7 +1226,7 @@
"name": "uni34",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 62
},
{
@ -1222,7 +1245,7 @@
"name": "uni37",
"ligatures": ""
},
"setIdx": 0,
"setIdx": 1,
"iconIdx": 63
}
],
@ -1245,13 +1268,14 @@
"baseline": 6.25,
"whitespace": 50
},
"showMetadata": false,
"showMetrics": true,
"useClassSelector": false,
"classSelector": ".icon",
"embed": false
"resetPoint": 58880
},
"imagePref": {
"color": 0,
"height": 32,
"columns": 16,
"margin": 16
},
"imagePref": {},
"historySize": 100,
"showCodes": true,
"search": "",

View file

@ -17,6 +17,7 @@
<glyph unicode="&#x35;" d="M135 424h241v-23h-241zM405 247l-127-124v222h-45v-220l-125 122-33-32 181-181 181 181z" />
<glyph unicode="&#x36;" d="M136 424h241v-23h-241zM108 122l126 124v-222h45v220l126-122 32 32-181 181-181-181z" />
<glyph unicode="&#x37;" d="M387.836 13.063h-263.672c-43.671 0-79.102 35.431-79.102 79.101v263.672c0 34.607 22.248 63.446 52.734 74.158v-34.607c0-22.248 18.127-39.551 39.551-39.551s39.551 17.303 39.551 39.551v39.551h158.203v-39.551c0-22.248 18.127-39.551 39.551-39.551s39.551 17.303 39.551 39.551v34.607c30.487-10.712 52.735-39.551 52.735-74.158v-263.672c0-43.671-35.431-79.101-79.101-79.101zM414.203 303.101h-316.406v-210.938c0-14.832 11.535-26.367 26.367-26.367h263.672c14.832 0 26.367 11.536 26.367 26.367zM308.735 171.265h52.735v-52.735h-52.735zM308.735 250.367h52.735v-52.734h-52.735zM229.633 171.265h52.734v-52.735h-52.734zM229.633 250.367h52.734v-52.734h-52.734zM150.531 171.265h52.734v-52.735h-52.734zM150.531 250.367h52.734v-52.734h-52.734zM374.652 382.203c-7.416 0-13.183 5.768-13.183 13.184v39.551h26.367v-39.551c0-7.416-5.768-13.184-13.183-13.184zM137.347 382.203c-7.416 0-13.183 5.768-13.183 13.184v39.551h26.367v-39.551c0-7.416-5.768-13.184-13.184-13.184z" />
<glyph unicode="&#x38;" d="M316.457 126.253l-86.823 86.825v116.391h52.734v-94.547l71.38-71.379zM256 434.938c-116.498 0-210.938-94.44-210.938-210.938s94.44-210.938 210.938-210.938 210.938 94.44 210.938 210.938-94.44 210.938-210.938 210.938zM256 65.797c-87.374 0-158.203 70.829-158.203 158.203s70.829 158.203 158.203 158.203c87.374 0 158.203-70.829 158.203-158.203s-70.829-158.203-158.203-158.203z" />
<glyph unicode="&#x39;" d="M256 449c-123.926 0-225-101.074-225-225s101.074-225 225-225c123.926 0 225 101.074 225 225s-101.074 225-225 225zM220.844 120.289l-102.832 103.711 39.551 39.551 63.281-64.16 135.351 135.351 39.551-39.551z" />
<glyph unicode="&#x3f;" d="M253.188 445.25c60.938 0 112.5-20.625 156.563-62.813 43.125-42.188 65.625-93.75 67.5-154.688 0-60.938-20.625-113.438-63.75-156.563-42.188-44.063-93.75-66.563-154.688-68.438-60.938 0-113.438 20.625-156.563 63.75-44.063 42.188-66.563 93.75-67.5 154.688s19.688 113.438 62.813 156.563c43.125 44.063 94.688 66.563 155.625 67.5zM252.25 89.938c9.375 0 17.813 2.813 23.438 8.438 5.625 6.563 9.375 14.063 9.375 22.5 0 10.313-1.875 17.813-8.438 24.375-5.625 5.625-14.063 8.438-23.438 8.438 0 0-0.938 0-0.938 0-9.375 0-16.875-2.813-22.5-8.438-6.563-5.625-9.375-13.125-10.313-22.5 0-9.375 2.813-16.875 9.375-23.438 5.625-5.625 13.125-9.375 22.5-9.375 0 0 0.938 0 0.938 0zM331.938 247.438c8.438 10.313 12.188 22.5 12.188 37.5 0 24.375-8.438 43.125-25.313 55.313s-38.438 17.813-64.688 17.813c-20.625 0-37.5-3.75-49.688-12.188-22.5-13.125-33.75-36.563-34.688-70.313 0 0 0-1.875 0-1.875s52.5 0 52.5 0c0 0 0 1.875 0 1.875 0 8.438 2.813 16.875 7.5 26.25 5.625 7.5 14.063 11.25 26.25 11.25 13.125 0 21.563-2.813 25.313-9.375 4.688-6.563 7.5-13.125 7.5-21.563 0-5.625-2.813-12.188-7.5-18.75-2.813-3.75-6.563-7.5-10.313-9.375 0 0-2.813-1.875-2.813-1.875-1.875-1.875-3.75-3.75-7.5-5.625-2.813-1.875-6.563-4.688-9.375-7.5-3.75-1.875-6.563-4.688-10.313-7.5s-6.563-5.625-8.438-8.438c-3.75-6.563-6.563-18.75-8.438-37.5 0 0 0-3.75 0-3.75s52.5 0 52.5 0c0 0 0 1.875 0 1.875 0 3.75 0 8.438 1.875 13.125 1.875 6.563 5.625 12.188 13.125 17.813 0 0 13.125 8.438 13.125 8.438 15 11.25 23.438 18.75 27.188 24.375z" />
<glyph unicode="&#x41;" d="M232 109l176 175c3 4 5 8 5 13s-2 9-5 13l-29 29c-4 4-8 6-13 6s-10-2-13-6l-134-133-60 60c-3 4-8 5-13 5s-9-1-13-5l-29-29c-3-4-5-8-5-13s2-9 5-13l103-102c3-4 7-6 12-6s10 2 13 6zM475 361v-274c0-23-8-42-24-58s-35-24-58-24h-274c-23 0-42 8-58 24s-24 35-24 58v274c0 23 8 42 24 58s35 24 58 24h274c23 0 42-8 58-24s24-35 24-58z" />

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 55 KiB

View file

@ -46,6 +46,13 @@ header{
}
}
a{
position:relative;
display:block;
width:100%;
height:100%;
}
span{
font-family:Bitter, Georgia, serif;
display:block;

View file

@ -44,6 +44,7 @@ form{
}
}
label{
width:auto;
color:white;
}
input[type=submit]{
@ -83,24 +84,9 @@ form{
.field{
padding:0;
}
.iconfield:before{
.iconfield .input:before{
display:none;
}
.full label{
@include border-radius(2px);
text-transform:uppercase;
padding:2px 5px;
position:absolute;
top:0;
left:0;
margin-top:-1px;
font-size:0.7em;
z-index:1;
margin:0.2em 0;
line-height:1.5em;
font-weight:normal;
}
}
/* Special full-width, one-off fields i.e a single text or textarea input */
.full input{
@ -173,7 +159,7 @@ form{
margin:0px (-$desktop-nice-padding);
.iconfield{
&:before{
.input:before{
display:inline-block;
position: absolute;
color:$color-grey-4;

View file

@ -25,9 +25,6 @@
}
}
.objects{
background:url("#{$static-root}bg-dark-diag.svg");
}
.object{
position:relative;
overflow:hidden;
@ -80,9 +77,9 @@
> h2, &.single-field label{
-webkit-font-smoothing: auto;
background:$color-grey-3;
background:$color-salmon-light;
text-transform:uppercase;
padding:0.9em 0 0.9em 4em;
padding:0.9em 0 0.9em 4.1em;
font-size:0.95em;
margin:0 0 0.2em 0;
line-height:1.5em;
@ -92,10 +89,10 @@
left:0;
right:0;
z-index:1;
text-shadow:1px 1px 1px rgba(255,255,255,0.5);
@include box-shadow(0 0 7px 0 rgba(0,0,0,0.4));
overflow:hidden;
&:before{
text-shadow:none;
font-family:wagtail;
text-transform:none;
content:"q";
@ -108,10 +105,11 @@
line-height:1.8em;
left:0px;
width:1.7em;
opacity:0.15;
color:white;
padding:0;
margin:0;
cursor:pointer;
background-color:$color-salmon;
}
}
@ -186,6 +184,17 @@
}
}
/* special panel for the publishing fields, requires a bit more pizzazz */
&.publishing{
h2:before{
content:"7";
font-size:2.4em;
line-height:1.4em;
width:1.4em;
}
}
&.title input,
&.title textarea{
font-size:2em;
@ -235,20 +244,20 @@
top:0px;
left:0px;
width:3.3em;
background-color:$color-teal;
padding:0;
margin:0 0 0 -20px;
cursor:pointer;
a{
font-size: 0em;
line-height: 0;
.button{
@include border-radius(0);
overflow: visible;
display:block;
display:inline-block;
padding:0;
width:3.45em;
background-color:$color-salmon;
&:before{
position:relative;
color:white;
padding:0;
line-height:1.8em; /* specific height required as parent 'a' has no height */
font-size:1.4rem;
@ -260,7 +269,6 @@
.multiple{
padding:0;
max-height:0px;
}
}

View file

@ -68,6 +68,12 @@ section{
.color-grey-5{
background-color:$color-grey-5;
}
.color-salmon{
background-color:$color-salmon;
}
.color-salmon-light{
background-color:$color-salmon-light;
}
}

View file

@ -3,10 +3,13 @@
.hallotoolbar{
position:absolute;
left:$mobile-nice-padding;
z-index:5;
margin-top:4em;
margin-left:0em;
margin-left:1.2em;
}
/* full is added to hallotoolbar when invoked on a field set to the full layout style */
.hallotoolbar.full{
margin-left:$mobile-nice-padding;
}
.hallotoolbar.affixed{
position:fixed;
@ -14,6 +17,7 @@
}
.hallotoolbar button{
@include border-radius(0);
height:2.4em;
}
.richtext {
@ -149,7 +153,7 @@
}
@media screen and (min-width: $breakpoint-mobile){
.hallotoolbar{
left:$menu-width + $desktop-nice-padding;
.hallotoolbar.full{
margin-left:$desktop-nice-padding;
}
}

View file

@ -27,9 +27,11 @@ $breakpoint-desktop-larger: 100em; /* 1600px */
$color-teal: #43b1b0;
$color-teal-darker: darken($color-teal, 10%);
$color-teal-dark: #246060;
$color-red: #f7474e;
$color-red: #cd3238;
$color-orange:#e9b04d;
$color-green: #189370;
$color-salmon: #f37e77;
$color-salmon-light: #fcf2f2;
/* darker to lighter */
$color-grey-1: #333333;

View file

@ -5,6 +5,7 @@ from django.contrib.auth import get_user_model
from django.db.models import Q
from wagtail.wagtailcore.models import PageRevision, GroupPagePermission
from wagtail.wagtailusers.models import UserProfile
# The following will check to see if we can import task from celery -
# if not then we definitely haven't installed it
@ -53,7 +54,7 @@ def send_notification(page_revision_id, notification, excluded_user_id):
if notification == 'submitted':
# Get list of publishers
recipients = users_with_page_permission(revision.page, 'publish')
elif notification == 'approved' or notification == 'rejected':
elif notification in ['rejected', 'approved']:
# Get submitter
recipients = [revision.user]
else:
@ -62,7 +63,7 @@ def send_notification(page_revision_id, notification, excluded_user_id):
# Get list of email addresses
email_addresses = [
recipient.email for recipient in recipients
if recipient.email and recipient.id != excluded_user_id
if recipient.email and recipient.id != excluded_user_id and getattr(UserProfile.get_for_user(recipient), notification + '_notifications')
]
# Return if there are no email addresses

View file

@ -1,5 +1,7 @@
{% extends "wagtailadmin/base.html" %}
{% load i18n %}
{% block titletag %}{% trans "Account" %}{% endblock %}
{% block content %}
{% trans "Account" as account_str %}
{% include "wagtailadmin/shared/header.html" with title=account_str %}
@ -28,6 +30,17 @@
</small>
</li>
{% endif %}
{% if show_notification_preferences %}
<li class="row row-flush">
<div class="col6">
<a href="{% url 'wagtailadmin_account_notification_preferences' %}" class="button button-primary">{% trans "Notification preferences" %}</a>
</div>
<small class="col6">
{% trans "Choose which email notifications to receive." %}
</small>
</li>
{% endif %}
</ul>
</div>
{% endblock %}
{% endblock %}

View file

@ -1,5 +1,7 @@
{% extends "wagtailadmin/base.html" %}
{% load i18n %}
{% block titletag %}{% trans "Change password" %}{% endblock %}
{% block content %}
{% trans "Change password" as change_str %}
{% include "wagtailadmin/shared/header.html" with title=change_str %}

View file

@ -0,0 +1,20 @@
{% extends "wagtailadmin/base.html" %}
{% load i18n %}
{% block titletag %}{% trans "Notification Preferences" %}{% endblock %}
{% block content %}
{% trans "Notification Preferences" as prefs_str %}
{% include "wagtailadmin/shared/header.html" with title=prefs_str %}
<div class="nice-padding">
<form action="{% url 'wagtailadmin_account_notification_preferences' %}" method="POST">
{% csrf_token %}
<ul class="fields">
{% for field in form %}
{% include "wagtailadmin/shared/field_as_li.html" with field=field %}
{% endfor %}
<li class="submit"><input type="submit" value="{% trans 'Update' %}" /></li>
</ul>
</form>
</div>
{% endblock %}

View file

@ -1,4 +1,4 @@
{% extends "wagtailadmin/edit_handlers/field_panel_field.html" %}
{% extends "wagtailadmin/shared/field.html" %}
{% load i18n %}
{% comment %}
Either the chosen or unchosen div will be shown, depending on the presence
@ -17,14 +17,14 @@
<div class="actions">
{% if not field.field.required %}
<input type="button" class="button-secondary action-clear" value="{% block clear_button_label %}{% trans "Clear choice" %}{% endblock %}">
<input type="button" class="action-clear button-small button-secondary" value="{% block clear_button_label %}{% trans "Clear choice" %}{% endblock %}">
{% endif %}
<input type="button" class="button-secondary action-choose" value="{% block choose_another_button_label %}{% trans "Choose another item" %}{% endblock %}">
<input type="button" class="action-choose button-small button-secondary" value="{% block choose_another_button_label %}{% trans "Choose another item" %}{% endblock %}">
</div>
</div>
<div class="unchosen">
<input type="button" class="action-choose button-secondary" value="{% block choose_button_label %}{% trans "Choose an item" %}{% endblock %}">
<input type="button" class="action-choose button-small button-secondary" value="{% block choose_button_label %}{% trans "Choose an item" %}{% endblock %}">
</div>
</div>

View file

@ -1,23 +1 @@
<div class="field">
{{ field.label_tag }}
<div class="field-content">
<div class="input {{ input_classes }} ">
{% block form_field %}
{{ field }}
{% endblock %}
<span></span>
</div>
{% if field.help_text %}
<p class="help">{{ field.help_text }}</p>
{% endif %}
{% if field.errors %}
<p class="error-message">
{% for error in field.errors %}
<span>{{ error }}</span>
{% endfor %}
</p>
{% endif %}
</div>
</div>
{% include "wagtailadmin/shared/field.html" %}

View file

@ -0,0 +1,7 @@
<ul class="field-row {{ self.classes|join:" " }}">
{% for child in self.children %}
<li class="field-col {{ child.classes|join:" " }}">
{{ child.render_as_field }}
</li>
{% endfor %}
</ul>

View file

@ -2,9 +2,7 @@
<legend>{{ self.heading }}</legend>
<ul class="fields">
{% for child in self.children %}
<li {% if child.field_classnames %}class="{{ child.field_classnames }}"{% endif %}>
{{ child.render_as_field }}
</li>
<li class="{{ child.classes|join:" " }}">{{ child.render_as_field }}</li>
{% endfor %}
</ul>
</fieldset>

View file

@ -1,6 +1,6 @@
<ul class="objects">
{% for child in self.children %}
<li class="object {{ child.object_classnames }}">
<li class="object {{ child.classes|join:" " }}">
{% if child.heading %}
<h2>{{ child.heading }}</h2>
{% endif %}

View file

@ -1,6 +1,6 @@
<fieldset>
<legend>{{ self.heading }}</legend>
<ul class="fields">
<li class="{{ self.field_classnames }}">{{ field_content }}</li>
<li>{{ field_content }}</li>
</ul>
</fieldset>

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|join:" " }} {% 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|join:" " }} {% if forloop.first %}active{% endif %}">
{{ child.render_as_object }}
</section>
{% endfor %}

View file

@ -3,25 +3,31 @@
<h2 class="visuallyhidden">{% trans "Site summary" %}</h2>
<ul class="stats">
<li class="icon icon-doc-empty-inverse">
<a href="{% url 'wagtailadmin_explore_root' %}">
{% blocktrans count counter=total_pages %}
<span>{{ total_pages }}</span> Page
{% plural %}
<span>{{ total_pages }}</span> Pages
{% endblocktrans %}
</a>
</li>
<li class="icon icon-image">
<a href="{% url 'wagtailimages_index' %}">
{% blocktrans count counter=total_images %}
<span>{{ total_images }}</span> Image
{% plural %}
<span>{{ total_images }}</span> Images
{% endblocktrans %}
</a>
</li>
<li class="icon icon-doc-full-inverse">
<a href="{% url 'wagtaildocs_index' %}">
{% blocktrans count counter=total_docs %}
<span>{{ total_docs }}</span> Document
{% plural %}
<span>{{ total_docs }}</span> Documents
{% endblocktrans %}
</a>
</li>
</ul>
</section>
</section>

View file

@ -28,17 +28,17 @@
<ul class="fields">
<li class="full">
<div class="field">
<div class="field iconfield">
{{ form.username.label_tag }}
<div class="input iconfield icon-user">
<div class="input icon-user">
{{ form.username }}
</div>
</div>
</li>
<li class="full">
<div class="field">
<div class="field iconfield">
{{ form.password.label_tag }}
<div class="input iconfield icon-password">
<div class="input icon-password">
{{ form.password }}
</div>
</div>

View file

@ -1,4 +1,4 @@
{% load i18n %}{% blocktrans with title=revision.page.title|safe %}The page "{{ title }}" has been approved{% endblocktrans %}
{% extends 'wagtailadmin/notifications/base_notification.html' %}{% block notification %}{% load i18n %}{% blocktrans with title=revision.page.title|safe %}The page "{{ title }}" has been approved{% endblocktrans %}
{% blocktrans with title=revision.page.title|safe %}The page "{{ title }}" has been approved.{% endblocktrans %}
{% trans "You can view the page here:" %} {{ revision.page.full_url }}
{% trans "You can view the page here:" %} {{ revision.page.full_url }}{% endblock %}

View file

@ -0,0 +1,3 @@
{% load i18n %}{% block notification %}{% endblock %}
{% trans "Edit your notification preferences here:" %} {{ settings.BASE_URL }}{% url 'wagtailadmin_account_notification_preferences' %}

View file

@ -1,4 +1,4 @@
{% load i18n %}{% blocktrans with title=revision.page.title|safe %}The page "{{ title }}" has been rejected{% endblocktrans %}
{% extends 'wagtailadmin/notifications/base_notification.html' %}{% block notification %}{% load i18n %}{% blocktrans with title=revision.page.title|safe %}The page "{{ title }}" has been rejected{% endblocktrans %}
{% blocktrans with title=revision.page.title|safe %}The page "{{ title }}" has been rejected.{% endblocktrans %}
{% trans "You can edit the page here:"%} {{ settings.BASE_URL }}{% url 'wagtailadmin_pages_edit' revision.page.id %}
{% trans "You can edit the page here:"%} {{ settings.BASE_URL }}{% url 'wagtailadmin_pages_edit' revision.page.id %}{% endblock %}

View file

@ -1,5 +1,5 @@
{% load i18n %}{% blocktrans with page=revision.page|safe %}The page "{{ page }}" has been submitted for moderation{% endblocktrans %}
{% extends 'wagtailadmin/notifications/base_notification.html' %}{% block notification %}{% load i18n %}{% blocktrans with page=revision.page|safe %}The page "{{ page }}" has been submitted for moderation{% endblocktrans %}
{% blocktrans with page=revision.page|safe %}The page "{{ page }}" has been submitted for moderation.{% endblocktrans %}
{% trans "You can preview the page here:" %} {{ settings.BASE_URL }}{% url 'wagtailadmin_pages_preview_for_moderation' revision.id %}
{% trans "You can edit the page here:" %} {{ settings.BASE_URL }}{% url 'wagtailadmin_pages_edit' revision.page.id %}
{% trans "You can edit the page here:" %} {{ settings.BASE_URL }}{% url 'wagtailadmin_pages_edit' revision.page.id %}{% endblock %}

View file

@ -16,11 +16,9 @@
<script src="{{ STATIC_URL }}wagtailadmin/js/vendor/tag-it.js"></script>
<script src="{{ STATIC_URL }}wagtailadmin/js/expanding_formset.js"></script>
<script src="{{ STATIC_URL }}wagtailadmin/js/modal-workflow.js"></script>
<script src="{{ STATIC_URL }}wagtailadmin/js/hallo-plugins/hallo-wagtail-toolbar.js"></script>
<script src="{{ STATIC_URL }}wagtailadmin/js/hallo-plugins/hallo-wagtaillink.js"></script>
<script src="{{ STATIC_URL }}wagtailadmin/js/hallo-plugins/hallo-hr.js"></script>
<script src="{{ STATIC_URL }}wagtailadmin/js/page-editor.js"></script>
<script src="{{ STATIC_URL }}wagtailadmin/js/page-chooser.js"></script>
<script src="{{ STATIC_URL }}admin/js/urlify.js"></script>

View file

@ -1,4 +1,4 @@
<button class="action-preview button {% if icon %}icon icon-view{% endif %}"
<button class="action-preview {% if icon %}icon icon-view{% endif %}"
data-action="{% url 'wagtailadmin_pages_preview_on_create' content_type.app_label content_type.model parent_page.id %}{% if mode %}?mode={{ mode|urlencode }}{% endif %}"
data-placeholder="{% url 'wagtailadmin_pages_preview' %}"
data-windowname="wagtail_preview_{{ parent_page.id }}_child">{{ label }}</button>

View file

@ -1,4 +1,4 @@
<button class="action-preview button {% if icon %}icon icon-view{% endif %}"
<button class="action-preview {% if icon %}icon icon-view{% endif %}"
data-action="{% url 'wagtailadmin_pages_preview_on_edit' page.id %}{% if mode %}?mode={{ mode|urlencode }}{% endif %}"
data-placeholder="{% url 'wagtailadmin_pages_preview' %}"
data-windowname="wagtail_preview_{{ page.id }}">{{ label }}</button>

View file

@ -70,7 +70,7 @@
{% blocktrans with last_mod=page.get_latest_revision.created_at %}Last modified: {{ last_mod }}{% endblocktrans %}
{% if page.get_latest_revision.user %}
{% blocktrans with modified_by=page.get_latest_revision.user.get_full_name|default:page.get_latest_revision.user.username %}by {{ modified_by }}{% endblocktrans %}
{% if request.user.email %}
{% if page.get_latest_revision.user.email %}
<span class="avatar small icon icon-user"><img src="{% gravatar_url page.get_latest_revision.user.email 25 %}" /></span>
{% endif %}
{% endif %}

View file

@ -11,5 +11,6 @@
<div id="loading-spinner-wrapper">
<div id="loading-spinner"></div>
</div>
<iframe id="preview-frame" src="{% url 'wagtailadmin_pages_preview_loading' %}"></iframe>
</body>
</html>

View file

@ -9,6 +9,6 @@
{% endif %}
{% endfor %}
{% if include_self %}
<li><a href="{% if choosing %}{% url 'wagtailadmin_choose_page_child' page.id %}?{{ querystring }}{% else %}{% url 'wagtailadmin_explore' page.id %}{% endif %}" {% if choosing %}class="navigate-pages"{% endif %}>>{{ page.title }}</a></li>
<li><a href="{% if choosing %}{% url 'wagtailadmin_choose_page_child' page.id %}?{{ querystring }}{% else %}{% url 'wagtailadmin_explore' page.id %}{% endif %}" {% if choosing %}class="navigate-pages"{% endif %}>{{ page.title }}</a></li>
{% endif %}
</ul>

View file

@ -0,0 +1,25 @@
{% load wagtailadmin_tags %}
<div class="field {{ field.field_classnames }} {{ field|fieldtype }} {{ field_classes }}">
{{ field.label_tag }}
<div class="field-content">
<div class="input {{ field.input_classnames }} {{ input_classes }} ">
{% block form_field %}
{{ field }}
{% endblock %}
{# This span only used on rare occasions by certain types of input #}
<span></span>
</div>
{% if field.help_text %}
<p class="help">{{ field.help_text }}</p>
{% endif %}
{% if field.errors %}
<p class="error-message">
{% for error in field.errors %}
<span>{{ error|escape }}</span>
{% endfor %}
</p>
{% endif %}
</div>
</div>

View file

@ -1,25 +1,4 @@
{% load wagtailadmin_tags %}
<li class="{% if field.field.required %}required{% endif %} {{ field.css_classes }} {{ field|fieldtype }} {{ li_classes }} {% if field.errors %}error{% endif %}">
<div class="field">
{{ field.label_tag }}
<div class="field-content">
<div class="input {{ input_classes }} ">
{% block form_field %}
{{ field }}
{% endblock %}
<span></span>
</div>
{% if field.help_text %}
<p class="help">{{ field.help_text }}</p>
{% endif %}
{% if field.errors %}
<p class="error-message">
{% for error in field.errors %}
<span>{{ error|escape }}</span>
{% endfor %}
</p>
{% endif %}
</div>
</div>
<li class="{% if field.field.required %}required{% endif %} {{ wrapper_classes }} {{ li_classes }} {% if field.errors %}error{% endif %}">
{% include "wagtailadmin/shared/field.html" %}
</li>

View file

@ -8,7 +8,7 @@
<form class="col search-form" action="{% url search_url %}" method="get">
<ul class="fields">
{% for field in search_form %}
{% include "wagtailadmin/shared/field_as_li.html" with field=field input_classes="field-small iconfield icon-search" %}
{% include "wagtailadmin/shared/field_as_li.html" with field=field field_classes="field-small iconfield" input_classes="icon-search" %}
{% endfor %}
<li class="submit visuallyhidden"><input type="submit" value="Search" class="button" /></li>
</ul>

View file

@ -1,10 +1,7 @@
<!doctype html>
{% load compress %}
<!--[if lt IE 7]> <html class="no-js ie lt-ie9 lt-ie8 lt-ie7" lang="{{ LANGUAGE_CODE|default:"en-gb" }}"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie lt-ie9 lt-ie8" lang="{{ LANGUAGE_CODE|default:"en-gb" }}"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie lt-ie9" lang="{{ LANGUAGE_CODE|default:"en-gb" }}"> <![endif]-->
<!--[if IE 9]> <html class="no-js ie lt-ie10" lang="{{ LANGUAGE_CODE|default:"en-gb" }}"> <![endif]-->
<!--[if gt IE 9]><!--> <html class="no-js" lang="{{ LANGUAGE_CODE|default:"en-gb" }}"> <!--<![endif]-->
<!--[if lt IE 9]> <html class="no-js ie lt-ie9" lang="{{ LANGUAGE_CODE|default:"en-gb" }}"> <![endif]-->
<!--[if IE 9]> <html class="no-js ie lt-ie10" lang="{{ LANGUAGE_CODE|default:"en-gb" }}"> <![endif]-->
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

View file

@ -8,9 +8,11 @@
### <img src="{% gravatar_url sometemplatevariable %}">
### just make sure to update the "default" image path below
import urllib
import hashlib
from six import b
from six.moves.urllib.parse import urlencode
from django import template
register = template.Library()
@ -30,8 +32,8 @@ class GravatarUrlNode(template.Node):
default = "blank"
size = int(self.size) * 2 # requested at retina size by default and scaled down at point of use with css
gravatar_url = "//www.gravatar.com/avatar/" + hashlib.md5(email.lower()).hexdigest() + "?"
gravatar_url += urllib.urlencode({'s': str(size), 'd': default})
gravatar_url = "//www.gravatar.com/avatar/" + hashlib.md5(b(email.lower())).hexdigest() + "?"
gravatar_url += urlencode({'s': str(size), 'd': default})
return gravatar_url

View file

@ -1,10 +1,12 @@
from __future__ import unicode_literals
from django import template
from django.core import urlresolvers
from django.utils.translation import ugettext_lazy as _
from wagtail.wagtailadmin import hooks
from wagtail.wagtailadmin.menu import MenuItem
from wagtail.wagtailcore import hooks
from wagtail.wagtailcore.models import get_navigation_menu_items, UserPagePermissionsProxy
from wagtail.wagtailcore.utils import camelcase_to_underscore
@ -95,4 +97,4 @@ def hook_output(hook_name):
Note that the output is not escaped - it is the hook function's responsibility to escape unsafe content.
"""
snippets = [fn() for fn in hooks.get_hooks(hook_name)]
return u''.join(snippets)
return ''.join(snippets)

View file

@ -1,10 +1,14 @@
from __future__ import unicode_literals
from django.test import TestCase
from wagtail.tests.utils import unittest, WagtailTestUtils
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.contrib.auth.models import User, Group, Permission
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.core import mail
from wagtail.tests.utils import WagtailTestUtils
from wagtail.wagtailusers.models import UserProfile
class TestAuthentication(TestCase, WagtailTestUtils):
"""
@ -177,6 +181,97 @@ class TestAccountSection(TestCase, WagtailTestUtils):
# Check that the password was not changed
self.assertTrue(User.objects.get(username='test').check_password('password'))
def test_notification_preferences_view(self):
"""
This tests that the notification preferences view responds with the
notification preferences page
"""
# Get notification preferences page
response = self.client.get(reverse('wagtailadmin_account_notification_preferences'))
# Check that the user recieved a notification preferences page
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'wagtailadmin/account/notification_preferences.html')
def test_notification_preferences_view_post(self):
"""
This posts to the notification preferences view and checks that the
user's profile is updated
"""
# Post new values to the notification preferences page
post_data = {
'submitted_notifications': 'false',
'approved_notifications': 'false',
'rejected_notifications': 'true',
}
response = self.client.post(reverse('wagtailadmin_account_notification_preferences'), post_data)
# Check that the user was redirected to the account page
self.assertRedirects(response, reverse('wagtailadmin_account'))
profile = UserProfile.get_for_user(User.objects.get(username='test'))
# Check that the notification preferences are as submitted
self.assertFalse(profile.submitted_notifications)
self.assertFalse(profile.approved_notifications)
self.assertTrue(profile.rejected_notifications)
class TestAccountManagementForNonModerator(TestCase, WagtailTestUtils):
"""
Tests of reduced-functionality for editors
"""
def setUp(self):
# Create a non-moderator user
self.submitter = User.objects.create_user('submitter', 'submitter@example.com', 'password')
self.submitter.groups.add(Group.objects.get(name='Editors'))
self.client.login(username=self.submitter.username, password='password')
def test_notification_preferences_form_is_reduced_for_non_moderators(self):
"""
This tests that a user without publish permissions is not shown the
notification preference for 'submitted' items
"""
response = self.client.get(reverse('wagtailadmin_account_notification_preferences'))
self.assertIn('approved_notifications', response.context['form'].fields.keys())
self.assertIn('rejected_notifications', response.context['form'].fields.keys())
self.assertNotIn('submitted_notifications', response.context['form'].fields.keys())
class TestAccountManagementForAdminOnlyUser(TestCase, WagtailTestUtils):
"""
Tests for users with no edit/publish permissions at all
"""
def setUp(self):
# Create a non-moderator user
admin_only_group = Group.objects.create(name='Admin Only')
admin_only_group.permissions.add(Permission.objects.get(codename='access_admin'))
self.admin_only_user = User.objects.create_user('admin_only_user', 'admin_only_user@example.com', 'password')
self.admin_only_user.groups.add(admin_only_group)
self.client.login(username=self.admin_only_user.username, password='password')
def test_notification_preferences_view_redirects_for_admin_only_users(self):
"""
Test that the user is not shown the notification preferences view but instead
redirected to the account page
"""
response = self.client.get(reverse('wagtailadmin_account_notification_preferences'))
self.assertRedirects(response, reverse('wagtailadmin_account'))
def test_notification_preferences_link_not_shown_for_admin_only_users(self):
"""
Test that the user is not even shown the link to the notification
preferences view
"""
response = self.client.get(reverse('wagtailadmin_account'))
self.assertEqual(response.context['show_notification_preferences'], False)
self.assertNotContains(response, reverse('wagtailadmin_account_notification_preferences'))
# safety check that checking for absence/presence of urls works
self.assertContains(response, reverse('wagtailadmin_home'))
class TestPasswordReset(TestCase, WagtailTestUtils):
"""

Some files were not shown because too many files have changed in this diff Show more