From 47ce1394042e8faf057124b47b777e92b8181ae9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Rekucki?= Date: Wed, 2 Sep 2009 10:18:24 +0200 Subject: [PATCH] =?utf8?q?Wy=C5=9Bwietlanie=20informacji=20o=20b=C5=82?= =?utf8?q?=C4=99dach=20w=20XML=20i=20DC.=20Closes=20#9.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- apps/explorer/views.py | 23 +++++------------------ project/static/css/master.css | 4 ++++ project/static/js/editor.js | 6 +++--- project/templates/explorer/editor.html | 6 +++--- 4 files changed, 15 insertions(+), 24 deletions(-) diff --git a/apps/explorer/views.py b/apps/explorer/views.py index d4d0f6dc..f0f45700 100644 --- a/apps/explorer/views.py +++ b/apps/explorer/views.py @@ -129,25 +129,12 @@ def file_dc(request, path, repo): file_contents = repo._get_file(path) # wczytaj dokument z repozytorium - document = parser.WLDocument.from_string(file_contents) - - rdf_ns = dcparser.BookInfo.RDF - dc_ns = dcparser.BookInfo.DC - - rdf_attrs = {rdf_ns('about'): form.cleaned_data.pop('about')} - field_dict = {} - - for key, value in form.cleaned_data.items(): - field_dict[ dc_ns(key) ] = value if isinstance(value, list) else [value] - - print field_dict - - new_info = dcparser.BookInfo(rdf_attrs, field_dict) - document.book_info = new_info - + document = parser.WLDocument.from_string(file_contents) + document.book_info.update(form.cleaned_data) + print "SAVING DC" - # zapisz + # zapisz repo._add_file(path, document.serialize()) repo._commit( \ message=(form.cleaned_data['commit_message'] or 'Lokalny zapis platformy.'), \ @@ -159,7 +146,7 @@ def file_dc(request, path, repo): errors = [e.message] if errors is None: - errors = dict( (field[0], field[1].as_text()) for field in form.errors.iteritems() ) + errors = ["Pole '%s': %s\n" % (field[0], field[1].as_text()) for field in form.errors.iteritems()] return HttpResponse( json.dumps({'result': errors and 'error' or 'ok', 'errors': errors}) ); diff --git a/project/static/css/master.css b/project/static/css/master.css index 841467e4..7e399428 100644 --- a/project/static/css/master.css +++ b/project/static/css/master.css @@ -371,6 +371,10 @@ div.isection p { width: 100%; } +#message-box * p { + padding: 0em; + margin: 0.1em; +} .msg-error { background-color: red; diff --git a/project/static/js/editor.js b/project/static/js/editor.js index 0a56c5ab..f6556578 100644 --- a/project/static/js/editor.js +++ b/project/static/js/editor.js @@ -320,7 +320,7 @@ Editor.prototype.showPopup = function(name, text) return; var box = $('#message-box > #' + name); - $('span.data', box).html(text); + $('*.data', box).html(text); box.fadeIn(); self._nextPopup = function() { @@ -329,11 +329,11 @@ Editor.prototype.showPopup = function(name, text) var box = $('#message-box > #' + elem[0]); box.fadeOut(300, function() { - $('span.data', box).html(); + $('*.data', box).html(); if( self.popupQueue.length > 0) { box = $('#message-box > #' + self.popupQueue[0][0]); - $('span.data', box).html(self.popupQueue[0][1]); + $('*.data', box).html(self.popupQueue[0][1]); box.fadeIn(); setTimeout(self._nextPopup, 5000); } diff --git a/project/templates/explorer/editor.html b/project/templates/explorer/editor.html index ae4be00a..68c8c7fc 100644 --- a/project/templates/explorer/editor.html +++ b/project/templates/explorer/editor.html @@ -19,9 +19,9 @@ {% endblock %} {% block message-box %} -
Zapisano :)
-
Błąd przy zapisie.
-
Tej funkcji jeszcze nie ma :(
+

Zapisano :)

+

Błąd przy zapisie.

+

Tej funkcji jeszcze nie ma :(

{% endblock %} {% block maincontent %} -- 2.20.1