From: zuber Date: Thu, 3 Dec 2009 13:34:36 +0000 (+0100) Subject: Ponowne dodanie przycisków do edytora XML. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/1617abdf1a5ec504c28f52daf2a2b1728a5b28f6?ds=sidebyside Ponowne dodanie przycisków do edytora XML. --- diff --git a/apps/toolbar/templates/toolbar/toolbar.html b/apps/toolbar/templates/toolbar/toolbar.html index c4fcdcbb..a69dc3bf 100644 --- a/apps/toolbar/templates/toolbar/toolbar.html +++ b/apps/toolbar/templates/toolbar/toolbar.html @@ -1,32 +1,20 @@ {% load toolbar_tags %}
- - {# This div will be connected to the right place #} - - {% for button in toolbar_extra_group.button_set.all %} - {% toolbar_button button %} - {% endfor %} - - -
-

+ +

{% for group in toolbar_groups %} -

+

{# buttons for this group #} {% for button in group.button_set.all %} {% toolbar_button button %} {% endfor %} -

+
{% endfor %}
- +
diff --git a/apps/toolbar/templatetags/toolbar_tags.py b/apps/toolbar/templatetags/toolbar_tags.py index 9957a939..14d3679d 100644 --- a/apps/toolbar/templatetags/toolbar_tags.py +++ b/apps/toolbar/templatetags/toolbar_tags.py @@ -1,11 +1,11 @@ from django import template -# from toolbar import models +from toolbar import models register = template.Library() @register.inclusion_tag('toolbar/toolbar.html') -def toolbar(groups, extra): - return {'toolbar_groups': groups, 'toolbar_extra_group': extra} +def toolbar(): + return {'toolbar_groups': models.ButtonGroup.objects.all()} @register.inclusion_tag('toolbar/button.html') def toolbar_button(b): diff --git a/apps/wiki/views.py b/apps/wiki/views.py index 339bde8c..33d6610b 100644 --- a/apps/wiki/views.py +++ b/apps/wiki/views.py @@ -1,5 +1,5 @@ from django.views.generic.simple import direct_to_template -from django.http import HttpResponseRedirect +from django.http import HttpResponse, HttpResponseRedirect from wiki.models import storage, Document, DocumentNotFound from wiki.forms import DocumentForm @@ -21,7 +21,9 @@ def document_detail(request, name, template_name='wiki/document_details.html'): form = DocumentForm(request.POST, instance=document) if form.is_valid(): form.save() - return HttpResponseRedirect('/') + return HttpResponse('OK') + else: + print form.errors else: form = DocumentForm(instance=document) diff --git a/platforma/static/js/button_scripts.js b/platforma/static/js/button_scripts.js index 4af9d72d..4f93d9bd 100755 --- a/platforma/static/js/button_scripts.js +++ b/platforma/static/js/button_scripts.js @@ -1,3 +1,32 @@ +(function() { + var slice = Array.prototype.slice; + + function update(array, args) { + var arrayLength = array.length, length = args.length; + while (length--) array[arrayLength + length] = args[length]; + return array; + }; + + function merge(array, args) { + array = slice.call(array, 0); + return update(array, args); + }; + + Function.prototype.bind = function(context) { + if (arguments.length < 2 && typeof arguments[0] === 'undefined') { + return this; + } + var __method = this; + var args = slice.call(arguments, 1); + return function() { + var a = merge(args, arguments); + return __method.apply(context, a); + } + } + +})(); + + function ScriptletCenter() { this.scriptlets = {}; @@ -198,19 +227,19 @@ function ScriptletCenter() } ScriptletCenter.prototype.XMLEditorSelectedText = function(panel) { - return panel.contentView.editor.selection(); + return panel.selection(); }; ScriptletCenter.prototype.XMLEditorReplaceSelectedText = function(panel, replacement) { - panel.contentView.editor.replaceSelection(replacement); + panel.replaceSelection(replacement); // Tell XML view that it's data has changed - panel.contentView.editorDataChanged(); + // panel.contentView.editorDataChanged(); }; ScriptletCenter.prototype.XMLEditorMoveCursorForward = function(panel, n) { - var pos = panel.contentView.editor.cursorPosition(); - panel.contentView.editor.selectLines(pos.line, pos.character + n); + var pos = panel.cursorPosition(); + panel.selectLines(pos.line, pos.character + n); }; var scriptletCenter; diff --git a/platforma/templates/wiki/document_details.html b/platforma/templates/wiki/document_details.html index e4c69eda..8a05589f 100644 --- a/platforma/templates/wiki/document_details.html +++ b/platforma/templates/wiki/document_details.html @@ -1,21 +1,27 @@ {% extends "base.html" %} +{% load toolbar_tags %} {% block extrahead %} + @@ -209,7 +241,7 @@ #sidebar { overflow: auto; - padding: 5px; +/* padding: 5px; */ } #header { @@ -262,11 +294,49 @@ } #tabs li.active { - background-color: #FFF; + background-color: #FEFCDF; background-image: none; /* background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0.25, #C1C1C1), to(#FFFFFF)); */ - border-bottom: 1px solid #FFF; + border-bottom: 1px solid #FEFCDF; } + + .toolbar { + border-bottom: 1px solid #777; + background-color: #FEFCDF; + margin: 0; + padding: 2px; + } + + .toolbar select { + float: left; + margin: 2px 5px 2px 0; + background: none; + border: 1px solid #999; + padding: 1px; + } + + .toolbar button { + display: block; + float: left; + margin: 4px 0 2px 0; + padding: 0 5px 2px 5px; + border: none; + background: none; + } + + .toolbar-end { + clear: both; + } + + .toolbar button:hover, .toolbar button:active { + background: #A2A2A2; + color: #FFF; + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + border-radius: 10px; + } + + p { margin: 0;} {% endblock %} @@ -284,6 +354,7 @@
+ {% toolbar %} {{ form.text }}