ms iz; everything is green, the sharewith is translated in js, fixed the clicking on the checkbox bug
This commit is contained in:
parent
c200c386fb
commit
402e84708b
5 changed files with 69 additions and 19 deletions
|
|
@ -1,3 +1,9 @@
|
|||
// Copyright (c) 2011, Diaspora Inc. This file is
|
||||
// licensed under the Affero General Public License version 3 or later. See
|
||||
// the COPYRIGHT file.
|
||||
|
||||
ContactEdit.updateNumber();
|
||||
|
||||
var element = $(".add[data-aspect_id=<%= @aspect.id %>][data-person_id=<%= @contact.person_id%>]");
|
||||
|
||||
if( $("#no_contacts").is(':visible') ) {
|
||||
|
|
@ -13,3 +19,4 @@ if($('#aspects_list').length == 1) {
|
|||
};
|
||||
|
||||
element.fadeTo(200,1);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
// Copyright (c) 2011, Diaspora Inc. This file is
|
||||
// licensed under the Affero General Public License version 3 or later. See
|
||||
// the COPYRIGHT file.
|
||||
|
||||
ContactEdit.updateNumber();
|
||||
var element = $(".added[data-aspect_id=<%= @aspect.id %>][data-person_id=<%= @contact.person_id%>]");
|
||||
element.parent().html("<%= escape_javascript(render('aspect_memberships/remove_from_aspect', :aspect => @aspect, :person => @contact.person, :contact => @contact)) %>");
|
||||
element.fadeTo(200,1);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
// Copyright (c) 2011, Diaspora Inc. This file is
|
||||
// licensed under the Affero General Public License version 3 or later. See
|
||||
// the COPYRIGHT file.
|
||||
|
||||
ContactEdit.updateNumber();
|
||||
$('ul.dropdown_list[data-person_id=<%= @person.id %>] .newItem').before("<%= escape_javascript( render('contacts/aspect_dropdown_list_item', :aspect => @aspect, :person => @person, :contact => @contact)) %>");
|
||||
$.facebox.close();
|
||||
$('#profile .dropdown').toggleClass("active");
|
||||
|
|
|
|||
|
|
@ -33,3 +33,11 @@ en:
|
|||
no_more: "No more posts."
|
||||
web_sockets:
|
||||
disconnected: "The websocket is closed; posts will no longer be streamed live."
|
||||
aspect_dropdown:
|
||||
add_to_aspect: "Add to aspect"
|
||||
toggle:
|
||||
zero: "Add to aspect"
|
||||
one: "In {{count}} aspect"
|
||||
few: "In {{count}} aspects"
|
||||
many: "In {{count}} aspects"
|
||||
other: "In {{count}} aspects"
|
||||
|
|
|
|||
|
|
@ -2,31 +2,56 @@
|
|||
// licensed under the Affero General Public License version 3 or later. See
|
||||
// the COPYRIGHT file.
|
||||
|
||||
(function(){
|
||||
var toggleCheckbox = function(checkbox){
|
||||
var ContactEdit = {
|
||||
init: function(){
|
||||
$('.dropdown .dropdown_list > li').live('click', function(evt){
|
||||
ContactEdit.processClick($(this), evt);
|
||||
});
|
||||
},
|
||||
updateNumber: function(){
|
||||
var number = $(".dropdown_list input[type=checkbox]:checked").length
|
||||
var element = $('.button.toggle');
|
||||
|
||||
var replacement;
|
||||
|
||||
if (number == 0) {
|
||||
replacement = Diaspora.widgets.i18n.t("aspect_dropdown.toggle.zero") ;
|
||||
}else if (number == 1) {
|
||||
replacement = Diaspora.widgets.i18n.t('aspect_dropdown.toggle.one', { count: number.toString()})
|
||||
}else if (number < 3) {
|
||||
replacement = Diaspora.widgets.i18n.t('aspect_dropdown.toggle.few', { count: number.toString()})
|
||||
}else if (number > 3) {
|
||||
replacement = Diaspora.widgets.i18n.t('aspect_dropdown.toggle.many', { count: number.toString()})
|
||||
}else {
|
||||
//the above one are a totalogy, but I want to have them here once for once we figure out a neat way i18n them
|
||||
replacement = Diaspora.widgets.i18n.t('aspect_dropdown.toggle.other', { count: number.toString()})
|
||||
}
|
||||
|
||||
element.html(replacement);
|
||||
},
|
||||
|
||||
toggleCheckbox:
|
||||
function(checkbox){
|
||||
if(checkbox.attr('checked')){
|
||||
checkbox.removeAttr('checked');
|
||||
} else {
|
||||
checkbox.attr('checked', true);
|
||||
}
|
||||
};
|
||||
var processClick = function(li, evt){
|
||||
},
|
||||
|
||||
processClick: function(li, evt){
|
||||
var button = li.find('.button');
|
||||
if(button.hasClass('disabled') || li.hasClass('newItem')){ return; }
|
||||
evt.preventDefault();
|
||||
|
||||
if( evt.target.type != "checkbox" ) {
|
||||
var checkbox = li.find('input[type=checkbox]');
|
||||
toggleCheckbox(checkbox);
|
||||
ContactEdit.toggleCheckbox(checkbox);
|
||||
}
|
||||
|
||||
$.fn.callRemote.apply(button);
|
||||
},
|
||||
};
|
||||
|
||||
$(document).ready(function(){
|
||||
$('.dropdown .dropdown_list > li').live('click', function(evt){
|
||||
processClick($(this), evt);
|
||||
ContactEdit.init();
|
||||
});
|
||||
$('.dropdown .dropdown_list > li *').live('click', function(evt){
|
||||
toggleCheckbox($(evt.target));
|
||||
})
|
||||
});
|
||||
}())
|
||||
|
|
|
|||
Loading…
Reference in a new issue