Move aspect contacts pane js to public
This commit is contained in:
parent
ec05c21472
commit
57485e7093
4 changed files with 64 additions and 37 deletions
|
|
@ -3,46 +3,15 @@
|
|||
-# the COPYRIGHT file.
|
||||
|
||||
- content_for :head do
|
||||
:javascript
|
||||
$("#edit_aspect_trigger").live("click",
|
||||
function(){
|
||||
EditPane.toggle();
|
||||
}
|
||||
);
|
||||
|
||||
var EditPane = {
|
||||
toggle: function() {
|
||||
if( $("#edit_aspect_pane").hasClass("active") ) {
|
||||
EditPane.fadeOut();
|
||||
} else {
|
||||
EditPane.fadeIn();
|
||||
}
|
||||
},
|
||||
|
||||
fadeIn: function(){
|
||||
var trigger = $("#edit_aspect_trigger");
|
||||
|
||||
$("#edit_aspect_pane").addClass("active");
|
||||
$(".contact_pictures").fadeOut(200, function(){
|
||||
$("#edit_aspect_pane").fadeIn(200);
|
||||
trigger.html("#{t('.done_editing')}");
|
||||
});
|
||||
},
|
||||
|
||||
fadeOut: function(){
|
||||
var trigger = $("#edit_aspect_trigger");
|
||||
trigger.html("#{t('aspects.show.edit_aspect')}");
|
||||
|
||||
$("#edit_aspect_pane").removeClass("active");
|
||||
$("#edit_aspect_pane").fadeOut(200, function(){
|
||||
$(".contact_pictures").fadeIn(200);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
=javascript_include_tag 'aspect-contacts'
|
||||
- if aspect != :all && aspect.contacts.count == 0
|
||||
:javascript
|
||||
$(document).ready(function(){
|
||||
EditPane.setTranslations({
|
||||
doneEditing: "#{t('.done_editing')}",
|
||||
editAspect:"#{t('aspects.show.edit_aspect')}"
|
||||
});
|
||||
|
||||
EditPane.fadeIn();
|
||||
});
|
||||
|
||||
|
|
|
|||
43
public/javascripts/aspect-contacts.js
Normal file
43
public/javascripts/aspect-contacts.js
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/* Copyright (c) 2010, Diaspora Inc. This file is
|
||||
* licensed under the Affero General Public License version 3 or later. See
|
||||
* the COPYRIGHT file.
|
||||
*/
|
||||
|
||||
$("#edit_aspect_trigger").live("click",
|
||||
function(){
|
||||
EditPane.toggle();
|
||||
}
|
||||
);
|
||||
|
||||
var EditPane = {
|
||||
setTranslations: function(translations) {
|
||||
EditPane.translations = translations;
|
||||
},
|
||||
toggle: function() {
|
||||
if( $("#edit_aspect_pane").hasClass("active") ) {
|
||||
EditPane.fadeOut();
|
||||
} else {
|
||||
EditPane.fadeIn();
|
||||
}
|
||||
},
|
||||
|
||||
fadeIn: function(){
|
||||
var trigger = $("#edit_aspect_trigger");
|
||||
|
||||
$("#edit_aspect_pane").addClass("active");
|
||||
$(".contact_pictures").fadeOut(200, function(){
|
||||
$("#edit_aspect_pane").fadeIn(200);
|
||||
trigger.html(EditPane.translations.doneEditing);
|
||||
});
|
||||
},
|
||||
|
||||
fadeOut: function(){
|
||||
var trigger = $("#edit_aspect_trigger");
|
||||
trigger.html(EditPane.translations.editAspect);
|
||||
|
||||
$("#edit_aspect_pane").removeClass("active");
|
||||
$("#edit_aspect_pane").fadeOut(200, function(){
|
||||
$(".contact_pictures").fadeIn(200);
|
||||
});
|
||||
}
|
||||
};
|
||||
14
spec/javascripts/aspect-contacts-spec.js
Normal file
14
spec/javascripts/aspect-contacts-spec.js
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/* Copyright (c) 2010, Diaspora Inc. This file is
|
||||
* licensed under the Affero General Public License version 3 or later. See
|
||||
* the COPYRIGHT file.
|
||||
*/
|
||||
|
||||
describe("EditPane", function() {
|
||||
describe("setTranslations", function() {
|
||||
it("sets the translations object", function(){
|
||||
var input = {doneEditing: 'I am done editing'};
|
||||
EditPane.setTranslations(input);
|
||||
expect(EditPane.translations.doneEditing).toEqual('I am done editing');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -17,6 +17,7 @@ src_files:
|
|||
- public/javascripts/diaspora.js
|
||||
- public/javascripts/mobile.js
|
||||
- public/javascripts/aspect-edit.js
|
||||
- public/javascripts/aspect-contacts.js
|
||||
- public/javascripts/web-socket-receiver.js
|
||||
|
||||
# stylesheets
|
||||
|
|
|
|||
Loading…
Reference in a new issue