super-productivity/app/scripts/_app.js
2017-01-06 22:01:21 +01:00

59 lines
1.6 KiB
JavaScript

/**
* @ngdoc overview
* @name superProductivity
* @description
* # superProductivity
*
* Main module of the application.
*/
(function () {
'use strict';
angular
.module('superProductivity', [
'ngAnimate',
'ngAria',
'ngResource',
'ui.router',
'ngStorage',
'ngMaterial',
'ngMdIcons',
'as.sortable',
'angularMoment'
])
.config(configMdTheme)
.run(initGlobalModels)
.run(initGlobalShortcuts);
function configMdTheme($mdThemingProvider) {
$mdThemingProvider.theme('dark-grey').backgroundPalette('grey').dark();
$mdThemingProvider.theme('dark-orange').backgroundPalette('orange').dark();
$mdThemingProvider.theme('dark-purple').backgroundPalette('deep-purple').dark();
$mdThemingProvider.theme('dark-blue').backgroundPalette('blue').dark();
}
function initGlobalModels($rootScope, Tasks, $localStorage, ProductivityTips) {
$rootScope.r = {};
$rootScope.r.tasks = Tasks.getToday();
$rootScope.r.backlogTasks = Tasks.getBacklog();
$rootScope.r.currentTask = Tasks.getCurrent();
$rootScope.r.doneBacklogTasks = Tasks.getDoneBacklog();
$rootScope.r.jiraSettings = $localStorage.jiraSettings;
$rootScope.r.noteForToday = $localStorage.tomorrowsNote;
$rootScope.r.productivityTip = ProductivityTips.getRandom();
}
function initGlobalShortcuts($document, Dialogs) {
// we just use this single one as this usually does mess
// up with the default browser shortcuts
// better to use the global electron shortcuts here
$document.bind('keypress', (ev) => {
if (ev.key === '*') {
Dialogs('ADD_TASK');
}
});
}
})();