summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/ui/editor/EditorSettings.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/javascripts/ui/editor/EditorSettings.js')
-rw-r--r--public/assets/javascripts/ui/editor/EditorSettings.js28
1 files changed, 23 insertions, 5 deletions
diff --git a/public/assets/javascripts/ui/editor/EditorSettings.js b/public/assets/javascripts/ui/editor/EditorSettings.js
index 2a3929a..92eff2b 100644
--- a/public/assets/javascripts/ui/editor/EditorSettings.js
+++ b/public/assets/javascripts/ui/editor/EditorSettings.js
@@ -10,15 +10,15 @@ var EditorSettings = FormView.extend({
"keydown": 'stopPropagation',
"keydown [name=name]": 'enterSubmit',
"click [data-role='show-collaborators']": 'showCollaborators',
- "click [data-role='save-project']": 'save',
+ "click [data-role='save-project']": 'clickSave',
"click [data-role='clone-project']": 'clone',
"click [data-role='clear-project']": 'clear',
"click [data-role='destroy-project']": 'destroy',
},
initialize: function(opt){
- this.parent = opt.parent
- this.__super__.initialize.call(this)
+ this.parent = opt.parent
+ this.__super__.initialize.call(this)
this.$id = this.$("[name=_id]")
this.$csrf = this.$("[name=_csrf]")
@@ -41,6 +41,16 @@ var EditorSettings = FormView.extend({
else {
this.parent.lightControl.loadDefaults()
}
+
+ if (data.walls) {
+ data.walls.some(function(wall){
+ if (wall.background !== "none") {
+ this.parent.wallpaperPicker.$remove.show()
+ return true
+ }
+ return false
+ }.bind(this))
+ }
if (data.isNew) {
this.$name.val( "Room " + moment().format("DD/MM/YYYY ha") )
@@ -96,8 +106,11 @@ var EditorSettings = FormView.extend({
}.bind(this))
},
- toggle: function(){
- this.$el.toggleClass("active")
+ toggle: function(state){
+ var state = typeof state == 'boolean' ? state : ! this.$el.hasClass("active")
+ this.$el.toggleClass("active", state)
+
+ $("[data-role='toggle-project-settings']").toggleClass("inuse", state)
},
enterSubmit: function (e) {
@@ -158,6 +171,11 @@ var EditorSettings = FormView.extend({
return false
},
+ clickSave: function(){
+ this.toggle(false)
+ this.save()
+ },
+
success: function(data){
this.$id.val(data._id)
this.$name.val(data.name)