Commit 77b14a4d32a9498fa61f7ede8196b03e8971c7df
- Diff rendering mode:
- inline
- side by side
mouchak/static/css/editor.css
(11 / 0)
  | |||
57 | 57 | width: 500px; | |
58 | 58 | z-index: 100; | |
59 | 59 | margin: 5px auto; | |
60 | position: absolute; | ||
61 | left: 33%; | ||
62 | top: 0px; | ||
60 | 63 | } | |
61 | 64 | #code-edit { | |
62 | 65 | position: absolute; | |
… | … | ||
68 | 68 | bottom: 0 ; | |
69 | 69 | left: 125px; | |
70 | 70 | width: 70%; | |
71 | } | ||
72 | #editor-overlay { | ||
73 | position: absolute; | ||
74 | width: 100%; | ||
75 | height: 100%; | ||
76 | background-color: #FFFFFF; | ||
77 | opacity: 0.7; | ||
78 | display: none; | ||
71 | 79 | } |
mouchak/static/js/editor.js
(17 / 0)
  | |||
59 | 59 | //console.log('remove', id); | |
60 | 60 | M.pages.get(id).destroy({ | |
61 | 61 | success: function(model, response) { | |
62 | M.editor.hideOverlay(); | ||
62 | 63 | //console.log('deleted', model, response); | |
63 | 64 | M.pages.remove(id); | |
64 | 65 | M.pagelistview.render(); | |
… | … | ||
72 | 72 | })); | |
73 | 73 | }, | |
74 | 74 | error: function(model, xhr) { | |
75 | M.editor.hideOverlay(); | ||
75 | 76 | console.log('failed', model, xhr); | |
76 | 77 | $('#notifications').html(fail_template({ | |
77 | 78 | title: 'Error', | |
… | … | ||
80 | 80 | })); | |
81 | 81 | } | |
82 | 82 | }); | |
83 | M.editor.showOverlay(); | ||
83 | 84 | }, | |
84 | 85 | showMenu: function(event) { | |
85 | 86 | this.menuconfigview.render(); | |
… | … | ||
243 | 243 | this.model.save({}, { | |
244 | 244 | success: function(model, response) { | |
245 | 245 | //console.log('saved', model, response); | |
246 | M.editor.hideOverlay(); | ||
246 | 247 | model.set(response.page); | |
247 | 248 | model.id = response.page.id; | |
248 | 249 | M.pagelistview.render(); | |
… | … | ||
253 | 253 | })); | |
254 | 254 | }, | |
255 | 255 | error: function(model, xhr) { | |
256 | M.editor.hideOverlay(); | ||
257 | model.set(response.page); | ||
256 | 258 | console.log('failed', model, xhr); | |
257 | 259 | $('#notifications').html(fail_template({ | |
258 | 260 | title: 'Error!', | |
… | … | ||
262 | 262 | })); | |
263 | 263 | } | |
264 | 264 | }); | |
265 | M.editor.showOverlay(); | ||
265 | 266 | return false; | |
266 | 267 | } | |
267 | 268 | }); | |
… | … | ||
462 | 462 | this.model.save({}, { | |
463 | 463 | success: function(model, response) { | |
464 | 464 | //console.log(model, response); | |
465 | M.editor.hideOverlay(); | ||
465 | 466 | $('#notifications').html(success_template({ | |
466 | 467 | title: 'Saved', | |
467 | 468 | msg: '' | |
… | … | ||
470 | 470 | ||
471 | 471 | }, | |
472 | 472 | error: function(xhr, response) { | |
473 | M.editor.hideOverlay(); | ||
473 | 474 | $('#notifications').html(fail_template({ | |
474 | 475 | title: 'Error!', | |
475 | 476 | msg: 'Something went wrong, and the page could not be updated' | |
… | … | ||
478 | 478 | } | |
479 | 479 | }); | |
480 | 480 | //alert('end of save menu'); | |
481 | M.editor.showOverlay(); | ||
481 | 482 | } | |
482 | 483 | }); | |
483 | 484 | ||
485 | |||
484 | 486 | M.editor = { | |
485 | 487 | init: function() { | |
486 | 488 | M.pages = new Pages(M.site_content.content); | |
… | … | ||
540 | 540 | }, | |
541 | 541 | cleanUp: function(id) { | |
542 | 542 | } | |
543 | }, | ||
544 | showOverlay: function() { | ||
545 | $('#editor-overlay').show(); | ||
546 | }, | ||
547 | hideOverlay: function() { | ||
548 | $('#editor-overlay').hide(); | ||
543 | 549 | } | |
544 | 550 | }; | |
545 | 551 |
  | |||
13 | 13 | </div> | |
14 | 14 | <div id="notifications"></div> | |
15 | 15 | </div> | |
16 | <div id="content-container"> | ||
17 | </div> | ||
18 | <div id="footer"> | ||
19 | </div> | ||
16 | <div id="content-container"></div> | ||
17 | <div id="footer"></div> | ||
20 | 18 | </div> | |
19 | <div id="editor-overlay"></div> | ||
21 | 20 | ||
22 | 21 | <script> | |
23 | 22 | // initialize editor |