Skip to content

Commit

Permalink
Added the editor templates
Browse files Browse the repository at this point in the history
  • Loading branch information
Corey Oordt committed Aug 27, 2009
1 parent 8deaaa2 commit 38979d4
Show file tree
Hide file tree
Showing 12 changed files with 698 additions and 0 deletions.
9 changes: 9 additions & 0 deletions editor/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from django.conf import settings
import django

DJANGO10_COMPAT = django.VERSION[0] < 1 or (django.VERSION[0] == 1 and django.VERSION[1] < 1)

MEDIA_PATH = getattr(settings, 'EDITOR_MEDIA_PATH', '/media/editor/')

# Link to google APIs instead of using local copy of JS libraries
MEDIA_HOTLINKING = getattr(settings, 'EDITOR_MEDIA_HOTLINKING', False)
11 changes: 11 additions & 0 deletions editor/templates/admin/editor/_messages.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{% load i18n %}

DELETE_MESSAGES = ["{% trans "Really delete item?" %}", "{% trans "Confirm to delete item" %}",
"{% trans "Item deleted successfully." %}", "{% trans "Cannot delete item" %}",
"{% trans "Cannot delete item, because it is parent of at least one other item." %}"];
TREE_SAVED_MESSAGE = "{% trans "Tree saved successfully." %}";
CHANGE_TEMPLATE_MESSAGES = ["{% trans "Change template" %}",
"{% trans "Really change template? <br />All changes are saved." %}",
"{% trans "Really change template? <br />All changes are saved and content from <strong>%(source_regions)s</strong> is moved to <strong>%(target_region)s</strong>." %}"];
DROP_FAILURE_MESSAGE = "{% trans "Cannot make a node a child of itself." %}";

1 change: 1 addition & 0 deletions editor/templates/admin/editor/box.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div class="fe_box" id="{{ identifier }}">{{ content|safe }}</div>
58 changes: 58 additions & 0 deletions editor/templates/admin/editor/editor.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{% extends "admin/change_form.html" %}
{% load i18n admin_modify adminmedia %}


{% block extrahead %}{{ block.super }}
{% if EDITOR_MEDIA_PATH_HOTLINKING %}
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
<link type="text/css" href="http://jqueryui.com/latest/themes/base/ui.all.css" rel="stylesheet" />
{% else %}
<script type="text/javascript" src="{{ EDITOR_MEDIA_PATH }}jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="{{ EDITOR_MEDIA_PATH }}ui/jqueryui-custom-1.7.2.min.js"></script>
<link rel="stylesheet" type="text/css" href="{{ EDITOR_MEDIA_PATH }}ui/jqueryui-custom-1.7.2.css" />
{% endif %}

<script type="text/javascript" src="{{ EDITOR_MEDIA_PATH }}jquery.alerts.js"></script>
<script type="text/javascript" src="{{ EDITOR_MEDIA_PATH }}itemeditor.js"></script>

<script type="text/javascript">
var contentblock_init_handlers = [];
</script>

{% for inc in object.feincms_item_editor_includes.head %}{% include inc %}{% endfor %}

<script type="text/javascript">
{% include "admin/feincms/_messages.html" %}

function init_contentblocks() {
for(var k in contentblock_init_handlers)
contentblock_init_handlers[k]();
}

$(function(){
init_contentblocks();
});
</script>
{% endblock %}

{% block content %}
<div class="content_main" id="frontend_editor">

<form method="post" action=".">
<div>
{% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %}

<table>
{{ form }}
</table>

<div class="submit-row" >
<input type="submit" value="{% trans "Save" %}" class="default" name="_save" />
</div>

</div>
</form>

</div>
{% endblock %}
12 changes: 12 additions & 0 deletions editor/templates/admin/editor/editor_done.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="{{ FEINCMS_ADMIN_MEDIA }}jquery.color.js"></script>

<div id="{{ identifier }}-new">
{{ content|safe }}
</div>

<script type="text/javascript">
opener.fe_update_content('{{ identifier }}', $('#{{ identifier }}-new').html());

window.close();
</script>
202 changes: 202 additions & 0 deletions editor/templates/admin/editor/item_editor.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
{% extends "admin/change_form.html" %}
{% load i18n admin_modify adminmedia %}

{% block bodyclass %}{{ opts.app_label }}-{{ opts.object_name.lower }} change-form{% endblock %}
{% block coltype %}{% if ordered_objects %}colMS{% else %}colM{% endif %}{% endblock %}

{% block extrahead %}{{ block.super }}
{% if FEINCMS_ADMIN_MEDIA_HOTLINKING %}
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
<link type="text/css" href="http://jqueryui.com/latest/themes/base/ui.all.css" rel="stylesheet" />
{% else %}
<script type="text/javascript" src="{{ FEINCMS_ADMIN_MEDIA }}jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="{{ FEINCMS_ADMIN_MEDIA }}ui/jqueryui-custom-1.7.2.min.js"></script>
<link rel="stylesheet" type="text/css" href="{{ FEINCMS_ADMIN_MEDIA }}ui/jqueryui-custom-1.7.2.css" />
{% endif %}

<link rel="stylesheet" type="text/css" href="{{ FEINCMS_ADMIN_MEDIA }}style.css" />
<script type="text/javascript" src="{{ FEINCMS_ADMIN_MEDIA }}jquery.alerts.js"></script>
<script type="text/javascript" src="{{ FEINCMS_ADMIN_MEDIA }}item_editor.js"></script>

<script type="text/javascript">
{% include "admin/feincms/_messages.html" %}
IMG_DELETELINK_PATH = "{{ FEINCMS_ADMIN_MEDIA }}img/icon_deletelink.gif";
REGION_MAP = [{% for region in object.template.regions %}'{{ region.key }}'{% if not forloop.last %}, {% endif %}{% endfor %}];
ACTIVE_REGION = 0;
CONTENT_NAMES = {
{% for name, value in content_types %}'{{ value }}': '{{ name|capfirst }}'{% if not forloop.last %},{% endif %}
{% endfor %}};
var contentblock_init_handlers = [];

var template_regions = {
{% for template in available_templates.values %}'{{ template.key }}': [{% for region in template.regions %}'{{ region.key }}'{% if not forloop.last %}, {% endif %}{% endfor %}]{% if not forloop.last %},{% endif %}
{% endfor %}};
</script>

{% for inc in object.feincms_item_editor_includes.head %}{% include inc %}{% endfor %}

<script type="text/javascript">
$(document).ready(function(){
{% block extra-init-js %}{# /* do not use this block, use feincms_item_editor_includes instead */ #}{% endblock %}
});
</script>
{% endblock %}

{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="../../../">{% trans "Home" %}</a> &rsaquo;
<a href="../../">{{ opts.app_label|capfirst|escape }}</a> &rsaquo;
<a href="../">{{ opts.verbose_name_plural|capfirst }}</a> &rsaquo;
{{ object.title|truncatewords:"18" }}
</div>
{% endblock %}

{% block content %}

<div id="content-main">

{% block object-tools %}
<ul class="object-tools">
{% if object.get_preview_url %}
<li><a target="_blank" href="{{ object.get_preview_url }}" class="viewsitelink">{% trans "Preview" %}</a></li>
{% endif %}
{% if object.get_absolute_url %}
<li><a target="_blank" href="{{ object.get_absolute_url }}" class="viewsitelink">{% trans "View on site" %}</a></li>
{% endif %}
</ul>
{% endblock %}

<form name="main_form" enctype="multipart/form-data" action="." method="post" id="{{ opts.module_name }}_form">
<div>

<div class="submit-row" >
<input type="submit" value="{% trans "Save" %}" class="default" name="_save" />
<p class="deletelink-box"><a href="delete/" class="deletelink">{% trans "Delete" %}</a></p>

<input type="submit" value="{% trans "Save and add another" %}" name="_addanother" />
<input type="submit" value="{% trans "Save and continue editing" %}" name="_continue" />
</div>

{% if errors %}
<p class="errornote">
{% blocktrans count errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
</p>
<ul class="errorlist">{% for error in object_form.non_field_errors %}<li>{{ error }}</li>{% endfor %}</ul>
{% endif %}

<fieldset class="module aligned">
{% for field in top_fields %}
<div class="form-row{% if field.errors %} errors{% endif %}">
{% ifequal field.name "language" %}
{# Maybe this should be moved somewhere else, since this is specific for translated objects... #}
{% with object.available_translations as translations %}
{% if translations %}
<div style="float:right;padding:5px 0 0 0">
{% trans "available translations" %}:
{% for translation in translations %}
<a href="../{{ translation.id }}/" title="{{ translation }}">{{ translation.language|upper }}</a>{% if not forloop.last %},{% endif %}
{% endfor %}
</div>
{% endif %}
{% endwith %}
{% endifequal %}

{{ field.errors }}
<label for="{{ field.auto_id }}"{% if field.field.required %} class="required"{% endif %}>{{ field.label }}</label>{{ field }}
{% if field.field.help_text %}<p class="help">{{ field.field.help_text|safe }}</p>{% endif %}
</div>
{% endfor %}
</fieldset>

<div id="main_wrapper">
{% for region in object.template.regions %}
<div class="navi_tab" id="{{ region.key }}_tab">{{ region.title }}</div>
{% endfor %}
<div class="navi_tab" id="settings_tab">{% trans "Properties" %}</div>
<div id="main">
<fieldset class="module aligned" id="settings_body">
{% for field in settings_fields %}
<div class="form-row{% if field.errors %} errors{% endif %}">
{{ field.errors }}
<label for="{{ field.auto_id }}"{% if field.field.required %} class="required"{% endif %}>{{ field.label }}</label>{{ field }}
{% if field.field.help_text %}<p class="help">{{ field.field.help_text|safe }}</p>{% endif %}
</div>
{% endfor %}
</fieldset>

{% for region in object.template.regions %}
<div id="{{ region.key }}_body" class="panel">
<div class="empty-machine-msg">
{% trans "Region empty" %}
</div>
<div class="empty-machine-msg" style="margin-left:20px; margin-top:20px;">
{% if region.inherited %}
{% trans "Content from the parent site is automatically inherited. To override this behaviour, add some content." %}
{% endif %}
</div>

<div class="order-machine"></div>

<div class="machine-control">
<div class="control-unit">
<span>{% trans "Add new item" %}:</span> <br/>
<select name="order-machine-add-select">
{% for v,n in region.content_types %}<option value="{{ v }}">{{ n|capfirst }}</option> {% endfor %}
</select>
<input type="button" class="order-machine-add-button button" value="OK" />
</div>
{% ifnotequal object.template.regions|length 1 %}
<div class="control-unit">
<span>{% trans "Move selected item to" %}:</span> <br/>
<select name="order-machine-move-select">
{% for r in object.template.regions %}{% ifnotequal region r %}<option value="{{ r.key }}">{{ r.title|capfirst }}</option> {% endifnotequal %}{% endfor %}
</select>
<input type="button" class="order-machine-move-button button" value="{% trans "OK" %}" />
</div>
{% endifnotequal %}
</div>
</div>
{% endfor %}
</div>
</div>

<div class="submit-row" >
<input type="submit" value="{% trans "Save" %}" class="default" name="_save" />
<p class="deletelink-box"><a href="delete/" class="deletelink">{% trans "Delete" %}</a></p>

<input type="submit" value="{% trans "Save and add another" %}" name="_addanother" />
<input type="submit" value="{% trans "Save and continue editing" %}" name="_continue" />
</div>

<div id="inlines">
{% for formset in inline_formsets %}
<div id="{{ formset.rel_name }}">
<div class="header">
{{ formset.management_form }}
</div>
{% for form in formset.forms %}
<div id="{{ formset.rel_name }}_item_{{ forloop.counter0 }}">
{% for field in form %}
{% if field.is_hidden %}
{{ field }}
{% else %}
<div class="form-row{% if field.errors %} errors{% endif %}">
{{ field.errors }}
<label for="{{ field.auto_id }}"{% if field.field.required %} class="required"{% endif %}>{{ field.label }}</label>{{ field }}
{% if field.field.help_text %}<p class="help">{{ field.field.help_text|safe }}</p>{% endif %}
</div>
{% endif %}
{% endfor %}
</div>
{% endfor %}
</div>
{% endfor %}
</div>

</div>
</form>

</div>
{% endblock %}

27 changes: 27 additions & 0 deletions editor/templates/admin/editor/splitpane_editor.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
if(window!=top) {
window.location.href = '?_blank=1';
}
setInterval(function(){
// This is really ugly. If possible this should only be done
// when a new document has been loaded into the frame below...
top.document.title = top.frames.frame_content.document.title;
}, 1000);
</script>
</head>
<frameset cols="250,*" rows="*" id="mainFrameset">
<frame frameborder="0" id="frame_navigation" src="?_tree=1" name="frame_navigation" />
<frame frameborder="0" id="frame_content" src="?_blank=1" name="frame_content" />
<noframes>
<body>
<p>You need a frame-enabled browser for the split pane editor.</p>
</body>
</noframes>
</frameset>
</html>
32 changes: 32 additions & 0 deletions editor/templates/admin/editor/splitpane_editor_blank.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{% extends "admin/change_list.html" %}
{% load i18n admin_modify adminmedia %}

{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="../../">
{% trans "Home" %}
</a>
&rsaquo;
<a href="../">
{{ opts.app_label|capfirst }}
</a>
&rsaquo;
{{ opts.verbose_name_plural|capfirst }}
</div>
{% endblock %}

{% block content %}

<div id="content-main">
{% block object-tools %}
{% if has_add_permission %}
<ul class="object-tools"><li><a href="add/{% if is_popup %}?_popup=1{% endif %}" class="addlink">{% blocktrans with opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}</a></li></ul>
{% endif %}
{% endblock %}
</div>

<p>{% trans "Select an item on the left side if you want to edit it." %}</p>
<p>{% trans "You can change the structure of the tree by drag-dropping elements. Please note that changes will be saved immediately. " %}</p>
<p>{% trans "The context menu on the tree root and tree nodes provide you with additional modes of operation." %}</p>

{% endblock %}

0 comments on commit 38979d4

Please sign in to comment.