codn/adminpanel

View on GitHub
app/views/adminpanel/shared/_new_resource_button.html.erb

Summary

Maintainability
Test Coverage
<% if @model.has_route?(:new) && can?(:create, @model) %>
  <%= link_to(
    content_tag(
      :div,
      content_tag(:i, nil, class: 'fa fa-plus-circle fa-2x') +
      content_tag(
        :span,
        I18n.t('action.create', resource: @model.display_name)
      ),
      class: 'btn btn-box span2'
    ),
    {
      controller: params[:controller],
      action: :new
    },
    id: 'new-resource-button'
  ) %>
<% end %>