AyuntamientoMadrid/participacion

View on GitHub
app/views/shared/_flag_actions.html.erb

Summary

Maintainability
Test Coverage
<span class="flag-content">
  <% if show_flag_action?(flaggable) %>
    <% if local_assigns[:divider] %>
      <span class="divider">&nbsp;|&nbsp;</span>
    <% end %>

    <button type="button" data-toggle="flag-drop-<%= dom_id(flaggable) %>" title="<%= t("shared.flag") %>">
      <span class="icon-flag flag-disable"></span>
    </button>
    <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">&nbsp;|&nbsp;</span>
    <% end %>

    <button type="button" data-toggle="unflag-drop-<%= dom_id(flaggable) %>" title="<%= t("shared.unflag") %>">
      <span class="icon-flag flag-active"></span>
    </button>
    <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>