Commit 2670b627663e48c898f1931295f085a9c041f4e1

Authored by Antonio Terceiro
2 parents d76b1434 f170cd12
Exists in stable-1.3

Merge remote-tracking branch 'origin/stable-1.3' into stable-1.3

app/helpers/forms_helper.rb
... ... @@ -186,6 +186,7 @@ module FormsHelper
186 186 element_id = html_options[:id] || 'datepicker-date'
187 187 value = value.strftime(format) if value.present?
188 188 method = datepicker_options[:time] ? 'datetimepicker' : 'datepicker'
  189 + current_date_or_nil = value.present? ? "new Date('#{value}')" : "null"
189 190 result = text_field_tag(name, value, html_options)
190 191 result +=
191 192 "
... ... @@ -236,7 +237,7 @@ module FormsHelper
236 237 weekHeader: #{datepicker_options[:week_header].to_json},
237 238 yearRange: #{datepicker_options[:year_range].to_json},
238 239 yearSuffix: #{datepicker_options[:year_suffix].to_json}
239   - }).datepicker('setDate', new Date('#{value}'))
  240 + }).datepicker('setDate', current_date_or_nil)
240 241 </script>
241 242 ".html_safe
242 243 result
... ...
app/models/article.rb
... ... @@ -77,7 +77,7 @@ class Article &lt; ActiveRecord::Base
77 77 belongs_to :last_changed_by, :class_name => 'Person', :foreign_key => 'last_changed_by_id'
78 78 belongs_to :created_by, :class_name => 'Person', :foreign_key => 'created_by_id'
79 79  
80   - has_many :comments, :class_name => 'Comment', :foreign_key => 'source_id', :dependent => :destroy, :order => 'created_at asc'
  80 + has_many :comments, :class_name => 'Comment', :as => 'source', :dependent => :destroy, :order => 'created_at asc'
81 81  
82 82 has_many :article_categorizations, :conditions => [ 'articles_categories.virtual = ?', false ]
83 83 has_many :categories, :through => :article_categorizations
... ...
test/functional/content_viewer_controller_test.rb
... ... @@ -1163,9 +1163,10 @@ class ContentViewerControllerTest &lt; ActionController::TestCase
1163 1163  
1164 1164 should 'add an zero width space every 4 caracters of comment urls' do
1165 1165 url = 'www.an.url.to.be.splited.com'
1166   - a = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'textile', :language => 'en')
1167   - c = a.comments.create!(:author => @profile, :title => 'An url', :body => url)
1168   - get :view_page, :profile => @profile.identifier, :page => [ 'textile' ]
  1166 + a = @profile.articles.build(:name => 'test')
  1167 + a.save!
  1168 + c = a.comments.create!(:author => @profile, :title => 'An url', :body => url, :source => a)
  1169 + get :view_page, :profile => @profile.identifier, :page => [ 'test' ]
1169 1170 assert_tag :a, :attributes => { :href => "http://" + url}, :content => url.scan(/.{4}/).join('&#x200B;')
1170 1171 end
1171 1172  
... ...