mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 12:09:21 +00:00
Start to update conversation settings screen
This commit is contained in:
parent
eb76a1491a
commit
7b430107e3
@ -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;
|
||||
|
||||
}
|
||||
|
@ -81,6 +81,7 @@ const ConversationsInterface = {
|
||||
name: infos.conversationName,
|
||||
follow : infos.follow,
|
||||
users: infos.users,
|
||||
color: infos.color.replace("#", "").toUpperCase(),
|
||||
canEveryoneAddMembers: infos.allowEveryoneToAddMembersInput
|
||||
};
|
||||
|
||||
|
@ -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,
|
||||
};
|
||||
|
||||
|
@ -101,16 +101,27 @@ const ConversationsUtils = {
|
||||
// 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({
|
||||
|
@ -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",
|
||||
);
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user