From: zuber Date: Tue, 26 Jan 2010 21:15:05 +0000 (+0100) Subject: Dodanie planszy ładowania do document_details.html. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/9e3b8dad3a369c212c5d7d3cc0af7fc4f3cf2b6c Dodanie planszy ładowania do document_details.html. --- diff --git a/platforma/static/css/master.css b/platforma/static/css/master.css index 5c5587d5..9d3efeca 100755 --- a/platforma/static/css/master.css +++ b/platforma/static/css/master.css @@ -3,6 +3,8 @@ body { overflow: hidden; padding: 0; min-width: 960px; + width: 100%; + height: 100%; } .vsplitbar { @@ -193,7 +195,7 @@ p { margin: 0;} overflow: hidden; } -img { +.gallery-image img { position: absolute; -moz-drag: none; user-select: none; @@ -201,4 +203,42 @@ img { -khtml-user-select: none; -moz-user-select: none; cursor: pointer; +} + + +#body-wrap { + height: 100%; + width: 100%; +} +#content { + height: 100%; + width: 100%; +} + +#loading-overlay { + background-color: #FFF; + position: absolute; + z-index: 1000; + padding: 0; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +#loading-message { + position: absolute; + height: 20px; + width: 120px; + left: 50%; + margin-left: -60px; + top: 50%; + margin-top: -10px; +/* text-align: center;*/ +} + +#loading-message img { + float: left; + margin-right: 10px; + margin-top: -6px; } \ No newline at end of file diff --git a/platforma/static/img/spinner.gif b/platforma/static/img/spinner.gif index f864d5fd..c69e9372 100644 Binary files a/platforma/static/img/spinner.gif and b/platforma/static/img/spinner.gif differ diff --git a/platforma/static/js/main.js b/platforma/static/js/main.js index edd82e35..22ec7332 100644 --- a/platforma/static/js/main.js +++ b/platforma/static/js/main.js @@ -287,41 +287,61 @@ function gallery(element, url) { } -function transform(editor) { - $.blockUI({message: 'Ładowanie...'}); +function transform(editor, callback) { + if (!callback) { + $.blockUI({message: 'Ładowanie...'}); + } setTimeout(function() { xml2html({ xml: editor.getCode(), success: function(element) { $('#html-view').html(element); $.unblockUI(); + if (callback) { + callback(); + } }, error: function(text) { $('#html-view').html('

Wystąpił błąd:

' + text + '
'); $.unblockUI(); + if (callback) { + callback(); + } } }); }, 200); }; -function reverseTransform(editor, cont) { +function reverseTransform(editor, cont, errorCont, dontBlock) { var serializer = new XMLSerializer(); if ($('#html-view .error').length > 0) { + if (errorCont) { + errorCont(); + } return; } - $.blockUI({message: 'Ładowanie...'}); + if (!dontBlock) { + $.blockUI({message: 'Ładowanie...'}); + } setTimeout(function() { html2xml({ xml: serializer.serializeToString($('#html-view div').get(0)), success: function(text) { editor.setCode(text); - $.unblockUI(); + if (!dontBlock) { + $.unblockUI(); + } if (cont) { cont(); } }, error: function(text) { $('#source-editor').html('

Wystąpił błąd:

' + text + '
'); - $.unblockUI(); + if (!dontBlock) { + $.unblockUI(); + } + if (errorCont) { + errorCont(); + } } }); }, 200); @@ -688,19 +708,20 @@ $(function() { $('#save-cancel').click(function() { $.unblockUI(); }); - - $('#simple-view-tab').click(function() { - if ($(this).hasClass('active')) { + + function changeTab(callback) { + if ($('#simple-view-tab').hasClass('active')) { return; } - $(this).addClass('active'); + $('#simple-view-tab').addClass('active'); $('#source-view-tab').removeClass('active'); $('#source-editor').hide(); $('#simple-editor').show(); - transform(editor); - }); - - $('#source-view-tab').click(function() { + transform(editor, callback); + } + $('#simple-view-tab').click(function() { changeTab(); }); + + $('#source-view-tab').click(function() { if ($(this).hasClass('active')) { return; } @@ -708,7 +729,7 @@ $(function() { $('#simple-view-tab').removeClass('active'); $('#simple-editor').hide(); $('#source-editor').show(); - reverseTransform(editor); + reverseTransform(editor); }); $('#source-editor .toolbar button').click(function(event) { @@ -727,7 +748,7 @@ $(function() { $('.toolbar-buttons-container').hide(); $('.toolbar select').change(); - $('#simple-view-tab').click(); + changeTab(function() { $('#loading-overlay').fadeOut() }, function() { $('#loading-overlay').fadeOut() }, true) } }); diff --git a/platforma/templates/wiki/document_details.html b/platforma/templates/wiki/document_details.html index 10a3af09..ad71c847 100644 --- a/platforma/templates/wiki/document_details.html +++ b/platforma/templates/wiki/document_details.html @@ -18,6 +18,9 @@ {% endblock %} {% block maincontent %} +
+

Ładowanie

+