Skip to content

Commit 74236bc

Browse files
author
Richard Jones
committed
include the popcal in Date field editing and search fields by default
1 parent 91c88ef commit 74236bc

File tree

5 files changed

+24
-5
lines changed

5 files changed

+24
-5
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Feature:
99
id is specified in the Subject
1010
- added StringHTMLProperty wrapped() method to wrap long lines in issue
1111
display
12+
- include the popcal in Date field editing and search fields by default
13+
1214

1315
Fixed:
1416
- Verbose option for import and export (sf bug 1505645)

doc/customizing.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Customising Roundup
33
===================
44

5-
:Version: $Revision: 1.199 $
5+
:Version: $Revision: 1.200 $
66

77
.. This document borrows from the ZopeBook section on ZPT. The original is at:
88
http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx
@@ -2051,6 +2051,10 @@ field render an appropriate form edit field for the property - for
20512051
format string argument as supplied to the ``pretty`` method
20522052
below.
20532053

2054+
popcal (Date properties only)
2055+
Include the Javascript-based popup calendar for date
2056+
selection. Defaults to on.
2057+
20542058
stext only on String properties - render the value of the property
20552059
as StructuredText (requires the StructureText module to be
20562060
installed separately)

roundup/cgi/templating.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,11 +1513,14 @@ def now(self, str_interval=None):
15131513
return DateHTMLProperty(self._client, self._classname, self._nodeid,
15141514
self._prop, self._formname, ret)
15151515

1516-
def field(self, size=30, default=None, format=_marker):
1516+
def field(self, size=30, default=None, format=_marker, popcal=True):
15171517
'''Render a form edit field for the property
15181518
15191519
If not editable, just display the value via plain().
15201520
1521+
If "popcal" then include the Javascript calendar editor.
1522+
Default=yes.
1523+
15211524
The format string is a standard python strftime format string.
15221525
'''
15231526
if not self.is_edit_ok():
@@ -1566,7 +1569,10 @@ def field(self, size=30, default=None, format=_marker):
15661569
value = value.pretty(format)
15671570

15681571
value = cgi.escape(str(value), 1)
1569-
return self.input(name=self._formname, value=value, size=size)
1572+
s = self.input(name=self._formname, value=value, size=size)
1573+
if popcal:
1574+
s += self.popcal()
1575+
return s
15701576

15711577
def reldate(self, pretty=1):
15721578
''' Render the interval between the date and now.

templates/classic/html/issue.search.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
group_on python:request.group[1] or 'priority';
1515
1616
search_input templates/page/macros/search_input;
17+
search_date templates/page/macros/search_date;
1718
column_input templates/page/macros/column_input;
1819
sort_input templates/page/macros/sort_input;
1920
group_input templates/page/macros/group_input;
@@ -64,7 +65,7 @@
6465

6566
<tr tal:define="name string:creation">
6667
<th i18n:translate="">Creation Date:</th>
67-
<td metal:use-macro="search_input"></td>
68+
<td metal:use-macro="search_date"></td>
6869
<td metal:use-macro="column_input"></td>
6970
<td metal:use-macro="sort_input"></td>
7071
<td metal:use-macro="group_input"></td>
@@ -86,7 +87,7 @@
8687

8788
<tr tal:define="name string:activity">
8889
<th i18n:translate="">Activity:</th>
89-
<td metal:use-macro="search_input"></td>
90+
<td metal:use-macro="search_date"></td>
9091
<td metal:use-macro="column_input"></td>
9192
<td metal:use-macro="sort_input"></td>
9293
<td>&nbsp;</td>

templates/classic/html/page.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,12 @@ <h2><span metal:define-slot="body_title">body title</span></h2>
164164
name name">
165165
</td>
166166

167+
<td metal:define-macro="search_date">
168+
<input tal:attributes="value python:request.form.getvalue(name) or nothing;
169+
name name">
170+
<a class="classhelp" tal:attributes="href python:'''javascript:help_window('issue?@template=calendar&property=%s&form=itemSynopsis', 300, 200)'''%name">(cal)</a>
171+
</td>
172+
167173
<td metal:define-macro="search_popup">
168174
<!--
169175
context needs to specify the popup "columns" as a comma-separated

0 commit comments

Comments
 (0)