0
したがって、この.erbコードを使用して、.hamlに変換します。 (一部はHAMLが高速であると言い、私は私はまだ学習曲線内struglingていると思う;))haml 2番目のクラスとしてのpull-rightは、その後に続く場合には機能しません。
<div class="row">
<div class="col-md-12">
<ul class="list-inline pull-right">
<% if current_page?(webservices_path) %>
<li class="submenu_links_current">
<% else %>
<li class="submenu_links">
<% end %>
<%= link_to webservices_path do %>
<i class="fa fa-home" aria-hidden="true" style="color: white;"></i>
Webservices
<% end %>
</li>
</ul>
</div>
</div>
は、私は気圧持って最寄りのHAML翻訳:
.row
.col-md-12
%ul.list-inline.pull-right
- if current_page?(webservices_path)
%li.submenu_links_current
= link_to webservices_path do
%i.fa.fa-home{"aria-hidden" => "true", "style" => "color: white;"}
Webservices
- else
%li.submenu_links
= link_to webservices_path do
%i.fa.fa-home{"aria-hidden" => "true", "style" => "color: white;"}
Webservices
私はこのHAMLを持つ2つの問題を抱えていますたった今。
。ulとliの間にif文がある場合、ulにはプル右が適用されません。
また、現在のwebservices_pathにlink_to webservices_pathが表示されていないので、このコード化された次のコードは機能しません。
.row
.col-md-12
%ul.list-inline.pull-right
- if current_page?(webservices_path)
%li.submenu_links_current
- else
%li.submenu_links
= link_to webservices_path do
%i.fa.fa-home{"aria-hidden" => "true", "style" => "color: white;"}
Webservices
ありがとうございます!私はあなたがこのような何かしたいと思います
ありがとう@matt。期待どおりに働く。明確な説明;) –