diff --git a/app/assets/javascripts/app/views/contacts_view.js b/app/assets/javascripts/app/views/contacts_view.js index d41c069cc..c9a2ffb11 100644 --- a/app/assets/javascripts/app/views/contacts_view.js +++ b/app/assets/javascripts/app/views/contacts_view.js @@ -6,6 +6,7 @@ app.views.Contacts = Backbone.View.extend({ events: { "click #contacts_visibility_toggle" : "toggleContactVisibility", + "click #chat_privilege_toggle" : "toggleChatPrivilege", "click #change_aspect_name" : "showAspectNameForm", "click .contact_remove-from-aspect" : "removeContactFromAspect", "click .contact_add-to-aspect" : "addContactToAspect", @@ -14,12 +15,29 @@ app.views.Contacts = Backbone.View.extend({ initialize: function() { this.visibility_toggle = $("#contacts_visibility_toggle .entypo"); + this.chat_toggle = $("#chat_privilege_toggle .entypo"); $("#people_stream.contacts .header .entypo").tooltip({ 'placement': 'bottom'}); $(".contact_remove-from-aspect").tooltip(); $(".contact_add-to-aspect").tooltip(); $(document).on('ajax:success', 'form.edit_aspect', this.updateAspectName); }, + toggleChatPrivilege: function() { + if (this.chat_toggle.hasClass("enabled")) { + this.chat_toggle.tooltip("destroy") + .removeClass("enabled") + .removeAttr("data-original-title") + .attr("title", Diaspora.I18n.t("contacts.aspect_chat_is_enabled")) + .tooltip({'placement': 'bottom'}); + } else { + this.chat_toggle.tooltip("destroy") + .addClass("enabled") + .removeAttr("data-original-title") + .attr("title", Diaspora.I18n.t("contacts.aspect_chat_is_not_enabled")) + .tooltip({'placement': 'bottom'}); + } + }, + toggleContactVisibility: function() { if (this.visibility_toggle.hasClass("lock-open")) { this.visibility_toggle.removeClass("lock-open") diff --git a/app/assets/stylesheets/aspects.css.scss b/app/assets/stylesheets/aspects.css.scss index 1b9cf7da9..9ccbcfe8f 100644 --- a/app/assets/stylesheets/aspects.css.scss +++ b/app/assets/stylesheets/aspects.css.scss @@ -39,11 +39,12 @@ } #new_aspect { - #aspect_contacts_visible.checkbox { + .checkbox { margin: 0px; } - label[for="aspect_contacts_visible"] { + label[for="aspect_contacts_visible"], + label[for="aspect_chat_enabled"] { display: inline; } } diff --git a/app/assets/stylesheets/contacts.css.scss b/app/assets/stylesheets/contacts.css.scss index 56ad441d3..5bf2597a6 100644 --- a/app/assets/stylesheets/contacts.css.scss +++ b/app/assets/stylesheets/contacts.css.scss @@ -24,6 +24,9 @@ text-decoration: none; margin-right: 25px; } + #chat_privilege_toggle > .enabled { + color: #000; + } .entypo.contacts-header-icon { font-size: 24.5px; line-height: 40px; diff --git a/config/routes.rb b/config/routes.rb index 08da714cb..a92f119c1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -64,6 +64,7 @@ Diaspora::Application.routes.draw do resources :aspects do put :toggle_contact_visibility + put :toggle_chat_privilege end get 'bookmarklet' => 'status_messages#bookmarklet'