<section class="viewblock">
  <header class="viewblock-header">
    <div class="viewblock-header_right">
      <div class="button-padding">
        <% if can? :create, ConcertoPlugin %>
          <%= link_to t(:new_model, model: ConcertoPlugin.model_name.human), new_concerto_plugin_path, class: "btn" %>
        <% end %>
      </div>
    </div>
    <h1 class="default-padding">
      <%= t :manage_model, model: ConcertoPlugin.model_name.human(count: 42) %>
    </h1>
  </header>
  <div class="viewblock-cont">
    <% if ENV['FROZEN'] == "1" %>
      <div id="gem-frozen">
        <%= t(:gems_frozen_warning) %>
      </div>
    <% end %>
    <div class="default-padding">
    <table class="plugins-list">
      <thead>
        <tr>
          <th><%= t('.status') %></th>
          <th><%= ConcertoPlugin.human_attribute_name(:gem_name) %></th>
          <th><%= t('.gem_description')%></th>
        </tr>
      </thead>
      <tbody>
        <% @concerto_plugins.each do |concerto_plugin| %>
          <% gemspec = Gem.loaded_specs[concerto_plugin.gem_name] %>
          <tr>

            <td>
              <h1>
                <%= status_badge concerto_plugin.enabled %>
                <% if gem_needs_upgrade?(concerto_plugin, Gem.loaded_specs[concerto_plugin.gem_name]) %>
                   <%=content_tag(:i, nil, class: 'fa fa-level-up tooltip-basic', 'data-tooltip-text' => t('concerto_plugins.index.upgrade_available')) %>
                <% end %>
              </h1>
            </td>
            <td>
              <h3><%= link_to(concerto_plugin.name.titleize, action: :show, id: concerto_plugin.id) %></h3>
            </td>

            <td><%= !gemspec.nil? ? gemspec.description : "" %></td>
          </tr>
        <% end %>
      </tbody>
    </table>
    </div>
  </div>
</section>
