GanttCalendarPlugin: show datepicker for text field of holiday if Trac 1.0 or later
@@ -7,6 +7,13 @@ | ||
7 | 7 | <xi:include href="admin.html" /> |
8 | 8 | <head> |
9 | 9 | <title>${_('Holidays')}</title> |
10 | + <script type="text/javascript"> | |
11 | + jQuery(document).ready(function($) { | |
12 | + if ($.ui) { | |
13 | + $('form.addnew input[name=date]').datepicker(); | |
14 | + } | |
15 | + }); | |
16 | + </script> | |
10 | 17 | </head> |
11 | 18 | |
12 | 19 | <body> |
@@ -6,6 +6,7 @@ | ||
6 | 6 | from trac.core import Component, implements, TracError |
7 | 7 | from trac.env import IEnvironmentSetupParticipant |
8 | 8 | from trac.util.datefmt import format_date, parse_date |
9 | +from trac.web.chrome import Chrome | |
9 | 10 | try: |
10 | 11 | from trac.util.datefmt import user_time |
11 | 12 | except ImportError: |
@@ -19,6 +20,9 @@ | ||
19 | 20 | from ganttcalendar.translation import _, add_domain |
20 | 21 | |
21 | 22 | |
23 | +has_jquery_ui = hasattr(Chrome, 'add_jquery_ui') | |
24 | + | |
25 | + | |
22 | 26 | class HolidayAdminPanel(Component): |
23 | 27 | |
24 | 28 | implements(IAdminPanelProvider, IEnvironmentSetupParticipant) |
@@ -78,6 +82,8 @@ | ||
78 | 82 | holidays = [dict(zip(columns, row)) for row in cursor] |
79 | 83 | tbl_chk = True |
80 | 84 | |
85 | + if has_jquery_ui: | |
86 | + Chrome(self.env).add_jquery_ui(req) | |
81 | 87 | data = {'_': _, 'holidays': holidays, 'tbl_chk': tbl_chk} |
82 | 88 | return 'ganttcalendar_admin_holiday.html', data |
83 | 89 |