2

I would know if it is possible to do something like this with a Rails wice grid plugin:

<g.column do |model| %>
    <ul class='list-inline'>
      <li>
        <%= link_to model_path( model ), :title => 'See' do %>
        <i class="glyphicon glyphicon-eye-open"></i>
        <% end %>
      </li>
      <!-- ... -->
    </ul>
< end -%>

Is it possible for a wice grid column to contain an HTML <ul> tag?

Jay
  • 3,445
  • 2
  • 24
  • 29
Npr
  • 41
  • 5

1 Answers1

1

I was searching for the same but finally figured it out. So adding this as an answer though its too late but might help someone else.

I think we can't use ERB in the grid column but we can use Ruby/Rails code in there. I think we can use HTML like this but have to use html_safe option

"<ul class='list-inline'><li><a href='#'><i class='fa fa-eye'></i></a></li></ul>".html_safe

But i preferred this to generate the HTML.

g.column do |model|
  content_tag(:ul, class: 'list-inline') do
    concat(content_tag(:li, link_to('<i class="fa fa-eye"></i>'.html_safe, controller_path(model), title: 'See')))
    concat(content_tag(:li, link_to('<i class="fa fa-wrench"></i>'.html_safe, edit_controller_path(model))))
  end
end
bluefoggy
  • 961
  • 1
  • 9
  • 23