prevent user from hitting aspectmemberships controller before response on dropdowns

This commit is contained in:
danielgrippi 2011-05-11 17:07:34 -07:00
parent c67d143719
commit 7893129435
8 changed files with 12 additions and 30 deletions

View file

@ -25,7 +25,7 @@ module AspectsHelper
:method => 'post', :method => 'post',
:class => 'add button', :class => 'add button',
'data-aspect_id' => aspect_id, 'data-aspect_id' => aspect_id,
'data-person_id' => person_id 'data-person_id' => person_id
end end
def remove_from_aspect_button(aspect_id, person_id) def remove_from_aspect_button(aspect_id, person_id)
@ -39,7 +39,7 @@ module AspectsHelper
:method => 'delete', :method => 'delete',
:class => 'added button', :class => 'added button',
'data-aspect_id' => aspect_id, 'data-aspect_id' => aspect_id,
'data-person_id' => person_id 'data-person_id' => person_id
end end
def aspect_membership_button(aspect, contact, person) def aspect_membership_button(aspect, contact, person)

View file

@ -32,7 +32,7 @@
▼ ▼
.wrapper .wrapper
%ul.dropdown_list %ul.dropdown_list{:unSelectable => 'on'}
- for aspect in @all_aspects - for aspect in @all_aspects
%li{:data => {:aspect_id => aspect.id}} %li{:data => {:aspect_id => aspect.id}}
= check_box_tag "yo", "hey", aspect.contacts.include?(contact) = check_box_tag "yo", "hey", aspect.contacts.include?(contact)

View file

@ -378,7 +378,6 @@ en:
gender: "gender" gender: "gender"
born: "birthday" born: "birthday"
in_aspects: "in aspects" in_aspects: "in aspects"
cannot_remove: "Cannot remove %{name} from last aspect. (If you want to disconnect from this person you must remove contact.)"
remove_from: "Remove %{name} from %{aspect}?" remove_from: "Remove %{name} from %{aspect}?"
helper: helper:
results_for: " results for %{params}" results_for: " results for %{params}"
@ -562,7 +561,6 @@ en:
new: "New %{type} from %{from}" new: "New %{type} from %{from}"
contact_list: contact_list:
all_contacts: "All contacts" all_contacts: "All contacts"
cannot_remove: "Cannot remove person from last aspect. (If you want to disconnect from this person you must remove contact.)"
stream_element: stream_element:
like: "I like this" like: "I like this"
dislike: "I dislike this" dislike: "I dislike this"

View file

@ -27,9 +27,6 @@ en:
watch: "Watch this video on {{provider}}" watch: "Watch this video on {{provider}}"
unknown: "Unknown video type" unknown: "Unknown video type"
search_for: "Search for {{name}}" search_for: "Search for {{name}}"
shared:
contact_list:
cannot_remove: "Cannot remove person from last aspect. (If you want to disconnect from this person you must remove contact.)"
publisher: publisher:
at_least_one_aspect: "You must publish to at least one aspect" at_least_one_aspect: "You must publish to at least one aspect"
infinite_scroll: infinite_scroll:

View file

@ -12,6 +12,7 @@
}; };
var processClick = function(li, evt){ var processClick = function(li, evt){
evt.preventDefault(); evt.preventDefault();
if(li.find('.button').hasClass('disabled')){ return; }
var checkbox = li.find('input[type=checkbox]'); var checkbox = li.find('input[type=checkbox]');
toggleCheckbox(checkbox); toggleCheckbox(checkbox);

View file

@ -40,29 +40,15 @@ var List = {
$(document).ready(function() { $(document).ready(function() {
$('.added').live('ajax:loading', function() { $('.added').live('ajax:loading', function() {
$(this).addClass('disabled');
$(this).fadeTo(200,0.4); $(this).fadeTo(200,0.4);
}); });
$('.add').live('ajax:loading', function() { $('.add').live('ajax:loading', function() {
$(this).addClass('disabled');
$(this).fadeTo(200,0.4); $(this).fadeTo(200,0.4);
}); });
$('.added').live('ajax:failure', function(data, html, xhr) {
if(confirm(Diaspora.widgets.i18n.t('shared.contact_list.cannot_remove'))){
var contact_id;
if( $('.contact_list').length == 1){
contact_id = $(this).parents('li').attr("data-contact_id");
$('.contact_list li[data-contact_id='+contact_id+']').fadeOut(200);
} else if($('#aspects_list').length == 1) {
contact_id = $(this).parents('#aspects_list').attr("data-contact_id");
};
List.disconnectUser(contact_id);
};
$(this).fadeTo(200,1);
});
$('.added').live('mouseover', function() { $('.added').live('mouseover', function() {
$(this).addClass("remove"); $(this).addClass("remove");
$(this).children("img").attr("src","/images/icons/monotone_close_exit_delete.png"); $(this).children("img").attr("src","/images/icons/monotone_close_exit_delete.png");

View file

@ -34,3 +34,8 @@
-khtml-opacity: $val; -khtml-opacity: $val;
opacity: $val; opacity: $val;
} }
@mixin user-select($val){
-webkit-user-select: $val;
-moz-user-select: $val;
}

View file

@ -246,12 +246,6 @@ ul.dropdown
li li
:display block :display block
&.share.active
li:first-child
:padding-bottom 6px
:background
:color #ccc
////////////////////////////////// //////////////////////////////////
.dropdown .dropdown
@ -270,6 +264,7 @@ ul.dropdown
:border 1px solid #AAA :border 1px solid #AAA
ul ul
@include user-select(none)
:padding 0 :padding 0
> li > li