mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-31 03:30:50 +00:00
73 lines
2.1 KiB
JavaScript
73 lines
2.1 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(configHttp)
|
|
.config(configMdTheme)
|
|
.run(initGlobalModels)
|
|
.run(initGlobalShortcuts)
|
|
.run(showHintsForToday);
|
|
|
|
function configHttp($httpProvider) {
|
|
//delete $httpProvider.defaults.headers.common['X-Requested-With'];
|
|
|
|
$httpProvider.defaults.headers.common = {};
|
|
$httpProvider.defaults.headers.post = {};
|
|
$httpProvider.defaults.headers.put = {};
|
|
$httpProvider.defaults.headers.patch = {};
|
|
}
|
|
|
|
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(Tasks, $rootScope, $localStorage) {
|
|
$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;
|
|
}
|
|
|
|
function showHintsForToday($rootScope, $localStorage, ProductivityTips) {
|
|
$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');
|
|
}
|
|
});
|
|
}
|
|
|
|
})();
|