diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-08-26 16:10:42 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-08-26 16:10:42 -0400 |
| commit | 0e03cb3c4065e002be50d37e80ddfab1407c8e6b (patch) | |
| tree | 56b79c22ff352ba892ee07801cf0a22b269c7429 /public/assets/javascripts/ui | |
| parent | e350f13c3772d0f1f4053ce3c1a1dbc43713e4d0 (diff) | |
popup notice to start a project
Diffstat (limited to 'public/assets/javascripts/ui')
4 files changed, 36 insertions, 1 deletions
diff --git a/public/assets/javascripts/ui/blueprint/BlueprintNotice.js b/public/assets/javascripts/ui/blueprint/BlueprintNotice.js new file mode 100644 index 0000000..bced4e1 --- /dev/null +++ b/public/assets/javascripts/ui/blueprint/BlueprintNotice.js @@ -0,0 +1,20 @@ +var BlueprintNotice = View.extend(ToggleableView.prototype).extend({ + + el: "#blueprintNotice", + + initialize: function(opt){ + this.parent = opt.parent + this.$notice = this.$(".notice") + }, + + notice: function(msg){ + this.$notice.html(msg) + }, + + showCreateProjectNotice: function(){ + this.notice("<a href='/project/blueprint/" + this.parent.data.slug + + "'>Start a new project</a> with this blueprint.") + this.show() + }, + +})
\ No newline at end of file diff --git a/public/assets/javascripts/ui/blueprint/BlueprintSettings.js b/public/assets/javascripts/ui/blueprint/BlueprintSettings.js index 0870a11..e41962e 100644 --- a/public/assets/javascripts/ui/blueprint/BlueprintSettings.js +++ b/public/assets/javascripts/ui/blueprint/BlueprintSettings.js @@ -37,7 +37,6 @@ var BlueprintSettings = FormView.extend(ToggleableView.prototype).extend({ shapes.deserialize( data.shapes ) shapes.build() } - this.data = data }, clear: function(){ @@ -107,11 +106,14 @@ var BlueprintSettings = FormView.extend(ToggleableView.prototype).extend({ }, success: function(data){ + this.parent.data = data + this.$id.val(data._id) this.$name.val(data.name) this.action = this.updateAction this.hide() + this.parent.notice.showCreateProjectNotice() Minotaur.unwatch(this) Minotaur.hide() diff --git a/public/assets/javascripts/ui/blueprint/BlueprintToolbar.js b/public/assets/javascripts/ui/blueprint/BlueprintToolbar.js index e22535e..88f1d0a 100644 --- a/public/assets/javascripts/ui/blueprint/BlueprintToolbar.js +++ b/public/assets/javascripts/ui/blueprint/BlueprintToolbar.js @@ -9,6 +9,7 @@ var BlueprintToolbar = View.extend({ "click [data-role=polyline-mode]": 'polylineMode', "click [data-role=ortho-polyline-mode]": 'orthoPolylineMode', "click [data-role=eraser-mode]": 'eraserMode', + "click [data-role=start-position-mode]": 'startPositionMode', "click [data-role=toggle-layout-settings]": 'toggleSettings', }, @@ -21,6 +22,7 @@ var BlueprintToolbar = View.extend({ this.$polylineMode = this.$('[data-role=polyline-mode]') this.$orthoPolylineMode = this.$('[data-role=ortho-polyline-mode]') this.$eraserMode = this.$('[data-role=eraser-mode]') + this.$startPositionMode = this.$('[data-role=start-position-mode]') this.orthoPolylineMode() }, @@ -52,6 +54,7 @@ var BlueprintToolbar = View.extend({ toggleSettings: function(){ this.parent.settings.toggle() + this.parent.notice.toggle( ! this.parent.data.isNew && ! this.parent.settings.visible() ) }, setActiveMode: function( $el ) { @@ -79,4 +82,9 @@ var BlueprintToolbar = View.extend({ this.parent.map.ui.set_tool("eraser") }, + startPositionMode: function(){ + this.setActiveMode( this.$startPositionMode ) + this.parent.map.ui.set_tool("start-position") + }, + })
\ No newline at end of file diff --git a/public/assets/javascripts/ui/blueprint/BlueprintView.js b/public/assets/javascripts/ui/blueprint/BlueprintView.js index 3095cfe..6f1d2f5 100644 --- a/public/assets/javascripts/ui/blueprint/BlueprintView.js +++ b/public/assets/javascripts/ui/blueprint/BlueprintView.js @@ -17,6 +17,7 @@ var BlueprintView = View.extend({ this.scaler = new BlueprintScaler ({ parent: this }) this.info = new BlueprintInfo ({ parent: this }) this.settings = new BlueprintSettings ({ parent: this }) + this.notice = new BlueprintNotice ({ parent: this }) }, load: function(name){ @@ -48,9 +49,13 @@ var BlueprintView = View.extend({ }, ready: function(data){ + this.data = data this.info.load(data) this.settings.load(data) this.editor.loadFloorplan(data) + if (! data.isNew) { + this.notice.showCreateProjectNotice() + } }, hideExtras: function(){ |
