ruby code not working under the "ui" class when using semantic-ui

144 views Asked by At

I want to use semantic-ui with my ruby-on-rails project

(here is my project: https://github.com/LiYingTW/c9_booking/tree/filling-in-layout)

However, my ruby code not work in the html tag with class = "ui".

Here is my code:

<nav class="ui menu">
    <a class="active teal item">
      <i class="home icon"></i> 
      <%= link_to "Main", :controller => "order", :action => "index" %>
    </a>        
    <% if @user.is_admin? %>
        <a class="active teal item">
          <%= link_to "Management - users", :controller => "admin", :action => "users_index" %>
        </a>            
    <% end %>
    <div class="ui orange inverted right menu">
      <a class="pink item">
        <i class="sign out icon"></i>
        <%= link_to "Logout", :controller => "login", :action => "logout" %>
      </a>
    </div>
</nav>

the code <%= link_to ... %> is not working while <% if @user.is_admin? %> is working.

I found that if I use <nav class="menu"> instead of <nav class="ui menu">, all the code in ruby is working, but I don't know why.

If anyone has an idea or any tips on how I can solve this, I'd be extremely grateful.

1

There are 1 answers

0
user3227949 On BEST ANSWER

Thanks for the help from Facebook.

Because we cannot put a tag within another one, use the code follow instead:

<%= link_to({:controller => 'user', :action => 'profile'}, class: 'green item') do %>
    <i class='setting icon'></i>
    Profile
<% end %>

It's work for me!!