--- a/mouchak/static/css/editor.css +++ b/mouchak/static/css/editor.css @@ -57,6 +57,9 @@ width: 500px; z-index: 100; margin: 5px auto; + position: absolute; + left: 33%; + top: 0px; } #code-edit { position: absolute; @@ -65,5 +68,13 @@ bottom: 0 ; left: 125px; width: 70%; +} +#editor-overlay { + position: absolute; + width: 100%; + height: 100%; + background-color: #FFFFFF; + opacity: 0.7; + display: none; } --- a/mouchak/static/js/editor.js +++ b/mouchak/static/js/editor.js @@ -59,6 +59,7 @@ //console.log('remove', id); M.pages.get(id).destroy({ success: function(model, response) { + M.editor.hideOverlay(); //console.log('deleted', model, response); M.pages.remove(id); M.pagelistview.render(); @@ -71,6 +72,7 @@ })); }, error: function(model, xhr) { + M.editor.hideOverlay(); console.log('failed', model, xhr); $('#notifications').html(fail_template({ title: 'Error', @@ -78,6 +80,7 @@ })); } }); + M.editor.showOverlay(); }, showMenu: function(event) { this.menuconfigview.render(); @@ -240,6 +243,7 @@ this.model.save({}, { success: function(model, response) { //console.log('saved', model, response); + M.editor.hideOverlay(); model.set(response.page); model.id = response.page.id; M.pagelistview.render(); @@ -249,6 +253,8 @@ })); }, error: function(model, xhr) { + M.editor.hideOverlay(); + model.set(response.page); console.log('failed', model, xhr); $('#notifications').html(fail_template({ title: 'Error!', @@ -256,6 +262,7 @@ })); } }); + M.editor.showOverlay(); return false; } }); @@ -455,6 +462,7 @@ this.model.save({}, { success: function(model, response) { //console.log(model, response); + M.editor.hideOverlay(); $('#notifications').html(success_template({ title: 'Saved', msg: '' @@ -462,6 +470,7 @@ }, error: function(xhr, response) { + M.editor.hideOverlay(); $('#notifications').html(fail_template({ title: 'Error!', msg: 'Something went wrong, and the page could not be updated' @@ -469,9 +478,11 @@ } }); //alert('end of save menu'); + M.editor.showOverlay(); } }); + M.editor = { init: function() { M.pages = new Pages(M.site_content.content); @@ -529,6 +540,12 @@ }, cleanUp: function(id) { } + }, + showOverlay: function() { + $('#editor-overlay').show(); + }, + hideOverlay: function() { + $('#editor-overlay').hide(); } }; --- a/mouchak/templates/editor.html +++ b/mouchak/templates/editor.html @@ -13,11 +13,10 @@
-
-
- +
+ +