Questions tagged [html-safe]

75 questions
0
votes
2 answers

Rails tag(:br) not considered as html_safe

Answer at the end. I currently refactoring my app, and I'm wondering how to short my "if" since I use them a lot in it : What I want, is a line break
only if the value isn't blank, so, for now I'm writing it this way : <% if…
Mene
  • 344
  • 2
  • 14
0
votes
1 answer

AS3 Make user input safe for display in htmltext

I've been searching for a good hour or two for this but I haven't found anything to what I'm looking for. I'm making a chat application( socket server made in Python ) and it's working fine. The main chat area where messages are stored use HTML, it…
0
votes
1 answer

Want To Use Twitter Bootstrap Code and html_safe in Rails 4 Application

I have a Rails 4 application which uses a PostgreSQL 9.2.x database that stores html emails. I have a text area field that contains the html5 code for the email. <%= @mass_email_parm["email"].html_email_text.html_safe %> In the past I have only…
0
votes
3 answers

Rails escapes string inside label tag

I have a label tag, whose content is loaded from a en.yml file. html.erb <%=label_tag(:name, t(:name, scope:[:helpers, :form], name: person_name(person))).html_safe%> person_name is a helper and outputs a string persons_helper.rb def…
felix
  • 11,304
  • 13
  • 69
  • 95
0
votes
2 answers

html_safe is not working in ruby on rails

I am using ckeditor to save posts content. If I save anything in my db then it saves content with html tags. To escape html i am using <%= raw(posts.content) %> function. I am using Speak.js for adding functionality to listen posts content also.…
Free-Minded
  • 5,322
  • 6
  • 50
  • 93
0
votes
1 answer

How to fix styling with html_safe in rails app?

When I include '.html_safe', I find that the styling (lass = 'lead' style = 'font-size: 14px;') doesn't get used. When I remove .html_safe, I get the styling but now all the html is shown. Any advice on how to fix this?

sharataka
  • 5,014
  • 20
  • 65
  • 125
0
votes
1 answer

right format for html_safe string in ruby

I've been trying this for a while now... <%= ("

(#{@user.first_name.capitalize}" + I18n.t('helpers.s_page') + I18n.t('find_something.empty_user_other')

").html_safe %> Can you tell me what the right way of putting it is... thanks for…
CHarris
  • 2,693
  • 8
  • 45
  • 71
0
votes
2 answers

Inserting styles into an html table

I am storing old html markup in my database, tracking changes, and then trying to render the diff using Differ and the :html format option. The following code is successfully generated: ...
Micah Alcorn
  • 2,363
  • 2
  • 22
  • 45
0
votes
3 answers

How to render html from a text column field in database?

I have an column in database as welcome_emil of type TEXT. I have saved the following code content saved in column as : Thanks for Joining in! \r\n\r\nYou can loginor refer your friends using your %referral_link%." When i try to render this…
0
votes
1 answer

Rails 3 - Alternative to html_safe on user generated comment content?

A html_safe method on user generated comment content really is not a good solution, obviously. However, this was, so far, the only solution I could come up with to implement the following feature: I wanted to enable users to quote another comment…
rails_has_elegance
  • 1,590
  • 4
  • 21
  • 37
-1
votes
1 answer

html_safe not working in controller rails 5

I currently need to send static content using API's created from admin using CKeditor. Now when rendering the html contents in tags are not appering even after using raw and html_safe, escape_html etc render json: {responseCode: xxx,…
-1
votes
2 answers

How to pass a instance html_safe string variable to js.erb

It seems a stupid question, but there are no way to achieve this With Rails 4.2.5. in a remote call to the controller, def update # ... save ... @notice="S'han trovat errors" # automatically renders update.js.erb end in…
Albert Català
  • 2,026
  • 2
  • 29
  • 35
-1
votes
3 answers

How to use flash message with html tags in laravel?

I'm using flash message with laravel to display notification to users. I want to include html tags in my message. For example: Flash::overlay('Votre compte n’est pas encore activé.activate');
Zied Feki
  • 812
  • 1
  • 10
  • 19
-2
votes
1 answer

html_safe not working on the input fields text in rails

I have tried to display text in input field like text_area but here text data is not plain text and it has some html tags also. Ex:- '<%= f.text_area :email_message, :value => "#{@message}".html_safe %>' I have used html_safe for this text to avoid…
Raju akula
  • 1,255
  • 1
  • 13
  • 18
1 2 3 4
5