summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2011-03-10 00:29:26 +0100
committerÉtienne Loks <etienne.loks@peacefrogs.net>2011-03-10 00:29:26 +0100
commit1fe643357ffdfa927e4a0c048412d09ef478f8c0 (patch)
treed4004e06333fe7955272e9ef6ddafc9ae4aca558
parentc66f45d648982d0aa7f62104d8009cfae7c7ccf7 (diff)
downloadIshtar-1fe643357ffdfa927e4a0c048412d09ef478f8c0.tar.bz2
Ishtar-1fe643357ffdfa927e4a0c048412d09ef478f8c0.zip
Manage multiple windows
-rw-r--r--ishtar/furnitures/views.py2
-rw-r--r--ishtar/templates/sheet.html9
-rw-r--r--ishtar/templates/sheet_file.html4
-rw-r--r--ishtar/templates/sheet_operation.html4
-rw-r--r--static/js/ishtar.js6
-rw-r--r--static/media/style.css6
6 files changed, 18 insertions, 13 deletions
diff --git a/ishtar/furnitures/views.py b/ishtar/furnitures/views.py
index b212dee77..b22257839 100644
--- a/ishtar/furnitures/views.py
+++ b/ishtar/furnitures/views.py
@@ -246,6 +246,8 @@ def show_item(model, name):
return HttpResponse(None)
doc_type = 'type' in dct and dct.pop('type')
dct['item'], dct['item_name'] = item, name
+ dct['window_id'] = "%s-%d-%s" % (name, item.pk,
+ datetime.datetime.now().strftime('%M%s'))
context_instance = RequestContext(request)
context_instance.update(dct)
n = datetime.datetime.now()
diff --git a/ishtar/templates/sheet.html b/ishtar/templates/sheet.html
index c157b61a0..8da56345c 100644
--- a/ishtar/templates/sheet.html
+++ b/ishtar/templates/sheet.html
@@ -12,8 +12,13 @@
</head>
<body>
{% endblock %}
-<div class="sheet">
-<div class="head"><a href='#' onclick='$("#window").hide("slow")'>{% trans "Close" %}</a></div>
+<div class="sheet" id='{{window_id}}'>
+<script type="text/javascript">var last_window='{{window_id}}';</script>
+<div class="head">
+<a href='#' onclick='$("#{{window_id}}").hide("slow")'>{% trans "Close" %}</a> -
+<a href='#' onclick='$("#window > div").hide("slow");$("#window").html("")'>
+{% trans "Close all windows" %}
+</a></div>
<div class="body">
{% block content %}{% endblock %}
</div>
diff --git a/ishtar/templates/sheet_file.html b/ishtar/templates/sheet_file.html
index 314fcaf06..8a004b0a5 100644
--- a/ishtar/templates/sheet_file.html
+++ b/ishtar/templates/sheet_file.html
@@ -25,7 +25,7 @@
<p><label>{%trans "Type:"%}</label> <span class='value'>{{ item.file_type }}</span></p>
-{% if item.related_file %}<p><label>{%trans "Related file:"%}</label> <span class='value'><a href='{% url show-file item.related_file.pk ''%}'>{{ item.related_file }}</a></span></p>{% endif %} <!-- Displayed as Year/index/Commune/Common_name This should be a link to the file sheet of the related file -->
+{% if item.related_file %}<p><label>{%trans "Related file:"%}</label> <span class='value'><a href='#' onclick='load_window("{% url show-file item.related_file.pk ''%}")'>{{ item.related_file }}</a></span></p>{% endif %} <!-- Displayed as Year/index/Commune/Common_name This should be a link to the file sheet of the related file -->
{% if item.comment %}<p><label>{%trans "Comment:"%}</label> <span class='value'>{{ item.comment }}</span></p>{%endif%}
<h3>{% trans "Localisation"%}</h3>
@@ -91,7 +91,7 @@
<td class='string'>{{operation.in_charge|default:""}}</td>
<td>{{operation.start_date|default:""}}</td>
<td>{{operation.end_date|default:""}}</td>
- <td class='link'><a href="#{#{%url show-operation operation.pk%}#}">{% trans "Details" %}</a></td>
+ <td class='link'><a href="#" onclick='load_window("{%url show-operation operation.pk ''%}")'>{% trans "Details" %}</a></td>
</tr>
{% empty %}
<tr><td colspan="8" class='no_items'>{% trans "No operation associated to this archaelogical file" %}</td></tr>
diff --git a/ishtar/templates/sheet_operation.html b/ishtar/templates/sheet_operation.html
index 8902126c6..d0e31ae5a 100644
--- a/ishtar/templates/sheet_operation.html
+++ b/ishtar/templates/sheet_operation.html
@@ -30,7 +30,7 @@
<p><label>{%trans "Periods:"%}</label> <span class='value'>{{ item.periods.all|join:", " }}</span></p>
{% if item.associated_file %}
-<p><label>{%trans "Associated file:"%}</label> <span class='value'><a href='{% url show-file item.associated_file.pk ''%}'>{{ item.associated_file }}</a></span></p><!-- Displayed as Year/index/Commune/Common_name This should be a link to the file sheet of the related file -->
+<p><label>{%trans "Associated file:"%}</label> <span class='value'><a href='#' onclick='load_window("{% url show-file item.associated_file.pk ''%}")'>{{ item.associated_file }}</a></span></p><!-- Displayed as Year/index/Commune/Common_name This should be a link to the file sheet of the related file -->
{% if item.associated_file.is_preventive %}
{#{% if item.operator_reference_code %}<p><label>{%trans "Operator's reference code:"%}</label> <span class='value'>{{ item.operator_reference_code }}</span></p>{% endif %}#}
{% if item.associated_file.town_planning_service %}<p><label>{%trans "Town planning service:"%}</label> <span class='value'>{{ item.associated_file.town_planning_service }}</span></p>{% endif %}
@@ -115,7 +115,7 @@
<td>{{ context_record.datings.all|join:", " }}</td>{# periods ?#}
<td class='string'>{{ context_record.description }}</td>
<td>{{ parcel.section }} - {{parcel.parcel_number}}</td>
- <td class='link'><a href="{%url show-context_record context_record.pk%}">{% trans "Details" %}</a></td>
+ <td class='link'><a href="#" onclick='load_window("{%url show-context_record context_record.pk%}")'>{% trans "Details" %}</a></td>
</tr>
{% empty %}
<tr><td colspan="5" class='no_items'>{% trans "No context record associated to parcel " %}{{ parcel.section }} - {{parcel.parcel_number}}</td></tr>
diff --git a/static/js/ishtar.js b/static/js/ishtar.js
index 7dc1be345..784480f81 100644
--- a/static/js/ishtar.js
+++ b/static/js/ishtar.js
@@ -45,13 +45,15 @@ $("#main_menu ul li").live('click', function(){
$(this).find('ul').show('slow');
});
+var last_window;
+
function load_window(url){
$.ajax({
url: url,
cache: false,
success:function(html){
- $("#window").html(html);
- $("#window").show('slow');
+ $("#window").append(html);
+ $("#"+last_window).show('slow');
},
error:function(XMLHttpRequest, textStatus, errorThrows){
}
diff --git a/static/media/style.css b/static/media/style.css
index 8aa4ead48..7868a4671 100644
--- a/static/media/style.css
+++ b/static/media/style.css
@@ -249,7 +249,7 @@ table.confirm tr.spacer td:last-child{
color:#D14;
}
-#window{
+.sheet{
width:760px;
position:fixed;
height:90%;
@@ -299,10 +299,6 @@ table.confirm tr.spacer td:last-child{
font-style:italic;
}
-#window .sheet{
-}
-
-
#window .head{
text-align:center;
background-color:#EEE;