Reputation: 8396
I have a form and a button:
= button_tag( "×" , type: "button", html: {class: "close", aria-hidden: "true"}, data: {dismiss: "alert"} )
it is converted to rails from the twitter bootstrap [ http://getbootstrap.com/components/#alerts ]:
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
But the rails variant getting an error:
SyntaxError in Search#get_search
Showing /.../app/views/search/new.html.slim where line #58 raised:
/.../app/views/search/new.html.slim:58: syntax error, unexpected tLABEL
...: {class: "close", aria-hidden: true}, data: {dismiss: "ale...
... ^
/.../app/views/search/new.html.slim:58: syntax error, unexpected ')', expecting keyword_end
... {dismiss: "alert"} )))).to_s));
... ^
Something with aria-hidden: "true"
or dismiss: "alert"
is wrong
Why is it so? I used different variants which complains to [ http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#method-i-button_tag ]:
button_tag(content_or_options = nil, options = nil, &block)
Upvotes: 0
Views: 1707
Reputation: 2853
This syntax is not allowed:
aria-hidden: "true"
Replace it with:
:"aria-hidden" => "true"
or
"aria-hidden" => "true"
or
aria: { hidden: true }
Upvotes: 1