changeset 147:af5334fc46c1 draft

table: make the actual table a separate template search was failing because table.html is now a full fledged page.
author diegoe-guest
date Wed, 12 Aug 2009 20:51:21 +0000
parents 79a57c5f9477
children fa98c6f46c8b
files bts_webui/amancay/search.py bts_webui/amancay/templates/search.html bts_webui/amancay/templates/table.html bts_webui/amancay/templates/table_widget.html
diffstat 4 files changed, 4 insertions(+), 106 deletions(-) [+]
line wrap: on
line diff
--- a/bts_webui/amancay/search.py
+++ b/bts_webui/amancay/search.py
@@ -7,6 +7,7 @@
 from django.contrib.sites.models import Site
 from django.http import HttpResponse
 from django.shortcuts import render_to_response
+from django.template import RequestContext
 from django.utils import simplejson
 
 from amancay.btsqueries import SoapQueries
@@ -137,7 +138,7 @@
 							mimetype='application/javascript')
 	elif request.path.find('table') != -1:
 		# We only need to render the table
-		return render_to_response('table.html',
+		return render_to_response('table_widget.html',
 								  {'bug_list': bug_list,
 								   'current_view': current_view,
 								   'url': url,
--- a/bts_webui/amancay/templates/search.html
+++ b/bts_webui/amancay/templates/search.html
@@ -1,11 +1,7 @@
 {% extends "base.html" %}
 
-{% block title %}Amancay BTS interface{% endblock %}
-
 {% block toolbox %}
 {% endblock %}
-
-
 {% block main_content %}
 <div id="main_content">
 	{% block search_form %}
@@ -14,7 +10,7 @@
 	<div id="search_results">
 		{% if bug_list %}
 			{% block bug_list %}
-			{% include "table.html" %}
+			{% include "table_widget.html" %}
 			{% endblock %}
 		{% endif %}
 	</div>
--- a/bts_webui/amancay/templates/table.html
+++ b/bts_webui/amancay/templates/table.html
@@ -1,100 +1,4 @@
 {% extends "base.html" %}
-{% comment %} vim: set sw=4 ts=4 sts=4 noet: {% endcomment %}
-{% load template_filters %}
-
 {% block main_content %}
-<script type="text/javascript" language="javascript" charset="utf-8">
-function toggle_star_cb(img, newimg, xml) {
-	img.src = newimg;
-}
-function toggle_star(id) {
-	var url = '/ajax/package/';
-	var img = document.getElementById(id + '_star');
-	var newimg = '';
-
-	if (MochiKit.Text.endsWith('star_on.png', img.src))
-	{
-		newimg = '/static/icons/star_off.png';
-		url += 'remove/';
-	}
-	else
-	{
-		newimg = '/static/icons/star_on.png';
-		url += 'add/';
-	}
-
-	var res = MochiKit.Async.doSimpleXMLHttpRequest(url, {'id': id});
-	res.addCallback(toggle_star_cb, img, newimg);
-}
-</script>
-<input id="current_view" type="hidden" value="{{ current_view }}" />
-{% if bug_list %}
-<span class="table_title">{{ title }}</span>
-<div class="pager">
-	{% if pages %}
-	<span class="page_numbers">Pages:
-		<ul class="page_numbers" id="pager">
-			{% for number in pages %}
-			{% ifequal number current_page %}
-				<li class="current">{{ number }}</li>
-			{% else %}
-				<li class="normal"><a href="{{ url }}&page={{number}}">{{ number }}</a></li>
-			{% endifequal %}
-			{% endfor %}
-		</ul>
-	</span>
-	{% endif %}
-	{% if total_bugs %}
-	<span class="total_bugs">Found {{ total_bugs }} 
-	{% ifequal total_bugs 1 %}bug{% else %}bugs{%endifequal%}</span>
-	{% endif %}
-</div>
-<table class="bugs">
-	<tr>
-		<th></th>
-		<th>Bug #</th>
-		<th>Summary</th>
-		<th>Last modified</th>
-	</tr>
-	{% for bug in bug_list %}
-	{% ifchanged %}
-	<tr>
-		<td class="starred">
-			<a href="javascript:toggle_star('{{ bug.package }}')" class="favorite_icon">
-		{% if bug.pkg_fav %}
-			<img id="{{ bug.package }}_star" src="/static/icons/star_on.png" style="vertical-align: middle"/>
-		{% else %}
-			<img id="{{ bug.package }}_star" src="/static/icons/star_off.png" style="vertical-align: middle"/>
-		{% endif %}
-			</a>
-		</td>
-		<td class="package" colspan="4">
-			<a href="/package/{{ bug.package }}">{{ bug.package }}</a>
-		</td>
-	</tr>
-	{% endifchanged %}
-	<tr>
-		<td class="starred"></td>
-		<td class="bug_number">#{{ bug.id }}</td>
-		<td class="subject">
-			<a href="/bug/{{ bug.id }}">{{ bug.subject|truncatewords:6 }}</a>
-		</td>
-		<td class="date">{{ bug.log_modified|tstodatetime|timesince}} ago</td>
-	</tr>
-	<tr>
-		<td></td>
-		<td></td>
-		<td colspan="3">
-			<span class="extra">
-				<span class="status {{ bug.severity }}">{{ bug.severity }}</span>
-				reported by <b>{{ bug.originator }}</b> marked <b>{{ bug.pending }}</b>
-				{% if bug.keywords %}
-				tagged <b>{{ bug.keywords }}</b>
-				{% endif%}
-			</span>
-		</td>
-	</tr>
-	{% endfor %}
-</table>
-{% endif %}
+    {% include "table_widget.html" %}
 {% endblock %}
copy from bts_webui/amancay/templates/table.html
copy to bts_webui/amancay/templates/table_widget.html
--- a/bts_webui/amancay/templates/table.html
+++ b/bts_webui/amancay/templates/table_widget.html
@@ -1,8 +1,6 @@
-{% extends "base.html" %}
 {% comment %} vim: set sw=4 ts=4 sts=4 noet: {% endcomment %}
 {% load template_filters %}
 
-{% block main_content %}
 <script type="text/javascript" language="javascript" charset="utf-8">
 function toggle_star_cb(img, newimg, xml) {
 	img.src = newimg;
@@ -97,4 +95,3 @@
 	{% endfor %}
 </table>
 {% endif %}
-{% endblock %}