• R/O
  • SSH
  • HTTPS

shibuya-trac: Commit


Commit MetaInfo

Revision855 (tree)
Zeit2014-08-30 23:59:05
Autorjun66j5

Log Message

GanttCalendarPlugin: show datepicker for text field of holiday if Trac 1.0 or later

Ändern Zusammenfassung

Diff

--- plugins/ganttcalendarplugin/trunk/ganttcalendar/templates/ganttcalendar_admin_holiday.html (revision 854)
+++ plugins/ganttcalendarplugin/trunk/ganttcalendar/templates/ganttcalendar_admin_holiday.html (revision 855)
@@ -7,6 +7,13 @@
77 <xi:include href="admin.html" />
88 <head>
99 <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>
1017 </head>
1118
1219 <body>
--- plugins/ganttcalendarplugin/trunk/ganttcalendar/admin.py (revision 854)
+++ plugins/ganttcalendarplugin/trunk/ganttcalendar/admin.py (revision 855)
@@ -6,6 +6,7 @@
66 from trac.core import Component, implements, TracError
77 from trac.env import IEnvironmentSetupParticipant
88 from trac.util.datefmt import format_date, parse_date
9+from trac.web.chrome import Chrome
910 try:
1011 from trac.util.datefmt import user_time
1112 except ImportError:
@@ -19,6 +20,9 @@
1920 from ganttcalendar.translation import _, add_domain
2021
2122
23+has_jquery_ui = hasattr(Chrome, 'add_jquery_ui')
24+
25+
2226 class HolidayAdminPanel(Component):
2327
2428 implements(IAdminPanelProvider, IEnvironmentSetupParticipant)
@@ -78,6 +82,8 @@
7882 holidays = [dict(zip(columns, row)) for row in cursor]
7983 tbl_chk = True
8084
85+ if has_jquery_ui:
86+ Chrome(self.env).add_jquery_ui(req)
8187 data = {'_': _, 'holidays': holidays, 'tbl_chk': tbl_chk}
8288 return 'ganttcalendar_admin_holiday.html', data
8389
Show on old repository browser