如何重定向到rails中另一个页面的选项卡?当我点击第一页的按钮时,当我点击设置时,它会将我重定向到页面的默认选项卡(基本),我想重定向到通知选项卡。
第一页视图:
.button
%a{:href => edit_student_path(current_student)}
settings
标签页视图:
%ul.nav.nav-pills
%li.active
%a{"data-toggle" => "tab", :href => "#student-basic", :role => "tab"} basic-info
%li
%a{"data-toggle" => "tab", :href => "#student-notification", :role => "tab"} notification
.tab-content
#student-basic.tab-pane.active
= render 'basic_info_form'
#student-notifications.tab-pane
= render 'notifications_form'
您可以将 css 类active
作为参数传递,这是一个示例:
使用按钮查看:
.button
%a{:href => edit_student_path(current_student, tab: "notification")}
settings
标签:
%ul.nav.nav-pills
%li{ class: ( "active" if params[:tab] == "tab" ) }
%a{"data-toggle" => "tab", :href => "#student-basic", :role => "tab"} basic-info
%li{ class: ( "active" if params[:tab] == "notification" ) }
%a{"data-toggle" => "tab", :href => "#student-notification", :role => "tab"} notification
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句