Created
May 5, 2014 17:47
-
-
Save cthrax/11543019 to your computer and use it in GitHub Desktop.
Quick demo of using angular module.run.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module("smartadmin.init.activity", []) | |
.run(function() { | |
// ACTIVITY | |
// ajax drop | |
$('#activity').click(function(e) { | |
var $this = $(this); | |
if ($this.find('.badge').hasClass('bg-color-red')) { | |
$this.find('.badge').removeClassPrefix('bg-color-'); | |
$this.find('.badge').text("0"); | |
// console.log("Ajax call for activity") | |
} | |
if (!$this.next('.ajax-dropdown').is(':visible')) { | |
$this.next('.ajax-dropdown').fadeIn(150); | |
$this.addClass('active'); | |
} else { | |
$this.next('.ajax-dropdown').fadeOut(150); | |
$this.removeClass('active') | |
} | |
var mytest = $this.next('.ajax-dropdown').find('.btn-group > .active > input').attr('id'); | |
//console.log(mytest) | |
e.preventDefault(); | |
}); | |
$('input[name="activity"]').change(function() { | |
//alert($(this).val()) | |
var $this = $(this); | |
url = $this.attr('id'); | |
container = $('.ajax-notifications'); | |
loadURL(url, container); | |
}); | |
$(document).mouseup(function(e) { | |
if (!$('.ajax-dropdown').is(e.target)// if the target of the click isn't the container... | |
&& $('.ajax-dropdown').has(e.target).length === 0) { | |
$('.ajax-dropdown').fadeOut(150); | |
$('.ajax-dropdown').prev().removeClass("active") | |
} | |
}); | |
$('button[data-loading-text]').on('click', function() { | |
var btn = $(this) | |
btn.button('loading') | |
setTimeout(function() { | |
btn.button('reset') | |
}, 3000) | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment