|
@@ -119,9 +119,9 @@ $(document).ready(function() {
|
|
|
if(this.activeTab) {
|
|
if(this.activeTab) {
|
|
|
this.activeTab.removeClass('bold');
|
|
this.activeTab.removeClass('bold');
|
|
|
}
|
|
}
|
|
|
- console.log('set active tab', idx, this.file);
|
|
|
|
|
var idx = this.fileIdx = _ws.files.indexOf(this.file);
|
|
var idx = this.fileIdx = _ws.files.indexOf(this.file);
|
|
|
this.activeTab = this.$elem.find('li:eq(' + idx + ')');
|
|
this.activeTab = this.$elem.find('li:eq(' + idx + ')');
|
|
|
|
|
+ console.log('set active tab', idx, this.file, this.activeTab);
|
|
|
this.activeTab.addClass('bold');
|
|
this.activeTab.addClass('bold');
|
|
|
},
|
|
},
|
|
|
getActiveTab: function() {
|
|
getActiveTab: function() {
|
|
@@ -204,15 +204,21 @@ $(document).ready(function() {
|
|
|
|
|
|
|
|
function onSaveChanges() {
|
|
function onSaveChanges() {
|
|
|
console.log('Saving', this.file, editorSession.getValue())
|
|
console.log('Saving', this.file, editorSession.getValue())
|
|
|
|
|
+ var filename = this.file.name;
|
|
|
|
|
+ var payload = {
|
|
|
|
|
+ content: editorSession.getValue()
|
|
|
|
|
+ };
|
|
|
|
|
+ rp.put('/' + _ws.repo.path + '/examples/' + _ws.example.slug + '/files/' + filename, payload)
|
|
|
// var payload = editorStorage.getSources();
|
|
// var payload = editorStorage.getSources();
|
|
|
// rp.put('/examples/' + currentHash, payload)
|
|
// rp.put('/examples/' + currentHash, payload)
|
|
|
- // .then(function(newExample) {
|
|
|
|
|
- // notify('success', "Exemple sauvegardé !");
|
|
|
|
|
- // loadExample(currentHash);
|
|
|
|
|
- // })
|
|
|
|
|
- // .catch(function(err) {
|
|
|
|
|
- // notify('error', 'Erreur: ' + jqXHR.responseText);
|
|
|
|
|
- // });
|
|
|
|
|
|
|
+ .then(function(updatedFile) {
|
|
|
|
|
+ console.log(updatedFile);
|
|
|
|
|
+ _ws.notify('success', "Fichier " + filename + " sauvegardé !");
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(function(err) {
|
|
|
|
|
+ console.error(err);
|
|
|
|
|
+ _ws.notify('error', 'Erreur: ' + err.message);
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// $fileSelect.change(function() {
|
|
// $fileSelect.change(function() {
|