fix dialogs not respecting current theme

This commit is contained in:
Johannes Millan 2017-02-10 16:57:14 +01:00
parent 53c64e7259
commit 4ce2eb1533
22 changed files with 60 additions and 21 deletions

View file

@ -1,4 +1,5 @@
<md-dialog aria-label="Was Idle Dialog"
md-theme="vm.theme"
class="was-idle-dialog">
<md-toolbar>
<div class="md-toolbar-tools">

View file

@ -14,9 +14,10 @@
.controller('AddTaskCtrl', AddTaskCtrl);
/* @ngInject */
function AddTaskCtrl($mdDialog, Tasks) {
function AddTaskCtrl($mdDialog, Tasks, theme) {
let vm = this;
vm.task = {};
vm.theme = theme;
vm.addTask = () => {
if (vm.isAddToBacklog) {

View file

@ -14,7 +14,7 @@
.service('Dialogs', Dialogs);
/* @ngInject */
function Dialogs($mdDialog, DIALOGS, $q) {
function Dialogs($mdDialog, DIALOGS, $q, $document, $localStorage) {
const dialogQueue = [];
function createDialogObject(dialogName, locals) {
@ -22,9 +22,19 @@
const defaults = angular.copy(DIALOGS.DEFAULTS);
let dialog = angular.extend(defaults, DIALOGS[dialogName]);
if (!locals) {
locals = {};
}
// pass default theme
locals = angular.extend(locals, {
theme: $localStorage.theme
});
// add passed variables
dialog = angular.extend(dialog, {
locals: locals
locals: locals,
parent: angular.element($document[0].body)
});
return dialog;
}
@ -54,6 +64,9 @@
nextDialog.wrapperPromise.resolve(res);
}, (err) => {
nextDialog.wrapperPromise.reject(err);
})
.catch((err) => {
nextDialog.wrapperPromise.reject(err);
});
} else {
$mdDialog.show(nextDialog.obj)
@ -65,6 +78,11 @@
nextDialog.wrapperPromise.reject(err);
removeLastResolvedFromQueue();
openNextInQueue();
})
.catch((err) => {
nextDialog.wrapperPromise.reject(err);
removeLastResolvedFromQueue();
openNextInQueue();
});
}
}

View file

@ -1,4 +1,5 @@
<md-dialog aria-label="Distractions"
md-theme="vm.theme"
class="distractions">
<md-toolbar>
<div class="md-toolbar-tools">

View file

@ -14,9 +14,10 @@
.controller('DistractionsCtrl', DistractionsCtrl);
/* @ngInject */
function DistractionsCtrl($mdDialog, $localStorage, SimpleToast) {
function DistractionsCtrl($mdDialog, $localStorage, SimpleToast, theme) {
let vm = this;
vm.r = $localStorage;
vm.theme = theme;
vm.isOpen = false;
vm.close = () => {

View file

@ -1,4 +1,5 @@
<md-dialog aria-label="Submit worklog to jira">
<md-dialog aria-label="Submit worklog to jira"
md-theme="vm.theme">
<md-toolbar>
<div class="md-toolbar-tools">
<h2>Submit worklog to jira for "{{ vm.taskCopy.originalKey }}"</h2>

View file

@ -14,10 +14,11 @@
.controller('JiraAddWorklogCtrl', JiraAddWorklogCtrl);
/* @ngInject */
function JiraAddWorklogCtrl($mdDialog, task, $window, comment) {
function JiraAddWorklogCtrl($mdDialog, task, $window, comment, theme) {
let vm = this;
const moment = $window.moment;
vm.theme = theme;
vm.taskCopy = angular.copy(task);
vm.taskCopy.started = moment(task.started).milliseconds(0).seconds(0).toDate();
vm.isUpdateLocalTaskSettings = false;

View file

@ -1,4 +1,5 @@
<md-dialog aria-label="Jira Set In Progress Dialog">
<md-dialog aria-label="Jira Set In Progress Dialog"
md-theme="vm.theme">
<md-toolbar>
<div class="md-toolbar-tools">

View file

@ -14,8 +14,9 @@
.controller('JiraSetInProgressCtrl', JiraSetInProgressCtrl);
/* @ngInject */
function JiraSetInProgressCtrl($mdDialog, task, transitions, localType, $window, $localStorage) {
function JiraSetInProgressCtrl($mdDialog, task, transitions, localType, $window, $localStorage, theme) {
let vm = this;
vm.theme = theme;
vm.transitions = transitions;
vm.task = task;
vm.localType = localType;

View file

@ -1,5 +1,6 @@
<md-dialog aria-label="Notes"
class="notes-dialog fullscreen-dialog">
class="notes-dialog fullscreen-dialog"
md-theme="vm.theme">
<md-toolbar>
<div class="md-toolbar-tools">
<h2>Notes for {{ vm.r.currentProject.title || 'Project' }}</h2>

View file

@ -14,11 +14,12 @@
.controller('NotesCtrl', NotesCtrl);
/* @ngInject */
function NotesCtrl($mdDialog, $localStorage) {
function NotesCtrl($mdDialog, $localStorage, theme) {
if (!$localStorage.note) {
$localStorage.note = 'write some note';
}
this.r = $localStorage;
this.theme = theme;
this.cancel = () => {
$mdDialog.hide();

View file

@ -1,5 +1,6 @@
<md-dialog aria-label="Task list export"
class="dialog-simple-task-summary">
class="dialog-simple-task-summary"
md-theme="vm.theme">
<md-toolbar>
<div class="md-toolbar-tools">
<h2>Task List Export</h2>

View file

@ -14,8 +14,9 @@
.controller('SimpleTaskSummaryCtrl', SimpleTaskSummaryCtrl);
/* @ngInject */
function SimpleTaskSummaryCtrl($mdDialog, tasks, settings, TasksUtil, $scope, ParseDuration, SimpleToast) {
function SimpleTaskSummaryCtrl($mdDialog, tasks, settings, TasksUtil, $scope, ParseDuration, SimpleToast, theme) {
let vm = this;
vm.theme = theme;
// init clipboard button
// dirty but good enough for now

View file

@ -1,5 +1,6 @@
<md-dialog aria-label="Time estimation dialog"
class="dialog-task-selection">
class="dialog-task-selection"
md-theme="vm.theme">
<form ng-submit="vm.submit()">
<md-dialog-content>

View file

@ -14,8 +14,9 @@
.controller('TaskSelectionCtrl', TaskSelectionCtrl);
/* @ngInject */
function TaskSelectionCtrl($mdDialog, Tasks) {
function TaskSelectionCtrl($mdDialog, Tasks, theme) {
let vm = this;
vm.theme = theme;
vm.undoneTasks = Tasks.getUndoneToday(true);

View file

@ -1,5 +1,6 @@
<md-dialog aria-label="Time estimation and time spent dialog"
class="dialog-time-estimate">
class="dialog-time-estimate"
md-theme="vm.theme">
<md-toolbar>
<div class="md-toolbar-tools">
<h2>Make an estimate / adjust time spent</h2>

View file

@ -14,8 +14,10 @@
.controller('TimeEstimateCtrl', TimeEstimateCtrl);
/* @ngInject */
function TimeEstimateCtrl($mdDialog, task, Tasks, TasksUtil, $window) {
function TimeEstimateCtrl($mdDialog, task, Tasks, TasksUtil, $window, theme) {
let vm = this;
vm.theme = theme;
const moment = $window.moment;
// TODO refactor and add to Tasks.service

View file

@ -1,5 +1,6 @@
<md-dialog aria-label="Was Idle Dialog"
class="was-idle-dialog">
class="was-idle-dialog"
md-theme="vm.theme">
<md-toolbar>
<div class="md-toolbar-tools">
<h2>Glad you're back!</h2>

View file

@ -14,8 +14,9 @@
.controller('WasIdleCtrl', WasIdleCtrl);
/* @ngInject */
function WasIdleCtrl($mdDialog, $localStorage, $scope, Tasks, $window, idleTime, minIdleTimeInMs) {
function WasIdleCtrl($mdDialog, $localStorage, $scope, Tasks, $window, idleTime, minIdleTimeInMs, theme) {
let vm = this;
vm.theme = theme;
const IPC_EVENT_IDLE = 'WAS_IDLE';
const IPC_EVENT_UPDATE_TIME_SPEND_FOR_CURRENT = 'UPDATE_TIME_SPEND';

View file

@ -1,5 +1,6 @@
<md-dialog aria-label="Welcome Dialog"
class="welcome-dialog">
class="welcome-dialog"
md-theme="vm.theme">
<md-toolbar>
<div class="md-toolbar-tools">
<h2>Welcome to Super Productivity!</h2>

View file

@ -14,8 +14,9 @@
.controller('WelcomeCtrl', WelcomeCtrl);
/* @ngInject */
function WelcomeCtrl($mdDialog, $localStorage, IS_ELECTRON) {
function WelcomeCtrl($mdDialog, $localStorage, IS_ELECTRON, theme) {
let vm = this;
vm.theme = theme;
vm.IS_ELECTRON = IS_ELECTRON;

View file

@ -21,7 +21,7 @@
"angular-resource": "1.6.2",
"angular-ui-router": "latest",
"ngstorage": "^0.3.11",
"angular-material": "^1.1.1",
"angular-material": "^1.1.3",
"angular-material-icons": "^0.7.1",
"lodash": "^4.17.3",
"moment": "^2.17.1",