diaspora/app/views/aspect_memberships/create.js.erb
Florian Staudacher 4cbae601e8 [WIP] aspect membership dropdown Backbone.js rework
* initial backbone port
* changed AspectMembershipsController#destroy to use aspect_membership_id
* included rudimentary jasmine specs
* more specs, updating the list elements after de-/selection
* update selected aspect count on button
* don't even try to render html in AspectMembershipsController
* more specs for button summary text
* adapt aspect management on contacts page and in the popup boxes
* adapt inline creation of aspects + memberships

TODO
* more tests
2013-02-17 13:40:10 +01:00

20 lines
828 B
Text

// Copyright (c) 2010-2011, Diaspora Inc. This file is
// licensed under the Affero General Public License version 3 or later. See
// the COPYRIGHT file.
// TODO handle this completely in Backbone.js, then remove this view!
var element = $(".add[data-aspect_id=<%= @aspect.id %>][data-person_id=<%= @contact.person_id%>]");
if( $("#no_contacts").is(':visible') ) {
$("#no_contacts").fadeOut(200);
}
element.parent().html("<%= escape_javascript(render('aspect_memberships/add_to_aspect', :aspect_id => @aspect.id, :person_id => @person.id)) %>");
if($('#aspects_list').length == 1) {
$('.aspect_list').attr('data-contact_id', "<%= @contact_id %>");
$('.aspect_list ul').find('.add').each(function(a,b){$(b).attr('href', $(b).attr('href').replace('contacts','aspect_memberships'));})
};
element.fadeTo(200,1);