{% extends 'base.html' %}
{% load i18n %}
{% load static %}
{% load compress %}

{% block title %}
  {% trans "Revision History" %}
{% endblock title %}

{% block content %}
  <div class="parent-course-history" xmlns="http://www.w3.org/1999/html">
    <div class="title">{% trans "Revision History" %}</div>

    <div>
      <p class="changed-by">
        {% with date=history_object.history_date|date:"d-m-Y" name=history_object.history_user.full_name %}
          {% blocktrans trimmed %}
            {{ date }} by {{ name }}
          {% endblocktrans %}
        {% endwith %}
        <button class="btn-show-changes show">{% trans "Show changes" %}</button>
      </p>
    </div>

    <div>
      <hr class="hr-line"/>
    </div>
    <div class="clearfix"></div>

    <div class="field-container">
      <div class="field-title">{% trans "Course Title" %}</div>
      <span class="object">{{ object.title }}</span>
      <span class="history-object">{{ history_object.title }}</span>
      <span class="show-diff"></span>
    </div>

    <div class="field-container">
      <div class="field-title">{% trans "Course Number" %}</div>
      <span class="object">{{ object.number }}</span>
      <span class="history-object">{{ history_object.number }}</span>
      <span class="show-diff"></span>
    </div>


    <div class="field-container">
      <div class="field-title">{% trans "Short Description" %}</div>
      <span class="object">{{ object.short_description }}</span>
      <span class="history-object">
        {% with  history_object.short_description as field %}
            {% include "publisher/_render_required_field.html" %}
        {% endwith %}
      </span>
      <span class="show-diff"></span>
    </div>


    <div class="field-container">
      <div class="field-title">{% trans "Long Description" %}</div>
      <span class="object">{{ object.full_description }}</span>
      <span class="history-object">
        {% with history_object.full_description as field %}
            {% include "publisher/_render_required_field.html" %}
        {% endwith %}
      </span>
      <span class="show-diff"></span>

    </div>

    <div class="field-container">
      <div class="field-title">{% trans "Expected Learning" %}</div>
      <span class="object">{{ object.expected_learnings }}</span>
      <span class="history-object">
        {% with history_object.expected_learnings as field %}
            {% include "publisher/_render_required_field.html" %}
        {% endwith %}
      </span>
      <span class="show-diff"></span>
    </div>

    <div class="field-container">
      <div class="field-title">{% trans "Primary Subject" %}</div>
      <span class="object">{{ object.primary_subject }}</span>
      <span class="history-object">
        {% with history_object.primary_subject as field %}
            {% include "publisher/_render_required_field.html" %}
        {% endwith %}
      </span>
      <span class="show-diff"></span>
    </div>

    <div class="field-container">
      <div class="field-title">{% trans "Additional Subject" %}</div>
      <span class="object">{{ object.secondary_subject }}</span>
      <span class="history-object">
        {% with  history_object.secondary_subject as field %}
            {% include "publisher/_render_optional_field.html" %}
        {% endwith %}
      </span>
      <span class="show-diff"></span>
    </div>

    <div class="field-container">
      <div class="field-title">{% trans "Additional Subject" %}</div>
      <span class="object">{{ object.tertiary_subject }}</span>
      <span class="history-object">
        {% with  history_object.tertiary_subject as field %}
            {% include "publisher/_render_optional_field.html" %}
        {% endwith %}
      </span>
      <span class="show-diff"></span>
    </div>

    <div class="field-container">
      <div class="field-title">{% trans "Prerequisites" %}</div>
      <span class="object">{{ object.prerequisites }}</span>
      <span class="history-object">
        {% with  history_object.prerequisites as field %}
            {% include "publisher/_render_required_field.html" %}
        {% endwith %}
      </span>
      <span class="show-diff"></span>
    </div>

    <div class="field-container">
      <div class="field-title">{% trans "Course Level" %}</div>
      <span class="object">{{ object.level_type }}</span>
      <span class="history-object">
        {% with  history_object.level_type as field %}
            {% include "publisher/_render_required_field.html" %}
        {% endwith %}
      </span>
      <span class="show-diff"></span>
    </div>

    <div class="field-container">
      <div class="field-title">{% trans "Learner Testimonials" %}</div>
      <span class="object">{{ object.learner_testimonial }}</span>
      <span class="history-object">
        {% with  history_object.learner_testimonial as field %}
            {% include "publisher/_render_optional_field.html" %}
        {% endwith %}
      </span>
      <span class="show-diff"></span>
    </div>

    <div class="field-container">
      <div class="field-title">{% trans "FAQ" %}</div>
      <span class="object">{{ object.faq }}</span>
      <span class="history-object">
        {% with  history_object.faq as field %}
            {% include "publisher/_render_optional_field.html" %}
        {% endwith %}
      </span>
      <span class="show-diff"></span>
    </div>

    <div class="field-container">
      <div class="field-title">{% trans "About Video Link" %}</div>
      <span class="object">{{ object.video_link }}</span>
      <span class="history-object">{{ history_object.video_link }}</span>
      <span class="show-diff"></span>
    </div>
  </div>

{% endblock %}

{% block js %}
  {{ block.super }}
    {% compress js %}
        <script src="{% static 'bower_components/jquery/dist/jquery.js' %}"></script>
        <script src="{% static 'bower_components/google-diff-match-patch/diff_match_patch.js' %}"></script>
        <script src="{% static 'js/publisher/comparing-objects.js' %}"></script>
    {% endcompress %}
{% endblock %}
