Skip to content
Extraits de code Groupes Projets
Valider 69974bdc rédigé par Jonne Haß's avatar Jonne Haß
Parcourir les fichiers

Merge pull request #6161 from svbergerem/fix-conversation-modal

Fix two modal issues
parents e1502bf6 61edda0f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -33,7 +33,7 @@ bind to an UNIX socket at `unix:tmp/diaspora.sock`. Please change your local
* Use a fixed width for the mobile drawer [#6057](https://github.com/diaspora/diaspora/pull/6057)
* Replace jquery.autoresize with autosize [#6104](https://github.com/diaspora/diaspora/pull/6104)
* Improve mobile conversation design [#6087](https://github.com/diaspora/diaspora/pull/6087)
* Replace remaining faceboxes with Bootstrap modals [#6106](https://github.com/diaspora/diaspora/pull/6106)
* Replace remaining faceboxes with Bootstrap modals [#6106](https://github.com/diaspora/diaspora/pull/6106) [#6161](https://github.com/diaspora/diaspora/pull/6161)
* Rewrite header using Bootstrap 3 [#6109](https://github.com/diaspora/diaspora/pull/6109) [#6130](https://github.com/diaspora/diaspora/pull/6130) [#6132](https://github.com/diaspora/diaspora/pull/6132)
* Use upstream CSS mappings for Entypo [#6158](https://github.com/diaspora/diaspora/pull/6158)
......
......@@ -8,7 +8,8 @@ app.pages.Contacts = Backbone.View.extend({
"click #contacts_visibility_toggle" : "toggleContactVisibility",
"click #chat_privilege_toggle" : "toggleChatPrivilege",
"click #change_aspect_name" : "showAspectNameForm",
"keyup #contact_list_search" : "searchContactList"
"keyup #contact_list_search" : "searchContactList",
"click .conversation_button": "showMessageModal"
},
initialize: function(opts) {
......@@ -77,6 +78,10 @@ app.pages.Contacts = Backbone.View.extend({
this.stream.search($(e.target).val());
},
showMessageModal: function(){
app.helpers.showModal("#conversationModal");
},
setupAspectSorting: function() {
$("#aspect_nav .list-group").sortable({
items: "a.aspect[data-aspect-id]",
......
......@@ -4,7 +4,8 @@ app.views.AspectCreate = app.views.Base.extend({
templateName: "aspect_create_modal",
events: {
"click .btn.btn-primary": "createAspect"
"click .btn.btn-primary": "createAspect",
"keypress input#aspect_name": "inputKeypress"
},
initialize: function(opts) {
......@@ -30,6 +31,13 @@ app.views.AspectCreate = app.views.Base.extend({
return this.$("#aspect_name").val();
},
inputKeypress: function(evt) {
if(evt.which === 13) {
evt.preventDefault();
this.createAspect();
}
},
createAspect: function() {
var aspect = new app.models.Aspect({
"person_id": this._personId,
......
......@@ -13,8 +13,7 @@ module ContactsHelper
content_tag :i,
nil,
class: "entypo-mail contacts-header-icon",
title: t("contacts.index.start_a_conversation"),
data: {toggle: "modal", target: "#conversationModal"}
title: t("contacts.index.start_a_conversation")
end
end
end
......@@ -40,6 +40,24 @@ describe("app.views.AspectCreate", function() {
});
});
describe("#inputKeypress", function() {
beforeEach(function() {
this.view.render();
spyOn(this.view, "createAspect");
});
it("should call createAspect if the enter key was pressed", function() {
var e = $.Event("keypress", { which: 13 });
this.view.inputKeypress(e);
expect(this.view.createAspect).toHaveBeenCalled();
});
it("shouldn't call createAspect if another key was pressed", function() {
var e = $.Event("keypress", { which: 42 });
this.view.inputKeypress(e);
expect(this.view.createAspect).not.toHaveBeenCalled();
});
});
describe("#createAspect", function() {
beforeEach(function() {
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter