Slim — Add target in link_to

The name of the pictureThe name of the pictureThe name of the pictureClash 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".





Is your question about slim template engine for ruby? If so, please consider removng slim tag and adding slim-lang tag.
– Nima
Aug 8 at 8:31


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.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard