嗨,我似乎无法看到这项工作,
if current_page?(question_path).include?("Question 1")
如果当前页面检测到一个文本,我有一个条件将显示特定的 html 元素"Question 1"
满足它的最好方法是什么?
因为,如果我使用具有特定 ID 的特定路线,它甚至不是动态的。
if current_page?(question_path(1))
ID:1如果被删除可以更改吗?
片段(我现在拥有的):
.reference_display
.reference_container
- if current_page?(question_path).include?("Question 1")
.reference_lip_ref
.lip_arrow{:title => "Click to expand"} ◀
.close_btn{:title => "Close"}
.lip.close_btn{:title => "Close"}
.slide
.preloader
%ul{"data-orbit" => "", "data-options" => "timer_container_class: hide; timer_paused_class: hide; timer_progress_class: hide; timer_speed:240000;"}
- @question.references.order("my_order").each do |r|
%li
%img.referenceImage{:alt => "Reference Data", :src => "#{r.image_url}", :style => "border: 1px solid #ccc;"}/
- elsif @questions.last
.reference_lip
.lip_arrow{:title => "Click to expand"} ◀
.close_btn{:title => "Close"}
.lip.close_btn{:title => "Close"}
.slide
.preloader
%ul{"data-orbit" => "", "data-options" => "timer_container_class: hide; timer_paused_class: hide; timer_progress_class: hide; timer_speed:240000;"}
- @question.references.order("my_order").each do |r|
%li
%img.referenceImage{:alt => "Reference Data", :src => "#{r.image_url}", :style => "border: 1px solid #ccc;"}/