Code refactoring

Flow first look
This commit is contained in:
RainLoop Team 2016-09-10 01:38:16 +03:00
parent 2f841524cb
commit e6e0b02849
71 changed files with 2092 additions and 1836 deletions

View file

@ -90,7 +90,7 @@ module.exports = {
'no-lone-blocks': 2, 'no-lone-blocks': 2,
'no-loop-func': 2, 'no-loop-func': 2,
// 'no-magic-numbers': [2, { // 'no-magic-numbers': [2, {
// 'ignore': [-1, 0, 1, 2], // 'ignore': [-1, 0, 1, 2, 10, 100],
// 'ignoreArrayIndexes': true // 'ignoreArrayIndexes': true
// }], // }],
'no-multi-spaces': 2, 'no-multi-spaces': 2,

23
.flowconfig Normal file
View file

@ -0,0 +1,23 @@
[ignore]
.*/node_modules/.*
.*/vendors/.*
.*/rainloop/.*
.*/plugins/.*
.*/build/.*
.*/asserts/.*
[include]
[libs]
./dev/
[options]
module.system=haste
esproposal.class_static_fields=enable
esproposal.class_instance_fields=enable
experimental.strict_type_args=true
unsafe.enable_getters_and_setters=true

View file

@ -437,11 +437,12 @@ class AppUser extends AbstractApp
const prom = Promises.foldersReload(FolderStore.foldersLoading); const prom = Promises.foldersReload(FolderStore.foldersLoading);
if (callback) if (callback)
{ {
prom.then((value) => { prom.then((value) => !!value).then(callback).catch(() => {
callback(!!value);
}).catch(() => {
_.delay(() => { _.delay(() => {
callback(false); if (callback)
{
callback(false); // eslint-disable-line callback-return
}
}, 1); }, 1);
}); });
} }

View file

@ -7,18 +7,20 @@ import {trim} from 'Common/Utils';
class Audio class Audio
{ {
notificator = null;
player = null;
supported = false;
supportedMp3 = false;
supportedOgg = false;
supportedWav = false;
supportedNotification = false;
constructor() { constructor() {
this.notificator = null;
this.supportedMp3 = false;
this.supportedOgg = false;
this.supportedWav = false;
this.supportedNotification = false;
this.player = this.createNewObject(); this.player = this.createNewObject();
this.supported = !bMobileDevice && !bSafari && !!this.player && !!this.player.play; this.supported = !bMobileDevice && !bSafari && !!this.player && !!this.player.play;
if (this.supported && this.player.canPlayType) if (this.supported && this.player && this.player.canPlayType)
{ {
this.supportedMp3 = '' !== this.player.canPlayType('audio/mpeg;').replace(/no/, ''); this.supportedMp3 = '' !== this.player.canPlayType('audio/mpeg;').replace(/no/, '');
this.supportedWav = '' !== this.player.canPlayType('audio/wav; codecs="1"').replace(/no/, ''); this.supportedWav = '' !== this.player.canPlayType('audio/wav; codecs="1"').replace(/no/, '');
@ -35,7 +37,7 @@ class Audio
this.supportedNotification = false; this.supportedNotification = false;
} }
if (this.supported) if (this.supported && this.player)
{ {
const stopFn = () => this.stop(); const stopFn = () => this.stop();
@ -137,4 +139,4 @@ class Audio
} }
} }
module.exports = new Audio(); export default new Audio();

View file

@ -6,6 +6,8 @@ import {CLIENT_SIDE_STORAGE_INDEX_NAME} from 'Common/Consts';
class LocalStorageDriver class LocalStorageDriver
{ {
s = null;
constructor() { constructor() {
this.s = window.localStorage || null; this.s = window.localStorage || null;
} }

View file

@ -4,7 +4,7 @@ import $ from '$';
import _ from '_'; import _ from '_';
import ko from 'ko'; import ko from 'ko';
import {$html, $body} from 'Common/Globals'; import {$html, $body} from 'Common/Globals';
import {EventKeyCode} from 'Common/Enums'; import {EventKeyCode, Magics} from 'Common/Enums';
import {trim, inArray, changeTheme} from 'Common/Utils'; import {trim, inArray, changeTheme} from 'Common/Utils';
import {reload as translatorReload} from 'Common/Translator'; import {reload as translatorReload} from 'Common/Translator';
@ -111,25 +111,28 @@ function cmdVersion() {
class CmdContoller class CmdContoller
{ {
dom = null;
opened = ko.observable(false);
cmd = ko.observable('');
focused = ko.observable(false);
themes = ThemeStore.themes;
cmdHistory = [];
cmdHistoryShift = 0;
cmdHelper = ko.observable('');
cmds = ['help', 'version', 'glass', 'clear', 'theme', 'lang'];
cmdsWithParameters = ['theme', 'lang'];
isAdmin = false;
constructor(dom) constructor(dom)
{ {
this.dom = dom; this.dom = dom;
this.isAdmin = !!Settings.appSettingsGet('admin');
this.opened = ko.observable(false);
this.cmd = ko.observable('');
this.focused = ko.observable(false);
this.themes = ThemeStore.themes;
this.cmdHistory = [];
this.cmdHistoryShift = 0;
this.cmdHelper = ko.observable('');
this.cmds = ['help', 'version', 'glass', 'clear', 'theme', 'lang'];
this.cmdsWithParameters = ['theme', 'lang'];
this.isAdmin = Settings.appSettingsGet('admin');
} }
runCmd(cmd, params, isTab) { runCmd(cmd, params, isTab) {
@ -377,11 +380,14 @@ export function toggle()
if (contoller.opened()) if (contoller.opened())
{ {
_.delay(() => { _.delay(() => {
if (contoller && contoller.focused)
{
contoller.focused(true); contoller.focused(true);
}, 50); }
}, Magics.Time50ms);
} }
} }
}, 50); }, Magics.Time50ms);
} }
} }

View file

@ -3,13 +3,27 @@ import window from 'window';
import _ from '_'; import _ from '_';
import $ from '$'; import $ from '$';
import {htmlEditorDefaultConfig, htmlEditorLangsMap} from 'Common/Globals'; import {htmlEditorDefaultConfig, htmlEditorLangsMap} from 'Common/Globals';
import {EventKeyCode} from 'Common/Enums'; import {EventKeyCode, Magics} from 'Common/Enums';
import * as Settings from 'Storage/Settings'; import * as Settings from 'Storage/Settings';
class HtmlEditor class HtmlEditor
{ {
editor;
blurTimer = 0;
__resizable = false;
__inited = false;
onBlur = null;
onReady = null;
onModeChange = null;
element;
$element;
resize;
/** /**
* @constructor
* @param {Object} element * @param {Object} element
* @param {Function=} onBlur * @param {Function=} onBlur
* @param {Function=} onReady * @param {Function=} onReady
@ -17,9 +31,6 @@ class HtmlEditor
*/ */
constructor(element, onBlur = null, onReady = null, onModeChange = null) constructor(element, onBlur = null, onReady = null, onModeChange = null)
{ {
this.editor = null;
this.blurTimer = 0;
this.onBlur = onBlur; this.onBlur = onBlur;
this.onReady = onReady; this.onReady = onReady;
this.onModeChange = onModeChange; this.onModeChange = onModeChange;
@ -27,20 +38,25 @@ class HtmlEditor
this.element = element; this.element = element;
this.$element = $(element); this.$element = $(element);
this.resize = _.throttle(_.bind(this.resize, this), 100); this.resize = _.throttle(_.bind(this.resizeEditor, this), 100);
this.__inited = false;
this.init(); this.init();
} }
runOnBlur() {
if (this.onBlur)
{
this.onBlur();
}
}
blurTrigger() { blurTrigger() {
if (this.onBlur) if (this.onBlur)
{ {
window.clearTimeout(this.blurTimer); window.clearTimeout(this.blurTimer);
this.blurTimer = window.setTimeout(() => { this.blurTimer = window.setTimeout(() => {
this.onBlur(); this.runOnBlur();
}, 200); }, Magics.Time200ms);
} }
} }
@ -198,8 +214,7 @@ class HtmlEditor
if (this.editor && this.__inited && 'wysiwyg' === this.editor.mode) if (this.editor && this.__inited && 'wysiwyg' === this.editor.mode)
{ {
try { try {
this.editor.setData( this.editor.setData(this.editor.getData().replace(find, replaceHtml));
this.editor.getData().replace(find, replaceHtml));
} }
catch (e) {} // eslint-disable-line no-empty catch (e) {} // eslint-disable-line no-empty
} }
@ -387,7 +402,7 @@ class HtmlEditor
} }
} }
resize() { resizeEditor() {
if (this.editor && this.__resizable) if (this.editor && this.__resizable)
{ {
try { try {

View file

@ -8,8 +8,31 @@ import {isArray, inArray, noop, noopTrue} from 'Common/Utils';
class Selector class Selector
{ {
list;
listChecked;
isListChecked;
focusedItem;
selectedItem;
itemSelectedThrottle;
selectedItemUseCallback = true;
iSelectNextHelper = 0;
iFocusedNextHelper = 0;
oContentVisible;
oContentScrollable;
sItemSelector;
sItemSelectedSelector;
sItemCheckedSelector;
sItemFocusedSelector;
sLastUid = '';
oCallbacks = {};
/** /**
* @constructor
* @param {koProperty} koList * @param {koProperty} koList
* @param {koProperty} koSelectedItem * @param {koProperty} koSelectedItem
* @param {koProperty} koFocusedItem * @param {koProperty} koFocusedItem
@ -28,7 +51,6 @@ class Selector
this.focusedItem = koFocusedItem || ko.observable(null); this.focusedItem = koFocusedItem || ko.observable(null);
this.selectedItem = koSelectedItem || ko.observable(null); this.selectedItem = koSelectedItem || ko.observable(null);
this.selectedItemUseCallback = true;
this.itemSelectedThrottle = _.debounce(_.bind(this.itemSelected, this), 300); this.itemSelectedThrottle = _.debounce(_.bind(this.itemSelected, this), 300);
@ -79,19 +101,11 @@ class Selector
this.selectedItem = this.selectedItem.extend({toggleSubscribeProperty: [this, 'selected']}); this.selectedItem = this.selectedItem.extend({toggleSubscribeProperty: [this, 'selected']});
this.focusedItem = this.focusedItem.extend({toggleSubscribeProperty: [null, 'focused']}); this.focusedItem = this.focusedItem.extend({toggleSubscribeProperty: [null, 'focused']});
this.iSelectNextHelper = 0;
this.iFocusedNextHelper = 0;
this.oContentVisible = null;
this.oContentScrollable = null;
this.sItemSelector = sItemSelector; this.sItemSelector = sItemSelector;
this.sItemSelectedSelector = sItemSelectedSelector; this.sItemSelectedSelector = sItemSelectedSelector;
this.sItemCheckedSelector = sItemCheckedSelector; this.sItemCheckedSelector = sItemCheckedSelector;
this.sItemFocusedSelector = sItemFocusedSelector; this.sItemFocusedSelector = sItemFocusedSelector;
this.sLastUid = '';
this.oCallbacks = {};
this.focusedItem.subscribe((item) => { this.focusedItem.subscribe((item) => {
if (item) if (item)
{ {
@ -253,7 +267,7 @@ class Selector
mFocused = null; mFocused = null;
mSelected = null; mSelected = null;
}, this); });
} }
itemSelected(item) { itemSelected(item) {

View file

@ -216,8 +216,10 @@ export function initOnStartOrLangChange(startCallback, langCallback = null)
{ {
startCallback(); startCallback();
} }
if (langCallback)
{
langCallback(); langCallback();
}
}); });
} }
else if (startCallback) else if (startCallback)

View file

@ -508,26 +508,16 @@ export function createCommandLegacy(context, fExecute, fCanExecute = true)
if (isFunc(fCanExecute)) if (isFunc(fCanExecute))
{ {
fResult.canExecute = ko.computed(() => fResult.enabled() && fCanExecute.call(context)); fResult.canExecute = ko.computed(() => fResult && fResult.enabled() && fCanExecute.call(context));
} }
else else
{ {
fResult.canExecute = ko.computed(() => fResult.enabled() && !!fCanExecute); fResult.canExecute = ko.computed(() => fResult && fResult.enabled() && !!fCanExecute);
} }
return fResult; return fResult;
} }
/**
* @param {Function} fExecute
* @param {(Function|boolean|null)=} fCanExecute = true
* @returns {Function}
*/
export function createCommand(fExecute, fCanExecute = true)
{
return createCommandLegacy(null, fExecute, fCanExecute);
}
/** /**
* @param {string} theme * @param {string} theme
* @returns {string} * @returns {string}
@ -1264,8 +1254,8 @@ export function changeTheme(value, themeTrigger = noop)
if (url) if (url)
{ {
url = url.toString().replace(/\/-\/[^\/]+\/\-\//, '/-/' + value + '/-/'); url = url.toString().replace(/\/-\/[^\/]+\/\-\//, '/-/' + value + '/-/');
url = url.toString().replace(/\/Css\/[^\/]+\/User\//, '/Css/0/User/'); url = url.replace(/\/Css\/[^\/]+\/User\//, '/Css/0/User/');
url = url.toString().replace(/\/Hash\/[^\/]+\//, '/Hash/-/'); url = url.replace(/\/Hash\/[^\/]+\//, '/Hash/-/');
if ('Json/' !== url.substring(url.length - 5, url.length)) if ('Json/' !== url.substring(url.length - 5, url.length))
{ {

View file

@ -6,7 +6,6 @@ import {AbstractComponent} from 'Component/Abstract';
class AbstracCheckbox extends AbstractComponent class AbstracCheckbox extends AbstractComponent
{ {
/** /**
* @constructor
* @param {Object} params = {} * @param {Object} params = {}
*/ */
constructor(params = {}) { constructor(params = {}) {

View file

@ -7,7 +7,6 @@ import {AbstractComponent} from 'Component/Abstract';
class AbstracRadio extends AbstractComponent class AbstracRadio extends AbstractComponent
{ {
/** /**
* @constructor
* @param {Object} params * @param {Object} params
*/ */
constructor(params) { constructor(params) {

View file

@ -5,9 +5,7 @@ import {isUnd} from 'Common/Utils';
class AbstractComponent class AbstractComponent
{ {
constructor() { disposable = [];
this.disposable = [];
}
dispose() { dispose() {
this.disposable.forEach((funcToDispose) => { this.disposable.forEach((funcToDispose) => {

View file

@ -7,7 +7,6 @@ import {AbstractComponent} from 'Component/Abstract';
class AbstractInput extends AbstractComponent class AbstractInput extends AbstractComponent
{ {
/** /**
* @constructor
* @param {Object} params * @param {Object} params
*/ */
constructor(params) { constructor(params) {

View file

@ -7,7 +7,6 @@ import {AbstracCheckbox} from 'Component/AbstracCheckbox';
class CheckboxMaterialDesignComponent extends AbstracCheckbox class CheckboxMaterialDesignComponent extends AbstracCheckbox
{ {
/** /**
* @constructor
* @param {Object} params * @param {Object} params
*/ */
constructor(params) { constructor(params) {

View file

@ -6,7 +6,6 @@ import {AbstractComponent, componentExportHelper} from 'Component/Abstract';
class SaveTriggerComponent extends AbstractComponent class SaveTriggerComponent extends AbstractComponent
{ {
/** /**
* @constructor
* @param {Object} params * @param {Object} params
*/ */
constructor(params) { constructor(params) {

View file

@ -5,7 +5,6 @@ import {AbstractComponent, componentExportHelper} from 'Component/Abstract';
class ScriptComponent extends AbstractComponent class ScriptComponent extends AbstractComponent
{ {
/** /**
* @constructor
* @param {Object} params * @param {Object} params
*/ */
constructor(params) { constructor(params) {

View file

@ -7,7 +7,6 @@ import {AbstractInput} from 'Component/AbstractInput';
class SelectComponent extends AbstractInput class SelectComponent extends AbstractInput
{ {
/** /**
* @constructor
* @param {Object} params * @param {Object} params
*/ */
constructor(params) { constructor(params) {

View file

@ -8,7 +8,6 @@ const DEFAULT_ROWS = 5;
class TextAreaComponent extends AbstractInput class TextAreaComponent extends AbstractInput
{ {
/** /**
* @constructor
* @param {Object} params * @param {Object} params
*/ */
constructor(params) { constructor(params) {

12
dev/External/ko.js vendored
View file

@ -581,7 +581,7 @@ ko.bindingHandlers.initFixedTrigger = {
if ($container) if ($container)
{ {
$win.resize(() => { $win.resize(() => {
const offset = $container.offset(); const offset = $container ? $container.offset() : null;
if (offset && offset.top) if (offset && offset.top)
{ {
$el.css('top', offset.top + top); $el.css('top', offset.top + top);
@ -654,7 +654,10 @@ ko.bindingHandlers.draggable = {
handle: '.dragHandle', handle: '.dragHandle',
cursorAt: {top: 22, left: 3}, cursorAt: {top: 22, left: 3},
refreshPositions: true, refreshPositions: true,
scroll: true scroll: true,
drag: null,
stop: null,
helper: null
}; };
if (droppableSelector) if (droppableSelector)
@ -733,7 +736,10 @@ ko.bindingHandlers.droppable = {
fOutCallback = fAllValueFunc && fAllValueFunc.droppableOut ? fAllValueFunc.droppableOut : null, fOutCallback = fAllValueFunc && fAllValueFunc.droppableOut ? fAllValueFunc.droppableOut : null,
conf = { conf = {
tolerance: 'pointer', tolerance: 'pointer',
hoverClass: 'droppableHover' hoverClass: 'droppableHover',
drop: null,
over: null,
out: null
}; };
if (fValueFunc) if (fValueFunc)

View file

@ -4,13 +4,15 @@ import {isArray, disposeObject} from 'Common/Utils';
class AbstractModel class AbstractModel
{ {
sModelName = '';
disposables = [];
/** /**
* @param {string} modelName * @param {string} modelName = ''
*/ */
constructor(modelName) constructor(modelName = '')
{ {
this.sModelName = modelName || ''; this.sModelName = modelName || '';
this.disposables = [];
} }
regDisposables(value) { regDisposables(value) {

View file

@ -5,9 +5,12 @@ import {isArray, isNonEmptyArray, noop} from 'Common/Utils';
class AbstractScreen class AbstractScreen
{ {
oCross = null;
sScreenName;
aViewModels;
constructor(screenName, viewModels = []) constructor(screenName, viewModels = [])
{ {
this.oCross = null;
this.sScreenName = screenName; this.sScreenName = screenName;
this.aViewModels = isArray(viewModels) ? viewModels : []; this.aViewModels = isArray(viewModels) ? viewModels : [];
} }
@ -54,8 +57,11 @@ class AbstractScreen
fMatcher = _.bind(this.onRoute || noop, this); fMatcher = _.bind(this.onRoute || noop, this);
route = crossroads.create(); route = crossroads.create();
_.each(routes, (aItem) => { _.each(routes, (item) => {
route.addRoute(aItem[0], fMatcher).rules = aItem[1]; if (item && route)
{
route.addRoute(item[0], fMatcher).rules = item[1];
}
}); });
this.oCross = route; this.oCross = route;

View file

@ -7,18 +7,16 @@ import {$win, keyScope} from 'Common/Globals';
class AbstractViewNext class AbstractViewNext
{ {
constructor() { bDisabeCloseOnEsc = false;
this.bDisabeCloseOnEsc = false; sDefaultKeyScope = KeyState.None;
this.sDefaultKeyScope = KeyState.None; sCurrentKeyScope = KeyState.None;
this.sCurrentKeyScope = this.sDefaultKeyScope;
this.viewModelVisibility = ko.observable(false); viewModelVisibility = ko.observable(false);
this.modalVisibility = ko.observable(false).extend({rateLimit: 0}); modalVisibility = ko.observable(false).extend({rateLimit: 0});
this.viewModelName = ''; viewModelName = '';
this.viewModelNames = []; viewModelNames = [];
this.viewModelDom = null; viewModelDom = null;
}
/** /**
* @returns {void} * @returns {void}

View file

@ -10,7 +10,7 @@ import {$html, aViewModels as VIEW_MODELS, popupVisibilityNames} from 'Common/Gl
import { import {
isArray, isUnd, pString, log, isFunc, isArray, isUnd, pString, log, isFunc,
createCommand, delegateRun, isNonEmptyArray createCommandLegacy, delegateRun, isNonEmptyArray
} from 'Common/Utils'; } from 'Common/Utils';
let let
@ -35,6 +35,16 @@ export function hideLoading()
$('#rl-loading').hide().remove(); $('#rl-loading').hide().remove();
} }
/**
* @param {Function} fExecute
* @param {(Function|boolean|null)=} fCanExecute = true
* @returns {Function}
*/
export function createCommand(fExecute, fCanExecute = true)
{
return createCommandLegacy(null, fExecute, fCanExecute);
}
/** /**
* @param {Function} SettingsViewModelClass * @param {Function} SettingsViewModelClass
* @param {string} template * @param {string} template
@ -98,15 +108,35 @@ export function screen(screenName)
return ('' !== screenName && !isUnd(SCREENS[screenName])) ? SCREENS[screenName] : null; return ('' !== screenName && !isUnd(SCREENS[screenName])) ? SCREENS[screenName] : null;
} }
/**
* @param {Function} ViewModelClassToShow
* @returns {Function|null}
*/
export function getScreenPopup(PopuViewModelClass)
{
let result = null;
if (PopuViewModelClass)
{
result = PopuViewModelClass;
if (PopuViewModelClass.default)
{
result = PopuViewModelClass.default;
}
}
return result;
}
/** /**
* @param {Function} ViewModelClassToHide * @param {Function} ViewModelClassToHide
* @returns {void} * @returns {void}
*/ */
export function hideScreenPopup(ViewModelClassToHide) export function hideScreenPopup(ViewModelClassToHide)
{ {
if (ViewModelClassToHide && ViewModelClassToHide.__vm && ViewModelClassToHide.__dom) const ModalView = getScreenPopup(ViewModelClassToHide);
if (ModalView && ModalView.__vm && ModalView.__dom)
{ {
ViewModelClassToHide.__vm.modalVisibility(false); ModalView.__vm.modalVisibility(false);
} }
} }
@ -231,19 +261,20 @@ export function buildViewModel(ViewModelClass, vmScreen)
*/ */
export function showScreenPopup(ViewModelClassToShow, params = []) export function showScreenPopup(ViewModelClassToShow, params = [])
{ {
if (ViewModelClassToShow) const ModalView = getScreenPopup(ViewModelClassToShow);
if (ModalView)
{ {
buildViewModel(ViewModelClassToShow); buildViewModel(ModalView);
if (ViewModelClassToShow.__vm && ViewModelClassToShow.__dom) if (ModalView.__vm && ModalView.__dom)
{ {
delegateRun(ViewModelClassToShow.__vm, 'onBeforeShow', params || []); delegateRun(ModalView.__vm, 'onBeforeShow', params || []);
ViewModelClassToShow.__vm.modalVisibility(true); ModalView.__vm.modalVisibility(true);
delegateRun(ViewModelClassToShow.__vm, 'onShow', params || []); delegateRun(ModalView.__vm, 'onShow', params || []);
vmRunHook('view-model-on-show', ViewModelClassToShow, params || []); vmRunHook('view-model-on-show', ModalView, params || []);
} }
} }
} }
@ -254,13 +285,14 @@ export function showScreenPopup(ViewModelClassToShow, params = [])
*/ */
export function warmUpScreenPopup(ViewModelClassToShow) export function warmUpScreenPopup(ViewModelClassToShow)
{ {
if (ViewModelClassToShow) const ModalView = getScreenPopup(ViewModelClassToShow);
if (ModalView)
{ {
buildViewModel(ViewModelClassToShow); buildViewModel(ModalView);
if (ViewModelClassToShow.__vm && ViewModelClassToShow.__dom) if (ModalView.__vm && ModalView.__dom)
{ {
delegateRun(ViewModelClassToShow.__vm, 'onWarmUp'); delegateRun(ModalView.__vm, 'onWarmUp');
} }
} }
} }
@ -271,7 +303,8 @@ export function warmUpScreenPopup(ViewModelClassToShow)
*/ */
export function isPopupVisible(ViewModelClassToShow) export function isPopupVisible(ViewModelClassToShow)
{ {
return ViewModelClassToShow && ViewModelClassToShow.__vm ? ViewModelClassToShow.__vm.modalVisibility() : false; const ModalView = getScreenPopup(ViewModelClassToShow);
return ModalView && ModalView.__vm ? ModalView.__vm.modalVisibility() : false;
} }
/** /**
@ -394,7 +427,7 @@ export function screenOnRoute(screenName, subPart)
} }
// -- // --
cross = vmScreen.__cross ? vmScreen.__cross() : null; cross = vmScreen && vmScreen.__cross ? vmScreen.__cross() : null;
if (cross) if (cross)
{ {
cross.parse(subPart); cross.parse(subPart);
@ -515,6 +548,15 @@ function viewDecorator({name, type, templateID})
}; };
} }
/**
* @param {Object} params
* @returns {Function}
*/
function popupDecorator({name, templateID})
{
return viewDecorator({name, type: ViewType.Popup, templateID});
}
/** /**
* @param {Function} canExecute * @param {Function} canExecute
* @returns {Function} * @returns {Function}
@ -548,4 +590,8 @@ function commandDecorator(canExecute = true)
}; };
} }
export {commandDecorator, commandDecorator as command, viewDecorator, viewDecorator as view, viewDecorator as viewModel}; export {
commandDecorator, commandDecorator as command,
viewDecorator, viewDecorator as view, viewDecorator as viewModel,
popupDecorator, popupDecorator as popup
};

View file

@ -3,6 +3,11 @@ import {trim, pString, encodeHtml} from 'Common/Utils';
class EmailModel class EmailModel
{ {
email = '';
name = '';
dkimStatus = '';
dkimValue = '';
/** /**
* @param {string=} email = '' * @param {string=} email = ''
* @param {string=} name = '' * @param {string=} name = ''

View file

@ -14,9 +14,11 @@ import {AbstractBasicPromises} from 'Promises/AbstractBasic';
class AbstractAjaxPromises extends AbstractBasicPromises class AbstractAjaxPromises extends AbstractBasicPromises
{ {
oRequests = {};
constructor() { constructor() {
super(); super();
this.oRequests = {};
this.clear(); this.clear();
} }

View file

@ -5,9 +5,7 @@ import {isArray} from 'Common/Utils';
class AbstractBasicPromises class AbstractBasicPromises
{ {
constructor() { oPromisesStack = {};
this.oPromisesStack = {};
}
func(fFunc) { func(fFunc) {
fFunc(); fFunc();

View file

@ -86,9 +86,10 @@ class AbstractSettingsScreen extends AbstractScreen
RoutedSettingsViewModel.__builded = true; RoutedSettingsViewModel.__builded = true;
RoutedSettingsViewModel.__vm = settingsScreen; RoutedSettingsViewModel.__vm = settingsScreen;
const tmpl = {name: RoutedSettingsViewModel.__rlSettingsData.Template};
ko.applyBindingAccessorsToNode(viewModelDom[0], { ko.applyBindingAccessorsToNode(viewModelDom[0], {
translatorInit: true, translatorInit: true,
template: () => ({name: RoutedSettingsViewModel.__rlSettingsData.Template}) template: () => tmpl
}, settingsScreen); }, settingsScreen);
delegateRun(settingsScreen, 'onBuild', [viewModelDom]); delegateRun(settingsScreen, 'onBuild', [viewModelDom]);

View file

@ -4,13 +4,15 @@ import ko from 'ko';
import { import {
settingsSaveHelperSimpleFunction, settingsSaveHelperSimpleFunction,
defautOptionsAfterRender, createCommand, defautOptionsAfterRender,
inArray, trim, boolToAjax inArray, trim, boolToAjax
} from 'Common/Utils'; } from 'Common/Utils';
import {SaveSettingsStep, StorageResultType, Magics} from 'Common/Enums'; import {SaveSettingsStep, StorageResultType, Magics} from 'Common/Enums';
import {i18n} from 'Common/Translator'; import {i18n} from 'Common/Translator';
import {settingsGet} from 'Storage/Settings'; import {settingsGet} from 'Storage/Settings';
import Remote from 'Remote/Admin/Ajax';
import {command} from 'Knoin/Knoin';
class ContactsAdminSettings class ContactsAdminSettings
{ {
@ -21,7 +23,6 @@ class ContactsAdminSettings
this.contactsSync = ko.observable(!!settingsGet('ContactsSync')); this.contactsSync = ko.observable(!!settingsGet('ContactsSync'));
const const
Remote = require('Remote/Admin/Ajax'),
supportedTypes = [], supportedTypes = [],
types = ['sqlite', 'mysql', 'pgsql'], types = ['sqlite', 'mysql', 'pgsql'],
getTypeName = (name) => { getTypeName = (name) => {
@ -111,8 +112,13 @@ class ContactsAdminSettings
this.testContactsError = ko.observable(false); this.testContactsError = ko.observable(false);
this.testContactsErrorMessage = ko.observable(''); this.testContactsErrorMessage = ko.observable('');
this.testContactsCommand = createCommand(() => { this.contactsType(settingsGet('ContactsPdoType'));
this.onTestContactsResponse = _.bind(this.onTestContactsResponse, this);
}
@command((self) => '' !== self.pdoDsn() && '' !== self.pdoUser())
testContactsCommand() {
this.testContactsSuccess(false); this.testContactsSuccess(false);
this.testContactsError(false); this.testContactsError(false);
this.testContactsErrorMessage(''); this.testContactsErrorMessage('');
@ -124,12 +130,6 @@ class ContactsAdminSettings
'ContactsPdoUser': this.pdoUser(), 'ContactsPdoUser': this.pdoUser(),
'ContactsPdoPassword': this.pdoPassword() 'ContactsPdoPassword': this.pdoPassword()
}); });
}, () => '' !== this.pdoDsn() && '' !== this.pdoUser());
this.contactsType(settingsGet('ContactsPdoType'));
this.onTestContactsResponse = _.bind(this.onTestContactsResponse, this);
} }
onTestContactsResponse(result, data) { onTestContactsResponse(result, data) {
@ -166,7 +166,6 @@ class ContactsAdminSettings
onBuild() { onBuild() {
_.delay(() => { _.delay(() => {
const const
Remote = require('Remote/Admin/Ajax'),
f1 = settingsSaveHelperSimpleFunction(this.pdoDsnTrigger, this), f1 = settingsSaveHelperSimpleFunction(this.pdoDsnTrigger, this),
f3 = settingsSaveHelperSimpleFunction(this.pdoUserTrigger, this), f3 = settingsSaveHelperSimpleFunction(this.pdoUserTrigger, this),
f4 = settingsSaveHelperSimpleFunction(this.pdoPasswordTrigger, this), f4 = settingsSaveHelperSimpleFunction(this.pdoPasswordTrigger, this),

View file

@ -2,7 +2,7 @@
import _ from '_'; import _ from '_';
import ko from 'ko'; import ko from 'ko';
import {createCommand, trim, boolToAjax} from 'Common/Utils'; import {trim, boolToAjax} from 'Common/Utils';
import {phpInfo} from 'Common/Links'; import {phpInfo} from 'Common/Links';
import {StorageResultType, Magics} from 'Common/Enums'; import {StorageResultType, Magics} from 'Common/Enums';
@ -13,6 +13,8 @@ import CapaAdminStore from 'Stores/Admin/Capa';
import Remote from 'Remote/Admin/Ajax'; import Remote from 'Remote/Admin/Ajax';
import {command} from 'Knoin/Knoin';
class SecurityAdminSettings class SecurityAdminSettings
{ {
constructor() { constructor() {
@ -77,7 +79,11 @@ class SecurityAdminSettings
this.adminPasswordNewError(false); this.adminPasswordNewError(false);
}); });
this.saveNewAdminPasswordCommand = createCommand(() => { this.onNewAdminPasswordResponse = _.bind(this.onNewAdminPasswordResponse, this);
}
@command((self) => '' !== trim(self.adminLogin()) && '' !== self.adminPassword())
saveNewAdminPasswordCommand() {
if ('' === trim(this.adminLogin())) if ('' === trim(this.adminLogin()))
{ {
@ -101,9 +107,6 @@ class SecurityAdminSettings
}); });
return true; return true;
}, () => '' !== trim(this.adminLogin()) && '' !== this.adminPassword());
this.onNewAdminPasswordResponse = _.bind(this.onNewAdminPasswordResponse, this);
} }
showTwoFactorDropper() { showTwoFactorDropper() {

View file

@ -3,12 +3,12 @@ import _ from '_';
import ko from 'ko'; import ko from 'ko';
import {StorageResultType, Notification} from 'Common/Enums'; import {StorageResultType, Notification} from 'Common/Enums';
import {createCommand} from 'Common/Utils';
import {getNotificationFromResponse, i18n} from 'Common/Translator'; import {getNotificationFromResponse, i18n} from 'Common/Translator';
import Remote from 'Remote/User/Ajax'; import Remote from 'Remote/User/Ajax';
import {getApp} from 'Helper/Apps/User'; import {getApp} from 'Helper/Apps/User';
import {command} from 'Knoin/Knoin';
class ChangePasswordUserSettings class ChangePasswordUserSettings
{ {
@ -43,7 +43,11 @@ class ChangePasswordUserSettings
this.passwordMismatch(false); this.passwordMismatch(false);
}); });
this.saveNewPasswordCommand = createCommand(() => { this.onChangePasswordResponse = _.bind(this.onChangePasswordResponse, this);
}
@command((self) => !self.changeProcess() && '' !== self.currentPassword() && '' !== self.newPassword() && '' !== self.newPassword2())
saveNewPasswordCommand() {
if (this.newPassword() !== this.newPassword2()) if (this.newPassword() !== this.newPassword2())
{ {
this.passwordMismatch(true); this.passwordMismatch(true);
@ -61,10 +65,6 @@ class ChangePasswordUserSettings
Remote.changePassword(this.onChangePasswordResponse, this.currentPassword(), this.newPassword()); Remote.changePassword(this.onChangePasswordResponse, this.currentPassword(), this.newPassword());
} }
}, () => !this.changeProcess() && '' !== this.currentPassword() && '' !== this.newPassword() && '' !== this.newPassword2());
this.onChangePasswordResponse = _.bind(this.onChangePasswordResponse, this);
} }
onHide() { onHide() {

View file

@ -2,20 +2,17 @@
import _ from '_'; import _ from '_';
import ko from 'ko'; import ko from 'ko';
import {windowResizeCallback, isArray, trim, delegateRunOnDestroy} from 'Common/Utils';
import {StorageResultType, Notification} from 'Common/Enums'; import {StorageResultType, Notification} from 'Common/Enums';
import {getNotification} from 'Common/Translator'; import {getNotification} from 'Common/Translator';
import {
windowResizeCallback, createCommand, isArray, trim, delegateRunOnDestroy
} from 'Common/Utils';
import {showScreenPopup} from 'Knoin/Knoin';
import FilterStore from 'Stores/User/Filter'; import FilterStore from 'Stores/User/Filter';
import Remote from 'Remote/User/Ajax'; import Remote from 'Remote/User/Ajax';
import {FilterModel} from 'Model/Filter'; import {FilterModel} from 'Model/Filter';
import {showScreenPopup, command} from 'Knoin/Knoin';
class FiltersUserSettings class FiltersUserSettings
{ {
constructor() { constructor() {
@ -46,7 +43,27 @@ class FiltersUserSettings
this.filterForDeletion = ko.observable(null).deleteAccessHelper(); this.filterForDeletion = ko.observable(null).deleteAccessHelper();
this.saveChanges = createCommand(() => { this.filters.subscribe(() => {
this.haveChanges(true);
});
this.filterRaw.subscribe(() => {
this.haveChanges(true);
this.filterRaw.error(false);
});
this.haveChanges.subscribe(() => {
this.saveErrorText('');
});
this.filterRaw.active.subscribe(() => {
this.haveChanges(true);
this.filterRaw.error(false);
});
}
@command((self) => self.haveChanges())
saveChangesCommand() {
if (!this.filters.saving()) if (!this.filters.saving())
{ {
if (this.filterRaw.active() && '' === trim(this.filterRaw())) if (this.filterRaw.active() && '' === trim(this.filterRaw()))
@ -79,25 +96,6 @@ class FiltersUserSettings
} }
return true; return true;
}, () => this.haveChanges());
this.filters.subscribe(() => {
this.haveChanges(true);
});
this.filterRaw.subscribe(() => {
this.haveChanges(true);
this.filterRaw.error(false);
});
this.haveChanges.subscribe(() => {
this.saveErrorText('');
});
this.filterRaw.active.subscribe(() => {
this.haveChanges(true);
this.filterRaw.error(false);
});
} }
scrollableOptions(wrapper) { scrollableOptions(wrapper) {

View file

@ -1,10 +1,10 @@
import {createCommand} from 'Common/Utils';
import SocialStore from 'Stores/Social'; import SocialStore from 'Stores/Social';
import {getApp} from 'Helper/Apps/User'; import {getApp} from 'Helper/Apps/User';
import {command} from 'Knoin/Knoin';
class SocialUserSettings class SocialUserSettings
{ {
constructor() { constructor() {
@ -29,39 +29,45 @@ class SocialUserSettings
this.twitterActions = SocialStore.twitter.loading; this.twitterActions = SocialStore.twitter.loading;
this.twitterLoggined = SocialStore.twitter.loggined; this.twitterLoggined = SocialStore.twitter.loggined;
this.twitterUserName = SocialStore.twitter.userName; this.twitterUserName = SocialStore.twitter.userName;
}
this.connectGoogle = createCommand(() => { @command((self) => !self.googleLoggined() && !self.googleActions())
connectGoogleCommand() {
if (!this.googleLoggined()) if (!this.googleLoggined())
{ {
getApp().googleConnect(); getApp().googleConnect();
} }
}, () => !this.googleLoggined() && !this.googleActions()); }
this.disconnectGoogle = createCommand(() => { @command()
disconnectGoogleCommand() {
getApp().googleDisconnect(); getApp().googleDisconnect();
}); }
this.connectFacebook = createCommand(() => { @command((self) => !self.facebookLoggined() && !self.facebookActions())
connectFacebookCommand() {
if (!this.facebookLoggined()) if (!this.facebookLoggined())
{ {
getApp().facebookConnect(); getApp().facebookConnect();
} }
}, () => !this.facebookLoggined() && !this.facebookActions()); }
this.disconnectFacebook = createCommand(() => { @command()
disconnectFacebookCommand() {
getApp().facebookDisconnect(); getApp().facebookDisconnect();
}); }
this.connectTwitter = createCommand(() => { @command((self) => !self.twitterLoggined() && !self.twitterActions())
connectTwitterCommand() {
if (!this.twitterLoggined()) if (!this.twitterLoggined())
{ {
getApp().twitterConnect(); getApp().twitterConnect();
} }
}, () => !this.twitterLoggined() && !this.twitterActions()); }
this.disconnectTwitter = createCommand(() => { @command()
disconnectTwitterCommand() {
getApp().twitterDisconnect(); getApp().twitterDisconnect();
});
} }
} }

View file

@ -2,19 +2,18 @@
import ko from 'ko'; import ko from 'ko';
import {StorageResultType, Notification} from 'Common/Enums'; import {StorageResultType, Notification} from 'Common/Enums';
import {trim, createCommand} from 'Common/Utils'; import {trim} from 'Common/Utils';
import {getNotification} from 'Common/Translator'; import {getNotification} from 'Common/Translator';
import Remote from 'Remote/User/Ajax'; import Remote from 'Remote/User/Ajax';
import {getApp} from 'Helper/Apps/User'; import {getApp} from 'Helper/Apps/User';
import {view, ViewType} from 'Knoin/Knoin'; import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext'; import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({ @popup({
name: 'View/Popup/Account', name: 'View/Popup/Account',
type: ViewType.Popup,
templateID: 'PopupsAccount' templateID: 'PopupsAccount'
}) })
class AccountPopupView extends AbstractViewNext class AccountPopupView extends AbstractViewNext
@ -43,8 +42,10 @@ class AccountPopupView extends AbstractViewNext
this.submitErrorAdditional = ko.observable(''); this.submitErrorAdditional = ko.observable('');
this.emailFocus = ko.observable(false); this.emailFocus = ko.observable(false);
}
this.addAccountCommand = createCommand(() => { @command((self) => !self.submitRequest())
addAccountCommand() {
this.emailError('' === trim(this.email())); this.emailError('' === trim(this.email()));
this.passwordError('' === trim(this.password())); this.passwordError('' === trim(this.password()));
@ -86,8 +87,6 @@ class AccountPopupView extends AbstractViewNext
}, this.email(), this.password(), this.isNew()); }, this.email(), this.password(), this.isNew());
return true; return true;
}, () => !this.submitRequest());
} }
clearPopup() { clearPopup() {
@ -118,4 +117,4 @@ class AccountPopupView extends AbstractViewNext
} }
} }
module.exports = AccountPopupView; export {AccountPopupView, AccountPopupView as default};

View file

@ -2,7 +2,7 @@
import ko from 'ko'; import ko from 'ko';
import {StorageResultType, Notification} from 'Common/Enums'; import {StorageResultType, Notification} from 'Common/Enums';
import {trim, isUnd, createCommand} from 'Common/Utils'; import {trim, isUnd} from 'Common/Utils';
import {RAINLOOP_TRIAL_KEY} from 'Common/Consts'; import {RAINLOOP_TRIAL_KEY} from 'Common/Consts';
import {i18n, getNotification} from 'Common/Translator'; import {i18n, getNotification} from 'Common/Translator';
@ -11,12 +11,11 @@ import * as Settings from 'Storage/Settings';
import Remote from 'Remote/Admin/Ajax'; import Remote from 'Remote/Admin/Ajax';
import LicenseStore from 'Stores/Admin/License'; import LicenseStore from 'Stores/Admin/License';
import {view, ViewType} from 'Knoin/Knoin'; import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext'; import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({ @popup({
name: 'View/Popup/Activate', name: 'View/Popup/Activate',
type: ViewType.Popup,
templateID: 'PopupsActivate' templateID: 'PopupsActivate'
}) })
class ActivatePopupView extends AbstractViewNext class ActivatePopupView extends AbstractViewNext
@ -48,8 +47,10 @@ class ActivatePopupView extends AbstractViewNext
this.licenseTrigger(!this.licenseTrigger()); this.licenseTrigger(!this.licenseTrigger());
} }
}); });
}
this.activateCommand = createCommand(() => { @command((self) => !self.activateProcess() && '' !== self.domain() && '' !== self.key() && !self.activationSuccessed())
activateCommand() {
this.activateProcess(true); this.activateProcess(true);
if (this.validateSubscriptionKey()) if (this.validateSubscriptionKey())
@ -94,8 +95,6 @@ class ActivatePopupView extends AbstractViewNext
this.activateText.isError(true); this.activateText.isError(true);
this.key.focus(true); this.key.focus(true);
} }
}, () => !this.activateProcess() && '' !== this.domain() && '' !== this.key() && !this.activationSuccessed());
} }
onShow(isTrial) { onShow(isTrial) {
@ -127,4 +126,4 @@ class ActivatePopupView extends AbstractViewNext
} }
} }
module.exports = ActivatePopupView; export {ActivatePopupView, ActivatePopupView as default};

View file

@ -1,17 +1,16 @@
import ko from 'ko'; import ko from 'ko';
import {trim, delegateRun, createCommand, log} from 'Common/Utils'; import {trim, delegateRun, log} from 'Common/Utils';
import PgpStore from 'Stores/User/Pgp'; import PgpStore from 'Stores/User/Pgp';
import {getApp} from 'Helper/Apps/User'; import {getApp} from 'Helper/Apps/User';
import {view, ViewType} from 'Knoin/Knoin'; import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext'; import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({ @popup({
name: 'View/Popup/AddOpenPgpKey', name: 'View/Popup/AddOpenPgpKey',
type: ViewType.Popup,
templateID: 'PopupsAddOpenPgpKey' templateID: 'PopupsAddOpenPgpKey'
}) })
class AddOpenPgpKeyPopupView extends AbstractViewNext class AddOpenPgpKeyPopupView extends AbstractViewNext
@ -28,8 +27,10 @@ class AddOpenPgpKeyPopupView extends AbstractViewNext
this.key.error(false); this.key.error(false);
this.key.errorMessage(''); this.key.errorMessage('');
}); });
}
this.addOpenPgpKeyCommand = createCommand(() => { @command()
addOpenPgpKeyCommand() {
const const
reg = /[\-]{3,6}BEGIN[\s]PGP[\s](PRIVATE|PUBLIC)[\s]KEY[\s]BLOCK[\-]{3,6}[\s\S]+?[\-]{3,6}END[\s]PGP[\s](PRIVATE|PUBLIC)[\s]KEY[\s]BLOCK[\-]{3,6}/gi, reg = /[\-]{3,6}BEGIN[\s]PGP[\s](PRIVATE|PUBLIC)[\s]KEY[\s]BLOCK[\-]{3,6}[\s\S]+?[\-]{3,6}END[\s]PGP[\s](PRIVATE|PUBLIC)[\s]KEY[\s]BLOCK[\-]{3,6}/gi,
@ -101,7 +102,6 @@ class AddOpenPgpKeyPopupView extends AbstractViewNext
delegateRun(this, 'cancelCommand'); delegateRun(this, 'cancelCommand');
return true; return true;
});
} }
clearPopup() { clearPopup() {
@ -119,4 +119,4 @@ class AddOpenPgpKeyPopupView extends AbstractViewNext
} }
} }
module.exports = AddOpenPgpKeyPopupView; export {AddOpenPgpKeyPopupView, AddOpenPgpKeyPopupView as default};

View file

@ -2,18 +2,17 @@
import _ from '_'; import _ from '_';
import ko from 'ko'; import ko from 'ko';
import {trim, createCommand} from 'Common/Utils'; import {trim} from 'Common/Utils';
import {i18n, trigger as translatorTrigger} from 'Common/Translator'; import {i18n, trigger as translatorTrigger} from 'Common/Translator';
import {searchSubtractFormatDateHelper} from 'Common/Momentor'; import {searchSubtractFormatDateHelper} from 'Common/Momentor';
import MessageStore from 'Stores/User/Message'; import MessageStore from 'Stores/User/Message';
import {view, ViewType} from 'Knoin/Knoin'; import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext'; import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({ @popup({
name: 'View/Popup/AdvancedSearch', name: 'View/Popup/AdvancedSearch',
type: ViewType.Popup,
templateID: 'PopupsAdvancedSearch' templateID: 'PopupsAdvancedSearch'
}) })
class AdvancedSearchPopupView extends AbstractViewNext class AdvancedSearchPopupView extends AbstractViewNext
@ -33,16 +32,6 @@ class AdvancedSearchPopupView extends AbstractViewNext
this.starred = ko.observable(false); this.starred = ko.observable(false);
this.unseen = ko.observable(false); this.unseen = ko.observable(false);
this.searchCommand = createCommand(() => {
const search = this.buildSearchString();
if ('' !== search)
{
MessageStore.mainMessageListSearch(search);
}
this.cancelCommand();
});
this.selectedDates = ko.computed(() => { this.selectedDates = ko.computed(() => {
translatorTrigger(); translatorTrigger();
return [ return [
@ -57,6 +46,17 @@ class AdvancedSearchPopupView extends AbstractViewNext
}); });
} }
@command()
searchCommand() {
const search = this.buildSearchString();
if ('' !== search)
{
MessageStore.mainMessageListSearch(search);
}
this.cancelCommand();
}
parseSearchStringValue(search) { parseSearchStringValue(search) {
const parts = (search || '').split(/[\s]+/g); const parts = (search || '').split(/[\s]+/g);
_.each(parts, (part) => { _.each(parts, (part) => {
@ -171,4 +171,4 @@ class AdvancedSearchPopupView extends AbstractViewNext
} }
} }
module.exports = AdvancedSearchPopupView; export {AdvancedSearchPopupView, AdvancedSearchPopupView as default};

View file

@ -6,12 +6,11 @@ import {KeyState} from 'Common/Enums';
import {isFunc} from 'Common/Utils'; import {isFunc} from 'Common/Utils';
import {i18n} from 'Common/Translator'; import {i18n} from 'Common/Translator';
import {view, ViewType} from 'Knoin/Knoin'; import {popup} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext'; import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({ @popup({
name: 'View/Popup/Ask', name: 'View/Popup/Ask',
type: ViewType.Popup,
templateID: 'PopupsAsk' templateID: 'PopupsAsk'
}) })
class AskPopupView extends AbstractViewNext class AskPopupView extends AbstractViewNext
@ -122,4 +121,4 @@ class AskPopupView extends AbstractViewNext
} }
} }
module.exports = AskPopupView; export {AskPopupView, AskPopupView as default};

View file

@ -13,7 +13,7 @@ import {
} from 'Common/Enums'; } from 'Common/Enums';
import { import {
trim, isArray, isNormal, createCommand, delegateRun, trim, isArray, isNormal, delegateRun,
isNonEmptyArray, clearBqSwitcher, replySubjectAdd, isNonEmptyArray, clearBqSwitcher, replySubjectAdd,
encodeHtml, noopFalse, inFocus, delegateRunOnDestroy, encodeHtml, noopFalse, inFocus, delegateRunOnDestroy,
pInt, isUnd pInt, isUnd
@ -46,12 +46,11 @@ import {ComposeAttachmentModel} from 'Model/ComposeAttachment';
import {getApp} from 'Helper/Apps/User'; import {getApp} from 'Helper/Apps/User';
import {view, ViewType, isPopupVisible, showScreenPopup, hideScreenPopup, routeOn, routeOff} from 'Knoin/Knoin'; import {popup, command, isPopupVisible, showScreenPopup, hideScreenPopup, routeOn, routeOff} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext'; import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({ @popup({
name: 'View/Popup/Compose', name: 'View/Popup/Compose',
type: ViewType.Popup,
templateID: 'PopupsCompose' templateID: 'PopupsCompose'
}) })
class ComposePopupView extends AbstractViewNext class ComposePopupView extends AbstractViewNext
@ -311,25 +310,47 @@ class ComposePopupView extends AbstractViewNext
this.canBeSentOrSaved = ko.computed(() => !this.sending() && !this.saving()); this.canBeSentOrSaved = ko.computed(() => !this.sending() && !this.saving());
this.deleteCommand = createCommand(() => {
const PopupsAskViewModel = require('View/Popup/Ask');
if (!isPopupVisible(PopupsAskViewModel) && this.modalVisibility())
{
showScreenPopup(PopupsAskViewModel, [i18n('POPUPS_ASK/DESC_WANT_DELETE_MESSAGES'), () => {
if (this.modalVisibility())
{
getApp().deleteMessagesFromFolderWithoutCheck(this.draftFolder(), [this.draftUid()]);
hideScreenPopup(ComposePopupView);
}
}]);
}
}, () => this.isDraftFolderMessage());
this.sendMessageResponse = _.bind(this.sendMessageResponse, this); this.sendMessageResponse = _.bind(this.sendMessageResponse, this);
this.saveMessageResponse = _.bind(this.saveMessageResponse, this); this.saveMessageResponse = _.bind(this.saveMessageResponse, this);
this.sendCommand = createCommand(() => { Events.sub('interval.2m', () => {
if (this.modalVisibility() && !FolderStore.draftFolderNotEnabled() && !this.isEmptyForm(false) &&
!this.saving() && !this.sending() && !this.savedError())
{
this.saveCommand();
}
});
this.showCc.subscribe(this.resizerTrigger);
this.showBcc.subscribe(this.resizerTrigger);
this.showReplyTo.subscribe(this.resizerTrigger);
this.dropboxEnabled = SocialStore.dropbox.enabled;
this.dropboxApiKey = SocialStore.dropbox.apiKey;
this.driveEnabled = ko.observable(bXMLHttpRequestSupported &&
!!Settings.settingsGet('AllowGoogleSocial') && !!Settings.settingsGet('AllowGoogleSocialDrive') &&
!!Settings.settingsGet('GoogleClientID') && !!Settings.settingsGet('GoogleApiKey'));
this.driveVisible = ko.observable(false);
this.driveCallback = _.bind(this.driveCallback, this);
this.onMessageUploadAttachments = _.bind(this.onMessageUploadAttachments, this);
this.bDisabeCloseOnEsc = true;
this.sDefaultKeyScope = KeyState.Compose;
this.tryToClosePopup = _.debounce(_.bind(this.tryToClosePopup, this), Magics.Time200ms);
this.emailsSource = _.bind(this.emailsSource, this);
this.autosaveFunction = _.bind(this.autosaveFunction, this);
this.iTimer = 0;
}
@command((self) => self.canBeSentOrSaved())
sendCommand() {
const const
sTo = trim(this.to()), sTo = trim(this.to()),
@ -430,10 +451,10 @@ class ComposePopupView extends AbstractViewNext
); );
} }
} }
}
}, this.canBeSentOrSaved); @command((self) => self.canBeSentOrSaved())
saveCommand() {
this.saveCommand = createCommand(() => {
if (!this.allowFolders) if (!this.allowFolders)
{ {
@ -475,10 +496,25 @@ class ComposePopupView extends AbstractViewNext
} }
return true; return true;
}
}, this.canBeSentOrSaved); @command((self) => self.isDraftFolderMessage())
deleteCommand() {
const PopupsAskViewModel = require('View/Popup/Ask');
if (!isPopupVisible(PopupsAskViewModel) && this.modalVisibility())
{
showScreenPopup(PopupsAskViewModel, [i18n('POPUPS_ASK/DESC_WANT_DELETE_MESSAGES'), () => {
if (this.modalVisibility())
{
getApp().deleteMessagesFromFolderWithoutCheck(this.draftFolder(), [this.draftUid()]);
hideScreenPopup(ComposePopupView);
}
}]);
}
}
this.skipCommand = createCommand(() => { @command((self) => self.canBeSentOrSaved())
skipCommand() {
this.bSkipNextHide = true; this.bSkipNextHide = true;
@ -489,11 +525,10 @@ class ComposePopupView extends AbstractViewNext
} }
this.tryToClosePopup(); this.tryToClosePopup();
}
}, this.canBeSentOrSaved); @command((self) => self.allowContacts)
contactsCommand() {
this.contactsCommand = createCommand(() => {
if (this.allowContacts) if (this.allowContacts)
{ {
this.skipCommand(); this.skipCommand();
@ -501,26 +536,10 @@ class ComposePopupView extends AbstractViewNext
showScreenPopup(require('View/Popup/Contacts'), [true, this.sLastFocusedField]); showScreenPopup(require('View/Popup/Contacts'), [true, this.sLastFocusedField]);
}, Magics.Time200ms); }, Magics.Time200ms);
} }
}, () => this.allowContacts);
Events.sub('interval.2m', () => {
if (this.modalVisibility() && !FolderStore.draftFolderNotEnabled() && !this.isEmptyForm(false) &&
!this.saving() && !this.sending() && !this.savedError())
{
this.saveCommand();
} }
});
this.showCc.subscribe(this.resizerTrigger);
this.showBcc.subscribe(this.resizerTrigger);
this.showReplyTo.subscribe(this.resizerTrigger);
this.dropboxEnabled = SocialStore.dropbox.enabled;
this.dropboxApiKey = SocialStore.dropbox.apiKey;
this.dropboxCommand = createCommand(() => {
@command((self) => self.dropboxEnabled())
dropboxCommand() {
if (window.Dropbox) if (window.Dropbox)
{ {
window.Dropbox.choose({ window.Dropbox.choose({
@ -534,35 +553,13 @@ class ComposePopupView extends AbstractViewNext
multiselect: false multiselect: false
}); });
} }
return true; return true;
}
}, () => this.dropboxEnabled()); @command((self) => self.driveEnabled())
driveCommand() {
this.driveEnabled = ko.observable(bXMLHttpRequestSupported &&
!!Settings.settingsGet('AllowGoogleSocial') && !!Settings.settingsGet('AllowGoogleSocialDrive') &&
!!Settings.settingsGet('GoogleClientID') && !!Settings.settingsGet('GoogleApiKey'));
this.driveVisible = ko.observable(false);
this.driveCommand = createCommand(() => {
this.driveOpenPopup(); this.driveOpenPopup();
return true; return true;
}, () => this.driveEnabled());
this.driveCallback = _.bind(this.driveCallback, this);
this.onMessageUploadAttachments = _.bind(this.onMessageUploadAttachments, this);
this.bDisabeCloseOnEsc = true;
this.sDefaultKeyScope = KeyState.Compose;
this.tryToClosePopup = _.debounce(_.bind(this.tryToClosePopup, this), Magics.Time200ms);
this.emailsSource = _.bind(this.emailsSource, this);
this.autosaveFunction = _.bind(this.autosaveFunction, this);
this.iTimer = 0;
} }
autosaveFunction() { autosaveFunction() {
@ -1991,4 +1988,4 @@ class ComposePopupView extends AbstractViewNext
} }
} }
module.exports = ComposePopupView; export {ComposePopupView, ComposePopupView as default};

View file

@ -5,8 +5,7 @@ import ko from 'ko';
import key from 'key'; import key from 'key';
import { import {
inArray, createCommand, inArray, pString, log, isUnd, trim,
pString, log, isUnd, trim,
defautOptionsAfterRender defautOptionsAfterRender
} from 'Common/Utils'; } from 'Common/Utils';
@ -17,14 +16,13 @@ import PgpStore from 'Stores/User/Pgp';
import {EmailModel} from 'Model/Email'; import {EmailModel} from 'Model/Email';
import {view, ViewType} from 'Knoin/Knoin'; import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext'; import {AbstractViewNext} from 'Knoin/AbstractViewNext';
const KEY_NAME_SUBSTR = -8; const KEY_NAME_SUBSTR = -8;
@view({ @popup({
name: 'View/Popup/ComposeOpenPgp', name: 'View/Popup/ComposeOpenPgp',
type: ViewType.Popup,
templateID: 'PopupsComposeOpenPgp' templateID: 'PopupsComposeOpenPgp'
}) })
class ComposeOpenPgpPopupView extends AbstractViewNext class ComposeOpenPgpPopupView extends AbstractViewNext
@ -92,8 +90,40 @@ class ComposeOpenPgpPopupView extends AbstractViewNext
this.resultCallback = null; this.resultCallback = null;
// commands this.selectedPrivateKey.subscribe((value) => {
this.doCommand = createCommand(() => { if (value)
{
this.selectCommand();
this.updateCommand();
}
});
this.selectedPublicKey.subscribe((value) => {
if (value)
{
this.addCommand();
}
});
this.sDefaultKeyScope = KeyState.PopupComposeOpenPGP;
this.defautOptionsAfterRender = defautOptionsAfterRender;
this.addOptionClass = (domOption, item) => {
this.defautOptionsAfterRender(domOption, item);
if (item && !isUnd(item.class) && domOption)
{
$(domOption).addClass(item.class);
}
};
this.deletePublickKey = _.bind(this.deletePublickKey, this);
}
@command((self) => !self.submitRequest() && (self.sign() || self.encrypt()))
doCommand() {
let let
result = true, result = true,
@ -247,11 +277,10 @@ class ComposeOpenPgpPopupView extends AbstractViewNext
} }
return result; return result;
}
}, () => !this.submitRequest() && (this.sign() || this.encrypt())); @command()
selectCommand() {
this.selectCommand = createCommand(() => {
const const
keyId = this.selectedPrivateKey(), keyId = this.selectedPrivateKey(),
option = keyId ? _.find(this.privateKeysOptions(), (item) => item && keyId === item.id) : null; option = keyId ? _.find(this.privateKeysOptions(), (item) => item && keyId === item.id) : null;
@ -266,9 +295,10 @@ class ComposeOpenPgpPopupView extends AbstractViewNext
'key': option.key 'key': option.key
}); });
} }
}); }
this.addCommand = createCommand(() => { @command()
addCommand() {
const const
keyId = this.selectedPublicKey(), keyId = this.selectedPublicKey(),
@ -288,44 +318,13 @@ class ComposeOpenPgpPopupView extends AbstractViewNext
this.encryptKeys(keys); this.encryptKeys(keys);
} }
}); }
this.updateCommand = createCommand(() => { @command()
updateCommand() {
_.each(this.encryptKeys(), (oKey) => { _.each(this.encryptKeys(), (oKey) => {
oKey.removable(!this.sign() || !this.signKey() || this.signKey().key.id !== oKey.key.id); oKey.removable(!this.sign() || !this.signKey() || this.signKey().key.id !== oKey.key.id);
}); });
});
this.selectedPrivateKey.subscribe((value) => {
if (value)
{
this.selectCommand();
this.updateCommand();
}
});
this.selectedPublicKey.subscribe((value) => {
if (value)
{
this.addCommand();
}
});
this.sDefaultKeyScope = KeyState.PopupComposeOpenPGP;
this.defautOptionsAfterRender = defautOptionsAfterRender;
this.addOptionClass = (domOption, item) => {
this.defautOptionsAfterRender(domOption, item);
if (item && !isUnd(item.class) && domOption)
{
$(domOption).addClass(item.class);
}
};
this.deletePublickKey = _.bind(this.deletePublickKey, this);
} }
deletePublickKey(publicKey) { deletePublickKey(publicKey) {
@ -459,4 +458,4 @@ class ComposeOpenPgpPopupView extends AbstractViewNext
} }
} }
module.exports = ComposeOpenPgpPopupView; export {ComposeOpenPgpPopupView, ComposeOpenPgpPopupView as default};

View file

@ -13,7 +13,7 @@ import {
import { import {
delegateRunOnDestroy, computedPagenatorHelper, delegateRunOnDestroy, computedPagenatorHelper,
inArray, trim, windowResizeCallback, createCommand, inArray, trim, windowResizeCallback,
isNonEmptyArray, fakeMd5, pInt, isUnd isNonEmptyArray, fakeMd5, pInt, isUnd
} from 'Common/Utils'; } from 'Common/Utils';
@ -37,12 +37,11 @@ import {ContactPropertyModel} from 'Model/ContactProperty';
import {getApp} from 'Helper/Apps/User'; import {getApp} from 'Helper/Apps/User';
import {view, ViewType, showScreenPopup, hideScreenPopup, routeOn, routeOff} from 'Knoin/Knoin'; import {popup, command, showScreenPopup, hideScreenPopup, routeOn, routeOff} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext'; import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({ @popup({
name: 'View/Popup/Contacts', name: 'View/Popup/Contacts',
type: ViewType.Popup,
templateID: 'PopupsContacts' templateID: 'PopupsContacts'
}) })
class ContactsPopupView extends AbstractViewNext class ContactsPopupView extends AbstractViewNext
@ -210,17 +209,39 @@ class ContactsPopupView extends AbstractViewNext
this.selector.on('onItemGetUid', (contact) => (contact ? contact.generateUid() : '')); this.selector.on('onItemGetUid', (contact) => (contact ? contact.generateUid() : ''));
this.newCommand = createCommand(() => { this.bDropPageAfterDelete = false;
this.populateViewContact(null);
this.currentContact(null); this.watchDirty = ko.observable(false);
this.watchHash = ko.observable(false);
this.viewHash = ko.computed(() => '' + _.map(this.viewProperties(), (oItem) => oItem.value()).join(''));
// this.saveCommandDebounce = _.debounce(_.bind(this.saveCommand, this), 1000);
this.viewHash.subscribe(() => {
if (this.watchHash() && !this.viewReadOnly() && !this.watchDirty())
{
this.watchDirty(true);
}
}); });
this.deleteCommand = createCommand(() => { this.sDefaultKeyScope = KeyState.ContactList;
}
@command()
newCommand() {
this.populateViewContact(null);
this.currentContact(null);
}
@command((self) => 0 < self.contactsCheckedOrSelected().length)
deleteCommand() {
this.deleteSelectedContacts(); this.deleteSelectedContacts();
this.emptySelection(true); this.emptySelection(true);
}, () => 0 < this.contactsCheckedOrSelected().length); }
this.newMessageCommand = createCommand(() => { @command((self) => 0 < self.contactsCheckedOrSelected().length)
newMessageCommand() {
if (!Settings.capa(Capa.Composer)) if (!Settings.capa(Capa.Composer))
{ {
@ -283,14 +304,20 @@ class ContactsPopupView extends AbstractViewNext
} }
return true; return true;
}
}, () => 0 < this.contactsCheckedOrSelected().length); @command()
clearCommand() {
this.clearCommand = createCommand(() => {
this.search(''); this.search('');
}); }
this.saveCommand = createCommand(() => { @command((self) => {
const
bV = self.viewHasNonEmptyRequaredProperties(),
bReadOnly = self.viewReadOnly();
return !self.viewSaving() && bV && !bReadOnly;
})
saveCommand() {
this.viewSaving(true); this.viewSaving(true);
this.viewSaveTrigger(SaveSettingsStep.Animate); this.viewSaveTrigger(SaveSettingsStep.Animate);
@ -337,16 +364,10 @@ class ContactsPopupView extends AbstractViewNext
} }
}, requestUid, this.viewID(), properties); }, requestUid, this.viewID(), properties);
}
}, () => { @command((self) => !self.contacts.syncing() && !self.contacts.importing())
const syncCommand() {
bV = this.viewHasNonEmptyRequaredProperties(),
bReadOnly = this.viewReadOnly();
return !this.viewSaving() && bV && !bReadOnly;
});
this.syncCommand = createCommand(() => {
getApp().contactsSync((result, data) => { getApp().contactsSync((result, data) => {
if (StorageResultType.Success !== result || !data || !data.Result) if (StorageResultType.Success !== result || !data || !data.Result)
{ {
@ -356,26 +377,6 @@ class ContactsPopupView extends AbstractViewNext
this.reloadContactList(true); this.reloadContactList(true);
}); });
}, () => !this.contacts.syncing() && !this.contacts.importing());
this.bDropPageAfterDelete = false;
this.watchDirty = ko.observable(false);
this.watchHash = ko.observable(false);
this.viewHash = ko.computed(() => '' + _.map(this.viewProperties(), (oItem) => oItem.value()).join(''));
// this.saveCommandDebounce = _.debounce(_.bind(this.saveCommand, this), 1000);
this.viewHash.subscribe(() => {
if (this.watchHash() && !this.viewReadOnly() && !this.watchDirty())
{
this.watchDirty(true);
}
});
this.sDefaultKeyScope = KeyState.ContactList;
} }
getPropertyPlaceholder(type) { getPropertyPlaceholder(type) {
@ -722,4 +723,4 @@ class ContactsPopupView extends AbstractViewNext
} }
} }
module.exports = ContactsPopupView; export {ContactsPopupView, ContactsPopupView as default};

View file

@ -5,7 +5,7 @@ import ko from 'ko';
import {StorageResultType, ServerSecure, Ports, Notification} from 'Common/Enums'; import {StorageResultType, ServerSecure, Ports, Notification} from 'Common/Enums';
import {IMAP_DEFAULT_PORT, SIEVE_DEFAULT_PORT, SMTP_DEFAULT_PORT} from 'Common/Consts'; import {IMAP_DEFAULT_PORT, SIEVE_DEFAULT_PORT, SMTP_DEFAULT_PORT} from 'Common/Consts';
import {bMobileDevice} from 'Common/Globals'; import {bMobileDevice} from 'Common/Globals';
import {createCommand, trim, pInt, pString} from 'Common/Utils'; import {trim, pInt, pString} from 'Common/Utils';
import {i18n} from 'Common/Translator'; import {i18n} from 'Common/Translator';
import CapaAdminStore from 'Stores/Admin/Capa'; import CapaAdminStore from 'Stores/Admin/Capa';
@ -14,12 +14,11 @@ import Remote from 'Remote/Admin/Ajax';
import {getApp} from 'Helper/Apps/Admin'; import {getApp} from 'Helper/Apps/Admin';
import {view, ViewType} from 'Knoin/Knoin'; import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext'; import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({ @popup({
name: 'View/Popup/Domain', name: 'View/Popup/Domain',
type: ViewType.Popup,
templateID: 'PopupsDomain' templateID: 'PopupsDomain'
}) })
class DomainPopupView extends AbstractViewNext class DomainPopupView extends AbstractViewNext
@ -141,79 +140,6 @@ class DomainPopupView extends AbstractViewNext
this.canBeTested = ko.computed(() => !this.testing() && this.domainIsComputed()); this.canBeTested = ko.computed(() => !this.testing() && this.domainIsComputed());
this.canBeSaved = ko.computed(() => !this.saving() && this.domainIsComputed()); this.canBeSaved = ko.computed(() => !this.saving() && this.domainIsComputed());
this.createOrAddCommand = createCommand(() => {
this.saving(true);
Remote.createOrUpdateDomain(
_.bind(this.onDomainCreateOrSaveResponse, this),
!this.edit(),
this.name(),
this.imapServer(),
pInt(this.imapPort()),
this.imapSecure(),
this.imapShortLogin(),
this.useSieve(),
this.sieveAllowRaw(),
this.sieveServer(),
pInt(this.sievePort()),
this.sieveSecure(),
this.smtpServer(),
pInt(this.smtpPort()),
this.smtpSecure(),
this.smtpShortLogin(),
this.smtpAuth(),
this.smtpPhpMail(),
this.whiteList()
);
}, this.canBeSaved);
this.testConnectionCommand = createCommand(() => {
this.page('main');
this.testingDone(false);
this.testingImapError(false);
this.testingSieveError(false);
this.testingSmtpError(false);
this.testing(true);
Remote.testConnectionForDomain(
_.bind(this.onTestConnectionResponse, this),
this.name(),
this.imapServer(),
pInt(this.imapPort()),
this.imapSecure(),
this.useSieve(),
this.sieveServer(),
pInt(this.sievePort()),
this.sieveSecure(),
this.smtpServer(),
pInt(this.smtpPort()),
this.smtpSecure(),
this.smtpAuth(),
this.smtpPhpMail()
);
}, this.canBeTested);
this.whiteListCommand = createCommand(() => {
this.page('white-list');
});
this.backCommand = createCommand(() => {
this.page('main');
});
this.sieveCommand = createCommand(() => {
this.sieveSettings(!this.sieveSettings());
this.clearTesting();
});
this.page.subscribe(() => { this.page.subscribe(() => {
this.sieveSettings(false); this.sieveSettings(false);
}); });
@ -293,6 +219,84 @@ class DomainPopupView extends AbstractViewNext
}); });
} }
@command((self) => self.canBeSaved())
createOrAddCommand() {
this.saving(true);
Remote.createOrUpdateDomain(
_.bind(this.onDomainCreateOrSaveResponse, this),
!this.edit(),
this.name(),
this.imapServer(),
pInt(this.imapPort()),
this.imapSecure(),
this.imapShortLogin(),
this.useSieve(),
this.sieveAllowRaw(),
this.sieveServer(),
pInt(this.sievePort()),
this.sieveSecure(),
this.smtpServer(),
pInt(this.smtpPort()),
this.smtpSecure(),
this.smtpShortLogin(),
this.smtpAuth(),
this.smtpPhpMail(),
this.whiteList()
);
}
@command((self) => self.canBeTested())
testConnectionCommand() {
this.page('main');
this.testingDone(false);
this.testingImapError(false);
this.testingSieveError(false);
this.testingSmtpError(false);
this.testing(true);
Remote.testConnectionForDomain(
_.bind(this.onTestConnectionResponse, this),
this.name(),
this.imapServer(),
pInt(this.imapPort()),
this.imapSecure(),
this.useSieve(),
this.sieveServer(),
pInt(this.sievePort()),
this.sieveSecure(),
this.smtpServer(),
pInt(this.smtpPort()),
this.smtpSecure(),
this.smtpAuth(),
this.smtpPhpMail()
);
}
@command()
whiteListCommand() {
this.page('white-list');
}
@command()
backCommand() {
this.page('main');
}
@command()
sieveCommand() {
this.sieveSettings(!this.sieveSettings());
this.clearTesting();
}
onTestConnectionResponse(sResult, oData) { onTestConnectionResponse(sResult, oData) {
this.testing(false); this.testing(false);
if (StorageResultType.Success === sResult && oData.Result) if (StorageResultType.Success === sResult && oData.Result)
@ -462,4 +466,4 @@ class DomainPopupView extends AbstractViewNext
} }
} }
module.exports = DomainPopupView; export {DomainPopupView, DomainPopupView as default};

View file

@ -4,7 +4,6 @@ import ko from 'ko';
import {StorageResultType, Notification} from 'Common/Enums'; import {StorageResultType, Notification} from 'Common/Enums';
import {bMobileDevice} from 'Common/Globals'; import {bMobileDevice} from 'Common/Globals';
import {createCommand} from 'Common/Utils';
import {i18n} from 'Common/Translator'; import {i18n} from 'Common/Translator';
import DomainStore from 'Stores/Admin/Domain'; import DomainStore from 'Stores/Admin/Domain';
@ -13,12 +12,11 @@ import Remote from 'Remote/Admin/Ajax';
import {getApp} from 'Helper/Apps/Admin'; import {getApp} from 'Helper/Apps/Admin';
import {view, ViewType} from 'Knoin/Knoin'; import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext'; import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({ @popup({
name: 'View/Popup/DomainAlias', name: 'View/Popup/DomainAlias',
type: ViewType.Popup,
templateID: 'PopupsDomainAlias' templateID: 'PopupsDomainAlias'
}) })
class DomainAliasPopupView extends AbstractViewNext class DomainAliasPopupView extends AbstractViewNext
@ -42,16 +40,17 @@ class DomainAliasPopupView extends AbstractViewNext
this.canBeSaved = ko.computed(() => !this.saving() && '' !== this.name() && '' !== this.alias()); this.canBeSaved = ko.computed(() => !this.saving() && '' !== this.name() && '' !== this.alias());
this.createCommand = createCommand(() => { this.onDomainAliasCreateOrSaveResponse = _.bind(this.onDomainAliasCreateOrSaveResponse, this);
}
@command((self) => self.canBeSaved())
createCommand() {
this.saving(true); this.saving(true);
Remote.createDomainAlias( Remote.createDomainAlias(
this.onDomainAliasCreateOrSaveResponse, this.onDomainAliasCreateOrSaveResponse,
this.name(), this.name(),
this.alias() this.alias()
); );
}, this.canBeSaved);
this.onDomainAliasCreateOrSaveResponse = _.bind(this.onDomainAliasCreateOrSaveResponse, this);
} }
onDomainAliasCreateOrSaveResponse(result, data) { onDomainAliasCreateOrSaveResponse(result, data) {
@ -96,4 +95,4 @@ class DomainAliasPopupView extends AbstractViewNext
} }
} }
module.exports = DomainAliasPopupView; export {DomainAliasPopupView, DomainAliasPopupView as default};

View file

@ -4,18 +4,17 @@ import ko from 'ko';
import {FiltersAction, FilterConditionField, FilterConditionType} from 'Common/Enums'; import {FiltersAction, FilterConditionField, FilterConditionType} from 'Common/Enums';
import {bMobileDevice} from 'Common/Globals'; import {bMobileDevice} from 'Common/Globals';
import {defautOptionsAfterRender, createCommand, delegateRun} from 'Common/Utils'; import {defautOptionsAfterRender, delegateRun} from 'Common/Utils';
import {i18n, initOnStartOrLangChange} from 'Common/Translator'; import {i18n, initOnStartOrLangChange} from 'Common/Translator';
import FilterStore from 'Stores/User/Filter'; import FilterStore from 'Stores/User/Filter';
import FolderStore from 'Stores/User/Folder'; import FolderStore from 'Stores/User/Folder';
import {view, ViewType} from 'Knoin/Knoin'; import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext'; import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({ @popup({
name: 'View/Popup/Filter', name: 'View/Popup/Filter',
type: ViewType.Popup,
templateID: 'PopupsFilter' templateID: 'PopupsFilter'
}) })
class FilterPopupView extends AbstractViewNext class FilterPopupView extends AbstractViewNext
@ -43,7 +42,18 @@ class FilterPopupView extends AbstractViewNext
} }
}); });
this.saveFilter = createCommand(() => { this.actionTypeOptions = ko.observableArray([]);
this.fieldOptions = ko.observableArray([]);
this.typeOptions = ko.observableArray([]);
this.typeOptionsSize = ko.observableArray([]);
initOnStartOrLangChange(_.bind(this.populateOptions, this));
this.modules.subscribe(this.populateOptions, this);
}
@command()
saveFilterCommand() {
if (this.filter()) if (this.filter())
{ {
@ -69,16 +79,6 @@ class FilterPopupView extends AbstractViewNext
} }
return true; return true;
});
this.actionTypeOptions = ko.observableArray([]);
this.fieldOptions = ko.observableArray([]);
this.typeOptions = ko.observableArray([]);
this.typeOptionsSize = ko.observableArray([]);
initOnStartOrLangChange(_.bind(this.populateOptions, this));
this.modules.subscribe(this.populateOptions, this);
} }
populateOptions() { populateOptions() {
@ -191,4 +191,4 @@ class FilterPopupView extends AbstractViewNext
} }
} }
module.exports = FilterPopupView; export {FilterPopupView, FilterPopupView as default};

View file

@ -2,7 +2,6 @@
import ko from 'ko'; import ko from 'ko';
import {StorageResultType, Notification} from 'Common/Enums'; import {StorageResultType, Notification} from 'Common/Enums';
import {createCommand} from 'Common/Utils';
import {i18n, getNotification} from 'Common/Translator'; import {i18n, getNotification} from 'Common/Translator';
import {setFolderHash} from 'Common/Cache'; import {setFolderHash} from 'Common/Cache';
@ -12,12 +11,11 @@ import Remote from 'Remote/User/Ajax';
import {getApp} from 'Helper/Apps/User'; import {getApp} from 'Helper/Apps/User';
import {view, ViewType} from 'Knoin/Knoin'; import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext'; import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({ @popup({
name: 'View/Popup/FolderClear', name: 'View/Popup/FolderClear',
type: ViewType.Popup,
templateID: 'PopupsFolderClear' templateID: 'PopupsFolderClear'
}) })
class FolderClearPopupView extends AbstractViewNext class FolderClearPopupView extends AbstractViewNext
@ -42,8 +40,16 @@ class FolderClearPopupView extends AbstractViewNext
this.dangerDescHtml = ko.computed( this.dangerDescHtml = ko.computed(
() => i18n('POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1', {'FOLDER': this.folderNameForClear()}) () => i18n('POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1', {'FOLDER': this.folderNameForClear()})
); );
}
this.clearCommand = createCommand(() => { @command((self) => {
const
folder = self.selectedFolder(),
isClearing = self.clearingProcess();
return !isClearing && null !== folder;
})
clearCommand() {
const folderToClear = this.selectedFolder(); const folderToClear = this.selectedFolder();
if (folderToClear) if (folderToClear)
@ -79,14 +85,6 @@ class FolderClearPopupView extends AbstractViewNext
} }
}, folderToClear.fullNameRaw); }, folderToClear.fullNameRaw);
} }
}, () => {
const
folder = this.selectedFolder(),
isClearing = this.clearingProcess();
return !isClearing && null !== folder;
});
} }
clearPopup() { clearPopup() {
@ -103,4 +101,4 @@ class FolderClearPopupView extends AbstractViewNext
} }
} }
module.exports = FolderClearPopupView; export {FolderClearPopupView, FolderClearPopupView as default};

View file

@ -4,7 +4,7 @@ import ko from 'ko';
import {Notification} from 'Common/Enums'; import {Notification} from 'Common/Enums';
import {UNUSED_OPTION_VALUE} from 'Common/Consts'; import {UNUSED_OPTION_VALUE} from 'Common/Consts';
import {bMobileDevice} from 'Common/Globals'; import {bMobileDevice} from 'Common/Globals';
import {trim, createCommand, defautOptionsAfterRender, folderListOptionsBuilder} from 'Common/Utils'; import {trim, defautOptionsAfterRender, folderListOptionsBuilder} from 'Common/Utils';
import FolderStore from 'Stores/User/Folder'; import FolderStore from 'Stores/User/Folder';
@ -12,12 +12,11 @@ import Promises from 'Promises/User/Ajax';
import {getApp} from 'Helper/Apps/User'; import {getApp} from 'Helper/Apps/User';
import {view, ViewType} from 'Knoin/Knoin'; import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext'; import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({ @popup({
name: 'View/Popup/FolderCreate', name: 'View/Popup/FolderCreate',
type: ViewType.Popup,
templateID: 'PopupsFolderCreate' templateID: 'PopupsFolderCreate'
}) })
class FolderCreateView extends AbstractViewNext class FolderCreateView extends AbstractViewNext
@ -49,8 +48,11 @@ class FolderCreateView extends AbstractViewNext
}); });
// commands this.defautOptionsAfterRender = defautOptionsAfterRender;
this.createFolder = createCommand(() => { }
@command((self) => self.simpleFolderNameValidation(self.folderName()))
createFolderCommand() {
let parentFolderName = this.selectedParentValue(); let parentFolderName = this.selectedParentValue();
if ('' === parentFolderName && 1 < FolderStore.namespace.length) if ('' === parentFolderName && 1 < FolderStore.namespace.length)
@ -64,10 +66,6 @@ class FolderCreateView extends AbstractViewNext
); );
this.cancelCommand(); this.cancelCommand();
}, () => this.simpleFolderNameValidation(this.folderName()));
this.defautOptionsAfterRender = defautOptionsAfterRender;
} }
simpleFolderNameValidation(sName) { simpleFolderNameValidation(sName) {
@ -92,4 +90,4 @@ class FolderCreateView extends AbstractViewNext
} }
} }
module.exports = FolderCreateView; export {FolderCreateView, FolderCreateView as default};

View file

@ -12,12 +12,11 @@ import FolderStore from 'Stores/User/Folder';
import * as Settings from 'Storage/Settings'; import * as Settings from 'Storage/Settings';
import Remote from 'Remote/User/Ajax'; import Remote from 'Remote/User/Ajax';
import {view, ViewType} from 'Knoin/Knoin'; import {popup} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext'; import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({ @popup({
name: 'View/Popup/FolderSystem', name: 'View/Popup/FolderSystem',
type: ViewType.Popup,
templateID: 'PopupsFolderSystem' templateID: 'PopupsFolderSystem'
}) })
class FolderSystemPopupView extends AbstractViewNext class FolderSystemPopupView extends AbstractViewNext
@ -110,4 +109,4 @@ class FolderSystemPopupView extends AbstractViewNext
} }
} }
module.exports = FolderSystemPopupView; export {FolderSystemPopupView, FolderSystemPopupView as default};

View file

@ -3,19 +3,18 @@ import ko from 'ko';
import {StorageResultType, Notification} from 'Common/Enums'; import {StorageResultType, Notification} from 'Common/Enums';
import {bMobileDevice} from 'Common/Globals'; import {bMobileDevice} from 'Common/Globals';
import {createCommand, trim, fakeMd5} from 'Common/Utils'; import {trim, fakeMd5} from 'Common/Utils';
import {getNotification} from 'Common/Translator'; import {getNotification} from 'Common/Translator';
import Remote from 'Remote/User/Ajax'; import Remote from 'Remote/User/Ajax';
import {getApp} from 'Helper/Apps/User'; import {getApp} from 'Helper/Apps/User';
import {view, ViewType} from 'Knoin/Knoin'; import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext'; import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({ @popup({
name: 'View/Popup/Identity', name: 'View/Popup/Identity',
type: ViewType.Popup,
templateID: 'PopupsIdentity' templateID: 'PopupsIdentity'
}) })
class IdentityPopupView extends AbstractViewNext class IdentityPopupView extends AbstractViewNext
@ -58,8 +57,10 @@ class IdentityPopupView extends AbstractViewNext
this.showReplyTo(true); this.showReplyTo(true);
} }
}); });
}
this.addOrEditIdentityCommand = createCommand(() => { @command((self) => !self.submitRequest())
addOrEditIdentityCommand() {
if (this.signature && this.signature.__fetchEditorValue) if (this.signature && this.signature.__fetchEditorValue)
{ {
@ -118,8 +119,6 @@ class IdentityPopupView extends AbstractViewNext
}, this.id, this.email(), this.name(), this.replyTo(), this.bcc(), this.signature(), this.signatureInsertBefore()); }, this.id, this.email(), this.name(), this.replyTo(), this.bcc(), this.signature(), this.signatureInsertBefore());
return true; return true;
}, () => !this.submitRequest());
} }
clearPopup() { clearPopup() {
@ -184,4 +183,4 @@ class IdentityPopupView extends AbstractViewNext
} }
} }
module.exports = IdentityPopupView; export {IdentityPopupView, IdentityPopupView as default};

View file

@ -4,12 +4,11 @@ import key from 'key';
import {KeyState, Magics} from 'Common/Enums'; import {KeyState, Magics} from 'Common/Enums';
import {view, ViewType} from 'Knoin/Knoin'; import {popup} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext'; import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({ @popup({
name: 'View/Popup/KeyboardShortcutsHelp', name: 'View/Popup/KeyboardShortcutsHelp',
type: ViewType.Popup,
templateID: 'PopupsKeyboardShortcutsHelp' templateID: 'PopupsKeyboardShortcutsHelp'
}) })
class KeyboardShortcutsHelpPopupView extends AbstractViewNext class KeyboardShortcutsHelpPopupView extends AbstractViewNext
@ -52,4 +51,4 @@ class KeyboardShortcutsHelpPopupView extends AbstractViewNext
} }
} }
module.exports = KeyboardShortcutsHelpPopupView; export {KeyboardShortcutsHelpPopupView, KeyboardShortcutsHelpPopupView as default};

View file

@ -4,12 +4,12 @@ import ko from 'ko';
import {convertLangName} from 'Common/Utils'; import {convertLangName} from 'Common/Utils';
import {view, ViewType} from 'Knoin/Knoin'; // import {view, ViewType} from 'Knoin/Knoin';
import {popup} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext'; import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({ @popup({
name: 'View/Popup/Languages', name: 'View/Popup/Languages',
type: ViewType.Popup,
templateID: 'PopupsLanguages' templateID: 'PopupsLanguages'
}) })
class LanguagesPopupView extends AbstractViewNext class LanguagesPopupView extends AbstractViewNext
@ -73,4 +73,4 @@ class LanguagesPopupView extends AbstractViewNext
} }
} }
module.exports = LanguagesPopupView; export {LanguagesPopupView, LanguagesPopupView as default};

View file

@ -4,15 +4,14 @@ import ko from 'ko';
import key from 'key'; import key from 'key';
import $ from '$'; import $ from '$';
import {createCommand, pString, log} from 'Common/Utils'; import {pString, log} from 'Common/Utils';
import {KeyState, Magics} from 'Common/Enums'; import {KeyState, Magics} from 'Common/Enums';
import {view, ViewType} from 'Knoin/Knoin'; import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext'; import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({ @popup({
name: 'View/Popup/MessageOpenPgp', name: 'View/Popup/MessageOpenPgp',
type: ViewType.Popup,
templateID: 'PopupsMessageOpenPgp' templateID: 'PopupsMessageOpenPgp'
}) })
class MessageOpenPgpPopupView extends AbstractViewNext class MessageOpenPgpPopupView extends AbstractViewNext
@ -33,8 +32,11 @@ class MessageOpenPgpPopupView extends AbstractViewNext
this.submitRequest = ko.observable(false); this.submitRequest = ko.observable(false);
// commands this.sDefaultKeyScope = KeyState.PopupMessageOpenPGP;
this.doCommand = createCommand(() => { }
@command((self) => !self.submitRequest())
doCommand() {
this.submitRequest(true); this.submitRequest(true);
@ -83,10 +85,6 @@ class MessageOpenPgpPopupView extends AbstractViewNext
this.resultCallback(privateKey); this.resultCallback(privateKey);
}, Magics.Time100ms); }, Magics.Time100ms);
}, () => !this.submitRequest());
this.sDefaultKeyScope = KeyState.PopupMessageOpenPGP;
} }
clearPopup() { clearPopup() {
@ -162,4 +160,4 @@ class MessageOpenPgpPopupView extends AbstractViewNext
} }
} }
module.exports = MessageOpenPgpPopupView; export {MessageOpenPgpPopupView, MessageOpenPgpPopupView as default};

View file

@ -3,18 +3,17 @@ import _ from '_';
import ko from 'ko'; import ko from 'ko';
import {Magics} from 'Common/Enums'; import {Magics} from 'Common/Enums';
import {trim, log, createCommand, delegateRun, pInt} from 'Common/Utils'; import {trim, log, delegateRun, pInt} from 'Common/Utils';
import PgpStore from 'Stores/User/Pgp'; import PgpStore from 'Stores/User/Pgp';
import {getApp} from 'Helper/Apps/User'; import {getApp} from 'Helper/Apps/User';
import {view, ViewType} from 'Knoin/Knoin'; import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext'; import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({ @popup({
name: 'View/Popup/NewOpenPgpKey', name: 'View/Popup/NewOpenPgpKey',
type: ViewType.Popup,
templateID: 'PopupsNewOpenPgpKey' templateID: 'PopupsNewOpenPgpKey'
}) })
class NewOpenPgpKeyPopupView extends AbstractViewNext class NewOpenPgpKeyPopupView extends AbstractViewNext
@ -36,8 +35,10 @@ class NewOpenPgpKeyPopupView extends AbstractViewNext
this.email.subscribe(() => { this.email.subscribe(() => {
this.email.error(false); this.email.error(false);
}); });
}
this.generateOpenPgpKeyCommand = createCommand(() => { @command()
generateOpenPgpKeyCommand() {
const const
userId = {}, userId = {},
@ -95,7 +96,6 @@ class NewOpenPgpKeyPopupView extends AbstractViewNext
}, Magics.Time100ms); }, Magics.Time100ms);
return true; return true;
});
} }
showError(e) { showError(e) {
@ -126,4 +126,4 @@ class NewOpenPgpKeyPopupView extends AbstractViewNext
} }
} }
module.exports = NewOpenPgpKeyPopupView; export {NewOpenPgpKeyPopupView, NewOpenPgpKeyPopupView as default};

View file

@ -4,17 +4,16 @@ import ko from 'ko';
import key from 'key'; import key from 'key';
import {KeyState, Magics, StorageResultType, Notification} from 'Common/Enums'; import {KeyState, Magics, StorageResultType, Notification} from 'Common/Enums';
import {createCommand, isNonEmptyArray, delegateRun} from 'Common/Utils'; import {isNonEmptyArray, delegateRun} from 'Common/Utils';
import {getNotification, i18n} from 'Common/Translator'; import {getNotification, i18n} from 'Common/Translator';
import Remote from 'Remote/Admin/Ajax'; import Remote from 'Remote/Admin/Ajax';
import {view, ViewType, isPopupVisible, showScreenPopup} from 'Knoin/Knoin'; import {popup, command, isPopupVisible, showScreenPopup} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext'; import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({ @popup({
name: 'View/Popup/Plugin', name: 'View/Popup/Plugin',
type: ViewType.Popup,
templateID: 'PopupsPlugin' templateID: 'PopupsPlugin'
}) })
class PluginPopupView extends AbstractViewNext class PluginPopupView extends AbstractViewNext
@ -43,7 +42,14 @@ class PluginPopupView extends AbstractViewNext
'content': () => `<pre>${this.readme()}</pre>` 'content': () => `<pre>${this.readme()}</pre>`
}; };
this.saveCommand = createCommand(() => { this.bDisabeCloseOnEsc = true;
this.sDefaultKeyScope = KeyState.All;
this.tryToClosePopup = _.debounce(_.bind(this.tryToClosePopup, this), Magics.Time200ms);
}
@command((self) => self.hasConfiguration())
saveCommand() {
const list = {}; const list = {};
list.Name = this.name(); list.Name = this.name();
@ -59,13 +65,6 @@ class PluginPopupView extends AbstractViewNext
this.saveError(''); this.saveError('');
Remote.pluginSettingsUpdate(this.onPluginSettingsUpdateResponse, list); Remote.pluginSettingsUpdate(this.onPluginSettingsUpdateResponse, list);
}, this.hasConfiguration);
this.bDisabeCloseOnEsc = true;
this.sDefaultKeyScope = KeyState.All;
this.tryToClosePopup = _.debounce(_.bind(this.tryToClosePopup, this), Magics.Time200ms);
} }
onPluginSettingsUpdateResponse(result, data) { onPluginSettingsUpdateResponse(result, data) {
@ -138,4 +137,4 @@ class PluginPopupView extends AbstractViewNext
} }
} }
module.exports = PluginPopupView; export {PluginPopupView, PluginPopupView as default};

View file

@ -2,7 +2,7 @@
import ko from 'ko'; import ko from 'ko';
import {StorageResultType, Notification} from 'Common/Enums'; import {StorageResultType, Notification} from 'Common/Enums';
import {trim, isNormal, createCommand} from 'Common/Utils'; import {trim, isNormal} from 'Common/Utils';
import {getNotification} from 'Common/Translator'; import {getNotification} from 'Common/Translator';
import {HtmlEditor} from 'Common/HtmlEditor'; import {HtmlEditor} from 'Common/HtmlEditor';
@ -10,12 +10,11 @@ import Remote from 'Remote/User/Ajax';
import {getApp} from 'Helper/Apps/User'; import {getApp} from 'Helper/Apps/User';
import {view, ViewType} from 'Knoin/Knoin'; import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext'; import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({ @popup({
name: 'View/Popup/Template', name: 'View/Popup/Template',
type: ViewType.Popup,
templateID: 'PopupsTemplate' templateID: 'PopupsTemplate'
}) })
class TemplatePopupView extends AbstractViewNext class TemplatePopupView extends AbstractViewNext
@ -46,8 +45,10 @@ class TemplatePopupView extends AbstractViewNext
this.submitRequest = ko.observable(false); this.submitRequest = ko.observable(false);
this.submitError = ko.observable(''); this.submitError = ko.observable('');
}
this.addTemplateCommand = createCommand(() => { @command((self) => !self.submitRequest())
addTemplateCommand() {
this.populateBodyFromEditor(); this.populateBodyFromEditor();
@ -84,8 +85,6 @@ class TemplatePopupView extends AbstractViewNext
}, this.id(), this.name(), this.body()); }, this.id(), this.name(), this.body());
return true; return true;
}, () => !this.submitRequest());
} }
clearPopup() { clearPopup() {
@ -183,4 +182,4 @@ class TemplatePopupView extends AbstractViewNext
} }
} }
module.exports = TemplatePopupView; export {TemplatePopupView, TemplatePopupView as default};

View file

@ -14,12 +14,11 @@ import Remote from 'Remote/User/Ajax';
import {getApp} from 'Helper/Apps/User'; import {getApp} from 'Helper/Apps/User';
import {view, ViewType, showScreenPopup} from 'Knoin/Knoin'; import {popup, showScreenPopup} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext'; import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({ @popup({
name: 'View/Popup/TwoFactorConfiguration', name: 'View/Popup/TwoFactorConfiguration',
type: ViewType.Popup,
templateID: 'PopupsTwoFactorConfiguration' templateID: 'PopupsTwoFactorConfiguration'
}) })
class TwoFactorConfigurationPopupView extends AbstractViewNext class TwoFactorConfigurationPopupView extends AbstractViewNext
@ -214,4 +213,4 @@ class TwoFactorConfigurationPopupView extends AbstractViewNext
} }
} }
module.exports = TwoFactorConfigurationPopupView; export {TwoFactorConfigurationPopupView, TwoFactorConfigurationPopupView as default};

View file

@ -3,16 +3,14 @@ import ko from 'ko';
import {StorageResultType} from 'Common/Enums'; import {StorageResultType} from 'Common/Enums';
import {bMobileDevice} from 'Common/Globals'; import {bMobileDevice} from 'Common/Globals';
import {createCommand} from 'Common/Utils';
import Remote from 'Remote/User/Ajax'; import Remote from 'Remote/User/Ajax';
import {view, ViewType} from 'Knoin/Knoin'; import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext'; import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({ @popup({
name: 'View/Popup/TwoFactorTest', name: 'View/Popup/TwoFactorTest',
type: ViewType.Popup,
templateID: 'PopupsTwoFactorTest' templateID: 'PopupsTwoFactorTest'
}) })
class TwoFactorTestPopupView extends AbstractViewNext class TwoFactorTestPopupView extends AbstractViewNext
@ -27,9 +25,10 @@ class TwoFactorTestPopupView extends AbstractViewNext
this.koTestedTrigger = null; this.koTestedTrigger = null;
this.testing = ko.observable(false); this.testing = ko.observable(false);
}
// commands @command((self) => '' !== self.code() && !self.testing())
this.testCode = createCommand(() => { testCodeCommand() {
this.testing(true); this.testing(true);
Remote.testTwoFactor((result, data) => { Remote.testTwoFactor((result, data) => {
@ -43,8 +42,6 @@ class TwoFactorTestPopupView extends AbstractViewNext
} }
}, this.code()); }, this.code());
}, () => '' !== this.code() && !this.testing());
} }
clearPopup() { clearPopup() {
@ -70,4 +67,4 @@ class TwoFactorTestPopupView extends AbstractViewNext
} }
} }
module.exports = TwoFactorTestPopupView; export {TwoFactorTestPopupView, TwoFactorTestPopupView as default};

View file

@ -5,12 +5,11 @@ import key from 'key';
import {KeyState} from 'Common/Enums'; import {KeyState} from 'Common/Enums';
import {selectElement} from 'Common/Utils'; import {selectElement} from 'Common/Utils';
import {view, ViewType} from 'Knoin/Knoin'; import {popup} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext'; import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({ @popup({
name: 'View/Popup/ViewOpenPgpKey', name: 'View/Popup/ViewOpenPgpKey',
type: ViewType.Popup,
templateID: 'PopupsTwoFactorTest' templateID: 'PopupsTwoFactorTest'
}) })
class ViewOpenPgpKeyPopupView extends AbstractViewNext class ViewOpenPgpKeyPopupView extends AbstractViewNext
@ -53,4 +52,4 @@ class ViewOpenPgpKeyPopupView extends AbstractViewNext
} }
} }
module.exports = ViewOpenPgpKeyPopupView; export {ViewOpenPgpKeyPopupView, ViewOpenPgpKeyPopupView as default};

View file

@ -3,12 +3,11 @@ import ko from 'ko';
import Promises from 'Promises/User/Ajax'; import Promises from 'Promises/User/Ajax';
import {view, ViewType} from 'Knoin/Knoin'; import {popup} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext'; import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({ @popup({
name: 'View/Popup/WelcomePage', name: 'View/Popup/WelcomePage',
type: ViewType.Popup,
templateID: 'PopupsWelcomePage' templateID: 'PopupsWelcomePage'
}) })
class WelcomePagePopupView extends AbstractViewNext class WelcomePagePopupView extends AbstractViewNext
@ -45,4 +44,4 @@ class WelcomePagePopupView extends AbstractViewNext
} }
} }
module.exports = WelcomePagePopupView; export {WelcomePagePopupView, WelcomePagePopupView as default};

View file

@ -22,8 +22,7 @@ import {
import { import {
inArray, isArray, isNonEmptyArray, trim, noop, inArray, isArray, isNonEmptyArray, trim, noop,
windowResize, windowResizeCallback, inFocus, windowResize, windowResizeCallback, inFocus,
removeSelection, removeInFocus, mailToHelper, removeSelection, removeInFocus, mailToHelper
createCommand
} from 'Common/Utils'; } from 'Common/Utils';
import Audio from 'Common/Audio'; import Audio from 'Common/Audio';
@ -52,7 +51,7 @@ import Promises from 'Promises/User/Ajax';
import {getApp} from 'Helper/Apps/User'; import {getApp} from 'Helper/Apps/User';
import {view, command, ViewType, showScreenPopup} from 'Knoin/Knoin'; import {view, command, ViewType, showScreenPopup, createCommand} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext'; import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({ @view({

View file

@ -1,4 +1,4 @@
/* @flow */
import bootstrap from 'bootstrap'; import bootstrap from 'bootstrap';
import App from 'App/Admin'; import App from 'App/Admin';

View file

@ -1,4 +1,4 @@
/* @flow */
import bootstrap from 'bootstrap'; import bootstrap from 'bootstrap';
import App from 'App/User'; import App from 'App/User';

2
dev/bootstrap.js vendored
View file

@ -1,4 +1,4 @@
/* @flow */
import window from 'window'; import window from 'window';
import {killCtrlACtrlS, detectDropdownVisibility, createCommandLegacy, domReady} from 'Common/Utils'; import {killCtrlACtrlS, detectDropdownVisibility, createCommandLegacy, domReady} from 'Common/Utils';
import {$win, $html, data as GlobalsData, bMobileDevice} from 'Common/Globals'; import {$win, $html, data as GlobalsData, bMobileDevice} from 'Common/Globals';

View file

@ -391,20 +391,33 @@ gulp.task('js:admin', ['js:webpack'], function() {
}); });
// - min // - min
gulp.task('js:min', ['js:app', 'js:admin'], function() { gulp.task('js:es5:min', ['js:app', 'js:admin'], function() {
return gulp.src(cfg.paths.staticJS + '*.js') return gulp.src(cfg.paths.staticJS + '*.js')
.pipe(ignore.exclude('*.next.js')) .pipe(ignore.exclude('*.next.js'))
.pipe(replace(/"rainloop\/v\/([^\/]+)\/static\/js\/"/g, '"rainloop/v/$1/static/js/min/"')) .pipe(replace(/"rainloop\/v\/([^\/]+)\/static\/js\/"/g, '"rainloop/v/$1/static/js/min/"'))
.pipe(rename({suffix: '.min'})) .pipe(rename({suffix: '.min'}))
.pipe(uglify({ .pipe(uglify({
mangle: true, mangle: true,
compress: true compress: true,
'screw-ie8': true
})) }))
.pipe(eol('\n', true)) .pipe(eol('\n', true))
.pipe(gulp.dest(cfg.paths.staticMinJS)) .pipe(gulp.dest(cfg.paths.staticMinJS))
.on('error', gutil.log); .on('error', gutil.log);
}); });
gulp.task('js:es6:min', ['js:app', 'js:admin'], function() {
return cfg.next ? gulp.src(cfg.paths.staticJS + '*.next.js')
.pipe(replace(/"rainloop\/v\/([^\/]+)\/static\/js\/"/g, '"rainloop/v/$1/static/js/min/"'))
// TODO
.pipe(eol('\n', true))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest(cfg.paths.staticMinJS))
.on('error', gutil.log) : true;
});
gulp.task('js:min', ['js:es5:min', 'js:es6:min']);
// lint // lint
gulp.task('js:eslint', function() { gulp.task('js:eslint', function() {
return gulp.src(cfg.paths.globjs) return gulp.src(cfg.paths.globjs)

203
npm-shrinkwrap.json generated
View file

@ -162,9 +162,9 @@
"resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz" "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz"
}, },
"async-each": { "async-each": {
"version": "1.0.0", "version": "1.0.1",
"from": "async-each@>=1.0.0 <2.0.0", "from": "async-each@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.0.tgz" "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz"
}, },
"autolinker": { "autolinker": {
"version": "1.1.0", "version": "1.1.0",
@ -633,9 +633,9 @@
"resolved": "https://registry.npmjs.org/big.js/-/big.js-3.1.3.tgz" "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.1.3.tgz"
}, },
"binary-extensions": { "binary-extensions": {
"version": "1.5.0", "version": "1.6.0",
"from": "binary-extensions@>=1.0.0 <2.0.0", "from": "binary-extensions@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.5.0.tgz" "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.6.0.tgz"
}, },
"binaryextensions": { "binaryextensions": {
"version": "1.0.1", "version": "1.0.1",
@ -685,9 +685,9 @@
"resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz" "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz"
}, },
"brorand": { "brorand": {
"version": "1.0.5", "version": "1.0.6",
"from": "brorand@>=1.0.1 <2.0.0", "from": "brorand@>=1.0.1 <2.0.0",
"resolved": "https://registry.npmjs.org/brorand/-/brorand-1.0.5.tgz" "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.0.6.tgz"
}, },
"browserify-aes": { "browserify-aes": {
"version": "1.0.6", "version": "1.0.6",
@ -940,7 +940,17 @@
"readable-stream": { "readable-stream": {
"version": "2.0.6", "version": "2.0.6",
"from": "readable-stream@>=2.0.0 <2.1.0", "from": "readable-stream@>=2.0.0 <2.1.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz" "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz",
"dependencies": {
"process-nextick-args": {
"version": "1.0.7",
"from": "process-nextick-args@>=1.0.6 <1.1.0"
},
"util-deprecate": {
"version": "1.0.2",
"from": "util-deprecate@>=1.0.1 <1.1.0"
}
}
} }
} }
}, },
@ -1161,7 +1171,21 @@
"readable-stream": { "readable-stream": {
"version": "2.1.5", "version": "2.1.5",
"from": "readable-stream@>=2.0.0 <3.0.0", "from": "readable-stream@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz" "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz",
"dependencies": {
"buffer-shims": {
"version": "1.0.0",
"from": "buffer-shims@>=1.0.0 <2.0.0"
},
"process-nextick-args": {
"version": "1.0.7",
"from": "process-nextick-args@>=1.0.6 <1.1.0"
},
"util-deprecate": {
"version": "1.0.2",
"from": "util-deprecate@>=1.0.1 <1.1.0"
}
}
} }
} }
}, },
@ -1191,9 +1215,9 @@
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-0.1.5.tgz" "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-0.1.5.tgz"
}, },
"enhanced-resolve": { "enhanced-resolve": {
"version": "2.2.2", "version": "2.3.0",
"from": "enhanced-resolve@>=2.2.0 <3.0.0", "from": "enhanced-resolve@>=2.2.0 <3.0.0",
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-2.2.2.tgz" "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-2.3.0.tgz"
}, },
"errno": { "errno": {
"version": "0.1.4", "version": "0.1.4",
@ -1738,7 +1762,22 @@
"readable-stream": { "readable-stream": {
"version": "2.1.5", "version": "2.1.5",
"from": "readable-stream@>=2.1.4 <3.0.0", "from": "readable-stream@>=2.1.4 <3.0.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz" "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz",
"dependencies": {
"buffer-shims": {
"version": "1.0.0",
"from": "buffer-shims@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz"
},
"process-nextick-args": {
"version": "1.0.7",
"from": "process-nextick-args@>=1.0.6 <1.1.0"
},
"util-deprecate": {
"version": "1.0.2",
"from": "util-deprecate@>=1.0.1 <1.1.0"
}
}
} }
} }
}, },
@ -1878,7 +1917,21 @@
"readable-stream": { "readable-stream": {
"version": "2.1.5", "version": "2.1.5",
"from": "readable-stream@>=2.0.2 <3.0.0", "from": "readable-stream@>=2.0.2 <3.0.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz" "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz",
"dependencies": {
"buffer-shims": {
"version": "1.0.0",
"from": "buffer-shims@>=1.0.0 <2.0.0"
},
"process-nextick-args": {
"version": "1.0.7",
"from": "process-nextick-args@>=1.0.6 <1.1.0"
},
"util-deprecate": {
"version": "1.0.2",
"from": "util-deprecate@>=1.0.1 <1.1.0"
}
}
} }
} }
}, },
@ -1994,7 +2047,21 @@
"readable-stream": { "readable-stream": {
"version": "2.1.5", "version": "2.1.5",
"from": "readable-stream@>=2.0.1 <3.0.0", "from": "readable-stream@>=2.0.1 <3.0.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz" "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz",
"dependencies": {
"buffer-shims": {
"version": "1.0.0",
"from": "buffer-shims@>=1.0.0 <2.0.0"
},
"process-nextick-args": {
"version": "1.0.7",
"from": "process-nextick-args@>=1.0.6 <1.1.0"
},
"util-deprecate": {
"version": "1.0.2",
"from": "util-deprecate@>=1.0.1 <1.1.0"
}
}
} }
} }
}, },
@ -2187,9 +2254,9 @@
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.5.tgz" "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.5.tgz"
}, },
"inherits": { "inherits": {
"version": "2.0.1", "version": "2.0.3",
"from": "inherits@>=2.0.1 <2.1.0", "from": "inherits@>=2.0.1 <2.1.0",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz"
}, },
"ini": { "ini": {
"version": "1.3.4", "version": "1.3.4",
@ -2964,7 +3031,21 @@
"readable-stream": { "readable-stream": {
"version": "2.1.5", "version": "2.1.5",
"from": "readable-stream@>=2.0.1 <3.0.0", "from": "readable-stream@>=2.0.1 <3.0.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz" "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz",
"dependencies": {
"buffer-shims": {
"version": "1.0.0",
"from": "buffer-shims@>=1.0.0 <2.0.0"
},
"process-nextick-args": {
"version": "1.0.7",
"from": "process-nextick-args@>=1.0.6 <1.1.0"
},
"util-deprecate": {
"version": "1.0.2",
"from": "util-deprecate@>=1.0.1 <1.1.0"
}
}
} }
} }
}, },
@ -3367,7 +3448,14 @@
"supports-color": { "supports-color": {
"version": "3.1.2", "version": "3.1.2",
"from": "supports-color@>=3.1.2 <4.0.0", "from": "supports-color@>=3.1.2 <4.0.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz" "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz",
"dependencies": {
"has-flag": {
"version": "1.0.0",
"from": "has-flag@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz"
}
}
} }
} }
}, },
@ -3402,9 +3490,9 @@
"resolved": "https://registry.npmjs.org/private/-/private-0.1.6.tgz" "resolved": "https://registry.npmjs.org/private/-/private-0.1.6.tgz"
}, },
"process": { "process": {
"version": "0.11.8", "version": "0.11.9",
"from": "process@>=0.11.0 <0.12.0", "from": "process@>=0.11.0 <0.12.0",
"resolved": "https://registry.npmjs.org/process/-/process-0.11.8.tgz" "resolved": "https://registry.npmjs.org/process/-/process-0.11.9.tgz"
}, },
"process-nextick-args": { "process-nextick-args": {
"version": "1.0.7", "version": "1.0.7",
@ -3647,7 +3735,21 @@
"readable-stream": { "readable-stream": {
"version": "2.1.5", "version": "2.1.5",
"from": "readable-stream@>=2.0.1 <3.0.0", "from": "readable-stream@>=2.0.1 <3.0.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz" "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz",
"dependencies": {
"buffer-shims": {
"version": "1.0.0",
"from": "buffer-shims@>=1.0.0 <2.0.0"
},
"process-nextick-args": {
"version": "1.0.7",
"from": "process-nextick-args@>=1.0.6 <1.1.0"
},
"util-deprecate": {
"version": "1.0.2",
"from": "util-deprecate@>=1.0.1 <1.1.0"
}
}
} }
} }
}, },
@ -3910,7 +4012,21 @@
"readable-stream": { "readable-stream": {
"version": "2.1.5", "version": "2.1.5",
"from": "readable-stream@>=2.0.2 <3.0.0", "from": "readable-stream@>=2.0.2 <3.0.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz" "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz",
"dependencies": {
"buffer-shims": {
"version": "1.0.0",
"from": "buffer-shims@>=1.0.0 <2.0.0"
},
"process-nextick-args": {
"version": "1.0.7",
"from": "process-nextick-args@>=1.0.6 <1.1.0"
},
"util-deprecate": {
"version": "1.0.2",
"from": "util-deprecate@>=1.0.1 <1.1.0"
}
}
} }
} }
}, },
@ -3937,7 +4053,21 @@
"readable-stream": { "readable-stream": {
"version": "2.1.5", "version": "2.1.5",
"from": "readable-stream@>=2.0.2 <3.0.0", "from": "readable-stream@>=2.0.2 <3.0.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz" "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz",
"dependencies": {
"buffer-shims": {
"version": "1.0.0",
"from": "buffer-shims@>=1.0.0 <2.0.0"
},
"process-nextick-args": {
"version": "1.0.7",
"from": "process-nextick-args@>=1.0.6 <1.1.0"
},
"util-deprecate": {
"version": "1.0.2",
"from": "util-deprecate@>=1.0.1 <1.1.0"
}
}
} }
} }
}, },
@ -4046,7 +4176,19 @@
"readable-stream": { "readable-stream": {
"version": "2.0.6", "version": "2.0.6",
"from": "readable-stream@>=2.0.0 <2.1.0", "from": "readable-stream@>=2.0.0 <2.1.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz" "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz",
"dependencies": {
"process-nextick-args": {
"version": "1.0.7",
"from": "process-nextick-args@>=1.0.6 <1.1.0",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz"
},
"util-deprecate": {
"version": "1.0.2",
"from": "util-deprecate@>=1.0.1 <1.1.0",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz"
}
}
} }
} }
}, },
@ -4241,7 +4383,14 @@
"util": { "util": {
"version": "0.10.3", "version": "0.10.3",
"from": "util@>=0.10.3 <0.11.0", "from": "util@>=0.10.3 <0.11.0",
"resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz" "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz",
"dependencies": {
"inherits": {
"version": "2.0.1",
"from": "inherits@2.0.1",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
}
}
}, },
"util-deprecate": { "util-deprecate": {
"version": "1.0.2", "version": "1.0.2",
@ -4338,9 +4487,9 @@
"resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz" "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz"
}, },
"webpack": { "webpack": {
"version": "2.1.0-beta.21", "version": "2.1.0-beta.22",
"from": "webpack@>=2.1.0-beta.21 <3.0.0", "from": "webpack@2.1.0-beta.22",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-2.1.0-beta.21.tgz", "resolved": "https://registry.npmjs.org/webpack/-/webpack-2.1.0-beta.22.tgz",
"dependencies": { "dependencies": {
"async": { "async": {
"version": "1.5.2", "version": "1.5.2",

View file

@ -114,7 +114,7 @@
"style-loader": "^0.13.1", "style-loader": "^0.13.1",
"tinycon": "github:tommoor/tinycon", "tinycon": "github:tommoor/tinycon",
"underscore": "^1.8.3", "underscore": "^1.8.3",
"webpack": "^2.1.0-beta.21", "webpack": "2.1.0-beta.22",
"webpack-notifier": "1.4.1" "webpack-notifier": "1.4.1"
} }
} }

View file

@ -53,7 +53,7 @@
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a class="btn buttonSave" data-bind="command: saveFilter"> <a class="btn buttonSave" data-bind="command: saveFilterCommand">
<i class="icon-ok"></i> <i class="icon-ok"></i>
&nbsp;&nbsp; &nbsp;&nbsp;
<span class="i18n" data-i18n="POPUPS_FILTER/BUTTON_DONE"></span> <span class="i18n" data-i18n="POPUPS_FILTER/BUTTON_DONE"></span>

View file

@ -16,7 +16,7 @@
</label> </label>
<div class="controls"> <div class="controls">
<input type="text" class="uiInput inputName" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" <input type="text" class="uiInput inputName" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="textInput: folderName, hasfocus: folderName.focused, onEnter: createFolder" /> data-bind="textInput: folderName, hasfocus: folderName.focused, onEnter: createFolderCommand" />
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group">
@ -31,7 +31,7 @@
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a class="btn buttonCreate" data-bind="command: createFolder"> <a class="btn buttonCreate" data-bind="command: createFolderCommand">
<i class="icon-folder-add"></i> <i class="icon-folder-add"></i>
&nbsp;&nbsp; &nbsp;&nbsp;
<span class="i18n" data-i18n="POPUPS_CREATE_FOLDER/BUTTON_CREATE"></span> <span class="i18n" data-i18n="POPUPS_CREATE_FOLDER/BUTTON_CREATE"></span>

View file

@ -17,13 +17,13 @@
<div class="controls"> <div class="controls">
<input type="text" class="uiInput inputName" <input type="text" class="uiInput inputName"
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="textInput: code, hasfocus: code.focused, onEnter: testCode" /> data-bind="textInput: code, hasfocus: code.focused, onEnter: testCodeCommand" />
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a class="btn" data-bind="command: testCode, css: { 'btn-success': true === code.status(), 'btn-danger': false === code.status() }"> <a class="btn" data-bind="command: testCodeCommand, css: { 'btn-success': true === code.status(), 'btn-danger': false === code.status() }">
<i data-bind="css: {'icon-ok': !testing(), 'icon-spinner animated': testing(), 'icon-white': true === code.status() || false === code.status() }"></i> <i data-bind="css: {'icon-ok': !testing(), 'icon-spinner animated': testing(), 'icon-white': true === code.status() || false === code.status() }"></i>
&nbsp;&nbsp; &nbsp;&nbsp;
<span class="i18n" data-i18n="POPUPS_TWO_FACTOR_TEST/BUTTON_TEST"></span> <span class="i18n" data-i18n="POPUPS_TWO_FACTOR_TEST/BUTTON_TEST"></span>

View file

@ -20,7 +20,7 @@
</a> </a>
&nbsp;&nbsp; &nbsp;&nbsp;
<a class="btn hide-on-disabled-command" data-placement="bottom" data-join="top" <a class="btn hide-on-disabled-command" data-placement="bottom" data-join="top"
data-bind="command: saveChanges, tooltipErrorTip: saveErrorText, css: {'btn-danger': '' !== saveErrorText()}"> data-bind="command: saveChangesCommand, tooltipErrorTip: saveErrorText, css: {'btn-danger': '' !== saveErrorText()}">
<i data-bind="css: {'icon-floppy': !filters.saving(), 'icon-spinner animated': filters.saving()}"></i> <i data-bind="css: {'icon-floppy': !filters.saving(), 'icon-spinner animated': filters.saving()}"></i>
&nbsp;&nbsp; &nbsp;&nbsp;
<span class="i18n" data-i18n="SETTINGS_FILTERS/BUTTON_SAVE"></span> <span class="i18n" data-i18n="SETTINGS_FILTERS/BUTTON_SAVE"></span>

View file

@ -4,7 +4,7 @@
<span class="i18n" data-i18n="SETTINGS_SOCIAL/LEGEND_GOOGLE"></span> <span class="i18n" data-i18n="SETTINGS_SOCIAL/LEGEND_GOOGLE"></span>
</div> </div>
<div class="control-group" data-bind="visible: !googleLoggined()"> <div class="control-group" data-bind="visible: !googleLoggined()">
<button class="btn" data-bind="command: connectGoogle"> <button class="btn" data-bind="command: connectGoogleCommand">
<i class="icon-google" data-bind="visible: !googleActions()"></i> <i class="icon-google" data-bind="visible: !googleActions()"></i>
<i class="icon-spinner animated" data-bind="visible: googleActions()"></i> <i class="icon-spinner animated" data-bind="visible: googleActions()"></i>
&nbsp;&nbsp; &nbsp;&nbsp;
@ -24,7 +24,7 @@
</strong> </strong>
<br /> <br />
<br /> <br />
<button class="btn" data-bind="command: disconnectGoogle"> <button class="btn" data-bind="command: disconnectGoogleCommand">
<i class="icon-remove" data-bind="visible: !googleActions()"></i> <i class="icon-remove" data-bind="visible: !googleActions()"></i>
<i class="icon-spinner animated" data-bind="visible: googleActions()"></i> <i class="icon-spinner animated" data-bind="visible: googleActions()"></i>
&nbsp;&nbsp; &nbsp;&nbsp;
@ -37,7 +37,7 @@
<span class="i18n" data-i18n="SETTINGS_SOCIAL/LEGEND_FACEBOOK"></span> <span class="i18n" data-i18n="SETTINGS_SOCIAL/LEGEND_FACEBOOK"></span>
</div> </div>
<div class="control-group" data-bind="visible: !facebookLoggined()"> <div class="control-group" data-bind="visible: !facebookLoggined()">
<button class="btn" data-bind="command: connectFacebook"> <button class="btn" data-bind="command: connectFacebookCommand">
<i class="icon-facebook" data-bind="visible: !facebookActions()"></i> <i class="icon-facebook" data-bind="visible: !facebookActions()"></i>
<i class="icon-spinner animated" data-bind="visible: facebookActions()"></i> <i class="icon-spinner animated" data-bind="visible: facebookActions()"></i>
&nbsp;&nbsp; &nbsp;&nbsp;
@ -57,7 +57,7 @@
</strong> </strong>
<br /> <br />
<br /> <br />
<button class="btn" data-bind="command: disconnectFacebook"> <button class="btn" data-bind="command: disconnectFacebookCommand">
<i class="icon-remove" data-bind="visible: !facebookActions()"></i> <i class="icon-remove" data-bind="visible: !facebookActions()"></i>
<i class="icon-spinner animated" data-bind="visible: facebookActions()"></i> <i class="icon-spinner animated" data-bind="visible: facebookActions()"></i>
&nbsp;&nbsp; &nbsp;&nbsp;
@ -70,7 +70,7 @@
<span class="i18n" data-i18n="SETTINGS_SOCIAL/LEGEND_TWITTER"></span> <span class="i18n" data-i18n="SETTINGS_SOCIAL/LEGEND_TWITTER"></span>
</div> </div>
<div class="control-group" data-bind="visible: !twitterLoggined()"> <div class="control-group" data-bind="visible: !twitterLoggined()">
<button class="btn" data-bind="command: connectTwitter"> <button class="btn" data-bind="command: connectTwitterCommand">
<i class="icon-twitter" data-bind="visible: !twitterActions()"></i> <i class="icon-twitter" data-bind="visible: !twitterActions()"></i>
<i class="icon-spinner animated" data-bind="visible: twitterActions()"></i> <i class="icon-spinner animated" data-bind="visible: twitterActions()"></i>
&nbsp;&nbsp; &nbsp;&nbsp;
@ -90,7 +90,7 @@
</strong> </strong>
<br /> <br />
<br /> <br />
<button class="btn" data-bind="command: disconnectTwitter"> <button class="btn" data-bind="command: disconnectTwitterCommand">
<i class="icon-remove" data-bind="visible: !twitterActions()"></i> <i class="icon-remove" data-bind="visible: !twitterActions()"></i>
<i class="icon-spinner animated" data-bind="visible: twitterActions()"></i> <i class="icon-spinner animated" data-bind="visible: twitterActions()"></i>
&nbsp;&nbsp; &nbsp;&nbsp;

View file

@ -3,9 +3,9 @@ var
path = require('path'), path = require('path'),
webpack = require('webpack'), webpack = require('webpack'),
devPath = path.resolve(__dirname, 'dev'), devPath = path.resolve(__dirname, 'dev'),
CopyWebpackPlugin = require('copy-webpack-plugin'), CopyWebpackPlugin = require('copy-webpack-plugin'),
WebpackNotifierPlugin = require('webpack-notifier'); WebpackNotifierPlugin = require('webpack-notifier'),
loose = true;
module.exports = function(publicPath, pro, es6) { module.exports = function(publicPath, pro, es6) {
return { return {
@ -54,29 +54,29 @@ module.exports = function(publicPath, pro, es6) {
include: [devPath], include: [devPath],
query: !es6 ? { query: !es6 ? {
cacheDirectory: true, cacheDirectory: true,
presets: [['es2015', {loose: true, modules: false}], 'es2016', 'stage-0'], presets: [['es2015', {loose: loose, modules: false}], 'es2016', 'stage-0'],
plugins: ['transform-runtime', 'transform-decorators-legacy'] plugins: ['transform-runtime', 'transform-decorators-legacy']
} : { } : {
cacheDirectory: true, cacheDirectory: true,
plugins: [ plugins: [
// es2015 // es2015
["transform-es2015-template-literals", {loose: true}], ["transform-es2015-template-literals", {loose: loose}],
"transform-es2015-literals", "transform-es2015-literals",
"transform-es2015-function-name", "transform-es2015-function-name",
// ["transform-es2015-arrow-functions")], // ["transform-es2015-arrow-functions")],
"transform-es2015-block-scoped-functions", "transform-es2015-block-scoped-functions",
// ["transform-es2015-classes", {loose: true}], // ["transform-es2015-classes", {loose: loose}],
// "transform-es2015-object-super", // "transform-es2015-object-super",
"transform-es2015-shorthand-properties", "transform-es2015-shorthand-properties",
"transform-es2015-duplicate-keys", "transform-es2015-duplicate-keys",
["transform-es2015-computed-properties", {loose: true}], ["transform-es2015-computed-properties", {loose: loose}],
["transform-es2015-for-of", {loose: true}], ["transform-es2015-for-of", {loose: loose}],
"transform-es2015-sticky-regex", "transform-es2015-sticky-regex",
"transform-es2015-unicode-regex", "transform-es2015-unicode-regex",
// "check-es2015-constants", // "check-es2015-constants",
//["transform-es2015-spread", {loose: true}], //["transform-es2015-spread", {loose: loose}],
// "transform-es2015-parameters", // "transform-es2015-parameters",
//["transform-es2015-destructuring", {loose: true}], //["transform-es2015-destructuring", {loose: loose}],
// "transform-es2015-block-scoping", // "transform-es2015-block-scoping",
"transform-es2015-typeof-symbol", "transform-es2015-typeof-symbol",
// ["transform-regenerator", { async: false, asyncGenerators: false }], // ["transform-regenerator", { async: false, asyncGenerators: false }],