summaryrefslogtreecommitdiff
path: root/public/js
diff options
context:
space:
mode:
authorCheng-Han, Wu2016-05-15 13:01:41 +0800
committerCheng-Han, Wu2016-05-15 13:01:41 +0800
commit9e75c5cdf4098f57ea9146bc10306759a6c274f9 (patch)
tree1d8ccdece14b024061fb0e012705f56404291bac /public/js
parentaa34faf8abeaeb9ef29bf02e58792be4e87a635e (diff)
Fix export snippet should check data before sending request and fix some code styles
Diffstat (limited to 'public/js')
-rw-r--r--public/js/index.js12
1 files changed, 5 insertions, 7 deletions
diff --git a/public/js/index.js b/public/js/index.js
index d034b4e8..6163d293 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -1202,7 +1202,7 @@ ui.toolbar.export.snippet.click(function() {
}
$('<option>').val(project.id).text(project.path_with_namespace).appendTo("#snippetExportModalProjects");
});
- $("#snippetExportModalProjects").prop('disabled',false);
+ $("#snippetExportModalProjects").prop('disabled', false);
}
$("#snippetExportModalLoading").hide();
})
@@ -1212,7 +1212,6 @@ ui.toolbar.export.snippet.click(function() {
.complete(function () {
ui.spinner.hide();
});
- return false;
});
//import from dropbox
ui.toolbar.import.dropbox.click(function () {
@@ -1291,7 +1290,7 @@ ui.toolbar.import.snippet.click(function () {
}
$('<option>').val(project.id).text(project.path_with_namespace).appendTo("#snippetImportModalProjects");
});
- $("#snippetImportModalProjects").prop('disabled',false);
+ $("#snippetImportModalProjects").prop('disabled', false);
}
$("#snippetImportModalLoading").hide();
})
@@ -1301,7 +1300,6 @@ ui.toolbar.import.snippet.click(function () {
.complete(function () {
ui.spinner.hide();
});
- return false;
});
//import from clipboard
ui.toolbar.import.clipboard.click(function () {
@@ -1340,7 +1338,7 @@ ui.modal.snippetImportProjects.change(function() {
$('<option>').val(snippet.id).text(snippet.title).appendTo($("#snippetImportModalSnippets"));
});
$("#snippetImportModalLoading").hide();
- $("#snippetImportModalSnippets").prop('disabled',false);
+ $("#snippetImportModalSnippets").prop('disabled', false);
})
.error(function(err) {
@@ -1508,7 +1506,7 @@ $("#snippetImportModalClear").click(function () {
$("#snippetImportModalContent").val('');
$("#snippetImportModalProjects").val('init');
$("#snippetImportModalSnippets").val('init');
- $("#snippetImportModalSnippets").prop('disabled',true);
+ $("#snippetImportModalSnippets").prop('disabled', true);
});
$("#snippetImportModalConfirm").click(function () {
var snippeturl = $("#snippetImportModalContent").val();
@@ -1563,7 +1561,7 @@ $("#snippetExportModalConfirm").click(function() {
code: editor.getValue(),
visibility_level: $("#snippetExportModalVisibility").val()
};
-
+ if (!data.title || !data.file_name || !data.code || !data.visibility_level || !$("#snippetExportModalProjects").val()) return;
$("#snippetExportModalLoading").show();
var fullURL = baseURL + '/api/v3/projects/' + $("#snippetExportModalProjects").val() + '/snippets?access_token=' + accesstoken;
$.post(fullURL