diff --git a/Gemfile b/Gemfile index 3b5625afde6..8c546ed4eac 100644 --- a/Gemfile +++ b/Gemfile @@ -108,6 +108,7 @@ group :test, :development do gem 'simplecov', require: false gem 'terminal-notifier-guard', require: false gem 'timecop' + gem 'rspec-given' end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index c2e7346a833..c35b94be26f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -371,6 +371,9 @@ GEM rspec-core (2.13.1) rspec-expectations (2.13.0) diff-lcs (>= 1.1.3, < 2.0) + rspec-given (2.4.1) + rspec (>= 2.11) + sorcerer (>= 0.3.7) rspec-mocks (2.13.1) rspec-rails (2.13.0) actionpack (>= 3.0) @@ -416,6 +419,7 @@ GEM temple (~> 0.6.3) tilt (~> 1.3.3) slop (3.4.4) + sorcerer (0.3.10) spork (0.9.2) temple (0.6.4) terminal-notifier-guard (1.5.3) @@ -511,6 +515,7 @@ DEPENDENCIES redis-rails rest-client rinku + rspec-given rspec-rails sanitize sass diff --git a/app/assets/javascripts/discourse/models/category.js b/app/assets/javascripts/discourse/models/category.js index 4044a41e5ed..24db481ed85 100644 --- a/app/assets/javascripts/discourse/models/category.js +++ b/app/assets/javascripts/discourse/models/category.js @@ -45,7 +45,8 @@ Discourse.Category = Discourse.Model.extend({ text_color: this.get('text_color'), hotness: this.get('hotness'), secure: this.get('secure'), - group_names: this.get('groups').join(",") + group_names: this.get('groups').join(","), + auto_close_days: this.get('auto_close_days') }, type: this.get('id') ? 'PUT' : 'POST' }); diff --git a/app/assets/javascripts/discourse/models/composer.js b/app/assets/javascripts/discourse/models/composer.js index 101cb883dbf..e4d7d51590b 100644 --- a/app/assets/javascripts/discourse/models/composer.js +++ b/app/assets/javascripts/discourse/models/composer.js @@ -538,13 +538,7 @@ Discourse.Composer = Discourse.Model.extend({ var reply = this.get('reply') || ""; while (Discourse.BBCode.QUOTE_REGEXP.test(reply)) { reply = reply.replace(Discourse.BBCode.QUOTE_REGEXP, ""); } return reply.replace(/\s+/img, " ").trim().length; - }.property('reply'), - - autoCloseChanged: function() { - if( this.get('auto_close_days') && this.get('auto_close_days').length > 0 ) { - this.set('auto_close_days', this.get('auto_close_days').replace(/[^\d]/g, '') ) - } - }.observes('auto_close_days') + }.property('reply') }); diff --git a/app/assets/javascripts/discourse/templates/auto_close_form.js.handlebars b/app/assets/javascripts/discourse/templates/auto_close_form.js.handlebars new file mode 100644 index 00000000000..eff55b4f0a4 --- /dev/null +++ b/app/assets/javascripts/discourse/templates/auto_close_form.js.handlebars @@ -0,0 +1,6 @@ +