ruby-on-rails - 重定向时在 Rails 中呈现 twitter Bootstrap 模式

标签 ruby-on-rails twitter-bootstrap modal-dialog

我有一个功能模式链接,可以从我的 View 中的某个页面点击:

<a href="#" data-toggle="modal" data-target="#manifesto-modal">Manifesto &amp; Rules</a>

除了可以在此页面上单击之外,我还希望它在重定向到此页面时默认显示。我还没有找到一个很好的方法来从 Controller 或其他地方对此进行编码,但无法想象它需要太多。输入表示赞赏!

最佳答案

根据文档,您可以使用 the flash (未经测试):

redirect_to your_path, flash: { manifesto_modal: true }

那么在你看来:
<% if flash[:manifesto_modal] %>
  // a script to display modal on document ready
<% end %>

关于ruby-on-rails - 重定向时在 Rails 中呈现 twitter Bootstrap 模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13264124/

相关文章:

html - 无法将内容移至中心

html - 定位卡而不改变标题

css - 如何创建适用于 IE11 的 flexbox 模态框?

javascript - 属性未传递给购物车商品的 AJAX 调用

ruby-on-rails - 找不到 'devise_install' 生成器 - Rails 2.3.8,Devise 1.0.8

ruby-on-rails - 如果请求包含查询字符串,则路由到单独的操作

ruby-on-rails - Time.zone.at 比 Time.at 慢 10 倍

javascript - 由于过滤器值中存在 `@` 符号,脚本中出现电子邮件验证错误

javascript - jquery geocomplete 无法与 vue js 一起使用

html - Bootstrap 模态主体挤入模态页脚