diff --git a/assets/js/components/conversations/chatWindows.js b/assets/js/components/conversations/chatWindows.js index 9fdc4ba3..f76bd311 100644 --- a/assets/js/components/conversations/chatWindows.js +++ b/assets/js/components/conversations/chatWindows.js @@ -665,15 +665,13 @@ const ConvChatWindow = { // Update checkbox to allow or not everyone to add members $(settingsForm.allowEveryoneToAddMembers).iCheck(conversation.infos.canEveryoneAddMembers ? "check" : "uncheck"); + settingsForm.usersElement.parentNode.style.display = "none"; + //Check if user is a conversation moderator or not if(!conversation.infos.members.find(m => m.user_id == userID()).is_admin) { //We disable name field settingsForm.conversationNameInput.disabled = "true"; - //We hide conversation users (presents in members pane - if user is not allowed to add new members) - if(!conversation.infos.canEveryoneAddMembers) - settingsForm.usersElement.parentNode.style.display = "none"; - settingsForm.allowEveryoneToAddMembers.parentNode.parentNode.remove(); } @@ -728,29 +726,16 @@ const ConvChatWindow = { //Then, get information about the input var newValues = { - conversationID: conversation.infos.ID, + conversationID: conversation.infos.id, following: conversation.settingsForm.followConversationInput.checked, } - //Get conversation members - if(conversation.infos.ID_owner == userID() || conversation.infos.canEveryoneAddMembers) - newValues.members = ComunicWeb.components.userSelect.getResults(conversation.settingsForm.usersElement); - //Add other fields if the user is a conversation moderator if(conversation.infos.ID_owner == userID()){ //Specify conversation name var nameValue = conversation.settingsForm.conversationNameInput.value newValues.name = (nameValue === "" ? false : nameValue); - - - //Check if any users were selected - if(newValues.members.length === 0){ - //Inform user that its input is invalid - notify("Please select at least one user !", "danger", 3); - return false; - } - newValues.canEveryoneAddMembers = conversation.settingsForm.allowEveryoneToAddMembers.checked; } diff --git a/assets/js/components/conversations/interface.js b/assets/js/components/conversations/interface.js index 29bc4586..4068e8b7 100644 --- a/assets/js/components/conversations/interface.js +++ b/assets/js/components/conversations/interface.js @@ -81,6 +81,7 @@ const ConversationsInterface = { name: infos.conversationName, follow : infos.follow, users: infos.users, + color: infos.color.replace("#", "").toUpperCase(), canEveryoneAddMembers: infos.allowEveryoneToAddMembersInput }; diff --git a/assets/js/components/conversations/list.js b/assets/js/components/conversations/list.js index 02b13d31..b29dd1eb 100644 --- a/assets/js/components/conversations/list.js +++ b/assets/js/components/conversations/list.js @@ -67,7 +67,7 @@ const ConversationsList = { } //Change box title - listBox.boxTitle.innerHTML = "New conversation"; + listBox.boxTitle.innerHTML = tr("New conversation"); //Create the form var form = ConversationsUtils.createConversationForm(listBox.boxBody); @@ -77,6 +77,7 @@ const ConversationsList = { listBox: listBox, usersElement: form.usersElement, conversationNameInput: form.conversationNameInput, + conversationColorInput: form.conversationColorInput, followConversationInput: form.followConversationInput, allowEveryoneToAddMembersInput: form.allowEveryoneToAddMembers, }; @@ -123,6 +124,7 @@ const ConversationsList = { users: selectedUsers, follow: infos.followConversationInput.checked, conversationName: (infos.conversationNameInput.value == "" ? false : infos.conversationNameInput.value), + color: infos.conversationColorInput.value == "" ? null : infos.conversationColorInput.value, allowEveryoneToAddMembersInput: infos.allowEveryoneToAddMembersInput.checked, }; diff --git a/assets/js/components/conversations/utils.js b/assets/js/components/conversations/utils.js index fe3d8107..4f81bdf8 100644 --- a/assets/js/components/conversations/utils.js +++ b/assets/js/components/conversations/utils.js @@ -98,19 +98,30 @@ const ConversationsUtils = { ComunicWeb.components.userSelect.init(form.usersElement); - //Conversation name + // Conversation name form.conversationNameInput = createFormGroup({ target: form.rootElem, - label: "Conversation name", - placeholder: "Optionnal", - type: "text"}); + label: tr("Conversation name"), + placeholder: tr("Optional"), + type: "text" + }); + + // Conversation color + form.conversationColorInput = createFormGroup({ + target: form.rootElem, + label: tr("Conversation color"), + placeholder: tr("Optional"), + type: "text" + }); + $(form.conversationColorInput).colorpicker({format: "hex"}) // Follow discussion form.followConversationInput = createFormGroup({ target: form.rootElem, - label: "Follow conversation", + label: tr("Follow conversation"), checked: true, - type: "checkbox"}); + type: "checkbox" + }); // Allow all the members of the conversation to add other members form.allowEveryoneToAddMembers = createFormGroup({ diff --git a/system/config/dev.config.php b/system/config/dev.config.php index c083cc90..cdc59c63 100644 --- a/system/config/dev.config.php +++ b/system/config/dev.config.php @@ -74,7 +74,10 @@ class Dev { "3rdparty/wdt-emoji/wdt-emoji-bundle.css", //SCEditor (BBCode editor) - "css/common/custom-sceditor.css" + "css/common/custom-sceditor.css", + + // Color picker + "3rdparty/adminLTE/plugins/colorpicker/bootstrap-colorpicker.min.css", ); /** @@ -170,6 +173,9 @@ class Dev { // Record MediaStream "3rdparty/MediaStreamRecorder.min.js", + + // Color picker + "3rdparty/adminLTE/plugins/colorpicker/bootstrap-colorpicker.min.js", ); /**