<% if cinstance.service.backend_version == "2"  %>
<div class='data-container'>
  <h3>Application ID</h3>
  <p class='sub'>This is the application ID, you should send with each API request.</p>
  <p class="key"><%= cinstance.application_id %></p>
</div>
<% end %>
<% if can? :manage_keys, @cinstance -%>
<div class='data-container' id="application_keys">
  <h3>Application Keys</h3>

  <p class='sub'>These are application keys used to authenticate requests.</p>
  <div class="operations">
    <%= switch cinstance.application_keys.can_add? do |context| %>
      <%= context.enabled do %>
        <%= fancy_button_to 'Create new key', admin_application_keys_path(cinstance),
          :method  => :post,
          :remote  => true,
          :class   => 'create_key' %>
      <% end %>

      <%= context.disabled do %>
        <p class="mini_info">At most <%= cinstance.keys_limit %> keys are allowed.</p>
      <% end %>
    <% end %>
  </div>

  <table class="data" id="keys">
    <% cinstance.keys.each do |key| %>
      <%= render 'applications/keys/key', :cinstance => cinstance, :key => key %>
    <% end %>
  </table>
</div>
<% end -%>
