mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-07 16:37:02 +03:00
Improve create folder popup
This commit is contained in:
parent
bc196bcd1a
commit
1126712d11
3 changed files with 14 additions and 17 deletions
|
|
@ -1,13 +1,11 @@
|
||||||
import { koComputable, addObservablesTo } from 'External/ko';
|
import { koComputable, addObservablesTo } from 'External/ko';
|
||||||
|
|
||||||
import { Notification } from 'Common/Enums';
|
import { Notification } from 'Common/Enums';
|
||||||
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
|
||||||
import { defaultOptionsAfterRender } from 'Common/Utils';
|
import { defaultOptionsAfterRender } from 'Common/Utils';
|
||||||
import { folderListOptionsBuilder, sortFolders } from 'Common/Folders';
|
import { folderListOptionsBuilder, sortFolders } from 'Common/Folders';
|
||||||
import { getNotification } from 'Common/Translator';
|
import { getNotification } from 'Common/Translator';
|
||||||
|
|
||||||
import { FolderUserStore } from 'Stores/User/Folder';
|
import { FolderUserStore } from 'Stores/User/Folder';
|
||||||
//import { SettingsUserStore } from 'Stores/User/Settings';
|
|
||||||
|
|
||||||
import Remote from 'Remote/User/Fetch';
|
import Remote from 'Remote/User/Fetch';
|
||||||
|
|
||||||
|
|
@ -21,10 +19,9 @@ export class FolderCreatePopupView extends AbstractViewPopup {
|
||||||
super('FolderCreate');
|
super('FolderCreate');
|
||||||
|
|
||||||
addObservablesTo(this, {
|
addObservablesTo(this, {
|
||||||
folderName: '',
|
name: '',
|
||||||
folderSubscribe: true,//SettingsUserStore.hideUnsubscribed(),
|
subscribe: true,
|
||||||
|
parentFolder: ''
|
||||||
selectedParentValue: UNUSED_OPTION_VALUE
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.parentFolderSelectList = koComputable(() =>
|
this.parentFolderSelectList = koComputable(() =>
|
||||||
|
|
@ -46,9 +43,8 @@ export class FolderCreatePopupView extends AbstractViewPopup {
|
||||||
submitForm(form) {
|
submitForm(form) {
|
||||||
if (form.reportValidity()) {
|
if (form.reportValidity()) {
|
||||||
const data = new FormData(form);
|
const data = new FormData(form);
|
||||||
data.set('subscribe', this.folderSubscribe() ? 1 : 0);
|
|
||||||
|
|
||||||
let parentFolderName = this.selectedParentValue();
|
let parentFolderName = this.parentFolder();
|
||||||
if (!parentFolderName && 1 < FolderUserStore.namespace.length) {
|
if (!parentFolderName && 1 < FolderUserStore.namespace.length) {
|
||||||
data.set('parent', FolderUserStore.namespace.slice(0, FolderUserStore.namespace.length - 1));
|
data.set('parent', FolderUserStore.namespace.slice(0, FolderUserStore.namespace.length - 1));
|
||||||
}
|
}
|
||||||
|
|
@ -79,7 +75,8 @@ export class FolderCreatePopupView extends AbstractViewPopup {
|
||||||
}
|
}
|
||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
this.folderName('');
|
this.name('');
|
||||||
this.selectedParentValue('');
|
this.subscribe(true);
|
||||||
|
this.parentFolder('');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ trait Folders
|
||||||
$oFolder = $this->MailClient()->FolderCreate(
|
$oFolder = $this->MailClient()->FolderCreate(
|
||||||
$this->GetActionParam('folder', ''),
|
$this->GetActionParam('folder', ''),
|
||||||
$this->GetActionParam('parent', ''),
|
$this->GetActionParam('parent', ''),
|
||||||
!!$this->GetActionParam('subscribe', 1)
|
!empty($this->GetActionParam('subscribe', 0))
|
||||||
);
|
);
|
||||||
|
|
||||||
// FolderInformation(string $sFolderName, int $iPrevUidNext = 0, array $aUids = array())
|
// FolderInformation(string $sFolderName, int $iPrevUidNext = 0, array $aUids = array())
|
||||||
|
|
@ -121,7 +121,7 @@ trait Folders
|
||||||
$this->initMailClientConnection();
|
$this->initMailClientConnection();
|
||||||
|
|
||||||
$sFolderFullName = $this->GetActionParam('folder', '');
|
$sFolderFullName = $this->GetActionParam('folder', '');
|
||||||
$bSubscribe = '1' === (string) $this->GetActionParam('subscribe', '0');
|
$bSubscribe = !empty($this->GetActionParam('subscribe', 0));
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -183,7 +183,7 @@ trait Folders
|
||||||
$this->MailClient()->FolderMove(
|
$this->MailClient()->FolderMove(
|
||||||
$this->GetActionParam('folder', ''),
|
$this->GetActionParam('folder', ''),
|
||||||
$this->GetActionParam('newFolder', ''),
|
$this->GetActionParam('newFolder', ''),
|
||||||
!!$this->GetActionParam('subscribe', 1)
|
!empty($this->GetActionParam('subscribe', 1))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
catch (\Throwable $oException)
|
catch (\Throwable $oException)
|
||||||
|
|
@ -207,7 +207,7 @@ trait Folders
|
||||||
$sFullName = $this->MailClient()->FolderRename(
|
$sFullName = $this->MailClient()->FolderRename(
|
||||||
$this->GetActionParam('folder', ''),
|
$this->GetActionParam('folder', ''),
|
||||||
$sName,
|
$sName,
|
||||||
!!$this->GetActionParam('subscribe', 1)
|
!empty($this->GetActionParam('subscribe', 1))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
catch (\Throwable $oException)
|
catch (\Throwable $oException)
|
||||||
|
|
|
||||||
|
|
@ -5,21 +5,21 @@
|
||||||
<form id="createfolderform" class="modal-body form-horizontal" autocomplete="off" spellcheck="false" data-bind="submit: submitForm">
|
<form id="createfolderform" class="modal-body form-horizontal" autocomplete="off" spellcheck="false" data-bind="submit: submitForm">
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label data-i18n="POPUPS_CREATE_FOLDER/LABEL_PARENT"></label>
|
<label data-i18n="POPUPS_CREATE_FOLDER/LABEL_PARENT"></label>
|
||||||
<select name="parent" data-bind="options: parentFolderSelectList, value: selectedParentValue,
|
<select name="parent" data-bind="options: parentFolderSelectList, value: parentFolder,
|
||||||
optionsText: 'name', optionsValue: 'id', optionsAfterRender: defaultOptionsAfterRender"></select>
|
optionsText: 'name', optionsValue: 'id', optionsAfterRender: defaultOptionsAfterRender"></select>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label data-i18n="GLOBAL/NAME"></label>
|
<label data-i18n="GLOBAL/NAME"></label>
|
||||||
<input name="folder" type="text"
|
<input name="folder" type="text"
|
||||||
autofocus="" autocomplete="off" autocorrect="off" autocapitalize="off"
|
autofocus="" autocomplete="off" autocorrect="off" autocapitalize="off"
|
||||||
required="" pattern="^[^\\/]+$" data-bind="textInput: folderName">
|
required="" pattern="^[^\\/]+$" data-bind="textInput: name">
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group" data-bind="component: {
|
<div class="control-group" data-bind="component: {
|
||||||
name: 'Checkbox',
|
name: 'Checkbox',
|
||||||
params: {
|
params: {
|
||||||
name: 'subscribe',
|
name: 'subscribe',
|
||||||
label: 'SETTINGS_FOLDERS/BUTTON_SUBSCRIBE',
|
label: 'SETTINGS_FOLDERS/BUTTON_SUBSCRIBE',
|
||||||
value: folderSubscribe
|
value: subscribe
|
||||||
}
|
}
|
||||||
}"></div>
|
}"></div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue