##// END OF EJS Templates
Move repetitive calendar include code from views into helper (patch #966 by Peter Suschlik)....
Jean-Philippe Lang -
r1300:68fe7856c921
parent child
Show More
@@ -463,9 +463,22 module ApplicationHelper
463 end
463 end
464
464
465 def calendar_for(field_id)
465 def calendar_for(field_id)
466 include_calendar_headers_tags
466 image_tag("calendar.png", {:id => "#{field_id}_trigger",:class => "calendar-trigger"}) +
467 image_tag("calendar.png", {:id => "#{field_id}_trigger",:class => "calendar-trigger"}) +
467 javascript_tag("Calendar.setup({inputField : '#{field_id}', ifFormat : '%Y-%m-%d', button : '#{field_id}_trigger' });")
468 javascript_tag("Calendar.setup({inputField : '#{field_id}', ifFormat : '%Y-%m-%d', button : '#{field_id}_trigger' });")
468 end
469 end
470
471 def include_calendar_headers_tags
472 unless @calendar_headers_tags_included
473 @calendar_headers_tags_included = true
474 content_for :header_tags do
475 javascript_include_tag('calendar/calendar') +
476 javascript_include_tag("calendar/lang/calendar-#{current_language}.js") +
477 javascript_include_tag('calendar/calendar-setup') +
478 stylesheet_link_tag('calendar')
479 end
480 end
481 end
469
482
470 def wikitoolbar_for(field_id)
483 def wikitoolbar_for(field_id)
471 return '' unless Setting.text_formatting == 'textile'
484 return '' unless Setting.text_formatting == 'textile'
@@ -35,10 +35,3
35
35
36 <%= submit_tag l(:button_submit) %>
36 <%= submit_tag l(:button_submit) %>
37 <% end %>
37 <% end %>
38
39 <% content_for :header_tags do %>
40 <%= javascript_include_tag 'calendar/calendar' %>
41 <%= javascript_include_tag "calendar/lang/calendar-#{current_language}.js" %>
42 <%= javascript_include_tag 'calendar/calendar-setup' %>
43 <%= stylesheet_link_tag 'calendar' %>
44 <% end %>
@@ -49,10 +49,3
49 <% end %>
49 <% end %>
50
50
51 <%= wikitoolbar_for 'issue_description' %>
51 <%= wikitoolbar_for 'issue_description' %>
52
53 <% content_for :header_tags do %>
54 <%= javascript_include_tag 'calendar/calendar' %>
55 <%= javascript_include_tag "calendar/lang/calendar-#{current_language}.js" %>
56 <%= javascript_include_tag 'calendar/calendar-setup' %>
57 <%= stylesheet_link_tag 'calendar' %>
58 <% end %>
@@ -47,10 +47,3
47
47
48 <p><%= submit_tag l(:button_submit) %>
48 <p><%= submit_tag l(:button_submit) %>
49 <% end %>
49 <% end %>
50
51 <% content_for :header_tags do %>
52 <%= javascript_include_tag 'calendar/calendar' %>
53 <%= javascript_include_tag "calendar/lang/calendar-#{current_language}.js" %>
54 <%= javascript_include_tag 'calendar/calendar-setup' %>
55 <%= stylesheet_link_tag 'calendar' %>
56 <% end %>
@@ -46,11 +46,3
46 </fieldset>
46 </fieldset>
47 <% end %>
47 <% end %>
48 <!--[eoform:project]-->
48 <!--[eoform:project]-->
49
50
51 <% content_for :header_tags do %>
52 <%= javascript_include_tag 'calendar/calendar' %>
53 <%= javascript_include_tag "calendar/lang/calendar-#{current_language}.js" %>
54 <%= javascript_include_tag 'calendar/calendar-setup' %>
55 <%= stylesheet_link_tag 'calendar' %>
56 <% end %>
@@ -44,10 +44,3
44 <span><%= link_to 'CSV', params.merge(:format => 'csv'), :class => 'csv' %></span>
44 <span><%= link_to 'CSV', params.merge(:format => 'csv'), :class => 'csv' %></span>
45 </p>
45 </p>
46 <% end %>
46 <% end %>
47
48 <% content_for :header_tags do %>
49 <%= javascript_include_tag 'calendar/calendar' %>
50 <%= javascript_include_tag "calendar/lang/calendar-#{current_language}.js" %>
51 <%= javascript_include_tag 'calendar/calendar-setup' %>
52 <%= stylesheet_link_tag 'calendar' %>
53 <% end %>
@@ -14,10 +14,3
14 <%= submit_tag l(:button_save) %>
14 <%= submit_tag l(:button_save) %>
15
15
16 <% end %>
16 <% end %>
17
18 <% content_for :header_tags do %>
19 <%= javascript_include_tag 'calendar/calendar' %>
20 <%= javascript_include_tag "calendar/lang/calendar-#{current_language}.js" %>
21 <%= javascript_include_tag 'calendar/calendar-setup' %>
22 <%= stylesheet_link_tag 'calendar' %>
23 <% end %> No newline at end of file
@@ -63,10 +63,3
63 <% end %>
63 <% end %>
64 <% end %>
64 <% end %>
65 <% end %>
65 <% end %>
66
67 <% content_for :header_tags do %>
68 <%= javascript_include_tag 'calendar/calendar' %>
69 <%= javascript_include_tag "calendar/lang/calendar-#{current_language}.js" %>
70 <%= javascript_include_tag 'calendar/calendar-setup' %>
71 <%= stylesheet_link_tag 'calendar' %>
72 <% end %>
@@ -30,10 +30,3
30 </div>
30 </div>
31 </div>
31 </div>
32 <!--[eoform:user]-->
32 <!--[eoform:user]-->
33
34 <% content_for :header_tags do %>
35 <%= javascript_include_tag 'calendar/calendar' %>
36 <%= javascript_include_tag "calendar/lang/calendar-#{current_language}.js" %>
37 <%= javascript_include_tag 'calendar/calendar-setup' %>
38 <%= stylesheet_link_tag 'calendar' %>
39 <% end %> No newline at end of file
@@ -6,10 +6,3
6 <p><%= f.text_field :wiki_page_title, :label => :label_wiki_page, :size => 60, :disabled => @project.wiki.nil? %></p>
6 <p><%= f.text_field :wiki_page_title, :label => :label_wiki_page, :size => 60, :disabled => @project.wiki.nil? %></p>
7 <p><%= f.text_field :effective_date, :size => 10 %><%= calendar_for('version_effective_date') %></p>
7 <p><%= f.text_field :effective_date, :size => 10 %><%= calendar_for('version_effective_date') %></p>
8 </div>
8 </div>
9
10 <% content_for :header_tags do %>
11 <%= javascript_include_tag 'calendar/calendar' %>
12 <%= javascript_include_tag "calendar/lang/calendar-#{current_language}.js" %>
13 <%= javascript_include_tag 'calendar/calendar-setup' %>
14 <%= stylesheet_link_tag 'calendar' %>
15 <% end %>
General Comments 0
You need to be logged in to leave comments. Login now