summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2013-09-18 23:31:21 +0200
committerÉtienne Loks <etienne.loks@peacefrogs.net>2013-09-18 23:31:21 +0200
commit08967c9a904b6380c6f794eb934038a3cfa65839 (patch)
treeda01a65898d1ddc8601d7dc4e04cc5b2f384c38a
parent36a54b1d288a9dd4d2be9d26aeebf68d6364cb54 (diff)
downloadIshtar-08967c9a904b6380c6f794eb934038a3cfa65839.tar.bz2
Ishtar-08967c9a904b6380c6f794eb934038a3cfa65839.zip
Add history navigation for operations, context records and finds (refs #1401)
-rw-r--r--archaeological_context_records/templates/ishtar/sheet_contextrecord.html12
-rw-r--r--archaeological_context_records/urls.py4
-rw-r--r--archaeological_context_records/views.py1
-rw-r--r--archaeological_finds/templates/ishtar/sheet_find.html14
-rw-r--r--archaeological_operations/templates/ishtar/sheet_operation.html15
-rw-r--r--archaeological_operations/urls.py2
6 files changed, 48 insertions, 0 deletions
diff --git a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html
index 355e76abc..8356d789d 100644
--- a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html
+++ b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html
@@ -1,6 +1,18 @@
{% extends "ishtar/sheet.html" %}
{% load i18n %}
{% block content %}
+{% if previous or next %}
+<div class='tool'>
+{%if previous%}
+<a href="#" onclick='load_window("{% url show-historized-contextrecord item.pk previous|date:"c"%}");$("#{{window_id}}").hide();return false;'>{%trans "Previous version"%} ({{previous}})</a>
+{% endif %}
+{% if previous and next %} - {% endif %}
+{%if next%}
+<a href="#" onclick='if(confirm("{%trans "Are you sure to rollback to this version?"%}")){load_url("{% url revert-contextrecord item.pk item.history_date|date:"c"%}");closeAllWindows();load_window("{% url show-contextrecord item.pk None %}");}'>Rollback</a> -
+<a href="#" onclick='load_window("{% url show-historized-contextrecord item.pk next|date:"c" %}");$("#{{window_id}}").hide();return false;'>{%trans "Next version"%} ({{next}})</a>
+{% endif %}
+</div>
+{% endif %}
<div class='tool'>{%trans "Export as:"%} <a href='{% url show-contextrecord item.pk "odt" %}'>{%trans "OpenOffice.org file"%}</a>, <a href='{% url show-contextrecord item.pk "pdf" %}'>{%trans "PDF file"%}</a></div>
<h3>{% trans "Context Record"%}</h3>
diff --git a/archaeological_context_records/urls.py b/archaeological_context_records/urls.py
index 0ac1566ac..772938b81 100644
--- a/archaeological_context_records/urls.py
+++ b/archaeological_context_records/urls.py
@@ -45,6 +45,10 @@ urlpatterns = patterns('',
urlpatterns += patterns('archaeological_context_records.views',
url(r'show-contextrecord/(?P<pk>.+)?/(?P<type>.+)?$',
'show_contextrecord', name='show-contextrecord'),
+ url(r'show-historized-contextrecord/(?P<pk>.+)?/(?P<date>.+)?$',
+ 'show_contextrecord', name='show-historized-contextrecord'),
+ url(r'revert-contextrecord/(?P<pk>.+)/(?P<date>.+)$',
+ 'revert_contextrecord', name='revert-contextrecord'),
url(r'get-contextrecord/(?P<type>.+)?$', 'get_contextrecord',
name='get-contextrecord'),
url(r'get-contextrecord-full/(?P<type>.+)?$',
diff --git a/archaeological_context_records/views.py b/archaeological_context_records/views.py
index 8f56182ff..7f42866d8 100644
--- a/archaeological_context_records/views.py
+++ b/archaeological_context_records/views.py
@@ -26,6 +26,7 @@ from forms import *
import models
show_contextrecord = show_item(models.ContextRecord, 'contextrecord')
+revert_contextrecord = revert_item(models.ContextRecord)
get_contextrecord = get_item(models.ContextRecord,
'get_contextrecord', 'contextrecord',
extra_request_keys={'parcel__town':'parcel__town__pk',
diff --git a/archaeological_finds/templates/ishtar/sheet_find.html b/archaeological_finds/templates/ishtar/sheet_find.html
index 223e07415..da1e91cc5 100644
--- a/archaeological_finds/templates/ishtar/sheet_find.html
+++ b/archaeological_finds/templates/ishtar/sheet_find.html
@@ -2,6 +2,20 @@
{% load i18n %}
{% block content %}
+
+{% if previous or next %}
+<div class='tool'>
+{%if previous%}
+<a href="#" onclick='load_window("{% url show-historized-find item.pk previous|date:"c"%}");$("#{{window_id}}").hide();return false;'>{%trans "Previous version"%} ({{previous}})</a>
+{% endif %}
+{% if previous and next %} - {% endif %}
+{%if next%}
+<a href="#" onclick='if(confirm("{%trans "Are you sure to rollback to this version?"%}")){load_url("{% url revert-find item.pk item.history_date|date:"c"%}");closeAllWindows();load_window("{% url show-find item.pk None %}");}'>Rollback</a> -
+<a href="#" onclick='load_window("{% url show-historized-find item.pk next|date:"c" %}");$("#{{window_id}}").hide();return false;'>{%trans "Next version"%} ({{next}})</a>
+{% endif %}
+</div>
+{% endif %}
+
<div class='tool'>{%trans "Export as:"%} <a href='{% url show-find item.pk "odt" %}'>{%trans "OpenOffice.org file"%}</a>, <a href='{% url show-find item.pk "pdf" %}'>{%trans "PDF file"%}</a></div>
<h3>{% trans "Find"%}</h3>
diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html
index fd4c4d021..06c30b9e7 100644
--- a/archaeological_operations/templates/ishtar/sheet_operation.html
+++ b/archaeological_operations/templates/ishtar/sheet_operation.html
@@ -1,7 +1,22 @@
{% extends "ishtar/sheet.html" %}
{% load i18n %}
{% block content %}
+
+{% if previous or next %}
+<div class='tool'>
+{%if previous%}
+<a href="#" onclick='load_window("{% url show-historized-operation item.pk previous|date:"c"%}");$("#{{window_id}}").hide();return false;'>{%trans "Previous version"%} ({{previous}})</a>
+{% endif %}
+{% if previous and next %} - {% endif %}
+{%if next%}
+<a href="#" onclick='if(confirm("{%trans "Are you sure to rollback to this version?"%}")){load_url("{% url revert-operation item.pk item.history_date|date:"c"%}");closeAllWindows();load_window("{% url show-operation item.pk None %}");}'>Rollback</a> -
+<a href="#" onclick='load_window("{% url show-historized-operation item.pk next|date:"c" %}");$("#{{window_id}}").hide();return false;'>{%trans "Next version"%} ({{next}})</a>
+{% endif %}
+</div>
+{% endif %}
+
<div class='tool'>{%trans "Export as:"%} <a href='{% url show-operation item.pk "odt" %}'>{%trans "OpenOffice.org file"%}</a>, <a href='{% url show-operation item.pk "pdf" %}'>{%trans "PDF file"%}</a></div>
+
<h3>{% trans "General"%}</h3>
{% if item.common_name %}<p><label>{%trans "Name:"%}</label> <span class='value'>{{ item.common_name }}</span></p>{% endif %}
<p><label>{%trans "Year:"%}</label> <span class='value'>{{ item.year }}</span></p>
diff --git a/archaeological_operations/urls.py b/archaeological_operations/urls.py
index 0da649d2d..13a2c5c35 100644
--- a/archaeological_operations/urls.py
+++ b/archaeological_operations/urls.py
@@ -67,6 +67,8 @@ urlpatterns += patterns('archaeological_operations.views',
'revert_operation', name='revert-operation'),
url(r'show-operation/(?P<pk>.+)?/(?P<type>.+)?$',
'show_operation', name='show-operation'),
+ url(r'show-historized-operation/(?P<pk>.+)?/(?P<date>.+)?$',
+ 'show_operation', name='show-historized-operation'),
url(r'get-administrativeactop/(?P<type>.+)?$',
'get_administrativeactop', name='get-administrativeactop'),
url(r'get-operationsource/(?P<type>.+)?$',