add simple welcome dialog

This commit is contained in:
Johannes Millan 2017-02-04 18:08:14 +01:00
parent c92fd3ebd3
commit ad4ba1db07
10 changed files with 121 additions and 12 deletions

View file

@ -129,6 +129,7 @@ TODO configure more restrictive Content-Security-Policy
<script src="scripts/dialogs/task-selection/task-selection-c.js"></script>
<script src="scripts/dialogs/time-estimate/time-estimate-c.js"></script>
<script src="scripts/dialogs/was-idle/was-idle-c.js"></script>
<script src="scripts/dialogs/welcome/welcome-c.js"></script>
<script src="scripts/done-tasks-backlog/done-tasks-backlog-d.js"></script>
<script src="scripts/download-backup/download-backup-d.js"></script>
<script src="scripts/edit-on-click/edit-on-click-d.js"></script>

View file

@ -40,7 +40,8 @@
.run(initPollJiraTaskUpdates)
.run(initPollForSimpleTimeTracking)
.run(initMousewheelZoomForElectron)
.run(initGlobalShortcuts);
.run(initGlobalShortcuts)
.run(showWelcomeDialog);
function configMarked(markedProvider) {
markedProvider.setRenderer({
@ -147,6 +148,12 @@
}
}
function showWelcomeDialog($localStorage, Dialogs) {
if ($localStorage.isShowWelcomeDialog) {
Dialogs('WELCOME', undefined, true);
}
}
function initMousewheelZoomForElectron($document, $window, IS_ELECTRON) {
if (IS_ELECTRON) {
const { webFrame } = require('electron');

View file

@ -12,7 +12,14 @@
angular
.module('superProductivity')
.constant('DEFAULT_THEME', 'blue-theme')
.constant('GLOBAL_LS_FIELDS', [
'currentProject',
'projects',
'keys',
'isShowWelcomeDialog'
])
.constant('LS_DEFAULTS', {
isShowWelcomeDialog: true,
note: undefined,
theme: undefined,
currentTask: undefined,

View file

@ -17,10 +17,9 @@
controllerAs: 'vm',
bindToController: true
},
CREATE_TASK: {
title: 'Out of undone tasks',
textContent: 'You run out of tasks. Go on and create some new ones if you like.',
ok: 'Got it!'
WELCOME: {
controller: 'WelcomeCtrl',
templateUrl: 'scripts/dialogs/welcome/welcome-c.html'
},
WAS_IDLE: {
controller: 'WasIdleCtrl',

View file

@ -0,0 +1,3 @@
.welcome-dialog {
}

View file

@ -0,0 +1,41 @@
<md-dialog aria-label="Welcome Dialog"
class="welcome-dialog">
<md-toolbar>
<div class="md-toolbar-tools">
<h2>Welcome to Super Productivity!</h2>
<span flex></span>
<md-button class="md-icon-button"
aria-label="Cancel"
ng-click="vm.cancel()">
<ng-md-icon icon="close"></ng-md-icon>
</md-button>
</div>
</md-toolbar>
<md-dialog-content>
<div class="md-dialog-content">
<p>Happy to see you try out super productivity!</p>
<p>After familiarizing you with the basic functionality, you might want head over to
<a ui-sref="settings"
ng-click="vm.cancel()"
class="md-accent">the settings</a> to adjust everything to your personal needs<span ng-if="vm.IS_ELECTRON"> and to set up the Jira Integration</span>. You can find them under the cog icon in the upper right.
</p>
<p>Enjoy yourself!</p>
<md-switch ng-model="vm.isHideDialog"
ng-change="vm.hideDialogChange(vm.isHideDialog)"
aria-label="Don't show this dialog at startup any more">
Don't show this dialog at startup any more
</md-switch>
</div>
</md-dialog-content>
<md-dialog-actions>
<md-button ng-click="vm.cancel()"
type="button"
class="md-raised">
Dismiss
</md-button>
</md-dialog-actions>
</md-dialog>

View file

@ -0,0 +1,32 @@
/**
* @ngdoc function
* @name superProductivity.controller:WelcomeCtrl
* @description
* # WelcomeCtrl
* Controller of the superProductivity
*/
(function () {
'use strict';
angular
.module('superProductivity')
.controller('WelcomeCtrl', WelcomeCtrl);
/* @ngInject */
function WelcomeCtrl($mdDialog, $localStorage, IS_ELECTRON) {
let vm = this;
vm.IS_ELECTRON = IS_ELECTRON;
vm.isShowDialogAgain = $localStorage.isShowWelcomeDialog;
vm.hideDialogChange = (isHide) => {
$localStorage.isShowWelcomeDialog = !isHide;
};
vm.cancel = () => {
$mdDialog.cancel();
};
}
})();

View file

@ -0,0 +1,23 @@
'use strict';
describe('Controller: WelcomeCtrl', function () {
// load the controller's module
beforeEach(module('superProductivity'));
var WelcomeCtrl;
var scope;
// Initialize the controller and a mock scope
beforeEach(inject(function ($controller, $rootScope) {
scope = $rootScope.$new();
WelcomeCtrl = $controller('WelcomeCtrl', {
$scope: scope
// place mocked dependencies here
});
}));
it('should ...', function () {
expect(true).toBe(true);
});
});

View file

@ -14,13 +14,7 @@
.service('Projects', Projects);
/* @ngInject */
function Projects(LS_DEFAULTS, $localStorage, Uid, $window, SimpleToast, $injector) {
const GLOBAL_LS_FIELDS = [
'currentProject',
'projects',
'keys'
];
function Projects(LS_DEFAULTS, $localStorage, Uid, $window, SimpleToast, $injector, GLOBAL_LS_FIELDS) {
const TMP_FIELDS = [
'$$hashKey',
'$$mdSelectId',

View file

@ -79,6 +79,8 @@ IMPORTANT NOTE:
@import '../scripts/dialogs/was-idle/_was-idle-c.scss';
@import '../scripts/dialogs/welcome/_welcome-c.scss';
@import '../scripts/done-tasks-backlog/_done-tasks-backlog-d.scss';
@import '../scripts/edit-on-click/_edit-on-click-d.scss';