rosa-build/app/assets/javascripts/application.js

84 lines
2.3 KiB
JavaScript
Raw Normal View History

//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require autocomplete-rails
//= require vendor
//= require jquery.dataTables_ext
//= require_tree ./design
//= require_tree ./extra
//= require_tree ./lib
//= require underscore
//= require backbone
//= require backbone_rails_sync
//= require backbone_datalink
//= require backbone/rosa
//= require_self
2012-03-03 16:03:23 +00:00
function disableNotifierCbx(global_cbx) {
if ($(global_cbx).attr('checked')) {
$('.notify_cbx').removeAttr('disabled');
$('.notify_cbx').each(function(i,el) { $(el).prev().removeAttr('disabled'); })
} else {
$('.notify_cbx').attr('disabled', 'disabled');
$('.notify_cbx').each(function(i,el) { $(el).prev().attr('disabled', 'disabled'); })
}
}
$(document).ready(function() {
// setup all placeholders on page
$('input[placeholder], textarea[placeholder]').placeholder();
2012-03-03 16:03:23 +00:00
$('input.user_role_chbx').click(function() {
var current = $(this);
current.parent().find('input.user_role_chbx').each(function(i,el) {
if ($(el).attr('id') != current.attr('id')) {
2012-08-29 15:58:58 +01:00
$(el).removeAttr('checked');
2012-03-03 16:03:23 +00:00
}
});
});
$('#settings_notifier_can_notify').click(function() {
disableNotifierCbx($(this));
});
$('div.information > div.profile > a').live('click', function(e) {
e.preventDefault();
});
2012-03-21 10:25:30 +00:00
$('.more_activities').live('click', function(){
var button = $(this);
$.ajax({
type: 'GET',
url: button.attr("href"),
success: function(data){
button.fadeOut('slow').after(data);
button.remove();
}
});
return false;
});
2013-02-12 16:35:14 +00:00
$('#description-top .git_help').click(function() {
$('#git_help_data').toggle();
});
$(".toggle_btn").click(function() {
var target = $( $(this).attr('data-target') );
//target.toggle();
if ( target.css('visibility') == 'hidden' ) {
target.css('visibility', 'visible');
} else {
target.css('visibility', 'hidden');
}
return false;
});
2012-08-29 15:58:58 +01:00
2012-09-21 11:31:55 +01:00
window.CodeMirrorRun = function(code) {
CodeMirror.runMode(code.innerHTML.replace(/&amp;/gi, '&').replace(/&lt;/gi, '<').replace(/&gt;/gi, '>'), code.className, code);
}
$('.md_and_cm code').each(function (code) { CodeMirrorRun(this); });
2012-03-03 16:03:23 +00:00
});