Acceptable ajax loader for the aspect dropdown.
This commit is contained in:
parent
3a18044821
commit
d228f50557
3 changed files with 17 additions and 2 deletions
BIN
public/images/ajax-loader_inverted.gif
Normal file
BIN
public/images/ajax-loader_inverted.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
|
|
@ -11,6 +11,7 @@ var ContactEdit = {
|
||||||
|
|
||||||
processClick: function(li, evt){
|
processClick: function(li, evt){
|
||||||
var dropdown = li.closest('.dropdown');
|
var dropdown = li.closest('.dropdown');
|
||||||
|
li.addClass('loading');
|
||||||
if (dropdown.hasClass('inviter')) {
|
if (dropdown.hasClass('inviter')) {
|
||||||
ContactEdit.inviteFriend(li, evt);
|
ContactEdit.inviteFriend(li, evt);
|
||||||
}
|
}
|
||||||
|
|
@ -22,8 +23,9 @@ var ContactEdit = {
|
||||||
inviteFriend: function(li, evt) {
|
inviteFriend: function(li, evt) {
|
||||||
$.post('/services/inviter/facebook.json', {
|
$.post('/services/inviter/facebook.json', {
|
||||||
"aspect_id" : li.data("aspect_id"),
|
"aspect_id" : li.data("aspect_id"),
|
||||||
"uid" : li.parent().data("service_uid")
|
"uid" : li.parent().data("service_uid")
|
||||||
}, function(data){
|
}, function(data){
|
||||||
|
li.removeClass('loading')
|
||||||
window.location = data.url;
|
window.location = data.url;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -41,6 +43,7 @@ var ContactEdit = {
|
||||||
"person_id": li.parent().data("person_id"),
|
"person_id": li.parent().data("person_id"),
|
||||||
"_method": (selected) ? "DELETE" : "POST"
|
"_method": (selected) ? "DELETE" : "POST"
|
||||||
}, function(aspectMembership) {
|
}, function(aspectMembership) {
|
||||||
|
li.removeClass('loading')
|
||||||
li.toggleClass("selected");
|
li.toggleClass("selected");
|
||||||
ContactEdit.updateNumber(li.closest(".dropdown_list"), li.parent().data("person_id"), aspectMembership.aspect_ids.length);
|
ContactEdit.updateNumber(li.closest(".dropdown_list"), li.parent().data("person_id"), aspectMembership.aspect_ids.length);
|
||||||
Diaspora.widgets.publish("aspectDropdown/updated", [li.parent().data("person_id"), li.parents(".dropdown").parent(".right").html()]);
|
Diaspora.widgets.publish("aspectDropdown/updated", [li.parent().data("person_id"), li.parents(".dropdown").parent(".right").html()]);
|
||||||
|
|
@ -54,7 +57,7 @@ var ContactEdit = {
|
||||||
if (number == 0) {
|
if (number == 0) {
|
||||||
button.removeClass("in_aspects");
|
button.removeClass("in_aspects");
|
||||||
replacement = Diaspora.widgets.i18n.t("aspect_dropdown.toggle.zero");
|
replacement = Diaspora.widgets.i18n.t("aspect_dropdown.toggle.zero");
|
||||||
}else if (number == 1) {
|
}else if (number == 1) {
|
||||||
button.addClass("in_aspects");
|
button.addClass("in_aspects");
|
||||||
replacement = dropdown.find(".selected").first().text();
|
replacement = dropdown.find(".selected").first().text();
|
||||||
}else if (number < 3) {
|
}else if (number < 3) {
|
||||||
|
|
|
||||||
|
|
@ -148,6 +148,18 @@
|
||||||
/* bump top position up 1px to compensate for the 1px added top border */
|
/* bump top position up 1px to compensate for the 1px added top border */
|
||||||
:position 3px 0px
|
:position 3px 0px
|
||||||
|
|
||||||
|
&.loading
|
||||||
|
:background
|
||||||
|
:image url('/images/ajax-loader.gif')
|
||||||
|
:repeat no-repeat
|
||||||
|
:position 4px 2px
|
||||||
|
|
||||||
|
&.loading:hover
|
||||||
|
:background
|
||||||
|
:image url('/images/ajax-loader_inverted.gif')
|
||||||
|
/* bump top position up 1px to compensate for the 1px added top border */
|
||||||
|
:position 4px 1px
|
||||||
|
|
||||||
&.newItem
|
&.newItem
|
||||||
a
|
a
|
||||||
:color #999
|
:color #999
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue