indentlabs/notebook

View on GitHub
app/views/content/list/_create_button.html.erb

Summary

Maintainability
Test Coverage
<% if @content.count > 0 %>
  <small class="right">
    <% if current_user.can_create?(@content_type_class) %>
      <%= link_to new_polymorphic_path(@content_type_class), class: "btn #{@content_type_class.color}" do %>
        <i class="material-icons white-text tooltipped" data-position="bottom" data-tooltip="Create another <%= @content_type_class.name %>" style="width:inherit;">
          add <%= @content_type_class.icon %>
        </i>
      <% end %>

    <% else %>
      <%= link_to subscription_path, class: "btn grey lighten-3 #{@content_type_class.text_color} tooltipped", data: {
          position: 'bottom',
          tooltip: "Upgrade to Premium to create more #{@content_type_class.name.pluralize}",
          enterDelay: 50
        } do %>
        +
        <i class="material-icons <%= @content_type_class.text_color %>">
          <%= @content_type_class.icon %>
        </i>
      <% end %>

    <% end %>
  </small>
<% end %>