diff options
author | Cheng-Han, Wu | 2016-05-15 13:01:41 +0800 |
---|---|---|
committer | Cheng-Han, Wu | 2016-05-15 13:01:41 +0800 |
commit | 9e75c5cdf4098f57ea9146bc10306759a6c274f9 (patch) | |
tree | 1d8ccdece14b024061fb0e012705f56404291bac | |
parent | aa34faf8abeaeb9ef29bf02e58792be4e87a635e (diff) |
Fix export snippet should check data before sending request and fix some code styles
Diffstat (limited to '')
-rw-r--r-- | public/js/index.js | 12 | ||||
-rw-r--r-- | public/views/body.ejs | 4 | ||||
-rw-r--r-- | public/views/header.ejs | 8 |
3 files changed, 11 insertions, 13 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 diff --git a/public/views/body.ejs b/public/views/body.ejs index 5e183dc3..62493e44 100644 --- a/public/views/body.ejs +++ b/public/views/body.ejs @@ -181,7 +181,7 @@ <input type="url" class="form-control" placeholder="/projects/:id/snippets/:snippet_id" id="snippetImportModalContent" disabled="disabled"> </div> <div class="modal-footer"> - <span id="snippetImportModalLoading"><i class="fa fa-refresh fa-spin"></i></span> + <span id="snippetImportModalLoading"><i class="fa fa-refresh fa-spin fa-fw"></i></span> <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> <button type="button" class="btn btn-danger" id="snippetImportModalClear">Clear</button> <button type="button" class="btn btn-primary" id="snippetImportModalConfirm" disabled="disabled">Import</button> @@ -227,7 +227,7 @@ </div> </div> <div class="modal-footer"> - <span id="snippetExportModalLoading"><i class="fa fa-refresh fa-spin"></i></span> + <span id="snippetExportModalLoading"><i class="fa fa-refresh fa-spin fa-fw"></i></span> <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> <button type="button" class="btn btn-primary" id="snippetExportModalConfirm">Export</button> </div> diff --git a/public/views/header.ejs b/public/views/header.ejs index 8610b861..75199cc3 100644 --- a/public/views/header.ejs +++ b/public/views/header.ejs @@ -43,7 +43,7 @@ </li> <% } %> <% if(typeof gitlab !== 'undefined' && gitlab) { %> - <li role="presentation"><a role="menuitem" class="ui-save-snippet" href="#" data-toggle="modal" data-target="#snippetExportModal"><i class="fa fa-gitlab fa-fw"></i> Snippet</a> + <li role="presentation"><a role="menuitem" class="ui-save-snippet" href="#"><i class="fa fa-gitlab fa-fw"></i> Snippet</a> </li> <% } %> <li class="divider"></li> @@ -55,7 +55,7 @@ <li role="presentation"><a role="menuitem" class="ui-import-gist" href="#" data-toggle="modal" data-target="#gistImportModal"><i class="fa fa-github fa-fw"></i> Gist</a> </li> <% if(typeof gitlab !== 'undefined' && gitlab) { %> - <li role="presentation"><a role="menuitem" class="ui-import-snippet" href="#" data-toggle="modal" data-target="#snippetImportModal"><i class="fa fa-gitlab fa-fw"></i> Snippet</a> + <li role="presentation"><a role="menuitem" class="ui-import-snippet" href="#"><i class="fa fa-gitlab fa-fw"></i> Snippet</a> </li> <% } %> <li role="presentation"><a role="menuitem" class="ui-import-clipboard" href="#" data-toggle="modal" data-target="#clipboardModal"><i class="fa fa-clipboard fa-fw"></i> Clipboard</a> @@ -136,7 +136,7 @@ </li> <% } %> <% if(typeof gitlab !== 'undefined' && gitlab) { %> - <li role="presentation"><a role="menuitem" class="ui-save-snippet" href="#" data-toggle="modal" data-target="#snippetExportModal"><i class="fa fa-gitlab fa-fw"></i> Snippet</a> + <li role="presentation"><a role="menuitem" class="ui-save-snippet" href="#"><i class="fa fa-gitlab fa-fw"></i> Snippet</a> </li> <% } %> <li class="divider"></li> @@ -148,7 +148,7 @@ <li role="presentation"><a role="menuitem" class="ui-import-gist" href="#" data-toggle="modal" data-target="#gistImportModal"><i class="fa fa-github fa-fw"></i> Gist</a> </li> <% if(typeof gitlab !== 'undefined' && gitlab) { %> - <li role="presentation"><a role="menuitem" class="ui-import-snippet" href="#" data-toggle="modal" data-target="#snippetImportModal"><i class="fa fa-gitlab fa-fw"></i> Snippet</a> + <li role="presentation"><a role="menuitem" class="ui-import-snippet" href="#"><i class="fa fa-gitlab fa-fw"></i> Snippet</a> </li> <% } %> <li role="presentation"><a role="menuitem" class="ui-import-clipboard" href="#" data-toggle="modal" data-target="#clipboardModal"><i class="fa fa-clipboard fa-fw"></i> Clipboard</a> |