diff options
author | Matt Claypotch <thepotch@gmail.com> | 2010-08-24 18:16:08 (GMT) |
---|---|---|
committer | Matt Claypotch <thepotch@gmail.com> | 2010-08-24 18:16:08 (GMT) |
commit | 9afb009c83c86b022eeb7cff879f01d5faf89b6e (patch) | |
tree | b1e6db96d9c21b4122a1e91027ea4d985d913aa3 /media | |
parent | d54e4fbafef4d5763ead82be2809078e975f205b (diff) |
Bug 585201, Collection watching widget
Diffstat (limited to 'media')
-rw-r--r-- | media/css/zamboni/zamboni.css | 17 | ||||
-rw-r--r-- | media/js/zamboni/collections.js | 38 |
2 files changed, 49 insertions, 6 deletions
diff --git a/media/css/zamboni/zamboni.css b/media/css/zamboni/zamboni.css index a50d57c..93d3cc8 100644 --- a/media/css/zamboni/zamboni.css +++ b/media/css/zamboni/zamboni.css @@ -2789,13 +2789,20 @@ a.outlink:hover { display: inline-block; } +.object-details .collection_widgets { + margin-bottom: 1em; +} + .collection_widgets > a { background-image: url(../../img/zamboni/icons/collections.png); background-repeat: no-repeat; - padding-left: 16px; + padding-left: 22px; margin-right: .8em; text-indent: -9000px; } +.collection_widgets > a[title] { + padding-left: 16px; +} .collection_widgets .edit { margin-left: .5em; background-position: 0 -350px; @@ -2804,13 +2811,15 @@ a.outlink:hover { .collection_widgets .copy { background-position: 0 -50px; } .collection_widgets .copy:hover { background-position: 0 0px; } .collection_widgets .watch { background-position: 0 -750px; } -.collection_widgets .watch:hover { background-position: 0 -700px; } +.collection_widgets .watch:hover { background-position: 0 -700px;} +.collection_widgets .watch.watching { background-position: 0 -650px; } .collection_widgets .share { background-position: 0 -600px; } .collection_widgets .share:hover { background-position: 0 -550px; } -.addon-favorite.ajax-loazding span, -.collection-add.ajax-loading span { +.addon-favorite.ajax-loading span, +.collection-add.ajax-loading span, +.collection_widgets > a.ajax-loading { background-image: url(../../img/zamboni/loading-white.gif); background-position: left bottom; } diff --git a/media/js/zamboni/collections.js b/media/js/zamboni/collections.js index 05418e1..bede8fe 100644 --- a/media/js/zamboni/collections.js +++ b/media/js/zamboni/collections.js @@ -649,8 +649,10 @@ $(document).ready(function () { }); -// Add to favorites functionality + $(document).ready(function () { + + // Add to favorites functionality $(".addon-favorite").click(function(e) { e.preventDefault(); var msg = $(".msg", this); @@ -681,4 +683,36 @@ $(document).ready(function () { } }); }); -});
\ No newline at end of file + + // Colleciton watching + $(".collection_widgets .watch").click(function(e) { + e.preventDefault(); + var widget = $(this); + widget.addClass('ajax-loading'); + + var watch_text = gettext("Watch this Collection"); + + $.ajax({ + url: this.href, + type: 'POST', + success: function(data) { + widget.removeClass('ajax-loading'); + if (data.watching) { + widget.addClass("watching"); + watch_text = gettext("Stop Watching"); + } else { + widget.removeClass("watching"); + } + if (widget.attr("title")) { + widget.attr("title", watch_text); + } else { + widget.text(watch_text); + } + }, + error: function() { + widget.removeClass('ajax-loading'); + } + }); + }); + +}); |