Commit 6703903a12e7e05a0ad493b1fc096750fe15633c
1 parent
b7fa995c
Exists in
event_fixes
Minor fixes on date format
- also fixes one broken test on content_viewer_controller Signed-off-by: Tallys Martins <tallysmartins@yahoo.com.br>
Showing
2 changed files
with
6 additions
and
4 deletions
Show diff stats
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 | ... | ... |
test/functional/content_viewer_controller_test.rb
| ... | ... | @@ -1163,9 +1163,10 @@ class ContentViewerControllerTest < 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('​') |
| 1170 | 1171 | end |
| 1171 | 1172 | ... | ... |
-
mentioned in commit f6eaf20a37e2217811c019f6514ba9df632f8b77