mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-31 21:19:21 +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 { Notification } from 'Common/Enums';
|
||||
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
||||
import { defaultOptionsAfterRender } from 'Common/Utils';
|
||||
import { folderListOptionsBuilder, sortFolders } from 'Common/Folders';
|
||||
import { getNotification } from 'Common/Translator';
|
||||
|
||||
import { FolderUserStore } from 'Stores/User/Folder';
|
||||
//import { SettingsUserStore } from 'Stores/User/Settings';
|
||||
|
||||
import Remote from 'Remote/User/Fetch';
|
||||
|
||||
|
|
@ -21,10 +19,9 @@ export class FolderCreatePopupView extends AbstractViewPopup {
|
|||
super('FolderCreate');
|
||||
|
||||
addObservablesTo(this, {
|
||||
folderName: '',
|
||||
folderSubscribe: true,//SettingsUserStore.hideUnsubscribed(),
|
||||
|
||||
selectedParentValue: UNUSED_OPTION_VALUE
|
||||
name: '',
|
||||
subscribe: true,
|
||||
parentFolder: ''
|
||||
});
|
||||
|
||||
this.parentFolderSelectList = koComputable(() =>
|
||||
|
|
@ -46,9 +43,8 @@ export class FolderCreatePopupView extends AbstractViewPopup {
|
|||
submitForm(form) {
|
||||
if (form.reportValidity()) {
|
||||
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) {
|
||||
data.set('parent', FolderUserStore.namespace.slice(0, FolderUserStore.namespace.length - 1));
|
||||
}
|
||||
|
|
@ -79,7 +75,8 @@ export class FolderCreatePopupView extends AbstractViewPopup {
|
|||
}
|
||||
|
||||
onShow() {
|
||||
this.folderName('');
|
||||
this.selectedParentValue('');
|
||||
this.name('');
|
||||
this.subscribe(true);
|
||||
this.parentFolder('');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ trait Folders
|
|||
$oFolder = $this->MailClient()->FolderCreate(
|
||||
$this->GetActionParam('folder', ''),
|
||||
$this->GetActionParam('parent', ''),
|
||||
!!$this->GetActionParam('subscribe', 1)
|
||||
!empty($this->GetActionParam('subscribe', 0))
|
||||
);
|
||||
|
||||
// FolderInformation(string $sFolderName, int $iPrevUidNext = 0, array $aUids = array())
|
||||
|
|
@ -121,7 +121,7 @@ trait Folders
|
|||
$this->initMailClientConnection();
|
||||
|
||||
$sFolderFullName = $this->GetActionParam('folder', '');
|
||||
$bSubscribe = '1' === (string) $this->GetActionParam('subscribe', '0');
|
||||
$bSubscribe = !empty($this->GetActionParam('subscribe', 0));
|
||||
|
||||
try
|
||||
{
|
||||
|
|
@ -183,7 +183,7 @@ trait Folders
|
|||
$this->MailClient()->FolderMove(
|
||||
$this->GetActionParam('folder', ''),
|
||||
$this->GetActionParam('newFolder', ''),
|
||||
!!$this->GetActionParam('subscribe', 1)
|
||||
!empty($this->GetActionParam('subscribe', 1))
|
||||
);
|
||||
}
|
||||
catch (\Throwable $oException)
|
||||
|
|
@ -207,7 +207,7 @@ trait Folders
|
|||
$sFullName = $this->MailClient()->FolderRename(
|
||||
$this->GetActionParam('folder', ''),
|
||||
$sName,
|
||||
!!$this->GetActionParam('subscribe', 1)
|
||||
!empty($this->GetActionParam('subscribe', 1))
|
||||
);
|
||||
}
|
||||
catch (\Throwable $oException)
|
||||
|
|
|
|||
|
|
@ -5,21 +5,21 @@
|
|||
<form id="createfolderform" class="modal-body form-horizontal" autocomplete="off" spellcheck="false" data-bind="submit: submitForm">
|
||||
<div class="control-group">
|
||||
<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>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label data-i18n="GLOBAL/NAME"></label>
|
||||
<input name="folder" type="text"
|
||||
autofocus="" autocomplete="off" autocorrect="off" autocapitalize="off"
|
||||
required="" pattern="^[^\\/]+$" data-bind="textInput: folderName">
|
||||
required="" pattern="^[^\\/]+$" data-bind="textInput: name">
|
||||
</div>
|
||||
<div class="control-group" data-bind="component: {
|
||||
name: 'Checkbox',
|
||||
params: {
|
||||
name: 'subscribe',
|
||||
label: 'SETTINGS_FOLDERS/BUTTON_SUBSCRIBE',
|
||||
value: folderSubscribe
|
||||
value: subscribe
|
||||
}
|
||||
}"></div>
|
||||
</form>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue