Show More
Commit Description:
wip
Commit Description:
wip
File last commit:
Show/Diff file:
Action:
app/javascript/custom.js | 51 lines | 1.3 KiB | application/javascript | JavascriptLexer |
$(document).on('change', '.btn-file :file', function() {
var input, label, numFiles;
input = $(this);
numFiles = input.get(0).files ? input.get(0).files.length : 1;
label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
input.trigger('fileselect', [numFiles, label]);
});
$(function() {
var e;
$(".select2").select2({});
$('.btn-file :file').on('fileselect', function(event, numFiles, label) {
var input, log;
input = $(this).parents('.input-group').find(':text');
log = numFiles > 1 ? numFiles + ' files selected' : label;
if (input.length) {
input.val(log);
} else {
if (log) {
alert(log);
}
}
});
$(".go-button").on('click', function(event) {
var link, url;
link = $(this).attr("data-source");
url = $(link).val();
if (url) {
window.location.href = url;
}
});
$('.ajax-toggle').on('click', function(event) {
var target;
target = $(event.target);
target.removeClass('btn-default');
target.removeClass('btn-success');
target.addClass('btn-warning');
target.text('...');
});
if ($("#editor").length > 0) {
e = ace.edit("editor");
e.setTheme('ace/theme/merbivore');
e.getSession().setTabSize(2);
e.getSession().setUseSoftTabs(true);
}
//jQuery(".best_in_place").best_in_place();
});
// ---
// generated by coffee-script 1.9.2