diff --git a/src/app.coffee b/src/app.coffee index 10f32b3..f0ccefa 100644 --- a/src/app.coffee +++ b/src/app.coffee @@ -33,6 +33,7 @@ pertApp.config ($stateProvider,$urlRouterProvider,$locationProvider) -> templateUrl: 'table.html' controller: pertController +# "Main" Controller pertController = ($scope) -> $scope.toLocalStorage = (data,options) -> options ?= {} diff --git a/src/controllers.coffee b/src/controllers.coffee index fb73a4c..e970190 100644 --- a/src/controllers.coffee +++ b/src/controllers.coffee @@ -49,11 +49,13 @@ pertApp.controller 'ganttDiagController', ($scope) -> $scope.buildTimeline $scope.fromLocalStorage() pertApp.controller 'rawEditorController', ($scope) -> + $scope.reset = -> + $scope.toLocalStorage [] $scope.saveData = -> try data = JSON.parse $scope.taData catch e - return swal 'Error', 'The data entered is invalid', 'error' + swal 'Invalid Data', e, 'error' $scope.toLocalStorage data $scope.reloadData = -> $scope.taData = JSON.stringify $scope.fromLocalStorage silent: yes, raw: yes @@ -107,6 +109,9 @@ pertApp.controller 'editorController', ($scope) -> catch e return newdata = $scope.fromLocalStorage silent: yes, raw: yes + if !newdata? or newdata is null or !newdata.push? + newdata = [] + console.log newdata newdata.push { id: id, duration: dur, depends: deps } $scope.toLocalStorage newdata, silent: yes diff --git a/src/edit.html b/src/edit.html index fb350ff..5d6d585 100644 --- a/src/edit.html +++ b/src/edit.html @@ -1,13 +1,19 @@
Dependencies must be a list of IDs separated by space
+ the program does not check cyclic or invalid dependencies for you
The RawEditor is intended for importing, exporting your data
+ and debugging.
Keep backups outside of this application if you rely on your data