Mercurial > hg > bts-webui
view bts_webui/amancay/templates/bug.html @ 131:2aa6bf2f3f2e draft
subscribe: implement subcribe action
discard the old ugly button+form, use a nice icon+link.
we need API from debbugs to know if an email is subscribed to a report. must
ask Don.
author | diegoe-guest |
---|---|
date | Thu, 06 Aug 2009 23:00:31 +0000 |
parents | 9fd31c1b495f |
children | 617e3c41e48f |
line wrap: on
line source
{% extends "base.html" %} {% load template_filters %} {% block title %}Amancay BTS interface - Bug View{% endblock %} {% block extrajs %} <script type="text/javascript" src="/static/buglog.js"></script> <script type="text/javascript" language="javascript" charset="utf-8"> function toggle_subscribe_cb(img, newimg, txt, newtxt, xml) { img.src = newimg; txt.innerHTML = newtxt; } function toggle_subscribe(id) { var url = '/ajax/bug/'; var img = document.getElementById('subscribe_img'); var txt = document.getElementById('subscribe_text'); var newimg = ''; if (MochiKit.Text.endsWith('list-remove.png', img.src)) { newimg = '/static/icons/list-add.png'; newtxt = 'Subscribe to this report'; url += 'unsubscribe/'; } else { newimg = '/static/icons/list-remove.png'; newtxt = 'Unsubscribe from this report'; url += 'subscribe/'; } res = MochiKit.Async.doSimpleXMLHttpRequest(url, {'id': id}); res.addCallback(toggle_subscribe_cb, img, newimg, txt, newtxt); } </script> {% endblock %} {% block main_content %} <div class="bug"> <div class="bug_information"> <span class="bug_number"><a href="/bug/{{ bug_number }}">bug #{{ bug_number }}</a></span> <span class="bug_modified">Last modified <span class="modified">{{ bug_status.log_modified|tstodatetime|timesince }}</span> ago ({{ bug_status.log_modified|tstodate }}) </div> <div class="bug_title">{{ bug_status.subject|escape }} <span class="bug_severity">((icon){{ bug_status.severity }})</span></div> <div class="bug_extra_information"> (Package: <a href="/package/{{ bug_status.package }}">{{ bug_status.package }}</a>)<br/> {% if bug_status.found_versions|length %} Found in: {{ bug_status.found_versions|join:", " }} {% endif %} </div> <div id="subscribe"> {% if current_user.is_authenticated %} <a href="javascript:toggle_subscribe({{ bug_number }})" class="action"> {% if current_user.subscribed %} <img id="subscribe_img" src="/static/icons/list-remove.png" /> <span id="subscribe_text">Unsubscribe from this report</span> {% else %} <img id="subscribe_img" src="/static/icons/list-add.png" /> <span id="subscribe_text">Subscribe to this report</span> {% endif %} </a> {% else %} Log in to be able to subscribe to reports. {% endif %} </div> {% if bug_messages %} {% for message in bug_messages %} {% if forloop.first %} <div class="bug_log_item bug_log_item_reporter"> <div class="bug_log_header"> {% if message.from.0 %} <span class="bug_log_from">Reported by <a href="mailto:{{ message.from.1 }}">{{ message.from.0 }}</a></span> <span class="bug_log_date">{{ message.date|tstodatetime|timesince }} ago ({{ message.date|tstodate }})</span> {% endif %} </div> <div class="bug_log_body"> <pre>{{ message.body|escape }}</pre> </div> </div> {% else %} <div class="bug_log_item {% cycle 'bug_log_item_even' 'bug_log_item_odd' %}"> <div class="bug_log_header"> {% if message.from.0 %} <span class="bug_log_from"><a href="mailto:{{ message.from.1 }}">{{ message.from.0 }}</a></span> <span class="bug_log_date">said on {{ message.date|tstodate }}:<br/></span> {% endif %} <span class="bug_log_subject">{{ message.subject|escape }}</span> </div> <div class="bug_log_body"> <pre>{{ message.body|escape }}</pre> </div> </div> {% endif %} {% endfor %} {% load bug_tags %} {% bug_tags_selector %} <br/> {% include "bug_actions.html" %} {% include "bug_forms.html" %} {% endif %} </div> {% endblock %}