Leland Reardon
Leland Reardon

Reputation: 144

Achieve rendering of Semantic UI Icon within button_to

I am trying to achieve a button_to which looks like a link (class="btn btn-link") and which has as its text (input) value a semantic-ui icon. I need the button to display in-line as a link. I am using the semantic-ui-rails gem. My button-to is formatted as below:

<%= button_to semantic_icon('lightbulb outline'),
                  votes_path,
                  options: {
                      params: {
                          voter_id: current_user.id,
                          target_type: "Comment",
                          target_id: comment.id,
                          value: 1
                      }
                  },
                  class: "btn btn-link",
                  remote: true
    %>

However, the button displays on my screen as <i class="lightbulb outline icon"></i> Instead of rendering the lightbulb-outline icon itself.

What must I change to get the value of the input tag of the button-to form to render properly?

Upvotes: 0

Views: 289

Answers (1)

PGill
PGill

Reputation: 3521

try

<%= button_to votes_path, class: "btn btn-link", remote: true, params: {
                                                                voter_id: current_user.id,
                                                                target_type: "Comment",
                                                                target_id: comment.id,
                                                                value: 1
                                                              } do %>
  <%= semantic_icon('lightbulb outline') %>
<% end %>

Upvotes: 1

Related Questions