Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update TicketReminderPlugin for Trac API changes and more ... #15

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env python

from setuptools import setup

VERSION = '0.2.1'
VERSION = '0.2.2'
PACKAGE = 'ticketreminder'

setup(
Expand All @@ -21,7 +23,19 @@
'templates/*.html',
],
},
install_requires = [],
install_requires = ['Trac'],
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Plugins',
'Environment :: Web Environment',
'Framework :: Trac',
'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)'
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
],
zip_safe = False,
entry_points = {
'trac.plugins': '%s = %s' % (PACKAGE, PACKAGE),
Expand Down
4 changes: 2 additions & 2 deletions ticketreminder/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from api import *
from .api import *
import pkg_resources

pkg_resources.require('Trac >= 1.0')
pkg_resources.require('Trac >= 1.3')
840 changes: 750 additions & 90 deletions ticketreminder/api.py

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions ticketreminder/htdocs/js/ticketreminderjinja.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

(function ($) {

$(document).ready(function ($) {
$("#attachments").after(trdata.tags);
if($(location).attr('hash') != "#reminders") {
$("#reminders").toggleClass("collapsed");
}
$(".trac-nav").prepend(' <a href="#reminders" id="trac-up-reminders" title="Go to the list of reminders">Reminders</a> &uarr;');
$("#trac-up-reminders").click(function () {
$("#reminders").removeClass("collapsed");
return true;
});
});

})(jQuery);

Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:py="http://genshi.edgewall.org/"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:i18n="http://genshi.edgewall.org/i18n">
<xi:include href="layout.html" />
# extends 'layout.html'
<!DOCTYPE html>
<html>
<head>
<title>${name_of(ticket.resource)} &ndash; Add Reminder</title>
# block title
${name_of(ticket.resource)} &ndash; Add Reminder ${ super() }
# endblock title

# block head
${ super() }
# endblock head
</head>

<body>
<div id="content" class="reminder">
# block content
<h1>Add reminder on <a href="${url_of(ticket.resource)}">${name_of(ticket.resource)}</a></h1>
<form id="reminder" method="post" enctype="multipart/form-data" action="">
${jmacros.form_token_input()}
<fieldset>
<legend><label><input type="radio" name="reminder_type" value="date" checked="${'checked' if req.args.get('reminder_type') == 'date' else None}" /> Specific Date</label></legend>
<div class="field">
On <input type="text" name="date" size="15" value="${req.args.get('date')}" />.
On <input type="text" class="trac-datepicker" name="date" size="15" value="${req.args.get('date')}" />.
<p class="hint">Enter date in ${date_hint} format.</p>
</div>
<br />
Expand All @@ -35,13 +38,13 @@ <h1>Add reminder on <a href="${url_of(ticket.resource)}">${name_of(ticket.resour
</fieldset>
<fieldset>
<legend>Reminder Info</legend>
<py:if test="authname == 'anonymous'">
# if authname == 'anonymous'
<div class="field">
<label>Your email or username:<br />
<input type="text" name="author" size="30" value="${req.args.get('author', author)}" />
</label>
</div>
</py:if>
# endif
<div class="field">
<label>Description of the reminder (optional):<br />
<input type="text" name="description" size="60" value="${req.args.get('description')}" /></label>
Expand All @@ -55,5 +58,7 @@ <h1>Add reminder on <a href="${url_of(ticket.resource)}">${name_of(ticket.resour
</div>
</form>
</div>
${ super() }
# endblock content
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:py="http://genshi.edgewall.org/"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:i18n="http://genshi.edgewall.org/i18n">
<xi:include href="layout.html" />
# extends 'layout.html'
<!DOCTYPE html>
<html>
<head>
<title>${name_of(ticket.resource)} &ndash; Delete Reminder</title>
# block title
${name_of(ticket.resource)} &ndash; Delete Reminder ${ super() }
# endblock title

# block head
${ super() }
# endblock head
</head>

<body>
<div id="content" class="reminder">
# block content
<h1>Delete reminder on <a href="${url_of(ticket.resource)}">${name_of(ticket.resource)}</a></h1>
<div id="formatted_reminder">${formatted_reminder}</div>
<p><strong>Are you sure you want to delete this reminder?</strong><br />
This is an irreversible operation.</p>
<div class="buttons">
<form method="post" action="">
${jmacros.form_token_input()}
<div id="delete">
<input type="hidden" name="action" value="deletereminder" />
<input type="hidden" name="reminder" value="${req.args.get('reminder')}" />
Expand All @@ -27,5 +30,7 @@ <h1>Delete reminder on <a href="${url_of(ticket.resource)}">${name_of(ticket.res
</form>
</div>
</div>
${ super() }
# endblock content
</body>
</html>
42 changes: 42 additions & 0 deletions ticketreminder/templates/ticket_reminder_email_jinja.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<base href="${abs_href.ticket(ticket.id)}" />
<title>#${ticket.id} (${ticket.summary})</title>
<style type="text/css">${styles|safe}</style>
</head>
<body>
<div id="reminder">
<pre>
${reminder}
</pre>
</div>
<div id="main">
<div id="content" class="ticket">
<h1 id="trac-ticket-title">
<a href="${abs_href.ticket(ticket.id)}">Ticket #${ticket.id}</a>
<span class="trac-status">${ticket.status}</span>
# if ticket.type:
<span class="trac-type">${ticket.type}</span>
# endif
# if ticket.resolution:
<span class="trac-resolution">${ticket.resolution}</span>
# endif
</h1>
<hr />
# with preview_mode = change_preview.fields
# include 'ticket_box.html'
# endwith
</div>
</div>
<div id="footer">
<hr />
<p>
${tag_('Ticket URL: \x3c%(link)s\x3e', link=link)}<br />
${project.name} &lt;<a href="${project.url or abs_href()}">${project.url or abs_href()}</a>&gt;<br />
${project.descr}
</p>
</div>
</body>
</html>
8 changes: 8 additions & 0 deletions ticketreminder/templates/ticket_reminder_email_jinja.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
${reminder}

${ticket_body_hdr}
${ticket_props}
${'-- '}
${_('Ticket URL: <%(link)s>', link=ticket.link)}
${project.name} <${project.url or abs_href()}>
${project.descr}