Fix export snippet should check data before sending request and fix some code styles
This commit is contained in:
parent
aa34faf8ab
commit
9e75c5cdf4
3 changed files with 11 additions and 13 deletions
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue