Fixes for 20160718 (#54)
* Simple form input fields now use TakeFlight styling * Styles the form widgets as per the styles in our CSS * Styling of TextArea now matches the remaining input types * Adds is_last modifier to navigation dropdown * Adds admin for talk, tutorial, and miniconf proposals * Adds an RSS feed * Adds a link to the RSS page * Unbreaks the old news index page * Adds never_cache to the login page, removes the never cache middleware from the settings
This commit is contained in:
parent
6eef5efcfb
commit
40a4df3767
14 changed files with 121 additions and 20 deletions
|
@ -1,6 +1,8 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django.http import Http404
|
||||
from django.db import models
|
||||
from django.shortcuts import render
|
||||
|
||||
from modelcluster.fields import ParentalKey
|
||||
|
||||
|
@ -10,6 +12,7 @@ from wagtail.wagtailcore.models import Page
|
|||
from wagtail.wagtailcore.models import Orderable
|
||||
from wagtail.wagtailcore.fields import RichTextField
|
||||
from wagtail.wagtailcore.fields import StreamField
|
||||
from wagtail.wagtailcore.url_routing import RouteResult
|
||||
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
|
||||
from wagtail.wagtailadmin.edit_handlers import InlinePanel
|
||||
from wagtail.wagtailadmin.edit_handlers import FieldPanel
|
||||
|
@ -17,7 +20,6 @@ from wagtail.wagtailadmin.edit_handlers import PageChooserPanel
|
|||
from wagtail.wagtailadmin.edit_handlers import StreamFieldPanel
|
||||
from wagtail.wagtailsearch import index
|
||||
|
||||
|
||||
ILLUSTRATION_ANTARCTICA = "antarctica.svg"
|
||||
ILLUSTRATION_BRIDGE = "bridge.svg"
|
||||
ILLUSTRATION_CASINO = "casino.svg"
|
||||
|
@ -152,6 +154,32 @@ class ContentPage(AbstractContentPage):
|
|||
|
||||
class NewsIndexPage(AbstractContentPage):
|
||||
|
||||
def route(self, request, path_components):
|
||||
|
||||
# Try the default to allow children to resolve
|
||||
try:
|
||||
return super(NewsIndexPage, self).route(request, path_components)
|
||||
except Http404:
|
||||
pass
|
||||
|
||||
if path_components:
|
||||
# tell Wagtail to call self.serve() with an additional 'path_components' kwarg
|
||||
return RouteResult(self, kwargs={'path_components': path_components})
|
||||
else:
|
||||
raise Http404
|
||||
|
||||
def serve(self, request, path_components=[]):
|
||||
''' Optionally return the RSS version of the page '''
|
||||
|
||||
template = self.template
|
||||
|
||||
if path_components and path_components[0] == "rss":
|
||||
template = template.replace(".html", ".rss")
|
||||
|
||||
r = super(NewsIndexPage, self).serve(request)
|
||||
r.template_name = template
|
||||
return r
|
||||
|
||||
def child_pages(self):
|
||||
return NewsPage.objects.live().child_of(self).specific().order_by("-date")
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ def do_monkey_patch():
|
|||
patch_speaker_profile_form()
|
||||
patch_accounts_to_send_bcc()
|
||||
fix_sitetree_check_access_500s()
|
||||
never_cache_login_page()
|
||||
|
||||
# Remove this function from existence
|
||||
global do_monkey_patch
|
||||
|
@ -76,3 +77,8 @@ def fix_sitetree_check_access_500s():
|
|||
return False
|
||||
|
||||
SiteTree.check_access = check_access
|
||||
|
||||
def never_cache_login_page():
|
||||
from django.views.decorators.cache import never_cache
|
||||
from account.views import LoginView
|
||||
LoginView.get = never_cache(LoginView.get)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from django.contrib import admin
|
||||
|
||||
from .models import TalkProposal
|
||||
import models
|
||||
|
||||
|
||||
admin.site.register(TalkProposal)
|
||||
admin.site.register(models.TalkProposal)
|
||||
admin.site.register(models.TutorialProposal)
|
||||
admin.site.register(models.MiniconfProposal)
|
||||
|
|
|
@ -115,7 +115,6 @@ MIDDLEWARE_CLASSES = [
|
|||
'wagtail.wagtailcore.middleware.SiteMiddleware',
|
||||
'wagtail.wagtailredirects.middleware.RedirectMiddleware',
|
||||
'pinaxcon.monkey_patch.MonkeyPatchMiddleware',
|
||||
'pinaxcon.disable_cscache.DisableClientSideCachingMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = "pinaxcon.urls"
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
{% load lca2017_tags %}
|
||||
|
||||
{% if form.non_field_errors %}
|
||||
{{ form.non_field_errors }}
|
||||
<br/>
|
||||
|
@ -9,16 +7,7 @@
|
|||
{% if not field.is_hidden %}
|
||||
<div class="fieldWrapper">
|
||||
<div>
|
||||
{% classname field.field.widget as widget %}
|
||||
{% if widget != "CheckboxInput" %}
|
||||
<h4><label for="{{ field.id_for_label }}">{{ field.label }}</label></h4>
|
||||
{{ field.errors }}
|
||||
{{ field }}
|
||||
{% else %}
|
||||
<label for="{{ field.id_for_label }}"><strong>{{ field.label }}</strong></label>
|
||||
{{ field }}
|
||||
{{ field.errors }}
|
||||
{% endif %}
|
||||
{% include "forms/widget.html" %}
|
||||
</div>
|
||||
|
||||
{% if field.help_text %}
|
||||
|
|
|
@ -36,5 +36,12 @@
|
|||
<div class="panel panel__compact"></div>
|
||||
{% endif %}
|
||||
|
||||
<div class="panel panel__compact">
|
||||
<div class="panel--content">
|
||||
<h3>Subscribe</h3>
|
||||
<p><a class="btn" href="rss">View as RSS</a></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
|
35
pinaxcon/templates/cms_pages/news_index_page.rss
Normal file
35
pinaxcon/templates/cms_pages/news_index_page.rss
Normal file
|
@ -0,0 +1,35 @@
|
|||
{% load wagtailcore_tags %}
|
||||
{% load i18n %}
|
||||
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>
|
||||
{{ SITE_NAME }} | {{ page.title }}
|
||||
</title>
|
||||
<link>{{ request.scheme }}://{{ request.get_host }}</link>
|
||||
<description>Recent content from {{ SITE_NAME }}</description>
|
||||
<generator>{{ SITE_NAME }}</generator>
|
||||
|
||||
<atom:link href="{{ request.scheme }}://{{ request.get_host }}{{ page.url }}rss" rel="self" type="application/rss+xml" />
|
||||
|
||||
{% if page.child_pages %}
|
||||
{% for item in page.child_pages %}
|
||||
<item>
|
||||
<title>{{ item.title }}</title>
|
||||
<link>{{ request.scheme }}://{{ request.get_host }}{{ item.url }}</link>
|
||||
<guid>{{ request.scheme }}://{{ request.get_host }}{{ item.url }}</guid>
|
||||
<pubDate>{{ item.date|date:"D, d M Y 00:00:00 +1000" }}</pubDate>
|
||||
<description>
|
||||
<p>
|
||||
{{ item.intro|richtext|force_escape }}
|
||||
</p>
|
||||
<p>
|
||||
{{ item.body|richtext|force_escape }}
|
||||
</p>
|
||||
|
||||
</description>
|
||||
</item>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</channel>
|
||||
</rss>
|
12
pinaxcon/templates/forms/widget.html
Normal file
12
pinaxcon/templates/forms/widget.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
{% load lca2017_tags %}
|
||||
|
||||
{% classname field.field.widget as widget %}
|
||||
{% if widget == "CheckboxInput" %}
|
||||
{% include "forms/widget_boolean_single.html" %}
|
||||
{% elif widget == "RadioSelect" %}
|
||||
{% include "forms/widget_boolean_multiple.html" %}
|
||||
{% elif widget == "Select" or widget == "SelectMultiple" %}
|
||||
{% include "forms/widget_basic.html" with widget_class="select" %}
|
||||
{% else %}
|
||||
{% include "forms/widget_basic.html" %}
|
||||
{% endif %}
|
3
pinaxcon/templates/forms/widget_basic.html
Normal file
3
pinaxcon/templates/forms/widget_basic.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
<h4><label for="{{ field.id_for_label }}">{{ field.label }}</label></h4>
|
||||
{{ field.errors }}
|
||||
<div class="form-field {{ widget_class }}">{{ field }}</div>
|
11
pinaxcon/templates/forms/widget_boolean_multiple.html
Normal file
11
pinaxcon/templates/forms/widget_boolean_multiple.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
<h4><label for="{{ field.id_for_label }}">{{ field.label }}</label></h4>
|
||||
<ul class="form-field boolean-group">
|
||||
{% for item in field %}
|
||||
LA
|
||||
<li class="boolean-group--row">
|
||||
{{ item }}
|
||||
<label for="{{ item.id_for_label }}"><strong>{{ item.label }}</strong></label>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{{ field.errors }}
|
7
pinaxcon/templates/forms/widget_boolean_single.html
Normal file
7
pinaxcon/templates/forms/widget_boolean_single.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
<ul class="form-field boolean-group">
|
||||
<li class="boolean-group--row">
|
||||
{{ field }}
|
||||
<label for="{{ field.id_for_label }}"><strong>{{ field.label }}</strong></label>
|
||||
</li>
|
||||
</ul>
|
||||
{{ field.errors }}
|
|
@ -13,8 +13,10 @@
|
|||
</a>
|
||||
|
||||
{% if item.has_children %}
|
||||
{% with is_last=forloop.last %}
|
||||
{% sitetree_children of item for menu template "sitetree_header_dropdown.html" %}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
</li>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</nav>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{% load sitetree %}
|
||||
<div class="menu-dropdown">
|
||||
|
||||
<div class="menu-dropdown {% if is_last%}menu-dropdown__last{% endif %}">
|
||||
<ul class="link-list" role="menu">
|
||||
{% for item in sitetree_items %}
|
||||
<li class="link-list--item">
|
||||
|
|
|
@ -528,7 +528,7 @@ table {
|
|||
border: 1px solid #3ab1c9;
|
||||
}
|
||||
|
||||
.form-field input[type='text'], .form-field input[type='tel'], .form-field input[type='number'], .form-field input[type='password'], .form-field input[type='email'] {
|
||||
.form-field input[type='text'], .form-field input[type='tel'], .form-field input[type='number'], .form-field input[type='password'], .form-field input[type='email'], textarea {
|
||||
color: #0c486c;
|
||||
padding: 10px;
|
||||
width: 100%;
|
||||
|
|
Loading…
Reference in a new issue