{# Workspace (storage) view: shows workspace on the left, map on the right #}
{% extends "lizard_map/wms.html" %}
{% load i18n %}

{% block sidebar %}

<div id="edit-workspace"
     class="sidebarbox workspace"
     data-workspace-id="{{ view.workspace.id }}"
     data-url-lizard-map-search-coordinates="{% url lizard_map.search_coordinates workspace_storage_id=view.workspace.id %}"
     data-url-lizard-map-search-name="{% url lizard_map.search_name workspace_storage_id=view.workspace.id %}"
     data-url-lizard-map-workspace-item-extent="{% url lizard_map_workspace_storage_item_extent %}"
     >
  <h2>
    <span title="{% trans 'This is your workspace. Hover your mouse over the containing items to see options.' %}">
      Workspace
    </span>
  </h2>

  <table id="edit-workspace-table" class="workspace-items ui-sortable wscol-table">
  <tbody>
    {% for workspace_item in view.workspace.workspace_items.all %}
      <tr id="workspace-item-{{ workspace_item.id }}"
          class="paddme"
          data-object-id="{{ workspace_item.id }}"
          data-adapter-class="{{ workspace_item.adapter_class }}"
          data-adapter-layer-json='{{ workspace_item.adapter_layer_json }}'
          data-visible="{{ workspace_item.visible }}">
        <td class="icontd">
          {# Symbol, appears left. #}
          {% if workspace_item.adapter.symbol_url %}
          <img class="workspace-item-image"
               src="{{ workspace_item.adapter.symbol_url }}"
               width="16"
               height="16" />
          {% endif %}
        </td>
        <td class="maintd">
          {% firstof workspace_item.name '(noname)' %}
        </td>
        <td class="lasttd">
        {% if workspace_item.has_extent %}
          <span class="ss_sprite ss_magnifier sidebarbox-action-icon
                       workspace-item-pan-to"
                title="{% trans 'Zoom to extent' %}"></span>
        {% else %}
          <span class="no-image-spacer"></span>
        {% endif %}
        </td>
      </tr>
    {% empty %}
      {# No workspace items #}
      <tr><td>{% trans 'No map layers selected.' %}</td></tr>
    {% endfor %}
  </tbody>
  </table>
  <ul class="wscol-actions">
    <li>
      <a id="workspace-load"
         href="{% url lizard_map_workspace_load %}"
         title="{% trans 'Edit this workspace' %}"
         class="btn sidebarbox-action-icon workspace-load"
         data-workspace-id="{{ view.workspace.id }}">
        <i class="ss_sprite ss_database_go"></i>
        {% trans 'Edit this workspace' %}
      </a>
    </li>
  </ul>
</div>
{% endblock sidebar %}
