The main obstacle to extract this partial was probably the paths for the flag and unflag actions. Now that we use Rails 5.1 `resolve` method to handle nested resources, we can use `polymorphic_path`. Also note the code is a bit ugly because comments render a divider. We should probably use a CSS border instead. Co-Authored-By: taitus <sebastia.roig@gmail.com>
28 lines
1.1 KiB
Plaintext
28 lines
1.1 KiB
Plaintext
<span class="flag-content">
|
|
<% if show_flag_action?(flaggable) %>
|
|
<% if local_assigns[:divider] %>
|
|
<span class="divider"> | </span>
|
|
<% end %>
|
|
|
|
<a data-toggle="flag-drop-<%= dom_id(flaggable) %>" title="<%= t("shared.flag") %>">
|
|
<span class="icon-flag flag-disable"></span>
|
|
</a>
|
|
<span class="dropdown-pane" id="flag-drop-<%= dom_id(flaggable) %>" data-dropdown data-auto-focus="true">
|
|
<%= link_to t("shared.flag"), polymorphic_path(flaggable, action: :flag), method: :put, remote: true %>
|
|
</span>
|
|
<% end %>
|
|
|
|
<% if show_unflag_action?(flaggable) %>
|
|
<% if local_assigns[:divider] %>
|
|
<span class="divider"> | </span>
|
|
<% end %>
|
|
|
|
<a data-toggle="unflag-drop-<%= dom_id(flaggable) %>" title="<%= t("shared.unflag") %>">
|
|
<span class="icon-flag flag-active"></span>
|
|
</a>
|
|
<span class="dropdown-pane" id="unflag-drop-<%= dom_id(flaggable) %>" data-dropdown data-auto-focus="true">
|
|
<%= link_to t("shared.unflag"), polymorphic_path(flaggable, action: :unflag), method: :put, remote: true %>
|
|
</span>
|
|
<% end %>
|
|
</span>
|