summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/activities.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/activities.js')
-rw-r--r--app/assets/javascripts/activities.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/app/assets/javascripts/activities.js b/app/assets/javascripts/activities.js
new file mode 100644
index 00000000000..1ab3c2197d8
--- /dev/null
+++ b/app/assets/javascripts/activities.js
@@ -0,0 +1,40 @@
+(function() {
+ this.Activities = (function() {
+ function Activities() {
+ Pager.init(20, true, false, this.updateTooltips);
+ $(".event-filter-link").on("click", (function(_this) {
+ return function(event) {
+ event.preventDefault();
+ _this.toggleFilter($(event.currentTarget));
+ return _this.reloadActivities();
+ };
+ })(this));
+ }
+
+ Activities.prototype.updateTooltips = function() {
+ return gl.utils.localTimeAgo($('.js-timeago', '#activity'));
+ };
+
+ Activities.prototype.reloadActivities = function() {
+ $(".content_list").html('');
+ return Pager.init(20, true);
+ };
+
+ Activities.prototype.toggleFilter = function(sender) {
+ var event_filters, filter;
+ $('.event-filter .active').removeClass("active");
+ event_filters = $.cookie("event_filter");
+ filter = sender.attr("id").split("_")[0];
+ $.cookie("event_filter", (event_filters !== filter ? filter : ""), {
+ path: '/'
+ });
+ if (event_filters !== filter) {
+ return sender.closest('li').toggleClass("active");
+ }
+ };
+
+ return Activities;
+
+ })();
+
+}).call(this);