Slim — Add target in link_to
Clash Royale CLAN TAG#URR8PPP
Slim — Add target in link_to
The origin slim code is:
= link_to page.info_page_link do
.price == "Gold: <br>#page.entry_fee"
.price.right == "Fee:<br>#page.popular_price"
.calendar == "Time:<br>#page.popular_period"
.clock == "Process:<br>#page.hours"
Now, I must add a target="_blank"
to this link, I try:
target="_blank"
= link_to target: '_blank', page.info_page_link do
.price == "Gold: <br>#page.entry_fee"
.price.right == "Fee:<br>#page.popular_price"
.calendar == "Time:<br>#page.popular_period"
.clock == "Process:<br>#page.hours"
But the browser says "syntax error".
slim
slim-lang
@Nima Yeah, I do it, now, tell me answer!
– Bobby 1995
Aug 8 at 8:37
Now wait for ruby guys to hopefully show up and help you :)
– Nima
Aug 8 at 8:39
1 Answer
1
Yeah, it is params order question.
Just move target hash to next location:
= link_to page.info_page_link, target: '_blank' do
.price == "Gold: <br>#page.entry_fee"
.price.right == "Fee:<br>#page.popular_price"
.calendar == "Time:<br>#page.popular_period"
.clock == "Process:<br>#page.hours"
Then it works! This is the API doc:
https://api.rubyonrails.org/v5.2.0/classes/ActionView/Helpers/UrlHelper.html
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Is your question about slim template engine for ruby? If so, please consider removng
slim
tag and addingslim-lang
tag.– Nima
Aug 8 at 8:31