|
|
|
@ -1326,33 +1326,58 @@ module ApplicationHelper
|
|
|
|
|
javascript_tag "contextMenuInit('#{ url_for(url) }')"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def calendar_for(field_id)
|
|
|
|
|
include_calendar_headers_tags
|
|
|
|
|
def calendar_for(field_id,start_day=nil)
|
|
|
|
|
include_calendar_headers_tags(start_day)
|
|
|
|
|
javascript_tag("$(function() { $('##{field_id}').datepicker(datepickerOptions); });")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def include_calendar_headers_tags
|
|
|
|
|
unless @calendar_headers_tags_included
|
|
|
|
|
@calendar_headers_tags_included = true
|
|
|
|
|
content_for :header_tags do
|
|
|
|
|
start_of_week = Setting.start_of_week
|
|
|
|
|
start_of_week = l(:general_first_day_of_week, :default => '1') if start_of_week.blank?
|
|
|
|
|
# Redmine uses 1..7 (monday..sunday) in settings and locales
|
|
|
|
|
# JQuery uses 0..6 (sunday..saturday), 7 needs to be changed to 0
|
|
|
|
|
start_of_week = start_of_week.to_i % 7
|
|
|
|
|
|
|
|
|
|
tags = javascript_tag(
|
|
|
|
|
"var datepickerOptions={dateFormat: 'yy-mm-dd',minDate: new Date(), firstDay: #{start_of_week}, " +
|
|
|
|
|
"showOn: 'button', buttonImageOnly: true, buttonImage: '" +
|
|
|
|
|
path_to_image('/images/calendar.png') +
|
|
|
|
|
"', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true, onClose: function(dateText, inst) {TimeClose(dateText,inst);}, beforeShow : function(input){TimeBeforeShow(input);} };")
|
|
|
|
|
jquery_locale = l('jquery.locale', :default => current_language.to_s)
|
|
|
|
|
unless jquery_locale == 'en'
|
|
|
|
|
tags << javascript_include_tag("i18n/jquery.ui.datepicker-#{jquery_locale}.js")
|
|
|
|
|
def include_calendar_headers_tags(start_day=nil)
|
|
|
|
|
if start_day.nil?
|
|
|
|
|
unless @calendar_headers_tags_included
|
|
|
|
|
@calendar_headers_tags_included = true
|
|
|
|
|
content_for :header_tags do
|
|
|
|
|
start_of_week = Setting.start_of_week
|
|
|
|
|
start_of_week = l(:general_first_day_of_week, :default => '1') if start_of_week.blank?
|
|
|
|
|
# Redmine uses 1..7 (monday..sunday) in settings and locales
|
|
|
|
|
# JQuery uses 0..6 (sunday..saturday), 7 needs to be changed to 0
|
|
|
|
|
start_of_week = start_of_week.to_i % 7
|
|
|
|
|
|
|
|
|
|
tags = javascript_tag(
|
|
|
|
|
"var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: #{start_of_week}, " +
|
|
|
|
|
"showOn: 'button', buttonImageOnly: true, buttonImage: '" +
|
|
|
|
|
path_to_image('/images/calendar.png') +
|
|
|
|
|
"', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true};")
|
|
|
|
|
jquery_locale = l('jquery.locale', :default => current_language.to_s)
|
|
|
|
|
unless jquery_locale == 'en'
|
|
|
|
|
tags << javascript_include_tag("i18n/jquery.ui.datepicker-#{jquery_locale}.js")
|
|
|
|
|
end
|
|
|
|
|
tags
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
unless @calendar_headers_tags_included
|
|
|
|
|
@calendar_headers_tags_included = true
|
|
|
|
|
content_for :header_tags do
|
|
|
|
|
start_of_week = Setting.start_of_week
|
|
|
|
|
start_of_week = l(:general_first_day_of_week, :default => '1') if start_of_week.blank?
|
|
|
|
|
# Redmine uses 1..7 (monday..sunday) in settings and locales
|
|
|
|
|
# JQuery uses 0..6 (sunday..saturday), 7 needs to be changed to 0
|
|
|
|
|
start_of_week = start_of_week.to_i % 7
|
|
|
|
|
|
|
|
|
|
tags = javascript_tag(
|
|
|
|
|
"var datepickerOptions={dateFormat: 'yy-mm-dd',minDate: new Date(), firstDay: #{start_of_week}, " +
|
|
|
|
|
"showOn: 'button', buttonImageOnly: true, buttonImage: '" +
|
|
|
|
|
path_to_image('/images/calendar.png') +
|
|
|
|
|
"', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true, onClose: function(dateText, inst) {TimeClose(dateText,inst);}, beforeShow : function(input){TimeBeforeShow(input);} };")
|
|
|
|
|
jquery_locale = l('jquery.locale', :default => current_language.to_s)
|
|
|
|
|
unless jquery_locale == 'en'
|
|
|
|
|
tags << javascript_include_tag("i18n/jquery.ui.datepicker-#{jquery_locale}.js")
|
|
|
|
|
end
|
|
|
|
|
tags
|
|
|
|
|
end
|
|
|
|
|
tags
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# Overrides Rails' stylesheet_link_tag with themes and plugins support.
|
|
|
|
|