{% extends "cosinnus_etherpad/base.html" %}
{% load i18n static cosinnus_tags widget_tweaks sekizai_tags %}

{% block page_title %}
{% trans "Pads" %} {{ block.super }}
{% endblock page_title %}

{% block breadcrumb %}
        {{ block.super }}
        {% if object.path != '/' %}
            <li><a href="{% group_url 'cosinnus:etherpad:list' group=group slug=object.container.slug %}">{{ object.container.title }}</a></li>
        {% endif %}
        <li><a href="{{ object.get_absolute_url }}">{{ object.title }}</a></li>
        <li class="active">{% trans "Edit" %}</li>
{% endblock %}

{% block leftnav %}
    {% include "cosinnus/leftnav_hierarchic_itemview.html" %}
{% endblock leftnav %}

{% block extrahead %}
    {{ block.super }}
    {% addtoblock "js" %}
        <script src="{% static 'js/cosinnus_etherpad/cosinnus_etherpad.js' %}"></script>
    {% endaddtoblock %}
{% endblock extrahead %}


{% block content %}
{% endblock content %}

{% block main_page %}
	{{ block.super }}
	
	
	
	<div class="row">
	    <div class="col-lg-12 col-md-12">    
	    
	        <div class="content-box"> <!-- a box with semi transparent background -->
	
	            <div class="regular-space">
	                <div class="btn btn-extra-emphasized w100">
	                    <ul class="media-list">
	                        <li class="media">
	                            <a class="pull-left" href="#">
	                                <i class="fa {% if object.type == 1 %}fa-table{% else %}fa-file-text{% endif %}"></i>
	                            </a>
	                            
	                            <div class="media-body">
	                                {% with creator=object.creator %}
	                                    <span class="annotation">
	                                        <a class="fullscreen-button fullscreen-toggle" href="#" title="{% trans "Fullscreen" %}">
	                                            <span>{% trans "Fullscreen" %}</span>
	                                            <i class="fa fa-expand"></i>
	                                        </a>
	                                    </span>
	                                    <span class="annotation">{% trans "by" %} <a href="{{ creator|profile_url }}" >{{ creator|full_name }}</a></span>
	                                {% endwith %}
	                                <span>{{ object.title }}</span>
	                            </div>
	                        </li>
	                    </ul>
	                </div>
	                
	                {% include 'cosinnus/media_tags_readonly.html' with object=object list_view="noindent" %}
	            </div> 
	            
	            
		        {% if object.attached_images %}
		            {% include 'cosinnus/common/attached_images_gallery.html' with object=object max_images=3 %}
		        {% endif %}
	
	
	        <div class="etherpad-iframe">
	            <iframe src="{{ etherpad.get_pad_url }}" width="100%" height="100%"></iframe>
	            
	            <button type="button" class="btn w100 btn-emphasized fullscreen-leave-button fullscreen-toggle">
	                <ul class="media-list">
	                    <li class="media">
	                        <a class="pull-left" href="#">
	                            <i class="fa fa-compress"></i>
	                        </a>
	                        <div class="media-body">
	                            {% trans "Leave Fullscreen" %}
	                        </div>
	                    </li>
	                </ul>
	            </button>
	        </div>
	
	    
	    </div><!-- content-box -->
	    
	    
	    
	    {% captureas help_text_id %}helptext_11_document{% endcaptureas %}
	    {% captureas help_modal_id %}modal-{{ help_text_id }}{% endcaptureas %}
		{% include 'cosinnus/common/modal_box_help_popup.html' with help_text_id=help_text_id help_title=help_title help_modal_id=help_modal_id %}
		<button type="button" class="btn btn-emphasized pull-left" style="margin: 0px;" data-toggle="modal" data-target="#{{ help_modal_id }}" title="{% trans "Help and Assistance for this page" %}">
            <ul class="media-list">
                <li class="media">
                    <a class="pull-left" href="#">
                        <i class="fa fa-question-circle-o"></i>
                    </a>
                    <div class="media-body">
                        {% trans "Help" %}
                    </div>
                </li>
            </ul>
        </button>
	    
	    
	    {% if user|has_write_access:object %}   
		    <button type="button" class="btn btn-emphasized pull-left" data-toggle="modal" data-target="#deleteModal">
	            <ul class="media-list">
	                <li class="media">
	                    <a class="pull-left" href="#">
	                        <i class="fa fa-eraser"></i>
	                    </a>
	                    <div class="media-body">
	                        {% trans "Delete" %}
	                    </div>
	                </li>
	            </ul>
	        </button>
		    {% captureas label %}{% blocktrans with pad=object.title %}Do you really want to delete etherpad „{{ pad }}“?{% endblocktrans %}{% endcaptureas %}
		    {% captureas title %}{% trans "Delete Etherpad" %}{% endcaptureas %}
		    {% group_url "cosinnus:etherpad:pad-delete" group=group slug=etherpad.slug as delete_url %}
		    {% include "cosinnus/modal_box.html" with id="deleteModal" label=label title=title form_action=delete_url %}
	    {% endif %}
	    
	    
	    {% if user|has_write_access:object %}
	    	<button type="button" class="btn btn-emphasized" href="{% group_url "cosinnus:etherpad:pad-edit" group=group slug=etherpad.slug %}">
	            <ul class="media-list">
	                <li class="media">
	                    <a class="pull-left" href="#">
	                        <i class="fa fa-cog"></i>
	                    </a>
	                    <div class="media-body">
	                        {% trans "Settings" %}
	                    </div>
	                </li>
	            </ul>
	        </button> 
	    {% endif %}
	    
	    {# Ethercalc needs external CSV export #}
	    {% if object.type == 1 %}
	    	<button type="button" class="btn btn-emphasized" href="{% group_url "cosinnus:etherpad:calc-csv" group=group slug=etherpad.slug %}">
	            <ul class="media-list">
	                <li class="media">
	                    <a class="pull-left" href="#">
	                        <i class="fa fa-download"></i>
	                    </a>
	                    <div class="media-body">
	                        {% trans "Download CSV" %}
	                    </div>
	                </li>
	            </ul>
	        </button> 
	    {% endif %}

	</div> <!-- row -->
    
{% endblock main_page %}
