{% extends "package/base.html" %}

{% set logged_in = true if c.userobj else false %}
{% set res = c.resource %}

{% block breadcrumb_content_selected %}{% endblock %}

{% block breadcrumb_content %}
  {{ super() }}
  {% if res %}
    <li>{% link_for h.resource_display_name(res)|truncate(30), controller='package', action='resource_read', id=pkg.name, resource_id=res.id %}</li>
    <li{% block breadcrumb_edit_selected %} class="active"{% endblock %}><a href="">{{ _('Edit') }}</a></li>
  {% endif %}
{% endblock %}

{% block content_action %}
  {% link_for _('All resources'), controller='package', action='resources', id=pkg.name, class_='btn', icon='arrow-left' %}
  {% if res %}
    {% link_for _('View resource'), controller='package', action='resource_read', id=pkg.name, resource_id=res.id, class_='btn', icon='eye-open' %}
  {% endif %}
{% endblock %}

{% block content_primary_nav %}
  {{ h.build_nav_icon('resource_edit', _('Edit resource'), id=pkg.name, resource_id=res.id) }}
  {% if 'datapusher' in g.plugins %}
    {{ h.build_nav_icon('resource_data', _('DataStore'), id=pkg.name, resource_id=res.id) }}
  {% endif %}
  {{ h.build_nav_icon('views', _('Views'), id=pkg.name, resource_id=res.id) }}
{% endblock %}

{% block primary_content_inner %}
  <h1 class="hide-heading">{% block form_title %}{{ _('Edit resource') }}{% endblock %}</h1>
  {% block form %}{% endblock %}
{% endblock %}

{% block secondary_content %}
  {% snippet 'package/snippets/resource_info.html', res=res %}
{% endblock %}

{% block scripts %}
  {{ super() }}
  {% resource 'vendor/fileupload' %}
{% endblock %}
