Set chat-flag for every aspect manually

On default none is permitted to chat with you.
You have to set extra privilege for an aspect.
This commit is contained in:
Lukas Matt 2014-11-13 11:21:21 +01:00
parent 50a7541d14
commit 38a238eb36
4 changed files with 25 additions and 2 deletions

View file

@ -6,6 +6,7 @@ app.views.Contacts = Backbone.View.extend({
events: { events: {
"click #contacts_visibility_toggle" : "toggleContactVisibility", "click #contacts_visibility_toggle" : "toggleContactVisibility",
"click #chat_privilege_toggle" : "toggleChatPrivilege",
"click #change_aspect_name" : "showAspectNameForm", "click #change_aspect_name" : "showAspectNameForm",
"click .contact_remove-from-aspect" : "removeContactFromAspect", "click .contact_remove-from-aspect" : "removeContactFromAspect",
"click .contact_add-to-aspect" : "addContactToAspect", "click .contact_add-to-aspect" : "addContactToAspect",
@ -14,12 +15,29 @@ app.views.Contacts = Backbone.View.extend({
initialize: function() { initialize: function() {
this.visibility_toggle = $("#contacts_visibility_toggle .entypo"); this.visibility_toggle = $("#contacts_visibility_toggle .entypo");
this.chat_toggle = $("#chat_privilege_toggle .entypo");
$("#people_stream.contacts .header .entypo").tooltip({ 'placement': 'bottom'}); $("#people_stream.contacts .header .entypo").tooltip({ 'placement': 'bottom'});
$(".contact_remove-from-aspect").tooltip(); $(".contact_remove-from-aspect").tooltip();
$(".contact_add-to-aspect").tooltip(); $(".contact_add-to-aspect").tooltip();
$(document).on('ajax:success', 'form.edit_aspect', this.updateAspectName); $(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() { toggleContactVisibility: function() {
if (this.visibility_toggle.hasClass("lock-open")) { if (this.visibility_toggle.hasClass("lock-open")) {
this.visibility_toggle.removeClass("lock-open") this.visibility_toggle.removeClass("lock-open")

View file

@ -39,11 +39,12 @@
} }
#new_aspect { #new_aspect {
#aspect_contacts_visible.checkbox { .checkbox {
margin: 0px; margin: 0px;
} }
label[for="aspect_contacts_visible"] { label[for="aspect_contacts_visible"],
label[for="aspect_chat_enabled"] {
display: inline; display: inline;
} }
} }

View file

@ -24,6 +24,9 @@
text-decoration: none; text-decoration: none;
margin-right: 25px; margin-right: 25px;
} }
#chat_privilege_toggle > .enabled {
color: #000;
}
.entypo.contacts-header-icon { .entypo.contacts-header-icon {
font-size: 24.5px; font-size: 24.5px;
line-height: 40px; line-height: 40px;

View file

@ -64,6 +64,7 @@ Diaspora::Application.routes.draw do
resources :aspects do resources :aspects do
put :toggle_contact_visibility put :toggle_contact_visibility
put :toggle_chat_privilege
end end
get 'bookmarklet' => 'status_messages#bookmarklet' get 'bookmarklet' => 'status_messages#bookmarklet'