html-safe Questions

7

Solved

Let's say I have: @string = "it is a <a href="#">string</a>" I want to use it in different parts of my application in two ways: With a clickable link Without the clickable link (bu...
Theona asked 6/3, 2013 at 15:45

4

Solved

I am using the automatic form label helper for creating my form labels and having them translated via the i18n support, however, I want to have HTML in the label and I can't figure out how to make ...
Elboa asked 7/12, 2010 at 1:44

3

Solved

What's wrong with this line of code? <%= submit_tag "Delete <i class='icon-check'></i>".html_safe, :disable_with => "Deleting", :class => "btn btn-danger"%> This literal...
Doorstone asked 22/8, 2012 at 16:45

3

I'm having a problem rendering a partial in a bootstrap popover in my rails app. The partial is always rendered as a plain text( showing all the HTML tags etc). this is the code from the index.ht...
Spithead asked 6/6, 2018 at 11:21

1

Solved

I have two pieces of code in my view: <%= sanitize('<h3>winter</h3>') %> <%= '<h3>winter</h3>'.html_safe %> And they both seem to result in encoding html tag...
Blossom asked 14/5, 2014 at 16:11

4

Solved

I have a textarea field where users can enter content. When it comes to displaying their entry on a page, rails returns \n for each line break, which appears as no break at all for html on the page...
Apron asked 23/11, 2010 at 7:23

2

Solved

In the @post.content, I want 1.simple_format, so content would have different lines rather than in a single line without breaks 2.html_safe, so user could paste some <embed> video link like...
Borrow asked 23/4, 2013 at 11:55

1

Solved

I am not able to escape raw html tags in the view <% array = @article.tags.collect { |p| (link_to p.name, '#') } %> <%= array.join(' , ') %> Raw and html_safe <% array = @article...
Pounce asked 25/4, 2013 at 14:35

3

Solved

I'm running into an issue with the rails auto-escaping. It currently thinks a string is html_safe (which it is), but for display purposes I need it to still escape the html. Here's the steps the st...
Cadre asked 5/6, 2012 at 17:47

2

It feels like html_safe adds an abstraction to the String class that requires understanding of what is going on, for example, <%= '1 <b>2</b>' %> # gives 1 <b>2&amp...
Longevous asked 1/11, 2010 at 15:22

3

Solved

I use rails 3. Is there any easy way to tell I18n to respect 'html safness' of string used in interpolation and make all translated string html safe by default? So if I have this en.yml: en: user...
Sheepshanks asked 31/3, 2011 at 15:17

1

Solved

I am using a rich text editor (CKEditor) and I have the opportunity to let users create profiles that are displayed to other users. Many of the attributes CKEditor can control are being lost when ...
Camphene asked 20/3, 2011 at 21:29
1

© 2022 - 2024 — McMap. All rights reserved.