Revision 2663:8dd9be9b33c1,
1.0 KB
checked in by franck <carnet.franck.paul@…>, 11 years ago
(diff) |
Add reset button in theme editor (available only on template file and if there is a model, from parent or from template set), addresses #1703
|
Line | |
---|
1 | $(function() { |
---|
2 | // Cope with saving |
---|
3 | var msg = false; |
---|
4 | $('#file-form input[name="write"]').click(function() { |
---|
5 | var f = this.form; |
---|
6 | |
---|
7 | var data = { |
---|
8 | file_content: (!dotclear.colorsyntax ? $(f).find('#file_content').get(0).value : editor.getValue()), |
---|
9 | xd_check: $(f).find('input[name="xd_check"]').get(0).value, |
---|
10 | write: 1 |
---|
11 | }; |
---|
12 | |
---|
13 | if (msg == false) { |
---|
14 | msg = $('<p style="font-weight:bold; color:red;"></p>'); |
---|
15 | $('#file_content').parent().after(msg); |
---|
16 | } |
---|
17 | |
---|
18 | msg.text(dotclear.msg.saving_document); |
---|
19 | |
---|
20 | $.post(document.location.href,data,function(res,status) { |
---|
21 | var err = $(res).find('div.error li:first'); |
---|
22 | if (err.length > 0) { |
---|
23 | msg.text(dotclear.msg.error_occurred + ' ' + err.text()); |
---|
24 | return; |
---|
25 | } else { |
---|
26 | msg.text(dotclear.msg.document_saved); |
---|
27 | $('#file-chooser').empty(); |
---|
28 | $(res).find('#file-chooser').children().appendTo('#file-chooser'); |
---|
29 | } |
---|
30 | }); |
---|
31 | |
---|
32 | return false; |
---|
33 | }); |
---|
34 | |
---|
35 | // Confirm for deleting current file |
---|
36 | $('#file-form input[name="delete"]').click(function() { |
---|
37 | return window.confirm(dotclear.msg.confirm_reset_file); |
---|
38 | }); |
---|
39 | |
---|
40 | }); |
---|
Note: See
TracBrowser
for help on using the repository browser.