Merge branch 'wagtail-separation' into staging

pull/3/head
Matt Westcott 2014-01-30 11:31:04 +00:00
commit e1f39dd508
19 zmienionych plików z 43 dodań i 43 usunięć

Wyświetl plik

@ -110,7 +110,7 @@ def formfield_for_dbfield(db_field, **kwargs):
return db_field.formfield(**kwargs)
class VerdantAdminModelFormMetaclass(ClusterFormMetaclass):
class WagtailAdminModelFormMetaclass(ClusterFormMetaclass):
# Override the behaviour of the regular ModelForm metaclass -
# which handles the translation of model fields to form fields -
# to use our own formfield_for_dbfield function to do that translation.
@ -126,12 +126,12 @@ class VerdantAdminModelFormMetaclass(ClusterFormMetaclass):
if 'formfield_callback' not in attrs or attrs['formfield_callback'] is None:
attrs['formfield_callback'] = formfield_for_dbfield
new_class = super(VerdantAdminModelFormMetaclass, cls).__new__(cls, name, bases, attrs)
new_class = super(WagtailAdminModelFormMetaclass, cls).__new__(cls, name, bases, attrs)
return new_class
VerdantAdminModelForm = VerdantAdminModelFormMetaclass('VerdantAdminModelForm', (ClusterForm,), {})
WagtailAdminModelForm = WagtailAdminModelFormMetaclass('WagtailAdminModelForm', (ClusterForm,), {})
# Now, any model forms built off VerdantAdminModelForm instead of ModelForm should pick up
# Now, any model forms built off WagtailAdminModelForm instead of ModelForm should pick up
# the nice form fields defined in FORM_FIELD_OVERRIDES.
@ -166,7 +166,7 @@ def get_form_for_model(model, fields=None, exclude=None, formsets=None, exclude_
'Meta': type('Meta', (object,), attrs)
}
return VerdantAdminModelFormMetaclass(class_name, (VerdantAdminModelForm,), form_class_attrs)
return WagtailAdminModelFormMetaclass(class_name, (WagtailAdminModelForm,), form_class_attrs)
def extract_panel_definitions_from_model_class(model, exclude=None):

Wyświetl plik

@ -19,7 +19,7 @@ def search_for_hooks():
if not _searched_for_hooks:
for app_module in settings.INSTALLED_APPS:
try:
import_module('%s.verdant_hooks' % app_module)
import_module('%s.wagtail_hooks' % app_module)
except ImportError:
continue

Wyświetl plik

@ -14,7 +14,7 @@
min-height:50px;
overflow: hidden;
/* Resetting various html tags that have been messed with by Verdant's main css */
/* Resetting various html tags that have been messed with by Wagtail's main css */
h1{
text-transform:none;
}

Wyświetl plik

@ -1,7 +1,7 @@
# plugin for hallo.js to allow inserting links using Verdant's page chooser
# plugin for hallo.js to allow inserting links using Wagtail's page chooser
(($) ->
$.widget "IKS.halloverdantlink",
$.widget "IKS.hallowagtaillink",
options:
uuid: ''
editable: null

Wyświetl plik

@ -25,10 +25,10 @@ function makeRichTextEditable(id) {
'hallolists': {},
'hallohr': {},
'halloreundo': {},
'halloverdantimage': {},
'halloverdantembeds': {},
'halloverdantlink': {},
'halloverdantdoclink': {},
'hallowagtailimage': {},
'hallowagtailembeds': {},
'hallowagtaillink': {},
'hallowagtaildoclink': {},
}
}).bind('hallomodified', function(event, data) {
input.val(data.content);
@ -235,7 +235,7 @@ $(function() {
$(this).data('action'),
$('#page-edit-form').serialize(),
function(data, textStatus, request) {
if (request.getResponseHeader('X-Verdant-Preview') == 'ok') {
if (request.getResponseHeader('X-Wagtail-Preview') == 'ok') {
previewWindow.document.open();
previewWindow.document.write(data);
previewWindow.document.close();

Wyświetl plik

@ -57,8 +57,8 @@ def send_notification(page_revision_id, notification, excluded_user_id):
email_content = '\n'.join(rendered_template[1:])
# Get from email
if hasattr(settings, 'VERDANTADMIN_NOTIFICATION_FROM_EMAIL'):
from_email = settings.VERDANTADMIN_NOTIFICATION_FROM_EMAIL
if hasattr(settings, 'WAGTAILADMIN_NOTIFICATION_FROM_EMAIL'):
from_email = settings.WAGTAILADMIN_NOTIFICATION_FROM_EMAIL
elif hasattr(settings, 'DEFAULT_FROM_EMAIL'):
from_email = settings.DEFAULT_FROM_EMAIL
else:

Wyświetl plik

@ -10,17 +10,17 @@
<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-verdant-toolbar.js"></script>
<script type="text/coffeescript" src="{{ STATIC_URL }}wagtailadmin/js/hallo-plugins/hallo-verdantlink.coffee"></script>
<script src="{{ STATIC_URL }}wagtailadmin/js/hallo-plugins/hallo-wagtail-toolbar.js"></script>
<script type="text/coffeescript" src="{{ STATIC_URL }}wagtailadmin/js/hallo-plugins/hallo-wagtaillink.coffee"></script>
<script type="text/coffeescript" src="{{ STATIC_URL }}wagtailadmin/js/hallo-plugins/hallo-hr.coffee"></script>
<script type="text/coffeescript" src="{{ STATIC_URL }}wagtailimages/js/hallo-plugins/hallo-verdantimage.coffee"></script>
<script type="text/coffeescript" src="{{ STATIC_URL }}wagtailembeds/js/hallo-plugins/hallo-verdantembeds.coffee"></script>
<script type="text/coffeescript" src="{{ STATIC_URL }}wagtaildocs/js/hallo-plugins/hallo-verdantdoclink.coffee"></script>
<script type="text/coffeescript" src="{{ STATIC_URL }}wagtailimages/js/hallo-plugins/hallo-wagtailimage.coffee"></script>
<script type="text/coffeescript" src="{{ STATIC_URL }}wagtailembeds/js/hallo-plugins/hallo-wagtailembeds.coffee"></script>
<script type="text/coffeescript" src="{{ STATIC_URL }}wagtaildocs/js/hallo-plugins/hallo-wagtaildoclink.coffee"></script>
<script src="{{ STATIC_URL }}wagtailadmin/js/page-editor.js"></script>
<script src="{{ STATIC_URL }}wagtailadmin/js/page-chooser.js"></script>
{% comment %}
TODO: have a mechanism to specify image-chooser.js (and hallo-verdantimage.coffee)
TODO: have a mechanism to specify image-chooser.js (and hallo-wagtailimage.coffee)
within the wagtailimages app -
ideally wagtailadmin shouldn't have to know anything at all about wagtailimages
TODO: a method of injecting these sorts of things on demand when the modal is spawned.

Wyświetl plik

@ -21,7 +21,7 @@
<input type="submit" value="Save as draft" class="button" />
<div class="dropdown-toggle icon icon-arrow-up"></div>
<ul role="menu">
<li><input type="button" id="action-preview" data-action="{% url 'wagtailadmin_pages_preview_on_create' content_type.app_label content_type.model parent_page.id %}" data-placeholder="{% url 'wagtailadmin_pages_preview_placeholder' %}" data-windowname="verdant_preview_{{ parent_page.id }}_child" value="Preview" class="button" /></li>
<li><input type="button" id="action-preview" data-action="{% url 'wagtailadmin_pages_preview_on_create' content_type.app_label content_type.model parent_page.id %}" data-placeholder="{% url 'wagtailadmin_pages_preview_placeholder' %}" data-windowname="wagtail_preview_{{ parent_page.id }}_child" value="Preview" class="button" /></li>
{% if parent_page_perms.can_publish_subpage %}
<li><input type="submit" name="action-publish" value="Publish" class="button" /></li>
{% endif %}

Wyświetl plik

@ -45,7 +45,7 @@
<li><input type="submit" name="action-publish" value="Publish" class="button" /></li>
{% endif %}
<li><input type="submit" name="action-submit" value="Submit for moderation" class="button" /></li>
<li><input type="button" id="action-preview" data-action="{% url 'wagtailadmin_pages_preview_on_edit' page.id %}" data-placeholder="{% url 'wagtailadmin_pages_preview_placeholder' %}" data-windowname="verdant_preview_{{ page.id }}" value="Preview" class="button" /></li>
<li><input type="button" id="action-preview" data-action="{% url 'wagtailadmin_pages_preview_on_edit' page.id %}" data-placeholder="{% url 'wagtailadmin_pages_preview_placeholder' %}" data-windowname="wagtail_preview_{{ page.id }}" value="Preview" class="button" /></li>
</ul>
</div>
</li>

Wyświetl plik

@ -3,10 +3,10 @@ from django import template
register = template.Library()
@register.simple_tag(takes_context=True)
def verdantuserbar(context, cssfile=""):
def wagtailuserbar(context, cssfile=""):
try:
items = ''.join(["<li>%s</li>" % item for item in context['request'].userbar])
context.hasuserbar = True
return """<link rel="stylesheet" href="%s" /><ul id="verdant-userbar">%s</ul>""" % (cssfile, items)
return """<link rel="stylesheet" href="%s" /><ul id="wagtail-userbar">%s</ul>""" % (cssfile, items)
except AttributeError:
return ''

Wyświetl plik

@ -65,7 +65,7 @@ def home(request):
fn(request, panels)
return render(request, "wagtailadmin/home.html", {
'site_name': settings.VERDANT_SITE_NAME,
'site_name': settings.WAGTAIL_SITE_NAME,
'panels': sorted(panels, key=lambda p: p.order),
'user':request.user
})

Wyświetl plik

@ -334,7 +334,7 @@ def preview_on_edit(request, page_id):
request.META.pop('HTTP_X_REQUESTED_WITH', None) # Make this request appear to the page's serve method as a non-ajax one, as they will often implement custom behaviour for XHR
response = page.serve(request)
response['X-Verdant-Preview'] = 'ok'
response['X-Wagtail-Preview'] = 'ok'
return response
else:
@ -344,7 +344,7 @@ def preview_on_edit(request, page_id):
'page': page,
'edit_handler': edit_handler,
})
response['X-Verdant-Preview'] = 'error'
response['X-Wagtail-Preview'] = 'error'
return response
@login_required
@ -371,7 +371,7 @@ def preview_on_create(request, content_type_app_name, content_type_model_name, p
# as a front-end GET request
response = page.serve(request)
response['X-Verdant-Preview'] = 'ok'
response['X-Wagtail-Preview'] = 'ok'
return response
else:
@ -384,7 +384,7 @@ def preview_on_create(request, content_type_app_name, content_type_model_name, p
'parent_page': parent_page,
'edit_handler': edit_handler,
})
response['X-Verdant-Preview'] = 'error'
response['X-Wagtail-Preview'] = 'error'
return response
def preview_placeholder(request):

Wyświetl plik

@ -21,7 +21,7 @@ class Migration(DataMigration):
)
homepage = orm['wagtailcore.page'].objects.create(
title="Welcome to your new Verdant site!",
title="Welcome to your new Wagtail site!",
slug='home',
content_type=page_content_type,
path='00010001',

Wyświetl plik

@ -50,10 +50,10 @@ class Site(models.Model):
else:
return 'http://%s:%d' % (self.hostname, self.port)
# clear the verdant_site_root_paths cache whenever Site records are updated
# clear the wagtail_site_root_paths cache whenever Site records are updated
def save(self, *args, **kwargs):
result = super(Site, self).save(*args, **kwargs)
cache.delete('verdant_site_root_paths')
cache.delete('wagtail_site_root_paths')
return result
@staticmethod
@ -62,14 +62,14 @@ class Site(models.Model):
Return a list of (root_path, root_url) tuples, most specific path first -
used to translate url_paths into actual URLs with hostnames
"""
result = cache.get('verdant_site_root_paths')
result = cache.get('wagtail_site_root_paths')
if result is None:
result = [
(site.id, site.root_page.url_path, site.root_url)
for site in Site.objects.select_related('root_page').order_by('-root_page__url_path')
]
cache.set('verdant_site_root_paths', result, 3600)
cache.set('wagtail_site_root_paths', result, 3600)
return result
@ -464,7 +464,7 @@ def get_navigation_menu_items():
# an exception here means that this node is one level deeper than any we've seen so far
depth_list.append(node)
# in Verdant, the convention is to have one root node in the db (depth=1); the menu proper
# in Wagtail, the convention is to have one root node in the db (depth=1); the menu proper
# begins with the children of that node (depth=2).
try:
root, root_children = depth_list[1]

Wyświetl plik

@ -1,7 +1,7 @@
# plugin for hallo.js to allow inserting links using Verdant's page chooser
# plugin for hallo.js to allow inserting links using Wagtail's page chooser
(($) ->
$.widget "IKS.halloverdantdoclink",
$.widget "IKS.hallowagtaildoclink",
options:
uuid: ''
editable: null

Wyświetl plik

@ -1,7 +1,7 @@
# plugin for hallo.js to allow inserting embeds
(($) ->
$.widget "IKS.halloverdantembeds",
$.widget "IKS.hallowagtailembeds",
options:
uuid: ''
editable: null

Wyświetl plik

@ -1,7 +1,7 @@
# plugin for hallo.js to allow inserting images from the Verdant image library
# plugin for hallo.js to allow inserting images from the Wagtail image library
(($) ->
$.widget "IKS.halloverdantimage",
$.widget "IKS.hallowagtailimage",
options:
uuid: ''
editable: null

Wyświetl plik

@ -54,7 +54,7 @@ class Search(object):
def __init__(self):
# Get settings
self.es_urls = getattr(settings, "WAGTAILSEARCH_ES_URLS", ["http://localhost:9200"])
self.es_index = getattr(settings, "WAGTAILSEARCH_ES_INDEX", "verdant")
self.es_index = getattr(settings, "WAGTAILSEARCH_ES_INDEX", "wagtail")
# Get ElasticSearch interface
self.es = get_es(urls=self.es_urls)