2014-09-30 22:20:37 +00:00
|
|
|
$(document).ready(function(){
|
2014-11-21 18:40:00 +00:00
|
|
|
$('.enabler').each(function(){
|
2014-03-10 05:18:05 +00:00
|
|
|
if (!$(this).prop('checked'))
|
2014-11-21 18:40:00 +00:00
|
|
|
$('#content_' + $(this).attr('id')).hide();
|
2014-03-10 05:18:05 +00:00
|
|
|
});
|
|
|
|
|
2014-11-21 18:40:00 +00:00
|
|
|
$('.enabler').click(function(){
|
2014-03-10 05:18:05 +00:00
|
|
|
if ($(this).prop('checked'))
|
2014-11-21 18:40:00 +00:00
|
|
|
$('#content_' + $(this).attr('id')).fadeIn('fast', 'linear');
|
2014-03-10 05:18:05 +00:00
|
|
|
else
|
2014-11-21 18:40:00 +00:00
|
|
|
$('#content_' + $(this).attr('id')).fadeOut('fast', 'linear');
|
2014-06-03 17:43:37 +00:00
|
|
|
});
|
|
|
|
|
2014-11-21 18:40:00 +00:00
|
|
|
$('.viewIf').click(function(){
|
2014-06-03 17:43:37 +00:00
|
|
|
if ($(this).prop('checked')) {
|
2014-11-21 18:40:00 +00:00
|
|
|
$('.hide_if_' + $(this).attr('id')).css('display','none');
|
|
|
|
$('.show_if_' + $(this).attr('id')).fadeIn('fast', 'linear');
|
2014-06-03 17:43:37 +00:00
|
|
|
} else {
|
2014-11-21 18:40:00 +00:00
|
|
|
$('.show_if_' + $(this).attr('id')).css('display','none');
|
|
|
|
$('.hide_if_' + $(this).attr('id')).fadeIn('fast', 'linear');
|
2014-06-03 17:43:37 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-11-21 18:40:00 +00:00
|
|
|
$('.datePresets').click(function(){
|
2014-06-03 17:43:37 +00:00
|
|
|
var def = $('#date_presets').val()
|
|
|
|
if ($(this).prop('checked') && '%x' == def) {
|
|
|
|
def = '%a, %b %d, %Y'
|
|
|
|
$('#date_use_system_default').html('1')
|
|
|
|
} else if (!$(this).prop('checked') && '1' == $('#date_use_system_default').html())
|
|
|
|
def = '%x'
|
|
|
|
|
|
|
|
$('#date_presets').attr('name', 'date_preset_old')
|
|
|
|
$('#date_presets').attr('id', 'date_presets_old')
|
|
|
|
|
|
|
|
$('#date_presets_na').attr('name', 'date_preset')
|
|
|
|
$('#date_presets_na').attr('id', 'date_presets')
|
|
|
|
|
|
|
|
$('#date_presets_old').attr('name', 'date_preset_na')
|
|
|
|
$('#date_presets_old').attr('id', 'date_presets_na')
|
|
|
|
|
|
|
|
if (def)
|
|
|
|
$('#date_presets').val(def)
|
|
|
|
});
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2014-09-30 22:20:37 +00:00
|
|
|
// bind 'myForm' and provide a simple callback function
|
2014-03-10 05:18:05 +00:00
|
|
|
$('#configForm').ajaxForm({
|
2014-09-30 22:20:37 +00:00
|
|
|
beforeSubmit: function(){
|
|
|
|
$('.config_submitter').each(function(){
|
2014-11-21 18:40:00 +00:00
|
|
|
$(this).attr('disabled', 'disabled');
|
2014-10-24 13:16:46 +00:00
|
|
|
$(this).after('<span><img src="' + sbRoot + '/images/loading16' + themeSpinner + '.gif"> Saving...</span>');
|
2014-03-10 05:18:05 +00:00
|
|
|
$(this).hide();
|
|
|
|
});
|
|
|
|
},
|
2014-09-30 22:20:37 +00:00
|
|
|
success: function(){
|
2014-03-10 05:18:05 +00:00
|
|
|
setTimeout('config_success()', 2000)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-09-30 22:20:37 +00:00
|
|
|
$('#api_key').click(function(){ $('#api_key').select() });
|
|
|
|
$("#generate_new_apikey").click(function(){
|
2014-11-21 18:40:00 +00:00
|
|
|
$.get(sbRoot + '/config/general/generateKey',
|
2014-09-30 22:20:37 +00:00
|
|
|
function(data){
|
2014-03-10 05:18:05 +00:00
|
|
|
if (data.error != undefined) {
|
|
|
|
alert(data.error);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
$('#api_key').val(data);
|
2014-09-30 22:20:37 +00:00
|
|
|
});
|
2014-03-10 05:18:05 +00:00
|
|
|
});
|
|
|
|
|
2014-11-21 18:40:00 +00:00
|
|
|
$('#branchCheckout').click(function(){
|
|
|
|
url = sbRoot + '/home/branchCheckout?branch=' + $('#branchVersion').val();
|
2014-09-30 22:20:37 +00:00
|
|
|
window.location.href = url;
|
2014-07-27 22:20:17 +00:00
|
|
|
});
|
2014-09-30 22:20:37 +00:00
|
|
|
|
2014-03-10 05:18:05 +00:00
|
|
|
});
|
|
|
|
|
2014-09-30 22:20:37 +00:00
|
|
|
function config_success(){
|
|
|
|
$('.config_submitter').each(function(){
|
2014-11-21 18:40:00 +00:00
|
|
|
$(this).removeAttr('disabled');
|
2014-03-10 05:18:05 +00:00
|
|
|
$(this).next().remove();
|
|
|
|
$(this).show();
|
|
|
|
});
|
|
|
|
$('#email_show').trigger('notify');
|
|
|
|
}
|