Commit 641cf7e943eb5712e46d21b05784f154c6aee398

Authored by Gustavo Cavalcante
1 parent fef0290f
Exists in staging

fixed html safe problems.

Signed-off-by: Gustavo Cavalcante <gustavo.cavalcante.oliveira@live.com>
Signed-off-by: Karine Valença <valenca.karine@gmail.com>
app/helpers/application_helper.rb
... ... @@ -518,8 +518,6 @@ module ApplicationHelper
518 518 html = "\n"
519 519 values.each { |val, h_val|
520 520 id = object_name.to_s() +'_'+ method.to_s() +'_'+ val.to_s()
521   - # Não está apresentando o sexo selecionado ao revisitar
522   - # http://localhost:3000/myprofile/manuel/profile_editor/edit :-(
523 521 html += self.class.content_tag( 'span',
524 522 @template.radio_button( object_name, method, val,
525 523 :id => id, :object => @object ) +
... ... @@ -530,6 +528,7 @@ module ApplicationHelper
530 528 html += "<br />\n".html_safe
531 529 end
532 530 }
  531 + html = html.html_safe
533 532 html += "<br />\n".html_safe if line_size == 0 || ( values.size % line_size ) > 0
534 533 column = object.class.columns_hash[method.to_s] if object
535 534 text =
... ...
app/helpers/search_helper.rb
... ... @@ -45,7 +45,8 @@ module SearchHelper
45 45 def search_page_title(title, category = nil)
46 46 title = "<h1>" + title
47 47 title += ' - <small>' + category.name + '</small>' if category
48   - title + "</h1>"
  48 + title += "</h1>"
  49 + title.html_safe
49 50 end
50 51  
51 52 def category_context(category, url)
... ...
test/integration/safe_strings_test.rb
... ... @@ -185,5 +185,14 @@ class SafeStringsTest &lt; ActionDispatch::IntegrationTest
185 185 assert_tag :tag => 'div', :attributes => {:class => 'read-more'}, :child => {:tag => 'a', :content => 'Read more'}
186 186 end
187 187  
  188 + should 'not scape sex radio button' do
  189 + env = Environment.default
  190 + env.custom_person_fields = { 'sex' => { 'active' => 'true' } }
  191 + env.save!
  192 + create_user('marley', :password => 'test', :password_confirmation => 'test').activate
  193 + login 'marley', 'test'
  194 + get "/myprofile/marley/profile_editor/edit"
  195 + assert_tag :tag => 'input', :attributes => { :id => "profile_data_sex_male" }
  196 + end
188 197  
189 198 end
... ...