Skip to content

Commit

Permalink
Release glass style
Browse files Browse the repository at this point in the history
  • Loading branch information
RainLoop committed Sep 15, 2016
1 parent 7ffa5af commit 155f4b6
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 69 deletions.
5 changes: 5 additions & 0 deletions dev/App/Abstract.js
Expand Up @@ -332,6 +332,11 @@ class AbstractApp extends AbstractBoot
leftPanelDisabled(false);
});

if (Settings.appSettingsGet('loginGlassStyle'))
{
$html.addClass('glass');
}

if (!mobile)
{
ssm.addState({
Expand Down
47 changes: 2 additions & 45 deletions dev/Common/Cmd.js
Expand Up @@ -3,7 +3,7 @@ import window from 'window';
import $ from '$';
import _ from '_';
import ko from 'ko';
import {$html, $body} from 'Common/Globals';
import {$body} from 'Common/Globals';
import {EventKeyCode, Magics} from 'Common/Enums';
import {trim, inArray, changeTheme} from 'Common/Utils';
import {reload as translatorReload} from 'Common/Translator';
Expand Down Expand Up @@ -40,43 +40,6 @@ function cmdHelp(cmds) {
return require('Html/Cmds/Help.html').replace('{{ commands }}', cmds.join(' '));
}

/**
* @returns {void}
*/
function initGlass() {
let state = null;
try {
if (window.localStorage && window.localStorage.setItem)
{
state = '1' === '' + window.localStorage.getItem('rl-labs-glass');
}
}
catch (e) {} // eslint-disable-line no-empty

if (null !== state)
{
$html.toggleClass('glass', !!state);
}
}

/**
* @returns {string}
*/
function cmdGlass() {
const state = !$html.hasClass('glass');

try {
if (window.localStorage && window.localStorage.setItem)
{
window.localStorage.setItem('rl-labs-glass', state ? '1' : '0');
}
}
catch (e) {} // eslint-disable-line no-empty

$html.toggleClass('glass', state);
return '';
}

/**
* @returns {string}
*/
Expand Down Expand Up @@ -124,7 +87,7 @@ class CmdContoller

cmdHelper = ko.observable('');

cmds = ['help', 'version', 'glass', 'clear', 'theme', 'lang'];
cmds = ['help', 'version', 'clear', 'theme', 'lang'];
cmdsWithParameters = ['theme', 'lang'];

isAdmin = false;
Expand Down Expand Up @@ -205,9 +168,6 @@ class CmdContoller
case 'help':
result = cmdHelp(this.cmds);
break;
case 'glass':
result = cmdGlass();
break;
case 'v':
case 'version':
result = cmdVersion();
Expand Down Expand Up @@ -390,6 +350,3 @@ export function toggle()
}, Magics.Time50ms);
}
}

// init
initGlass();
2 changes: 1 addition & 1 deletion dev/Settings/Admin/Prem/Licensing.js
@@ -1,5 +1,6 @@

import ko from 'ko';
import moment from 'moment';

import {settingsGet} from 'Storage/Settings';
import {showScreenPopup} from 'Knoin/Knoin';
Expand Down Expand Up @@ -60,7 +61,6 @@ class LicensingPremAdminSettings
*/
licenseExpiredMomentValue() {
const
moment = require('moment'),
time = this.licenseExpired(),
momentUnix = moment.unix(time);

Expand Down
8 changes: 7 additions & 1 deletion dev/Styles/Login.less
Expand Up @@ -59,7 +59,7 @@
}

.wrapper {
padding: 40px 40px 12px 40px;
padding: 40px 40px 20px 40px;
}

#recaptcha_image img {
Expand Down Expand Up @@ -102,6 +102,12 @@
font-size: 17px;
line-height: 29px;
color: #999;

&.login-submit-icon{
font-size: 24px;
padding-top: 2px;
cursor: pointer;
}
}

.controls.error .add-on i, .control-group.error .add-on i {
Expand Down
4 changes: 4 additions & 0 deletions dev/Styles/Ui.less
Expand Up @@ -174,6 +174,10 @@ html.rgba .g-ui-resizable-delimiter-highlight {
}
}

.display-none {
display: none;
}

.e-spinner {
display: none;
}
Expand Down
6 changes: 2 additions & 4 deletions dev/View/User/Login.js
Expand Up @@ -36,7 +36,7 @@ import {view, command, ViewType, routeOff, showScreenPopup} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';

@view({
name: 'View/User/Login',
name: ['View/App/Login', 'View/User/Login'],
type: ViewType.Center,
templateID: 'Login'
})
Expand Down Expand Up @@ -83,7 +83,6 @@ class LoginUserView extends AbstractViewNext

this.emailFocus = ko.observable(false);
this.passwordFocus = ko.observable(false);
this.submitFocus = ko.observable(false);

this.email.subscribe(() => {
this.emailError(false);
Expand Down Expand Up @@ -335,7 +334,7 @@ class LoginUserView extends AbstractViewNext
onShowWithDelay() {
if ('' !== this.email() && '' !== this.password())
{
this.submitFocus(true);
this.passwordFocus(true);
}
else if ('' === this.email())
{
Expand All @@ -352,7 +351,6 @@ class LoginUserView extends AbstractViewNext
}

onHide() {
this.submitFocus(false);
this.emailFocus(false);
this.passwordFocus(false);
}
Expand Down
1 change: 1 addition & 0 deletions rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php
Expand Up @@ -1455,6 +1455,7 @@ public function AppDataSystem($bAdmin = false, $bMobile = false, $bMobileDevice
'customLogoutLink' => $oConfig->Get('labs', 'custom_logout_link', ''),
'forgotPasswordLinkUrl' => \trim($oConfig->Get('login', 'forgot_password_link_url', '')),
'registrationLinkUrl' => \trim($oConfig->Get('login', 'registration_link_url', '')),
'loginGlassStyle' => (bool) $oConfig->Get('login', 'glass_style', true),
'jsHash' => \md5(\RainLoop\Utils::GetConnectionToken()),
'useImapThread' => (bool) $oConfig->Get('labs', 'use_imap_thread', false),
'useImapSubscribe' => (bool) $oConfig->Get('labs', 'use_imap_list_subscribe', true),
Expand Down
Expand Up @@ -249,6 +249,8 @@ protected function defaultValues()

'welcome_page' => array(false, ''),

'glass_style' => array(true, ''),

'forgot_password_link_url' => array('', ''),
'registration_link_url' => array('', ''),

Expand Down
7 changes: 4 additions & 3 deletions rainloop/v/0.0.0/app/templates/Views/Admin/AdminLogin.html
Expand Up @@ -26,12 +26,13 @@
style="padding-right: 35px;"
autocorrect="off" autocapitalize="off" spellcheck="false" data-i18n="[placeholder]LOGIN/LABEL_PASSWORD"
data-bind="textInput: password, disable: submitRequest" />
<span class="add-on">
<i class="icon-key"></i>
<span class="add-on" data-bind="command: submitCommand">
<i class="icon-key" data-bind="visible: '' === password()"></i>
<i class="icon-right-middle login-submit-icon" data-bind="visible: '' !== password()"></i>
</span>
</div>
</div>
<div class="controls">
<div class="controls controls-submit-wrp display-none">
<button type="submit" class="btn btn-large btn-block buttonLogin" data-bind="command: submitCommand">
<span data-i18n="LOGIN/BUTTON_LOGIN"></span>
</button>
Expand Down
11 changes: 6 additions & 5 deletions rainloop/v/0.0.0/app/templates/Views/User/Login.html
Expand Up @@ -44,8 +44,9 @@
style="padding-right: 35px;"
autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="textInput: password, hasFocus: passwordFocus, disable: submitRequest" data-i18n="[placeholder]LOGIN/LABEL_PASSWORD" />
<span class="add-on">
<i class="icon-key"></i>
<span class="add-on i18n" data-bind="command: submitCommand, tooltip: 'LOGIN/BUTTON_SIGN_IN'">
<i class="icon-key" data-bind="visible: '' === password()"></i>
<i class="icon-right-middle login-submit-icon" data-bind="visible: '' !== password()"></i>
</span>
</div>
</div>
Expand All @@ -70,12 +71,12 @@
}"></div>
</div>
{{INCLUDE/BottomControlGroup/PLACE}}
<div class="controls">
<button type="submit" class="btn btn-large btn-block buttonLogin" data-bind="command: submitCommand, hasFocus: submitFocus">
<div class="controls controls-submit-wrp display-none">
<button type="submit" class="btn btn-large btn-block buttonLogin" data-bind="command: submitCommand">
<span class="i18n i18n-animation" data-i18n="LOGIN/BUTTON_SIGN_IN"></span>
</button>
</div>
<div class="controls clearfix" style="margin-bottom: 20px">
<div class="controls clearfix" style="margin-bottom: 10px">
<div class="pull-right social-buttons">
<a href="#" tabindex="-1" class="social-button" data-bind="visible: facebookLoginEnabled, command: facebookCommand, tooltip: 'LOGIN/TITLE_SIGN_IN_FACEBOOK'">
<i class="icon-facebook-alt"></i>
Expand Down
10 changes: 1 addition & 9 deletions tests/e2e/tests/login_test.js
Expand Up @@ -12,18 +12,10 @@ Scenario('login/page', function(I) {
I.see('Remember Me');
});

Scenario('login/empty-fields-error', function(I) {
I.fillField('.inputEmail', '');
I.fillField('.inputPassword', '');
I.click('.buttonLogin');
I.see('Remember Me');
I.seeElement('.controls.error');
});

Scenario('login/auth-error', function(I) {
I.fillField('.inputEmail', 'xxx');
I.fillField('.inputPassword', 'yyy');
I.click('.buttonLogin');
I.click('.login-submit-icon');
I.waitForVisible('.alertError', 3);
I.see('Authentication failed', '.alertError');
});
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/tests/main_test.js
Expand Up @@ -9,7 +9,7 @@ Before((I) => {
I.waitForElement('.e-powered', 10);
I.fillField('.inputEmail', cfg.user);
I.fillField('.inputPassword', cfg.pass);
I.click('.buttonLogin');
I.click('.login-submit-icon');
I.waitForText('test@rainloop.de', 10, '.accountPlace');
I.resizeWindow(1000, 1000);
});
Expand Down

0 comments on commit 155f4b6

Please sign in to comment.