functional minimalism

This commit is contained in:
Mo Bitar
2017-01-27 19:39:10 -06:00
parent ce053226a5
commit f296b0e49e
36 changed files with 444 additions and 960 deletions

View File

@@ -88,7 +88,7 @@ angular.module('app.frontend')
}
}
})
.controller('EditorCtrl', function ($sce, $timeout, apiController, markdownRenderer, $rootScope, extensionManager, syncManager) {
.controller('EditorCtrl', function ($sce, $timeout, authManager, markdownRenderer, $rootScope, extensionManager, syncManager) {
this.setNote = function(note, oldNote) {
this.editorMode = 'edit';
@@ -149,7 +149,7 @@ angular.module('app.frontend')
if(statusTimeout) $timeout.cancel(statusTimeout);
statusTimeout = $timeout(function(){
var status = "All changes saved"
if(syncManager.offline) {
if(authManager.offline()) {
status += " (offline)";
}
this.saveError = false;

View File

@@ -1,5 +1,5 @@
angular.module('app.frontend')
.directive("header", function(apiController){
.directive("header", function(authManager){
return {
restrict: 'E',
scope: {},
@@ -22,17 +22,17 @@ angular.module('app.frontend')
}
}
})
.controller('HeaderCtrl', function (apiController, modelManager, $timeout, dbManager, syncManager) {
.controller('HeaderCtrl', function (authManager, modelManager, $timeout, dbManager, syncManager) {
this.user = apiController.user;
this.user = authManager.user;
this.updateOfflineStatus = function() {
this.offline = syncManager.offline;
this.offline = authManager.offline();
}
this.updateOfflineStatus();
this.findErrors = function() {
this.error = syncManager.syncProviders.filter(function(provider){return provider.error}).length > 0 ? true : false;
this.error = syncManager.error;
}
this.findErrors();

View File

@@ -1,8 +1,8 @@
angular.module('app.frontend')
.controller('HomeCtrl', function ($scope, $rootScope, $timeout, modelManager, syncManager) {
.controller('HomeCtrl', function ($scope, $rootScope, $timeout, modelManager, syncManager, authManager) {
$rootScope.bodyClass = "app-body-class";
syncManager.loadLocalItems(function(items){
syncManager.loadLocalItems(function(items) {
$scope.$apply();
syncManager.sync(null);
@@ -138,7 +138,7 @@ angular.module('app.frontend')
}
syncManager.sync(function(){
if(syncManager.offline) {
if(authManager.offline()) {
// when deleting items while ofline, we need to explictly tell angular to refresh UI
setTimeout(function () {
$scope.safeApply();

View File

@@ -24,7 +24,7 @@ angular.module('app.frontend')
}
}
})
.controller('NotesCtrl', function (apiController, $timeout, $rootScope, modelManager) {
.controller('NotesCtrl', function (authManager, $timeout, $rootScope, modelManager) {
$rootScope.$on("editorFocused", function(){
this.showMenu = false;