From 33bd7ddbe67e3ddc5c4b6422ec641b5093b7fd5c Mon Sep 17 00:00:00 2001 From: zuber Date: Mon, 30 Nov 2009 18:00:37 +0100 Subject: [PATCH] CodeMirror i splitter w widoku edycji. --- platforma/static/img/gallery.png | Bin 0 -> 840 bytes platforma/static/js/lib/jquery.splitter.js | 213 ++++++++++++++++++ platforma/templates/base.html | 20 +- .../templates/wiki/document_details.html | 110 ++++++++- 4 files changed, 329 insertions(+), 14 deletions(-) create mode 100644 platforma/static/img/gallery.png create mode 100755 platforma/static/js/lib/jquery.splitter.js diff --git a/platforma/static/img/gallery.png b/platforma/static/img/gallery.png new file mode 100644 index 0000000000000000000000000000000000000000..0b843290cb13dce260864e55045385030891ce6c GIT binary patch literal 840 zcmV-O1GoH%P)@3qf8H_YX7L8%soVJ*6`ib6sJ70>}U(R^|`t?WZ^16+X*FaZytOByG{Sqi6M z5R_Lxj6hpzpEi{$rwv zixKrg7Bulb9CBl6vF{_=1Xp21@zBk{E7mycYIGCY%z8LhOsp})Cn~XZuug$et*kU` zk@#+q*F0#p0a@h=^>D<+qYa+M`3)-dbJz;6B406NGC|M)5?+8-xC1KxBj^BKtR@q; z<7DMTfsOcDrom!nm2*9O18c+TAoyYdv+)KkP|WI_)vC1XsctY|*7IGMC+TJe2f*#P zm{r~?w<@?2iZ;XpWmS-rq;m(ohb14YANjf`ou03%;^qRKMhz?kYbrvQIli6I(fvQM z6(z%l4@dcJ!8Uq+ydRzOZnzc+3mQ&iSy|_7E0o+I>F7!OuP+8e-~;L@K#QQNkx4}5fu^jK> zWMLQ7!YtSfs^CYsq(w|D!DUd1m8+^I`vcBGmBfjnkehN{3(fEzUL*RBb?qPIZzjF( SnC@c$0000*", splitter[0]).css({ + position: "absolute", // positioned inside splitter container + "z-index": "1", // splitbar is positioned above + "-moz-outline-style": "none" // don't show dotted outline + }); + var A = $(panes[0]); // left or top + var B = $(panes[1]); // right or bottom + + // Focuser element, provides keyboard support; title is shown by Opera accessKeys + var focuser = $('') + .attr({accessKey: opts.accessKey, tabIndex: opts.tabIndex, title: opts.splitbarClass}) + .bind($.browser.opera?"click":"focus", function(){ this.focus(); bar.addClass(opts.activeClass) }) + .bind("keydown", function(e){ + var key = e.which || e.keyCode; + var dir = key==opts["key"+opts.side1]? 1 : key==opts["key"+opts.side2]? -1 : 0; + if ( dir ) + resplit(A[0][opts.pxSplit]+dir*opts.pxPerKey, false); + }) + .bind("blur", function(){ bar.removeClass(opts.activeClass) }); + + // Splitbar element, can be already in the doc or we create one + var bar = $(panes[2] || '
') + .insertAfter(A).css("z-index", "100").append(focuser) + .attr({"class": opts.splitbarClass, unselectable: "on"}) + .css({position: "absolute", "user-select": "none", "-webkit-user-select": "none", + "-khtml-user-select": "none", "-moz-user-select": "none"}) + .bind("mousedown", startSplitMouse); + // Use our cursor unless the style specifies a non-default cursor + if ( /^(auto|default|)$/.test(bar.css("cursor")) ) + bar.css("cursor", opts.cursor); + + // Cache several dimensions for speed, rather than re-querying constantly + bar._DA = bar[0][opts.pxSplit]; + splitter._PBF = $.boxModel? dimSum(splitter, "border"+opts.side3+"Width", "border"+opts.side4+"Width") : 0; + splitter._PBA = $.boxModel? dimSum(splitter, "border"+opts.side1+"Width", "border"+opts.side2+"Width") : 0; + A._pane = opts.side1; + B._pane = opts.side2; + $.each([A,B], function(){ + this._min = opts["min"+this._pane] || dimSum(this, "min-"+opts.split); + this._max = opts["max"+this._pane] || dimSum(this, "max-"+opts.split) || 9999; + this._init = opts["size"+this._pane]===true ? + parseInt($.curCSS(this[0],opts.split)) : opts["size"+this._pane]; + }); + + // Determine initial position, get from cookie if specified + var initPos = A._init; + if ( !isNaN(B._init) ) // recalc initial B size as an offset from the top or left side + initPos = splitter[0][opts.pxSplit] - splitter._PBA - B._init - bar._DA; + if ( opts.cookie ) { + if ( !$.cookie ) + alert('jQuery.splitter(): jQuery cookie plugin required'); + var ckpos = parseInt($.cookie(opts.cookie)); + if ( !isNaN(ckpos) ) + initPos = ckpos; + $(window).bind("unload", function(){ + var state = String(bar.css(opts.origin)); // current location of splitbar + $.cookie(opts.cookie, state, {expires: opts.cookieExpires || 365, + path: opts.cookiePath || document.location.pathname}); + }); + } + if ( isNaN(initPos) ) // King Solomon's algorithm + initPos = Math.round((splitter[0][opts.pxSplit] - splitter._PBA - bar._DA)/2); + + // Resize event propagation and splitter sizing + if ( opts.anchorToWindow ) { + // Account for margin or border on the splitter container and enforce min height + splitter._hadjust = dimSum(splitter, "borderTopWidth", "borderBottomWidth", "marginBottom"); + splitter._hmin = Math.max(dimSum(splitter, "minHeight"), 20); + $(window).bind("resize", function(){ + var top = splitter.offset().top; + var wh = $(window).height(); + splitter.css("height", Math.max(wh-top-splitter._hadjust, splitter._hmin)+"px"); + if ( !$.browser.msie ) splitter.trigger("resize"); + }).trigger("resize"); + } + else if ( opts.resizeToWidth && !$.browser.msie ) + $(window).bind("resize", function(){ + splitter.trigger("resize"); + }); + + // Resize event handler; triggered immediately to set initial position + splitter.bind("resize", function(e, size){ + // Custom events bubble in jQuery 1.3; don't Yo Dawg + if ( e.target != this ) return; + // Determine new width/height of splitter container + splitter._DF = splitter[0][opts.pxFixed] - splitter._PBF; + splitter._DA = splitter[0][opts.pxSplit] - splitter._PBA; + // Bail if splitter isn't visible or content isn't there yet + if ( splitter._DF <= 0 || splitter._DA <= 0 ) return; + // Re-divvy the adjustable dimension; maintain size of the preferred pane + resplit(!isNaN(size)? size : (!(opts.sizeRight||opts.sizeBottom)? A[0][opts.pxSplit] : + splitter._DA-B[0][opts.pxSplit]-bar._DA)); + }).trigger("resize" , [initPos]); + }); +}; + +})(jQuery); \ No newline at end of file diff --git a/platforma/templates/base.html b/platforma/templates/base.html index 5abf44bc..57d8f985 100755 --- a/platforma/templates/base.html +++ b/platforma/templates/base.html @@ -4,8 +4,8 @@ {% block title %}Platforma Redakcyjna{% block subtitle %}{% endblock subtitle %}{% endblock title%} - - + {# #} + {# #} {% block extrahead %} @@ -13,14 +13,14 @@
- + {# #}
{% block maincontent %} {% endblock %}
{% block extrabody %}{% endblock %} diff --git a/platforma/templates/wiki/document_details.html b/platforma/templates/wiki/document_details.html index 7a2aa4bb..ebb7242e 100644 --- a/platforma/templates/wiki/document_details.html +++ b/platforma/templates/wiki/document_details.html @@ -2,6 +2,7 @@ {% block extrahead %} + + + {% endblock %} {% block maincontent %} -
- {{ form.as_p }} -

-
+ +
+
+
+ {{ form.text }} + {# #} + {#

Autor: {{ form.author }}

#} + {#

Komentarz: {{ form.comment }}

#} + {#

#} +
+
+ + +
{% endblock %} \ No newline at end of file -- 2.20.1