diff --git a/app/scripts/controllers/draw.coffee b/app/scripts/controllers/draw.coffee index 1debd90..a7d9073 100644 --- a/app/scripts/controllers/draw.coffee +++ b/app/scripts/controllers/draw.coffee @@ -104,6 +104,16 @@ angular.module('seaspongeApp') # return arr # )() + $scope.generateThreat = -> + model.addThreat($scope.newThreat) + $scope.menu.newThreatOpen = false + $scope.menu.threatsOpen = true + $scope.newThreat = { + name: '' + severity: null + description: '' + } + $scope.shareModel = -> model = $scope.model serialized = model.serialize() diff --git a/app/scripts/services/model.coffee b/app/scripts/services/model.coffee index 1bdebca..0392128 100644 --- a/app/scripts/services/model.coffee +++ b/app/scripts/services/model.coffee @@ -18,7 +18,7 @@ angular.module('seaspongeApp') title: "Untitled Model" version: "0.0.0" authors: "" - threats: "" + threats: [] notes: "" diagrams: null @@ -34,6 +34,21 @@ angular.module('seaspongeApp') @diagrams.push(diagram) return diagram + addThreat: (threat) -> + @threats.push(threat) + + removeThreat: (threat) -> + index = @threats.indexOf(threat) + if index > - 1 + @threats.splice(index, 1) + return + + threatLength: -> + if @threats.length > 0 + return true + else + return false + removeDiagram: (diagram) -> @diagrams.remove(diagram) diff --git a/app/views/draw.html b/app/views/draw.html index 9d51d3a..e17c7c4 100644 --- a/app/views/draw.html +++ b/app/views/draw.html @@ -283,7 +283,7 @@
+ Add threats first +
-