diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-03-31 21:48:01 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-03-31 21:48:01 +0000 |
commit | 68fe7856c9218d0bfa5c4cf468e7120cf2c964d4 (patch) | |
tree | e0ff2e92047667b8161b89bb5c39a49cb90bdf52 /app | |
parent | 0d9e4196463b5cacc103186f888097b6189f58d5 (diff) | |
download | redmine-68fe7856c9218d0bfa5c4cf468e7120cf2c964d4.tar.gz redmine-68fe7856c9218d0bfa5c4cf468e7120cf2c964d4.zip |
Move repetitive calendar include code from views into helper (patch #966 by Peter Suschlik).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1315 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/application_helper.rb | 13 | ||||
-rw-r--r-- | app/views/account/register.rhtml | 7 | ||||
-rw-r--r-- | app/views/issues/_form.rhtml | 7 | ||||
-rw-r--r-- | app/views/issues/bulk_edit.rhtml | 7 | ||||
-rw-r--r-- | app/views/projects/_form.rhtml | 8 | ||||
-rw-r--r-- | app/views/timelog/details.rhtml | 7 | ||||
-rw-r--r-- | app/views/timelog/edit.rhtml | 7 | ||||
-rw-r--r-- | app/views/timelog/report.rhtml | 7 | ||||
-rw-r--r-- | app/views/users/_form.rhtml | 7 | ||||
-rw-r--r-- | app/views/versions/_form.rhtml | 7 |
10 files changed, 13 insertions, 64 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 77019eba3..e30343ff5 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -463,9 +463,22 @@ module ApplicationHelper end def calendar_for(field_id) + include_calendar_headers_tags image_tag("calendar.png", {:id => "#{field_id}_trigger",:class => "calendar-trigger"}) + javascript_tag("Calendar.setup({inputField : '#{field_id}', ifFormat : '%Y-%m-%d', button : '#{field_id}_trigger' });") end + + def include_calendar_headers_tags + unless @calendar_headers_tags_included + @calendar_headers_tags_included = true + content_for :header_tags do + javascript_include_tag('calendar/calendar') + + javascript_include_tag("calendar/lang/calendar-#{current_language}.js") + + javascript_include_tag('calendar/calendar-setup') + + stylesheet_link_tag('calendar') + end + end + end def wikitoolbar_for(field_id) return '' unless Setting.text_formatting == 'textile' diff --git a/app/views/account/register.rhtml b/app/views/account/register.rhtml index c1425a380..7cf4b6da3 100644 --- a/app/views/account/register.rhtml +++ b/app/views/account/register.rhtml @@ -35,10 +35,3 @@ <%= submit_tag l(:button_submit) %> <% end %> - -<% content_for :header_tags do %> -<%= javascript_include_tag 'calendar/calendar' %> -<%= javascript_include_tag "calendar/lang/calendar-#{current_language}.js" %> -<%= javascript_include_tag 'calendar/calendar-setup' %> -<%= stylesheet_link_tag 'calendar' %> -<% end %> diff --git a/app/views/issues/_form.rhtml b/app/views/issues/_form.rhtml index 5034e0a29..9bb74fd34 100644 --- a/app/views/issues/_form.rhtml +++ b/app/views/issues/_form.rhtml @@ -49,10 +49,3 @@ <% end %> <%= wikitoolbar_for 'issue_description' %> - -<% content_for :header_tags do %> - <%= javascript_include_tag 'calendar/calendar' %> - <%= javascript_include_tag "calendar/lang/calendar-#{current_language}.js" %> - <%= javascript_include_tag 'calendar/calendar-setup' %> - <%= stylesheet_link_tag 'calendar' %> -<% end %> diff --git a/app/views/issues/bulk_edit.rhtml b/app/views/issues/bulk_edit.rhtml index 31ed7ee56..86bc76765 100644 --- a/app/views/issues/bulk_edit.rhtml +++ b/app/views/issues/bulk_edit.rhtml @@ -47,10 +47,3 @@ <p><%= submit_tag l(:button_submit) %> <% end %> - -<% content_for :header_tags do %> - <%= javascript_include_tag 'calendar/calendar' %> - <%= javascript_include_tag "calendar/lang/calendar-#{current_language}.js" %> - <%= javascript_include_tag 'calendar/calendar-setup' %> - <%= stylesheet_link_tag 'calendar' %> -<% end %> diff --git a/app/views/projects/_form.rhtml b/app/views/projects/_form.rhtml index a810369d4..32e4dcd44 100644 --- a/app/views/projects/_form.rhtml +++ b/app/views/projects/_form.rhtml @@ -46,11 +46,3 @@ </fieldset> <% end %> <!--[eoform:project]--> - - -<% content_for :header_tags do %> -<%= javascript_include_tag 'calendar/calendar' %> -<%= javascript_include_tag "calendar/lang/calendar-#{current_language}.js" %> -<%= javascript_include_tag 'calendar/calendar-setup' %> -<%= stylesheet_link_tag 'calendar' %> -<% end %> diff --git a/app/views/timelog/details.rhtml b/app/views/timelog/details.rhtml index cba1597d1..89793745e 100644 --- a/app/views/timelog/details.rhtml +++ b/app/views/timelog/details.rhtml @@ -44,10 +44,3 @@ <span><%= link_to 'CSV', params.merge(:format => 'csv'), :class => 'csv' %></span>
</p>
<% end %>
-
-<% content_for :header_tags do %>
- <%= javascript_include_tag 'calendar/calendar' %>
- <%= javascript_include_tag "calendar/lang/calendar-#{current_language}.js" %>
- <%= javascript_include_tag 'calendar/calendar-setup' %>
- <%= stylesheet_link_tag 'calendar' %>
-<% end %>
diff --git a/app/views/timelog/edit.rhtml b/app/views/timelog/edit.rhtml index 13d76f1ef..e221038a0 100644 --- a/app/views/timelog/edit.rhtml +++ b/app/views/timelog/edit.rhtml @@ -14,10 +14,3 @@ <%= submit_tag l(:button_save) %>
<% end %>
-
-<% content_for :header_tags do %>
-<%= javascript_include_tag 'calendar/calendar' %>
-<%= javascript_include_tag "calendar/lang/calendar-#{current_language}.js" %>
-<%= javascript_include_tag 'calendar/calendar-setup' %>
-<%= stylesheet_link_tag 'calendar' %>
-<% end %>
\ No newline at end of file diff --git a/app/views/timelog/report.rhtml b/app/views/timelog/report.rhtml index 8fc15a3b4..2682a5cb0 100644 --- a/app/views/timelog/report.rhtml +++ b/app/views/timelog/report.rhtml @@ -63,10 +63,3 @@ <% end %> <% end %> <% end %> - -<% content_for :header_tags do %> -<%= javascript_include_tag 'calendar/calendar' %> -<%= javascript_include_tag "calendar/lang/calendar-#{current_language}.js" %> -<%= javascript_include_tag 'calendar/calendar-setup' %> -<%= stylesheet_link_tag 'calendar' %> -<% end %> diff --git a/app/views/users/_form.rhtml b/app/views/users/_form.rhtml index d32399c60..ff4278c1f 100644 --- a/app/views/users/_form.rhtml +++ b/app/views/users/_form.rhtml @@ -30,10 +30,3 @@ </div> </div> <!--[eoform:user]--> - -<% content_for :header_tags do %> -<%= javascript_include_tag 'calendar/calendar' %> -<%= javascript_include_tag "calendar/lang/calendar-#{current_language}.js" %> -<%= javascript_include_tag 'calendar/calendar-setup' %> -<%= stylesheet_link_tag 'calendar' %> -<% end %>
\ No newline at end of file diff --git a/app/views/versions/_form.rhtml b/app/views/versions/_form.rhtml index e18f912bf..adc83b573 100644 --- a/app/views/versions/_form.rhtml +++ b/app/views/versions/_form.rhtml @@ -6,10 +6,3 @@ <p><%= f.text_field :wiki_page_title, :label => :label_wiki_page, :size => 60, :disabled => @project.wiki.nil? %></p> <p><%= f.text_field :effective_date, :size => 10 %><%= calendar_for('version_effective_date') %></p> </div> - -<% content_for :header_tags do %> -<%= javascript_include_tag 'calendar/calendar' %> -<%= javascript_include_tag "calendar/lang/calendar-#{current_language}.js" %> -<%= javascript_include_tag 'calendar/calendar-setup' %> -<%= stylesheet_link_tag 'calendar' %> -<% end %> |