mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-26 05:49:22 +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
|
// Update checkbox to allow or not everyone to add members
|
||||||
$(settingsForm.allowEveryoneToAddMembers).iCheck(conversation.infos.canEveryoneAddMembers ? "check" : "uncheck");
|
$(settingsForm.allowEveryoneToAddMembers).iCheck(conversation.infos.canEveryoneAddMembers ? "check" : "uncheck");
|
||||||
|
|
||||||
|
settingsForm.usersElement.parentNode.style.display = "none";
|
||||||
|
|
||||||
//Check if user is a conversation moderator or not
|
//Check if user is a conversation moderator or not
|
||||||
if(!conversation.infos.members.find(m => m.user_id == userID()).is_admin) {
|
if(!conversation.infos.members.find(m => m.user_id == userID()).is_admin) {
|
||||||
//We disable name field
|
//We disable name field
|
||||||
settingsForm.conversationNameInput.disabled = "true";
|
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();
|
settingsForm.allowEveryoneToAddMembers.parentNode.parentNode.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -728,29 +726,16 @@ const ConvChatWindow = {
|
|||||||
|
|
||||||
//Then, get information about the input
|
//Then, get information about the input
|
||||||
var newValues = {
|
var newValues = {
|
||||||
conversationID: conversation.infos.ID,
|
conversationID: conversation.infos.id,
|
||||||
following: conversation.settingsForm.followConversationInput.checked,
|
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
|
//Add other fields if the user is a conversation moderator
|
||||||
if(conversation.infos.ID_owner == userID()){
|
if(conversation.infos.ID_owner == userID()){
|
||||||
//Specify conversation name
|
//Specify conversation name
|
||||||
var nameValue = conversation.settingsForm.conversationNameInput.value
|
var nameValue = conversation.settingsForm.conversationNameInput.value
|
||||||
newValues.name = (nameValue === "" ? false : nameValue);
|
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;
|
newValues.canEveryoneAddMembers = conversation.settingsForm.allowEveryoneToAddMembers.checked;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -81,6 +81,7 @@ const ConversationsInterface = {
|
|||||||
name: infos.conversationName,
|
name: infos.conversationName,
|
||||||
follow : infos.follow,
|
follow : infos.follow,
|
||||||
users: infos.users,
|
users: infos.users,
|
||||||
|
color: infos.color.replace("#", "").toUpperCase(),
|
||||||
canEveryoneAddMembers: infos.allowEveryoneToAddMembersInput
|
canEveryoneAddMembers: infos.allowEveryoneToAddMembersInput
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ const ConversationsList = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Change box title
|
//Change box title
|
||||||
listBox.boxTitle.innerHTML = "New conversation";
|
listBox.boxTitle.innerHTML = tr("New conversation");
|
||||||
|
|
||||||
//Create the form
|
//Create the form
|
||||||
var form = ConversationsUtils.createConversationForm(listBox.boxBody);
|
var form = ConversationsUtils.createConversationForm(listBox.boxBody);
|
||||||
@ -77,6 +77,7 @@ const ConversationsList = {
|
|||||||
listBox: listBox,
|
listBox: listBox,
|
||||||
usersElement: form.usersElement,
|
usersElement: form.usersElement,
|
||||||
conversationNameInput: form.conversationNameInput,
|
conversationNameInput: form.conversationNameInput,
|
||||||
|
conversationColorInput: form.conversationColorInput,
|
||||||
followConversationInput: form.followConversationInput,
|
followConversationInput: form.followConversationInput,
|
||||||
allowEveryoneToAddMembersInput: form.allowEveryoneToAddMembers,
|
allowEveryoneToAddMembersInput: form.allowEveryoneToAddMembers,
|
||||||
};
|
};
|
||||||
@ -123,6 +124,7 @@ const ConversationsList = {
|
|||||||
users: selectedUsers,
|
users: selectedUsers,
|
||||||
follow: infos.followConversationInput.checked,
|
follow: infos.followConversationInput.checked,
|
||||||
conversationName: (infos.conversationNameInput.value == "" ? false : infos.conversationNameInput.value),
|
conversationName: (infos.conversationNameInput.value == "" ? false : infos.conversationNameInput.value),
|
||||||
|
color: infos.conversationColorInput.value == "" ? null : infos.conversationColorInput.value,
|
||||||
allowEveryoneToAddMembersInput: infos.allowEveryoneToAddMembersInput.checked,
|
allowEveryoneToAddMembersInput: infos.allowEveryoneToAddMembersInput.checked,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -98,19 +98,30 @@ const ConversationsUtils = {
|
|||||||
ComunicWeb.components.userSelect.init(form.usersElement);
|
ComunicWeb.components.userSelect.init(form.usersElement);
|
||||||
|
|
||||||
|
|
||||||
//Conversation name
|
// Conversation name
|
||||||
form.conversationNameInput = createFormGroup({
|
form.conversationNameInput = createFormGroup({
|
||||||
target: form.rootElem,
|
target: form.rootElem,
|
||||||
label: "Conversation name",
|
label: tr("Conversation name"),
|
||||||
placeholder: "Optionnal",
|
placeholder: tr("Optional"),
|
||||||
type: "text"});
|
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
|
// Follow discussion
|
||||||
form.followConversationInput = createFormGroup({
|
form.followConversationInput = createFormGroup({
|
||||||
target: form.rootElem,
|
target: form.rootElem,
|
||||||
label: "Follow conversation",
|
label: tr("Follow conversation"),
|
||||||
checked: true,
|
checked: true,
|
||||||
type: "checkbox"});
|
type: "checkbox"
|
||||||
|
});
|
||||||
|
|
||||||
// Allow all the members of the conversation to add other members
|
// Allow all the members of the conversation to add other members
|
||||||
form.allowEveryoneToAddMembers = createFormGroup({
|
form.allowEveryoneToAddMembers = createFormGroup({
|
||||||
|
@ -74,7 +74,10 @@ class Dev {
|
|||||||
"3rdparty/wdt-emoji/wdt-emoji-bundle.css",
|
"3rdparty/wdt-emoji/wdt-emoji-bundle.css",
|
||||||
|
|
||||||
//SCEditor (BBCode editor)
|
//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
|
// Record MediaStream
|
||||||
"3rdparty/MediaStreamRecorder.min.js",
|
"3rdparty/MediaStreamRecorder.min.js",
|
||||||
|
|
||||||
|
// Color picker
|
||||||
|
"3rdparty/adminLTE/plugins/colorpicker/bootstrap-colorpicker.min.js",
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user