diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-08-20 23:33:36 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-08-20 23:33:36 -0400 |
| commit | 272474767b6ed1f419843c7a205c16f934eeb84f (patch) | |
| tree | 5ff43f054a0d34d3698de893a26b9e5b24bce424 /public/assets/javascripts/ui | |
| parent | 4ead3876f33036a94c0e5f7671df3f1f6d148400 (diff) | |
turn segments into rects
Diffstat (limited to 'public/assets/javascripts/ui')
3 files changed, 30 insertions, 7 deletions
diff --git a/public/assets/javascripts/ui/blueprint/BlueprintEditor.js b/public/assets/javascripts/ui/blueprint/BlueprintEditor.js index 8fe66ca..18ecf5f 100644 --- a/public/assets/javascripts/ui/blueprint/BlueprintEditor.js +++ b/public/assets/javascripts/ui/blueprint/BlueprintEditor.js @@ -93,7 +93,7 @@ var BlueprintEditor = View.extend(AnimatedView.prototype).extend({ map.draw.ctx.save() map.draw.translate() - // this.floorplan.draw(map.draw.ctx, true) + this.floorplan.draw(map.draw.ctx, true) map.draw.coords() diff --git a/public/assets/javascripts/ui/blueprint/BlueprintSettings.js b/public/assets/javascripts/ui/blueprint/BlueprintSettings.js index acd8dcc..252e3f1 100644 --- a/public/assets/javascripts/ui/blueprint/BlueprintSettings.js +++ b/public/assets/javascripts/ui/blueprint/BlueprintSettings.js @@ -1,5 +1,5 @@ -var BlueprintSettings = FormView.extend({ +var BlueprintSettings = FormView.extend(ToggleableView.prototype).extend({ el: "#blueprintSettings", action: "/api/blueprint/edit", @@ -25,7 +25,13 @@ var BlueprintSettings = FormView.extend({ load: function(data){ this.$id.val(data._id) - this.$name.val(data.name) + if (data.name) { + this.$name.val(data.name) + this.hide() + } + else { + this.$name.val("") + } if (data.shapes) { shapes.destroy() shapes.deserialize( data.shapes ) @@ -51,10 +57,6 @@ var BlueprintSettings = FormView.extend({ }.bind(this)) }, - toggle: function(state){ - this.$el.toggleClass("active", state) - }, - enterSubmit: function (e) { e.stopPropagation() var base = this @@ -105,6 +107,8 @@ var BlueprintSettings = FormView.extend({ this.$name.val(data.name) this.action = this.updateAction + this.hide() + Minotaur.unwatch(this) Minotaur.hide() diff --git a/public/assets/javascripts/ui/lib/ToggleableView.js b/public/assets/javascripts/ui/lib/ToggleableView.js new file mode 100644 index 0000000..371629f --- /dev/null +++ b/public/assets/javascripts/ui/lib/ToggleableView.js @@ -0,0 +1,19 @@ +var ToggleableView = View.extend({ + + toggle: function(state){ + this.$el.toggleClass("active", state) + }, + + show: function(){ + this.toggle(true) + }, + + hide: function(){ + this.toggle(false) + }, + + visible: function(){ + return this.$el.hasClass("active") + } + +})
\ No newline at end of file |
