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

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

{% block breadcrumb_content_selected %}{% endblock %}

{% block breadcrumb_content %}
  {{ super() }}
  {% if res %}
      <li>{% link_for h.resource_display_name(res)|truncate(30), named_route=pkg.type ~ '_resource.read', id=pkg.name, resource_id=res.id, title=h.resource_display_name(res) %}</li>
      <li{% block breadcrumb_edit_selected %} class="active"{% endblock %}><a href="">{{ _('Edit') }}</a></li>
  {% endif %}
{% endblock %}

{% block content_action %}
    {% if res %}
	{% link_for _('View resource'), named_route=pkg.type ~ '_resource.read', id=pkg.name, resource_id=res.id, class_='btn btn-secondary', icon='eye' %}
  {% endif %}
{% endblock %}

{% block content_primary_nav %}
  {{ h.build_nav_icon(pkg.type ~ '_resource.edit', _('Edit resource'), id=pkg.name, resource_id=res.id, icon='pencil') }}
  {% block inner_primary_nav %}{% endblock %}
  {{ h.build_nav_icon(pkg.type ~ '_resource.views', _('Views'), id=pkg.name, resource_id=res.id, icon='chart-bar') }}
{% endblock %}

{% block primary_content_inner %}
  <h1>{% block form_title %}{{ _('Edit Resource') }}{% endblock %}</h1>
  {% block form %}{% endblock %}
{% endblock %}

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

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