Cachet/app/assets/js/start.js
2014-12-30 13:57:38 +00:00

38 lines
1.0 KiB
JavaScript

$(function() {
$('.color-code').minicolors({
control: 'hue',
defaultValue: $(this).val() || '',
inline: false,
letterCase: 'lowercase',
opacity: false,
position: 'bottom left',
theme: 'bootstrap'
});
$('[data-toggle="tooltip"]').tooltip();
$('button.close').on('click', function() {
$(this).parents('div.alert').addClass('hide');
});
// Toggle inline component statuses.
$('form.component-inline').on('click', 'input[type=radio]', function() {
var $form = $(this).parents('form');
var formData = $form.serializeObject();
$.ajax({
async: true,
url: '/dashboard/api/components/' + formData['component_id'],
type: 'POST',
data: formData,
success: function(component) {
$('.alert').removeClass('hide');
},
error: function(a, b, c) {
alert('Something went wrong updating the component.');
}
});
});
});