Haml: Fix problem with HTML-escaped single quotes in text fields
Haml 3.1.2 displays single quotes in FormBuilder#text_ field
html escaped. You may see something like that:
David's Chapter
Looking at the page's HTML, your field's values will be doubly escaped:
<input ... value="David&#x27;s Chapter" />
Updating Haml to 3.1.5 or newer Show archive.org snapshot will fix it.
Related cards:
Click on a piece of text in Cucumber / Capyabra
The step definition below lets you write:
When I click on "Foo"
This is useful in Selenium features where the element you click on is not necessarily a link or button, but could be any HTML element with a Javascript event binding.
The e...
Render Single-Line Markdown Text with Redcarpet
We love Markdown. We use it wherever we can for text formatting. In a web app, the obvious place for it is in large text areas, where we can allow complete freedom of formatting. Headers, paragraphs, lists, it’s all good.
What about the forma...
Show hint in HTML 5 text fields
To have your text input field pre-filled in with some text that disappears as soon as the user selects it, use the attribute placeholder
:
<input type="text" placeholder="User name here">
This will only [work in recent browsers](http://...
Angular with haml: Dynamic html classes
A haml angular 1 template with
.thing(class="is-{{:: item.type }}")
will be compiled (by haml) to
<div class="is-{{:: item.type thing }}"></div>
which is not what you want! It will also crash in angular (unless thing
is a val...
Check that a text field is empty with Cucumber
This will not work (it always passes):
Then the "Title" field should contain ""
The value is turned into a regular expression, and an empty regular expression matches any string!
Do this instead for Capybara:
Then the "Title" field sho...
Balance your texts today with text-wrap: balance
So you have a heading that is just barely wider than the container it should fit into, and it wraps a single word to a new line and it's not really pretty?
Cry no more, for you can use text-wrap: balance
today to fix that. At least in some b...
WYSIWYG with Action Text
Rails 6 includes a WYSIWYG editor, Action Text. It works out of the box quite well, but chances are that you want to add some custom functionality. This card contains some tips how to ach...
Use -webkit-line-clamp to natively truncate long (multi-line) texts with an ellipsis
Note: You won't need this for single lines of text. In this case it is better to just use the text-overflow
property: Use CSS "text-overflow" to truncate long texts
You can use -webkit-line-clamp
in your CSS/SA...
Bug in Chrome 56+ prevents filling in fields with slashes using selenium-webdriver/Capybara
There seems to be a nasty bug in Chrome 56 when testing with Selenium and Capybara: Slashes are not written to input fields with fill_in
. A workaround is to use javascript / jquery to change the contents of an input field.
Use the following cod...
Auto-generating plain-text bodies for HTML e-mails in Rails apps
When building an application that sends e-mails to users, you want to avoid those e-mails from being classified as spam. Most obvious scoring issues will not be relevant to you because you are not a spammer.
However, your application must do one ...