summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/editcave.html4
-rw-r--r--templates/html_editor_scripts_css.html36
-rw-r--r--templates/widgets/HTMLarea.html4
3 files changed, 33 insertions, 11 deletions
diff --git a/templates/editcave.html b/templates/editcave.html
index 49aa767..64c2f97 100644
--- a/templates/editcave.html
+++ b/templates/editcave.html
@@ -1,11 +1,11 @@
{% extends "cavebase.html" %}
{% block title %}Edit Cave - {{cave.official_name|safe}} - {{cave.kataster_number}}{% endblock %}
{% block extraheaders %}
-
-<!--<script src="{{ settings.TINY_MCE_MEDIA_URL }}tiny_mce.js" type="text/javascript"></script>-->
+{% include 'html_editor_scripts_css.html' %}
{% endblock %}
{% block content %}
<h1>Edit Cave - {{cave.official_name|safe}} - {{cave.kataster_number}}</h1>
+{% include 'html_editor_pop_ups.html' %}
<h2>{{message}}</h2>
<form action="" method="post">{% csrf_token %}
<table>{{ form }}{{caveAndEntranceFormSet}}</table>
diff --git a/templates/html_editor_scripts_css.html b/templates/html_editor_scripts_css.html
index 78dad9f..8634958 100644
--- a/templates/html_editor_scripts_css.html
+++ b/templates/html_editor_scripts_css.html
@@ -8,7 +8,6 @@
<script src={{ settings.MEDIA_URL }}codemirror/css.js></script>
<script src={{ settings.MEDIA_URL }}codemirror/htmlmixed.js></script>
<link rel=stylesheet href={{ settings.MEDIA_URL }}codemirror/codemirror.css>
- <link rel=stylesheet href={{ settings.MEDIA_URL }}codemirror/docs.css>
<style type=text/css>
html {
@@ -32,6 +31,8 @@
left: 5%;
z-index: 20;
}
+
+ .HTMLarea { width:1000px;}
.popup-overlay.active {
/*displays pop-up when "active" class is present*/
@@ -71,14 +72,14 @@
float: left;
width: 50%;
border: 1px solid black;
- height: 80%;
+ height: 70%;
}
.CodeMirror-scroll{
height: 99%
}
iframe {
width: 49%;
- height: 80%;
+ height: 70%;
float: left;
border: 1px solid black;
border-left: 0px;
@@ -97,8 +98,12 @@
$(".HTMLarea").each(function(){
var HTMLarea = $(this).children("textarea")
- HTMLarea.data("editor",
+ var preview = $(this).children('.HTMLpreview')
+ if ( preview.length )
+ {
+ HTMLarea.data("editor",
CodeMirror.fromTextArea(HTMLarea[0], {
+ lineWrapping: true,
mode: 'text/html',
tabMode: 'indent',
onChange: function() {
@@ -107,8 +112,18 @@
}
})
);
- HTMLarea.data("preview", $('#preview'));
- updatePreview(HTMLarea);
+ HTMLarea.data("preview", preview);
+ updatePreview(HTMLarea);
+ } else {
+ HTMLarea.data("editor",
+ CodeMirror.fromTextArea(HTMLarea[0], {
+ lineWrapping: true,
+ mode: 'text/html',
+ tabMode: 'indent'
+ })
+ );
+ }
+
});
$(".addTag").click(function(){
addTag($(this).parents(".HTMLarea").children("textarea").data("editor"),
@@ -130,7 +145,7 @@
function updatePreview(HTMLarea) {
- var preview = $('#preview')[0].contentDocument || $('#preview')[0].contentWindow.document;
+ var preview = HTMLarea.data("preview")[0].contentDocument || $('#preview')[0].contentWindow.document;
preview.open();
preview.write("<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8' /><link rel='stylesheet' type='text/css' href='/css/main2.css' /> <style type=text/css>body{max-width: none;margin-left: 15px;margin-right: 15px;}</style></head><body>");
preview.write(HTMLarea.data("editor").getValue());
@@ -158,7 +173,12 @@
function add_image_popup(editor) {
$('.add-image-popup').addClass('active');
window.current_editor = editor;
- $('#image_popup_content').load("{% url 'image_selector' path %}", function() {
+ {% if not path %}
+ var path = $("#id_url").val();
+ {% else %}
+ var path = "";
+ {% endif %}
+ $('#image_popup_content').load("{% url 'image_selector' path %}" + path, function() {
$('.thumbnail').click(function(){
$(".add-image-popup").removeClass("active");
addStr(window.current_editor, $( this ).attr("data-html"))
diff --git a/templates/widgets/HTMLarea.html b/templates/widgets/HTMLarea.html
index 1f1c99a..50a332c 100644
--- a/templates/widgets/HTMLarea.html
+++ b/templates/widgets/HTMLarea.html
@@ -1,6 +1,8 @@
<div class="HTMLarea">
{% include "django/forms/widgets/textarea.html" %}
-<iframe id=preview class="HTMLpreview" {% include "django/forms/widgets/attrs.html" with widget=iframe %}></iframe>
+{% if preview %}
+<iframe class="HTMLpreview"></iframe>
+{% endif %}
<button type="button" class="addTag" data-tag="i">italic</button>
<button type="button" class="addTag" data-tag="b">bold</button>
<button type="button" class="addTag" data-tag="h2" data-attr="id=&quot;tophead&quot;">top heading</button>