单击以重定向到特定页面时如何制作引导按钮

时间:2022-07-04 23:00:09

Here is the code i have

这是我的代码

<div class="btn btn-default btn-lg btn-block for-get-button">
  <%= link_to "Get this box for", download_picture_path(@gig), :target => "_blank" %> <%= @gig.pointsneeded %> points
</div>

To clarify the first code above,redirects the user where i need.

为了澄清上面的第一个代码,将用户重定向到我需要的地方。

<%= link_to "Get this box for", download_picture_path(@gig), :target => "_blank" %> 

The second code,just shows the number of points required

第二个代码,只显示所需的点数

<%= @gig.pointsneeded %>

and the word "points" is just a word that comes after the code.

而“点”这个词只是代码之后的一个词。

and this is the css for all the code:

这是所有代码的css:

.btn.btn-default.btn-lg.btn-block.for-get-button {
  background-color: #000000;
  text-color: #00FFFF;
  a:link { 
    color: #00FFFF;
  }
  a:visited { 
    color: #00FFFF;
  }
  a:hover { 
    color: #00FFFF;
  }
  a:active { 
    color: #00FFFF;
  }
  color: #00FFFF;
}

Question: how to make this whole code when clicked on any part/side of the button that is formed around it,when clicked it should redirect to download_picture_path(@gig).Because now,on hover over the "Get this box for" an underline appears,and i have to click EXACTLY on "Get this box for" to get redirected where i need,when i should be able to click anywhere in the button to get redirected.

问题:当点击它周围形成的按钮的任何部分/侧面时如何制作这整个代码,点击它时应该重定向到download_picture_path(@gig)。因为现在,将鼠标悬停在“获取此框”上显示下划线,我必须单击“获取此框”以完全重定向到我需要的位置,此时我应该能够单击按钮中的任意位置以进行重定向。

hope I made myself clear.

希望我清楚自己。

1 个解决方案

#1


This should work for you:

这应该适合你:

<%= link_to "Get this box for #{@gig.pointsneeded} points", download_picture_path(@gig), :target => "_blank", class: "btn btn-default btn-lg btn-block for-get-button" %>

Although my code might not on the styling since i took out the div and placed it on the link_to. but it should solve the problem

虽然我的代码可能不在样式上,因为我拿出div并将其放在link_to上。但它应该解决问题

#1


This should work for you:

这应该适合你:

<%= link_to "Get this box for #{@gig.pointsneeded} points", download_picture_path(@gig), :target => "_blank", class: "btn btn-default btn-lg btn-block for-get-button" %>

Although my code might not on the styling since i took out the div and placed it on the link_to. but it should solve the problem

虽然我的代码可能不在样式上,因为我拿出div并将其放在link_to上。但它应该解决问题