2017-05-30 21:11:28 +08:00
|
|
|
(function() {
|
|
|
|
'use strict';
|
|
|
|
|
2017-06-14 15:11:20 +08:00
|
|
|
function loadRepositoryTab() {
|
|
|
|
var param, pane;
|
|
|
|
$('#repository-tabs a').on("click", function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
e.stopPropagation();
|
|
|
|
e.stopImmediatePropagation();
|
|
|
|
pane = $(this);
|
|
|
|
|
|
|
|
$.ajax({
|
2017-06-14 16:55:24 +08:00
|
|
|
url: pane.attr('data-url'),
|
2017-06-14 15:11:20 +08:00
|
|
|
type: 'GET',
|
|
|
|
dataType: 'json',
|
2017-06-14 16:55:24 +08:00
|
|
|
success: function(data) {
|
|
|
|
var tabBody = $(pane.context.hash).find('.tab-content-body');
|
2017-06-14 15:11:20 +08:00
|
|
|
tabBody.html(data.html);
|
|
|
|
pane.tab('show');
|
|
|
|
},
|
|
|
|
error: function (error) {
|
|
|
|
// TODO
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// on page load
|
|
|
|
if( param = getParam('repository') ){
|
|
|
|
// load selected tab
|
|
|
|
$('a[href="#custom_repo_' + param + '"]').click();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
// load first tab content
|
|
|
|
$('#repository-tabs a:first').click();
|
|
|
|
}
|
|
|
|
|
|
|
|
// clean tab content
|
|
|
|
$('a[data-toggle="tab"]').on('hide.bs.tab', function (e) {
|
|
|
|
$(".tab-content-body").html("");
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2017-06-14 16:55:24 +08:00
|
|
|
function showParsedRecords() {
|
|
|
|
$('#form-records-file').bind('ajax:success', function(evt, data, status, xhr) {
|
|
|
|
debugger;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-06-05 20:09:04 +08:00
|
|
|
$('.delete-repo-option').initializeModal('#delete-repo-modal');
|
|
|
|
$('.rename-repo-option').initializeModal('#rename-repo-modal');
|
2017-06-08 00:43:48 +08:00
|
|
|
$('.copy-repo-option').initializeModal('#copy-repo-modal');
|
2017-06-06 21:50:43 +08:00
|
|
|
$('.create-repository').initializeModal('#create-repo-modal');
|
2017-06-08 17:44:24 +08:00
|
|
|
|
2017-06-14 15:11:20 +08:00
|
|
|
$(document).ready(function() {
|
|
|
|
loadRepositoryTab();
|
2017-06-14 16:55:24 +08:00
|
|
|
showParsedRecords();
|
2017-06-08 17:44:24 +08:00
|
|
|
});
|
|
|
|
|
2017-06-14 15:11:20 +08:00
|
|
|
})();
|