Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add blank_html translation so it's possible to use html tags now #43

Merged
merged 1 commit into from May 30, 2012

Conversation

nashby
Copy link
Collaborator

@nashby nashby commented May 26, 2012

closes #29

end

def blank_value(options)
options.delete(:if_blank) || translate_blank_html.html_safe
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that we need to call html_safe here. Could you test it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I've tested it without html_safe and it was escaped. So I think we need it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm. Actually I think that we should use ActionView::Helpers::TranslationHelper.translate here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean like this?

diff --git a/lib/show_for/content.rb b/lib/show_for/content.rb
index 4819292..6c44604 100644
--- a/lib/show_for/content.rb
+++ b/lib/show_for/content.rb
@@ -44,7 +44,7 @@ module ShowFor
     end

     def translate_blank_html
-      I18n.t(:'show_for.blank_html', :default => translate_blank_text)
+      template.t(:'show_for.blank_html', :default => translate_blank_text)
     end

     def translate_blank_text
@@ -52,7 +52,7 @@ module ShowFor
     end

     def blank_value(options)
-      options.delete(:if_blank) || translate_blank_html.html_safe
+      options.delete(:if_blank) || translate_blank_html
     end
   end
 end

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed.

rafaelfranca added a commit that referenced this pull request May 30, 2012
add blank_html translation so it's possible to use html tags now
@rafaelfranca rafaelfranca merged commit 990ad51 into heartcombo:master May 30, 2012
@rafaelfranca
Copy link
Collaborator

Thank you ❤️

@nashby
Copy link
Collaborator Author

nashby commented May 30, 2012

Yay! 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

escape tag problems
2 participants