Login

YUI editor for flatpages inside admin interface

Author:
nnrcschmdt
Posted:
March 23, 2008
Language:
HTML/template
Version:
Not specified
Tags:
admin flatpages yui-editor
Score:
2 (after 2 ratings)

This template extends the change form for the flatpages inside the admin interface to use Yahoo! User Interface Library's Rich Text Editor.

It should be named change_form.html and be placed in the admin/flatpages/flatpage/ directory of the project templates.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{% extends "admin/change_form.html" %}

{% block extrastyle %}
<link rel="stylesheet" type="text/css"
href="http://yui.yahooapis.com/2.5.1/build/assets/skins/sam/skin.css">
{% endblock %}

{% block extrahead %}
{{ block.super }}
<script type="text/javascript"
src="http://yui.yahooapis.com/2.5.1/build/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript"
src="http://yui.yahooapis.com/2.5.1/build/element/element-beta.js"></script>
<script type="text/javascript"
src="http://yui.yahooapis.com/2.5.1/build/container/container_core.js"></script>
<script type="text/javascript"
src="http://yui.yahooapis.com/2.5.1/build/menu/menu.js"></script>
<script type="text/javascript"
src="http://yui.yahooapis.com/2.5.1/build/button/button.js"></script>
<script type="text/javascript"
src="http://yui.yahooapis.com/2.5.1/build/editor/editor-beta.js"></script>
{% endblock %}

{% block bodyclass %}{{ block.super }} change-form yui-skin-sam{% endblock %}

{% block after_field_sets %}
<script type="text/javascript">
    var editor = new YAHOO.widget.Editor('id_content', { handleSubmit: true});
    editor.render();
</script>
{% endblock %}

More like this

  1. Encoding datetime for JSON consumers like YUI by acdha 5 years, 7 months ago
  2. WTForm (What The Form) by chrj 8 years, 2 months ago
  3. template code for "Google v3 geocoding for Geodjango admin site" by samhag 2 years, 9 months ago
  4. S3 static media uploader by phlex 6 years, 8 months ago
  5. Allow template tags in a Flatpage's content by kylefox 7 years ago

Comments

Winand (on February 26, 2013):

extrastyle also needs {{block.super}} (otherwise the whole page is broken), though i just moved styles to extrahead. Also "change-form" body class duplicates definition in parent.

#

Please login first before commenting.