gpt4 book ai didi

ruby-on-rails - 如果您在某个页面上,则隐藏按钮

转载 作者:太空宇宙 更新时间:2023-11-03 17:29:38 25 4
gpt4 key购买 nike

我需要在某些页面上显示使用 button_to 创建的两个按钮(示例:list/id1/edit)并在所有其他页面上隐藏一个按钮(示例:列表/新)。我有这个:

= button_link t("list.save"), list_path(@list.save_id), class: "button"    
= button_link t("list.cancel"), list_path(@list.hashed_id), class: "button"

如何创建“如果您在第 X 页显示一个按钮,否则 - 2 个按钮”?

最佳答案

请查看此文档 - http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-current_page-3F

用作

current_page?('http://www.example.com/shop/checkout')

关于ruby-on-rails - 如果您在某个页面上,则隐藏按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46731365/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com