Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Swap calendar_date_select with jQuery's datepicker.

  • Loading branch information...
commit d7cf909f33498118163b4cc724236a23753d9dc8 1 parent 90d23a6
Steve Kenworthy steveyken authored
Showing with 2,504 additions and 1,954 deletions.
  1. +2 −1  app/assets/javascripts/application.js.erb
  2. +0 −26 app/assets/javascripts/crm.js
  3. +21 −0 app/assets/javascripts/datepicker.js.coffee
  4. +5 −1 app/controllers/application_controller.rb
  5. +0 −9 app/helpers/application_helper.rb
  6. +3 −12 app/models/polymorphic/task.rb
  7. +2 −2 app/views/campaigns/_top_section.html.haml
  8. +0 −2  app/views/campaigns/create.js.rjs
  9. +0 −2  app/views/campaigns/edit.js.rjs
  10. +0 −2  app/views/campaigns/new.js.rjs
  11. +0 −2  app/views/campaigns/update.js.rjs
  12. +3 −8 app/views/layouts/application.html.haml
  13. +1 −1  app/views/opportunities/_top_section.html.haml
  14. +0 −1  app/views/tasks/_pending.html.haml
  15. +3 −2 app/views/tasks/_top_section.html.haml
  16. +1 −3 config/environments/production.rb
  17. +0 −10 config/locales/cz_fat_free_crm.yml
  18. +0 −6 config/locales/de_fat_free_crm.yml
  19. +0 −10 config/locales/en-GB_fat_free_crm.yml
  20. +0 −10 config/locales/en-US_fat_free_crm.yml
  21. +0 −6 config/locales/es_fat_free_crm.yml
  22. +0 −6 config/locales/fr-CA_fat_free_crm.yml
  23. +0 −11 config/locales/fr_fat_free_crm.yml
  24. +0 −11 config/locales/it_fat_free_crm.yml
  25. +0 −10 config/locales/ja_fat_free_crm.yml
  26. +0 −6 config/locales/pl_fat_free_crm.yml
  27. +0 −6 config/locales/pt-BR_fat_free_crm.yml
  28. +0 −9 config/locales/ru_fat_free_crm.yml
  29. +0 −10 config/locales/sv-SE_fat_free_crm.yml
  30. +0 −6 config/locales/th_fat_free_crm.yml
  31. +0 −10 config/locales/zh-CN_fat_free_crm.yml
  32. +0 −2  public/blank_iframe.html
  33. +14 −102 spec/models/polymorphic/task_spec.rb
  34. +0 −446 vendor/assets/javascripts/calendar_date_select/calendar_date_select.js
  35. +0 −35 vendor/assets/javascripts/calendar_date_select/format_american.js
  36. +0 −31 vendor/assets/javascripts/calendar_date_select/format_danish.js
  37. +0 −27 vendor/assets/javascripts/calendar_date_select/format_db.js
  38. +0 −7 vendor/assets/javascripts/calendar_date_select/format_euro_24hr.js
  39. +0 −7 vendor/assets/javascripts/calendar_date_select/format_euro_24hr_ymd.js
  40. +0 −32 vendor/assets/javascripts/calendar_date_select/format_finnish.js
  41. +0 −24 vendor/assets/javascripts/calendar_date_select/format_french.js
  42. +0 −37 vendor/assets/javascripts/calendar_date_select/format_hyphen_ampm.js
  43. +0 −29 vendor/assets/javascripts/calendar_date_select/format_iso_date.js
  44. +0 −24 vendor/assets/javascripts/calendar_date_select/format_italian.js
  45. +0 −10 vendor/assets/javascripts/calendar_date_select/locale/ar.js
  46. +0 −11 vendor/assets/javascripts/calendar_date_select/locale/da.js
  47. +0 −11 vendor/assets/javascripts/calendar_date_select/locale/de.js
  48. +0 −11 vendor/assets/javascripts/calendar_date_select/locale/es.js
  49. +0 −10 vendor/assets/javascripts/calendar_date_select/locale/fi.js
  50. +0 −11 vendor/assets/javascripts/calendar_date_select/locale/fr.js
  51. +0 −9 vendor/assets/javascripts/calendar_date_select/locale/it.js
  52. +0 −11 vendor/assets/javascripts/calendar_date_select/locale/ja.js
  53. +0 −11 vendor/assets/javascripts/calendar_date_select/locale/nl.js
  54. +0 −11 vendor/assets/javascripts/calendar_date_select/locale/pl.js
  55. +0 −11 vendor/assets/javascripts/calendar_date_select/locale/pt.js
  56. +0 −10 vendor/assets/javascripts/calendar_date_select/locale/ru.js
  57. +0 −11 vendor/assets/javascripts/calendar_date_select/locale/sl.js
  58. +0 −9 vendor/assets/javascripts/calendar_date_select/locale/sv.js
  59. +1,530 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-addon.js
  60. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-af.js
  61. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-ca.js
  62. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-cz.js
  63. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-de.js
  64. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-el.js
  65. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-es.js
  66. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-et.js
  67. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-fi.js
  68. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-fr-CA.js
  69. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-fr.js
  70. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-gl.js
  71. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-he.js
  72. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-hu.js
  73. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-id.js
  74. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-it.js
  75. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-ja.js
  76. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-ko.js
  77. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-lt.js
  78. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-nl.js
  79. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-no.js
  80. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-pl.js
  81. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-pt-BR.js
  82. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-pt.js
  83. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-ro.js
  84. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-ru.js
  85. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-sk.js
  86. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-sv.js
  87. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-tr.js
  88. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-vi.js
  89. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-zh-CN.js
  90. +20 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-zh-TW.js
  91. +23 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery.ui.datepicker-cz.js
  92. +23 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery.ui.datepicker-de.js
  93. +23 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery.ui.datepicker-en-GB.js
  94. +23 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery.ui.datepicker-es.js
  95. +23 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery.ui.datepicker-fr.js
  96. +23 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery.ui.datepicker-it.js
  97. +23 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery.ui.datepicker-ja.js
  98. +23 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery.ui.datepicker-pl.js
  99. +23 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery.ui.datepicker-pt-BR.js
  100. +23 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery.ui.datepicker-ru.js
  101. +23 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery.ui.datepicker-sv-SE.js
  102. +23 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery.ui.datepicker-th.js
  103. +23 −0 vendor/assets/javascripts/jquery_ui_datepicker/jquery.ui.datepicker-zh-CN.js
  104. +0 −130 vendor/assets/stylesheets/calendar_date_select/blue.css
  105. +0 −135 vendor/assets/stylesheets/calendar_date_select/default.css
  106. +0 −142 vendor/assets/stylesheets/calendar_date_select/green.css
  107. +0 −128 vendor/assets/stylesheets/calendar_date_select/plain.css
  108. +0 −135 vendor/assets/stylesheets/calendar_date_select/red.css
  109. +0 −133 vendor/assets/stylesheets/calendar_date_select/silver.css
3  app/assets/javascripts/application.js.erb
View
@@ -30,13 +30,14 @@
//= require crm_fields
//= require textarea_autocomplete
//= require crm_textarea_autocomplete
-//= require calendar_date_select/calendar_date_select
//= require event.simulate
//= require ajax-chosen-prototype
//= require crm_chosen
//= require search
//= require lists
//= require autocomplete-rails
+//= require datepicker
+//= require jquery_ui_datepicker/jquery-ui-timepicker-addon
//= require_self
<%
26 app/assets/javascripts/crm.js
View
@@ -24,32 +24,6 @@ var crm = {
base_url : "",
//----------------------------------------------------------------------------
- date_select_popup: function(id, dropdown_id, show_time) {
- $(id).observe("focus", function() {
- if (!$(id).calendar_was_shown) { // The field recieved initial focus, show the calendar.
- var calendar = new CalendarDateSelect(this, { month_year: "label", year_range: 10, time: show_time, before_close: function() { this.calendar_was_shown = true } });
- if (dropdown_id) {
- calendar.buttons_div.build("span", { innerHTML: " | ", className: "button_seperator" });
- calendar.buttons_div.build("a", { innerHTML: "Back to List", href: "#", onclick: function() {
- calendar.close(); // Hide calendar popup.
- $(id).hide(); // Hide date edit field.
- $(dropdown_id).show(); // Show dropdown.
- $(dropdown_id).selectedIndex = 0; // Select first dopdown item.
- $(id).update(""); // Reset date field value.
- return false;
- }.bindAsEventListener(this) });
- }
- } else {
- $(id).calendar_was_shown = null; // Focus is back from the closed calendar, make it show up again.
- }
- });
-
- $(id).observe("blur", function() {
- $(id).calendar_was_shown = null; // Get the calendar ready if we loose focus.
- });
- },
-
- //----------------------------------------------------------------------------
find_form: function(class_name) {
var forms = $$('form.' + class_name);
return (forms.length > 0 ? forms[0].id : null);
21 app/assets/javascripts/datepicker.js.coffee
View
@@ -0,0 +1,21 @@
+(($) ->
+
+ $('.datepicker').live 'click focus', ->
+ $(this).datepicker({
+ showOn: 'focus',
+ changeMonth: true,
+ dateFormat: $(this).data('datepicker-format') || 'yy-mm-dd'})
+
+ $('.datetimepicker').live 'click focus', ->
+ $(this).datetimepicker({
+ showOn: 'focus',
+ changeMonth: true,
+ dateFormat: $(this).data('datetimepicker-format') || 'yy-mm-dd'})
+
+ $('.timepicker').live 'click focus', ->
+ $(this).timepicker({
+ showOn: 'focus',
+ changeMonth: true,
+ dateFormat: $(this).data('timepicker-format') || 'HH:MM'})
+
+) jQuery
6 app/controllers/application_controller.rb
View
@@ -66,7 +66,11 @@ def clear_setting_cache
#----------------------------------------------------------------------------
def set_context
Time.zone = ActiveSupport::TimeZone[session[:timezone_offset]] if session[:timezone_offset]
- I18n.locale = Setting.locale if Setting.locale
+ if (locale = current_user.preference[:locale]).present?
+ I18n.locale = locale
+ elsif Setting.locale.present?
+ I18n.locale = Setting.locale
+ end
end
#----------------------------------------------------------------------------
9 app/helpers/application_helper.rb
View
@@ -299,15 +299,6 @@ def get_browser_timezone_offset
end
end
- #----------------------------------------------------------------------------
- def localize_calendar_date_select
- update_page_tag do |page|
- page.assign '_translations', { 'OK' => t('calendar_date_select.ok'), 'Now' => t('calendar_date_select.now'), 'Today' => t('calendar_date_select.today'), 'Clear' => t('calendar_date_select.clear') }
- page.assign 'Date.weekdays', t('date.abbr_day_names')
- page.assign 'Date.months', t('date.month_names')[1..-1]
- end
- end
-
# Users can upload their avatar, and if it's missing we're going to use
# gravatar. For leads and contacts we always use gravatars.
#----------------------------------------------------------------------------
15 app/models/polymorphic/task.rb
View
@@ -247,17 +247,8 @@ def specific_time
#----------------------------------------------------------------------------
def parse_calendar_date
- translate_month_and_day_names!(self.calendar) unless I18n.locale == :"en-US"
-
- DateTime.strptime(self.calendar,
- I18n.t(Setting.task_calendar_with_time ? 'time.formats.mmddyyyy_hhmm' : 'date.formats.mmddyyyy')).utc
- end
-
- # Translates month and day names of a given datetime string.
- #----------------------------------------------------------------------------
- def translate_month_and_day_names!(date_string)
- translated = I18n.t([:month_names, :abbr_month_names, :day_names, :abbr_day_names], :scope => :date).flatten.compact
- original = (Date::MONTHNAMES + Date::ABBR_MONTHNAMES + Date::DAYNAMES + Date::ABBR_DAYNAMES).compact
- translated.each_with_index { |name, i| date_string.gsub!(name, original[i]) }
+ # always in 2012-10-28 06:28 format regardless of language
+ Time.parse(self.calendar)
end
+
end
4 app/views/campaigns/_top_section.html.haml
View
@@ -8,11 +8,11 @@
%tr
%td
.label #{t :start_date}:
- = f.text_field :starts_on, :value => f.object.starts_on ? l(f.object.starts_on, :format => :mmddyyyy) : "", :style => "width:110px", :autocomplete => :off
+ = f.text_field :starts_on, :value => f.object.starts_on, :style => "width:110px", :autocomplete => :off, :class => 'datepicker'
%td= spacer
%td
.label #{t :end_date}:
- = f.text_field :ends_on, :value => f.object.ends_on ? l(f.object.ends_on, :format => :mmddyyyy) : "", :style => "width:110px", :autocomplete => :off
+ = f.text_field :ends_on, :value => f.object.ends_on, :style => "width:110px", :autocomplete => :off, :class => 'datepicker'
%td= spacer
%td
.label #{t :status}:
2  app/views/campaigns/create.js.rjs
View
@@ -10,8 +10,6 @@ if @campaign.valid?
else
page[:create_campaign].replace_html :partial => "new"
page.call "crm.init_chosen_fields"
- page.call "crm.date_select_popup", :campaign_starts_on
- page.call "crm.date_select_popup", :campaign_ends_on
page[:create_campaign].visual_effect :shake, :duration => 0.25, :distance => 6
if @campaign.errors[:name].blank? and @campaign.errors[:ends_on].present?
page[:campaign_ends_on].focus
2  app/views/campaigns/edit.js.rjs
View
@@ -31,8 +31,6 @@ else # <---------------------------------------- Show [Edit Campaign] form.
page.call "crm.set_title", :edit_campaign, "#{t :edit} #{@campaign.name}"
end
- page.call "crm.date_select_popup", :campaign_starts_on
- page.call "crm.date_select_popup", :campaign_ends_on
page[:campaign_name].focus
end
2  app/views/campaigns/new.js.rjs
View
@@ -6,8 +6,6 @@ unless params[:cancel].true?
page[:create_campaign].replace_html :partial => "new"
page.call "crm.init_chosen_fields"
page.call "crm.set_title", :create_campaign, t(:create_campaign)
- page.call "crm.date_select_popup", :campaign_starts_on
- page.call "crm.date_select_popup", :campaign_ends_on
else
page.call "crm.set_title", :create_campaign, t(:campaigns)
end
2  app/views/campaigns/update.js.rjs
View
@@ -12,8 +12,6 @@ if @campaign.errors.empty?
end
else
page[id].replace_html :partial => "edit"
- page.call "crm.date_select_popup", :campaign_starts_on
- page.call "crm.date_select_popup", :campaign_ends_on
page[id].visual_effect :shake, :duration => 0.25, :distance => 6
if @campaign.errors[:name].blank? and @campaign.errors[:ends_on].present?
page[:campaign_ends_on].focus
11 app/views/layouts/application.html.haml
View
@@ -6,14 +6,13 @@
== <!-- #{controller.controller_name} : #{controller.action_name} -->
= stylesheet_link_tag :application
= stylesheet_link_tag :print, :media => 'print'
- - unless tabless_layout?
- = stylesheet_link_tag 'calendar_date_select/default'
%style= yield :styles
= javascript_include_tag :application
- - unless tabless_layout?
- = javascript_include_tag "calendar_date_select/format_#{t(:calendar_date_select_format, :default => 'american')}"
+ - unless tabless_layout? || %w(en-US en-GB).include?(I18n.locale.to_s)
+ = javascript_include_tag "jquery_ui_datepicker/jquery.ui.datepicker-#{I18n.locale}"
+ = javascript_include_tag "jquery_ui_datepicker/jquery-ui-timepicker-#{I18n.locale}"
= csrf_meta_tag
= hook(:javascript_includes, self)
@@ -35,12 +34,8 @@
= render "layouts/tabbed"
= render "layouts/footer"
- - unless tabless_layout? || I18n.locale == "en-US"
- = localize_calendar_date_select
-
%script{:type => "text/javascript"}
= "crm.base_url = '#{Setting.base_url}';" unless Setting.base_url.blank?
= get_browser_timezone_offset
= content_for :javascript_epilogue
= hook(:javascript_epilogue, self)
-
2  app/views/opportunities/_top_section.html.haml
View
@@ -14,7 +14,7 @@
%tr
%td
.label #{t :close_date}:
- = f.text_field :closes_on, :value => f.object.closes_on ? l(f.object.closes_on, :format => :mmddyyyy) : "", :style => "width:110px;", :autocomplete => :off
+ = f.text_field :closes_on, :value => f.object.closes_on, :style => "width:110px;", :autocomplete => :off, :class => 'datepicker'
%td= spacer
%td
.label #{t :probability} (%):
1  app/views/tasks/_pending.html.haml
View
@@ -49,4 +49,3 @@
- unless pending.background_info.blank?
%div
%dt= h(pending.background_info)
-
5 app/views/tasks/_top_section.html.haml
View
@@ -10,10 +10,11 @@
- bucket = (params[:bucket].blank? ? @task.bucket : params[:bucket]) || "due_asap"
- if @task.bucket != "specific_time"
= f.select :bucket, @bucket, { :selected => bucket.to_sym }, { :style => "width:160px;", :onchange => "crm.flip_calendar(this.value)" }
- = f.text_field :calendar, :style => "width:160px; display:none;", :autocomplete => :off
+ = f.text_field :calendar, :style => "width:160px; display:none;", :autocomplete => :off, :class => 'datetimepicker'
- else
= f.select :bucket, @bucket, { :selected => :specific_time }, { :style => "width:160px; display:none;", :onchange => "crm.flip_calendar(this.value)" }
- = f.text_field :calendar, :value => (Setting.task_calendar_with_time ? l(f.object.due_at.localtime, :format => :mmddyyyy_hhmm) : l(f.object.due_at.to_date, :format => :mmddyyyy)), :style => "width:160px;", :autocomplete => :off
+ - fmt = Setting.task_calendar_with_time ? '%Y-%m-%d %H:%M' : '%Y-%m-%d'
+ = f.text_field :calendar, :value => f.object.due_at.strftime(fmt), :style => "width:160px;", :autocomplete => :off, :class => 'datetimepicker'
%td= spacer
%td
.label.req #{t :assign_to}:
4 config/environments/production.rb
View
@@ -46,9 +46,7 @@
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
# config.assets.precompile += %w( search.js )
- config.assets.precompile += ['print.css',
- 'calendar_date_select/default.css',
- /calendar_date_select\/[^\/]*\.js/]
+ config.assets.precompile += ['print.css']
# Enable threaded mode
# config.threadsafe!
10 config/locales/cz_fat_free_crm.yml
View
@@ -663,16 +663,6 @@ cz:
mmddhhss: "%e %b v %H:%M"
mmddyyyy_hhmm: "%Y-%m-%d %H:%M"
- calendar_date_select:
- ok: OK
- now: Nyní
- today: Dnes
- clear: Smazat
-
- # If you need custom format look at
- # http://code.google.com/p/calendardateselect/wiki/ChangingDateFormatCustom
- calendar_date_select_format: iso_date
-
# will_paginate translations copied for 'en-US'
#----------------------------------------------------------------------------
will_paginate:
6 config/locales/de_fat_free_crm.yml
View
@@ -304,11 +304,6 @@ de:
completed: "Erledigt"
rejected: "Abgelehnt"
msg_password_changed: "Ihr Passwort wurde geändert."
- calendar_date_select:
- clear: "Zurücksetzen"
- now: "Jetzt"
- ok: "OK"
- today: "Heute"
pluralize:
comment:
other: "%{count} Kommentare"
@@ -608,7 +603,6 @@ de:
lead_permissions_intro_private: "Standardmäßig werden die Zugriffsregeln aus der Kampagne kopiert oder auf privat gesetzt. Dies kann auch später durchgeführt werden."
remember_me: "Erinnere mich"
edit_comment: "Kommentar bearbeiten"
- calendar_date_select_format: "euro_24hr"
no_tasks_pending: "wartend"
lead_summary: "Anfrage-Zusammenfassung"
task_small: "Aufgabe"
10 config/locales/en-GB_fat_free_crm.yml
View
@@ -740,16 +740,6 @@ en-GB:
mmddhhss: "%e %b at %l:%M%p"
mmddyyyy_hhmm: "%Y-%m-%d %H:%M"
- calendar_date_select:
- ok: OK
- now: Now
- today: Today
- clear: Clear
-
- # If you need custom format look at
- # http://code.google.com/p/calendardateselect/wiki/ChangingDateFormatCustom
- calendar_date_select_format: iso_date
-
# will_paginate translations copied from 'en-US'
#----------------------------------------------------------------------------
will_paginate:
10 config/locales/en-US_fat_free_crm.yml
View
@@ -756,16 +756,6 @@ en-US:
mmddhhss: "%b %e at %l:%M%p"
mmddyyyy_hhmm: "%m/%d/%Y %l:%M %p"
- calendar_date_select:
- ok: OK
- now: Now
- today: Today
- clear: Clear
-
- # If you need custom format look at
- # http://code.google.com/p/calendardateselect/wiki/ChangingDateFormatCustom
- calendar_date_select_format: american
-
# will_paginate translations copied for 'en-US'
#----------------------------------------------------------------------------
will_paginate:
6 config/locales/es_fat_free_crm.yml
View
@@ -634,9 +634,3 @@
time:
formats:
mmddhhss: "%b %e at %l:%M%p"
-
- calendar_date_select:
- ok: Cancelar
- now: Ahora
- today: Hoy
- clear: Limpiar
6 config/locales/fr-CA_fat_free_crm.yml
View
@@ -627,9 +627,3 @@ fr-CA:
time:
formats:
mmddhhss: "%e %b à %l:%M%p"
-
- calendar_date_select:
- ok: OK
- now: Maintenant
- today: "Aujourd'hui"
- clear: Vider
11 config/locales/fr_fat_free_crm.yml
View
@@ -718,16 +718,6 @@ fr:
mmddhhss: "%b %e à %H:%M%"
mmddyyyy_hhmm: "%d/%m/%Y à %H:%M"
- calendar_date_select:
- ok: OK
- now: Maintenant
- today: "Aujourd'hui"
- clear: Vider
-
- # If you need custom format look at
- # http://code.google.com/p/calendardateselect/wiki/ChangingDateFormatCustom
- calendar_date_select_format: french
-
# will_paginate translations copied for 'fr'
#----------------------------------------------------------------------------
will_paginate:
@@ -845,4 +835,3 @@ fr:
one: "Impossible d'enregistrer ce %{model} : 1 erreur"
other: "Impossible d'enregistrer ce %{model} : %{count} erreurs"
body: "Veuillez vérifier les champs suivants : "
-
11 config/locales/it_fat_free_crm.yml
View
@@ -652,14 +652,3 @@ it:
formats:
mmddhhss: "%b %e at %l:%M%p"
mmddyyyy_hhmm: "%d/%m/%Y %H:%M"
-
- calendar_date_select:
- ok: OK
- now: Ora
- today: Oggi
- clear: Pulisci
-
- # If you need custom format look at
- # http://code.google.com/p/calendardateselect/wiki/ChangingDateFormatCustom
- calendar_date_select_format: italian
-
10 config/locales/ja_fat_free_crm.yml
View
@@ -624,13 +624,3 @@ ja:
formats:
mmddhhss: "%b %e at %l:%M%p"
mmddyyyy_hhmm: "%m/%d/%Y %l:%M %p"
-
- calendar_date_select:
- ok: OK
- now: Now
- today: Today
- clear: Clear
-
- # If you need custom format look at
- # http://code.google.com/p/calendardateselect/wiki/ChangingDateFormatCustom
- calendar_date_select_format: american
6 config/locales/pl_fat_free_crm.yml
View
@@ -638,9 +638,3 @@ pl:
time:
formats:
mmddhhss: "%e %b o %H:%M"
-
- calendar_date_select:
- ok: OK
- now: Teraz
- today: Dziś
- clear: Wyczyść
6 config/locales/pt-BR_fat_free_crm.yml
View
@@ -631,9 +631,3 @@ pt-BR:
time:
formats:
mmddhhss: "%b %e at %l:%M%p"
-
- calendar_date_select:
- ok: OK
- now: Agora
- today: Hoje
- clear: Limpar
9 config/locales/ru_fat_free_crm.yml
View
@@ -650,12 +650,3 @@ ru:
time:
formats:
mmddhhss: "%d %B в %H:%M"
-
- calendar_date_select:
- ok: OK
- now: Сейчас
- today: Сегодня
- clear: Очистить
-
- # Default is Finnish (31.12.2009 17:00)
- calendar_date_select_format: finnish
10 config/locales/sv-SE_fat_free_crm.yml
View
@@ -626,13 +626,3 @@ sv-SE:
formats:
mmddhhss: "%b %e, kl %H:%M"
mmddyyyy_hhmm: "%m/%d/%Y %l:%M %p"
-
- calendar_date_select:
- ok: OK
- now: Nu
- today: Idag
- clear: Rensa
-
- # If you need custom format look at
- # http://code.google.com/p/calendardateselect/wiki/ChangingDateFormatCustom
- calendar_date_select_format: american
6 config/locales/th_fat_free_crm.yml
View
@@ -635,9 +635,3 @@ th:
time:
formats:
mmddhhss: "%b %e at %l:%M%p"
-
- calendar_date_select:
- ok: OK
- now: Now
- today: Today
- clear: Clear
10 config/locales/zh-CN_fat_free_crm.yml
View
@@ -619,13 +619,3 @@ zh-CN:
time:
formats:
mmddhhss: "%b %e at %l:%M%p"
-
- calendar_date_select:
- ok: OK
- now: 现在
- today: 今天
- clear: 清除
-
- # If you need custom format look at
- # http://code.google.com/p/calendardateselect/wiki/ChangingDateFormatCustom
- calendar_date_select_format: hyphen_ampm
2  public/blank_iframe.html
View
@@ -1,2 +0,0 @@
-<!-- Nothing here; part of the calendar_date_select plugin -->
-<html><head></head><body></body></html>
116 spec/models/polymorphic/task_spec.rb
View
@@ -47,10 +47,10 @@
end
it "should create a task with due date selected from the calendar within #{offset ? 'different' : 'current'} timezone" do
- task = FactoryGirl.create(:task, :bucket => "specific_time", :calendar => "5/5/2020 12:00 AM")
+ task = FactoryGirl.create(:task, :bucket => "specific_time", :calendar => "2020-03-20")
task.errors.should be_empty
task.bucket.should == "specific_time"
- task.due_at.should == DateTime.parse("2020-05-05")
+ task.due_at.to_i.should == Time.parse("2020-03-20").to_i
end
end
end
@@ -104,10 +104,10 @@
it "should update due date if specific calendar date selected within #{offset ? 'different' : 'current'} timezone" do
task = FactoryGirl.create(:task, :due_at => Time.now.midnight.tomorrow, :bucket => "due_tomorrow")
- task.update_attributes( { :bucket => "specific_time", :calendar => "05/05/2020 12:00 AM" } )
+ task.update_attributes( { :bucket => "specific_time", :calendar => "2020-03-20" } )
task.errors.should be_empty
task.bucket.should == "specific_time"
- task.due_at.should == DateTime.parse("2020-05-05")
+ task.due_at.to_i.should == Time.parse("2020-03-20").to_i
end
end
@@ -149,16 +149,12 @@
end
it "completion should preserve original due date" do
- due_at = 42.days.ago
- time_format = I18n.t(Setting.task_calendar_with_time ?
- 'time.formats.mmddyyyy_hhmm' :
- 'date.formats.mmddyyyy')
+ due_at = Time.now - 42.days
task = FactoryGirl.create(:task, :due_at => due_at, :bucket => "specific_time",
- :calendar => due_at.strftime(time_format))
+ :calendar => due_at.strftime('%Y-%m-%d %H:%M'))
task.update_attributes(:completed_at => Time.now, :completed_by => @current_user.id, :calendar => '')
task.completed?.should == true
- parsed_time = DateTime.strptime(due_at.strftime(time_format), time_format).utc
- task.due_at.to_i.should == parsed_time.to_i
+ task.due_at.should == due_at.utc.strftime('%Y-%m-%d %H:%M')
end
end
@@ -262,96 +258,13 @@
end
describe "#parse_calendar_date" do
- before :each do
- I18n.locale = "de"
- @task = Task.new
- @task.bucket = "specific_time"
- @backup_with_time = Setting.task_calendar_with_time
- end
-
- after :each do
- I18n.locale = "en-Us"
- Setting.task_calendar_with_time = @backup_with_time
- end
-
- context "german" do
- context "date" do
- before :each do
- Setting.task_calendar_with_time = false
- end
-
- it "should translate: \"20 Jänner 2012\" to \"20 January 2012\"" do
- @task.calendar = "20 Jänner 2012"
- @task.send(:parse_calendar_date).should == "20 January 2012"
- end
-
- it "should translate: \"20 Februar 2012\" to \"20 February 2012\"" do
- @task.calendar = "20 Februar 2012"
- @task.send(:parse_calendar_date).should == "20 February 2012"
- end
-
- it "should translate: \"20 März 2012\" to \"20 March 2012\"" do
- @task.calendar = "20 März 2012"
- @task.send(:parse_calendar_date).should == "20 March 2012"
- end
-
- it "should translate: \"20 April 2012\" to \"20 April 2012\"" do
- @task.calendar = "20 April 2012"
- @task.send(:parse_calendar_date).should == "20 April 2012"
- end
-
- it "should translate: \"20 Mai 2012\" to \"20 May 2012\"" do
- @task.calendar = "20 Mai 2012"
- @task.send(:parse_calendar_date).should == "20 May 2012"
- end
-
- it "should translate: \"20 Juni 2012\" to \"20 June 2012\"" do
- @task.calendar = "20 Juni 2012"
- @task.send(:parse_calendar_date).should == "20 June 2012"
- end
-
- it "should translate: \"20 Juli 2012\" to \"20 July 2012\"" do
- @task.calendar = "20 Juli 2012"
- @task.send(:parse_calendar_date).should == "20 July 2012"
- end
- it "should translate: \"20 August 2012\" to \"20 August 2012\"" do
- @task.calendar = "20 August 2012"
- @task.send(:parse_calendar_date).should == "20 August 2012"
- end
-
- it "should translate: \"20 September 2012\" to \"20 September 2012\"" do
- @task.calendar = "20 September 2012"
- @task.send(:parse_calendar_date).should == "20 September 2012"
- end
-
- it "should translate: \"20 Oktober 2012\" to \"20 October 2012\"" do
- @task.calendar = "20 Oktober 2012"
- @task.send(:parse_calendar_date).should == "20 October 2012"
- end
-
- it "should translate: \"20 November 2012\" to \"20 November 2012\"" do
- @task.calendar = "20 November 2012"
- @task.send(:parse_calendar_date).should == "20 November 2012"
- end
-
- it "should translate: \"20 Dezember 2012\" to \"20 December 2012\"" do
- @task.calendar = "20 Dezember 2012"
- @task.send(:parse_calendar_date).should == "20 December 2012"
- end
- end
-
- context 'datetime' do
- before :each do
- Setting.task_calendar_with_time = true
- end
-
- it "should translate: \"20 Jänner 2012 12:27\" to \"20 January 2012 12:27\"" do
- @task.calendar = "20 Jänner 2012 12:27"
- @task.send(:parse_calendar_date).should == "20 January 2012 12:27"
- end
- end
+ it "should parse the date" do
+ @task = Task.new(:calendar => '2020-12-23')
+ Time.should_receive(:parse).with('2020-12-23')
+ @task.send(:parse_calendar_date)
end
+
end
describe "scopes" do
@@ -390,12 +303,11 @@
context "by_due_at" do
it "should show tasks ordered by due_at" do
t1 = FactoryGirl.create(:task, :name => 't1', :bucket => "due_asap")
- t2 = FactoryGirl.create(:task, :calendar => 5.days.from_now.strftime("%m/%d/%Y %I:%M %p"), :bucket => "specific_time")
+ t2 = FactoryGirl.create(:task, :calendar => 5.days.from_now.strftime("%Y-%m-%d %H:%M"), :bucket => "specific_time")
t3 = FactoryGirl.create(:task, :name => 't3', :bucket => "due_next_week")
- t4 = FactoryGirl.create(:task, :calendar => 20.days.from_now.strftime("%m/%d/%Y %I:%M %p"), :bucket => "specific_time")
+ t4 = FactoryGirl.create(:task, :calendar => 20.days.from_now.strftime("%Y-%m-%d %H:%M"), :bucket => "specific_time")
Task.by_due_at.should == [t1, t2, t3, t4]
end
end
end
end
-
446 vendor/assets/javascripts/calendar_date_select/calendar_date_select.js
View
@@ -1,446 +0,0 @@
-// CalendarDateSelect version 1.16.1 - a prototype based date picker
-// Questions, comments, bugs? - see the project page: http://code.google.com/p/calendardateselect
-if (typeof Prototype == 'undefined') alert("CalendarDateSelect Error: Prototype could not be found. Please make sure that your application's layout includes prototype.js (.g. <%= javascript_include_tag :defaults %>) *before* it includes calendar_date_select.js (.g. <%= calendar_date_select_includes %>).");
-if (Prototype.Version < "1.6") alert("Prototype 1.6.0 is required. If using earlier version of prototype, please use calendar_date_select version 1.8.3");
-
-Element.addMethods({
- purgeChildren: function(element) { $A(element.childNodes).each(function(e){$(e).remove();}); },
- build: function(element, type, options, style) {
- var newElement = Element.buildAndAppend(type, options, style);
- element.appendChild(newElement);
- return newElement;
- }
-});
-
-Element.buildAndAppend = function(type, options, style)
-{
- var e = $(document.createElement(type));
- $H(options).each(function(pair) { e[pair.key] = pair.value });
- if (style) e.setStyle(style);
- return e;
-};
-nil = null;
-
-Date.one_day = 24*60*60*1000;
-Date.weekdays = $w("S M T W T F S");
-Date.first_day_of_week = 0;
-Date.months = $w("January February March April May June July August September October November December" );
-Date.padded2 = function(hour) { var padded2 = parseInt(hour, 10); if (hour < 10) padded2 = "0" + padded2; return padded2; }
-Date.prototype.getPaddedMinutes = function() { return Date.padded2(this.getMinutes()); }
-Date.prototype.getAMPMHour = function() { var hour = this.getHours(); return (hour == 0) ? 12 : (hour > 12 ? hour - 12 : hour ) }
-Date.prototype.getAMPM = function() { return (this.getHours() < 12) ? "AM" : "PM"; }
-Date.prototype.stripTime = function() { return new Date(this.getFullYear(), this.getMonth(), this.getDate());};
-Date.prototype.daysDistance = function(compare_date) { return Math.round((compare_date - this) / Date.one_day); };
-Date.prototype.toFormattedString = function(include_time){
- var hour, str;
- str = Date.months[this.getMonth()] + " " + this.getDate() + ", " + this.getFullYear();
-
- if (include_time) { hour = this.getHours(); str += " " + this.getAMPMHour() + ":" + this.getPaddedMinutes() + " " + this.getAMPM() }
- return str;
-}
-Date.parseFormattedString = function(string) { return new Date(string);}
-Math.floor_to_interval = function(n, i) { return Math.floor(n/i) * i;}
-window.f_height = function() { return( [window.innerHeight ? window.innerHeight : null, document.documentElement ? document.documentElement.clientHeight : null, document.body ? document.body.clientHeight : null].select(function(x){return x>0}).first()||0); }
-window.f_scrollTop = function() { return ([window.pageYOffset ? window.pageYOffset : null, document.documentElement ? document.documentElement.scrollTop : null, document.body ? document.body.scrollTop : null].select(function(x){return x>0}).first()||0 ); }
-
-_translations = {
- "OK": "OK",
- "Now": "Now",
- "Today": "Today",
- "Clear": "Clear"
-}
-SelectBox = Class.create();
-SelectBox.prototype = {
- initialize: function(parent_element, values, html_options, style_options) {
- this.element = $(parent_element).build("select", html_options, style_options);
- this.populate(values);
- },
- populate: function(values) {
- this.element.purgeChildren();
- var that = this; $A(values).each(function(pair) { if (typeof(pair)!="object") {pair = [pair, pair]}; that.element.build("option", { value: pair[1], innerHTML: pair[0]}) });
- },
- setValue: function(value) {
- var e = this.element;
- var matched = false;
- $R(0, e.options.length - 1 ).each(function(i) { if(e.options[i].value==value.toString()) {e.selectedIndex = i; matched = true;}; } );
- return matched;
- },
- getValue: function() { return $F(this.element)}
-}
-CalendarDateSelect = Class.create();
-CalendarDateSelect.prototype = {
- initialize: function(target_element, options) {
- this.target_element = $(target_element); // make sure it's an element, not a string
- if (!this.target_element) { alert("Target element " + target_element + " not found!"); return false;}
- if (this.target_element.tagName != "INPUT") this.target_element = this.target_element.down("INPUT")
-
- this.target_element.calendar_date_select = this;
- this.last_click_at = 0;
- // initialize the date control
- this.options = $H({
- embedded: false,
- popup: nil,
- time: false,
- buttons: true,
- clear_button: true,
- year_range: 10,
- close_on_click: nil,
- minute_interval: 5,
- popup_by: this.target_element,
- month_year: "dropdowns",
- onchange: this.target_element.onchange,
- valid_date_check: nil
- }).merge(options || {});
- this.use_time = this.options.get("time");
- this.parseDate();
- this.callback("before_show")
- this.initCalendarDiv();
- if(!this.options.get("embedded")) {
- this.positionCalendarDiv()
- // set the click handler to check if a user has clicked away from the document
- Event.observe(document, "mousedown", this.closeIfClickedOut_handler = this.closeIfClickedOut.bindAsEventListener(this));
- Event.observe(document, "keypress", this.keyPress_handler = this.keyPress.bindAsEventListener(this));
- }
- this.callback("after_show")
- },
- positionCalendarDiv: function() {
- var above = false;
- var c_pos = this.calendar_div.cumulativeOffset(), c_left = c_pos[0], c_top = c_pos[1], c_dim = this.calendar_div.getDimensions(), c_height = c_dim.height, c_width = c_dim.width;
- var w_top = window.f_scrollTop(), w_height = window.f_height();
- var e_dim = $(this.options.get("popup_by")).cumulativeOffset(), e_top = e_dim[1], e_left = e_dim[0], e_height = $(this.options.get("popup_by")).getDimensions().height, e_bottom = e_top + e_height;
-
- if ( (( e_bottom + c_height ) > (w_top + w_height)) && ( e_bottom - c_height > w_top )) above = true;
- var left_px = e_left.toString() + "px", top_px = (above ? (e_top - c_height ) : ( e_top + e_height )).toString() + "px";
-
- this.calendar_div.style.left = left_px; this.calendar_div.style.top = top_px;
-
- this.calendar_div.setStyle({visibility:""});
-
- // draw an iframe behind the calendar -- ugly hack to make IE 6 happy
- if(navigator.appName=="Microsoft Internet Explorer") this.iframe = $(document.body).build("iframe", {src: "javascript:false", className: "ie6_blocker"}, { left: left_px, top: top_px, height: c_height.toString()+"px", width: c_width.toString()+"px", border: "0px"})
- },
- initCalendarDiv: function() {
- if (this.options.get("embedded")) {
- var parent = this.target_element.parentNode;
- var style = {}
- } else {
- var parent = document.body
- var style = { position:"absolute", visibility: "hidden", left:0, top:0 }
- }
- this.calendar_div = $(parent).build('div', {className: "calendar_date_select"}, style);
-
- var that = this;
- // create the divs
- $w("top header body buttons footer bottom").each(function(name) {
- eval("var " + name + "_div = that." + name + "_div = that.calendar_div.build('div', { className: 'cds_"+name+"' }, { clear: 'left'} ); ");
- });
-
- this.initHeaderDiv();
- this.initButtonsDiv();
- this.initCalendarGrid();
- this.updateFooter("&#160;");
-
- this.refresh();
- this.setUseTime(this.use_time);
- },
- initHeaderDiv: function() {
- var header_div = this.header_div;
- this.close_button = header_div.build("a", { innerHTML: "x", href:"#", onclick:function () { this.close(); return false; }.bindAsEventListener(this), className: "close" });
- this.next_month_button = header_div.build("a", { innerHTML: "&gt;", href:"#", onclick:function () { this.navMonth(this.date.getMonth() + 1 ); return false; }.bindAsEventListener(this), className: "next" });
- this.prev_month_button = header_div.build("a", { innerHTML: "&lt;", href:"#", onclick:function () { this.navMonth(this.date.getMonth() - 1 ); return false; }.bindAsEventListener(this), className: "prev" });
-
- if (this.options.get("month_year")=="dropdowns") {
- this.month_select = new SelectBox(header_div, $R(0,11).map(function(m){return [Date.months[m], m]}), {className: "month", onchange: function () { this.navMonth(this.month_select.getValue()) }.bindAsEventListener(this)});
- this.year_select = new SelectBox(header_div, [], {className: "year", onchange: function () { this.navYear(this.year_select.getValue()) }.bindAsEventListener(this)});
- this.populateYearRange();
- } else {
- this.month_year_label = header_div.build("span")
- }
- },
- initCalendarGrid: function() {
- var body_div = this.body_div;
- this.calendar_day_grid = [];
- var days_table = body_div.build("table", { cellPadding: "0px", cellSpacing: "0px", width: "100%" })
- // make the weekdays!
- var weekdays_row = days_table.build("thead").build("tr");
- Date.weekdays.each( function(weekday) {
- weekdays_row.build("th", {innerHTML: weekday});
- });
-
- var days_tbody = days_table.build("tbody")
- // Make the days!
- var row_number = 0, weekday;
- for(var cell_index = 0; cell_index<42; cell_index++)
- {
- weekday = (cell_index+Date.first_day_of_week ) % 7;
- if ( cell_index % 7==0 ) days_row = days_tbody.build("tr", {className: 'row_'+row_number++});
- (this.calendar_day_grid[cell_index] = days_row.build("td", {
- calendar_date_select: this,
- onmouseover: function () { this.calendar_date_select.dayHover(this); },
- onmouseout: function () { this.calendar_date_select.dayHoverOut(this) },
- onclick: function() { this.calendar_date_select.updateSelectedDate(this, true); },
- className: (weekday==0) || (weekday==6) ? " weekend" : "" //clear the class
- },
- { cursor: "pointer" }
- )).build("div");
- this.calendar_day_grid[cell_index];
- }
- },
- initButtonsDiv: function()
- {
- var buttons_div = this.buttons_div;
- if (this.options.get("time"))
- {
- var blank_time = $A(this.options.get("time")=="mixed" ? [[" - ", ""]] : []);
- buttons_div.build("span", {innerHTML:"@", className: "at_sign"});
-
- var t = new Date();
- this.hour_select = new SelectBox(buttons_div,
- blank_time.concat($R(0,23).map(function(x) {t.setHours(x); return $A([t.getAMPMHour()+ " " + t.getAMPM(),x])} )),
- {
- calendar_date_select: this,
- onchange: function() { this.calendar_date_select.updateSelectedDate( { hour: this.value });},
- className: "hour"
- }
- );
- buttons_div.build("span", {innerHTML:":", className: "seperator"});
- var that = this;
- this.minute_select = new SelectBox(buttons_div,
- blank_time.concat($R(0,59).select(function(x){return (x % that.options.get('minute_interval')==0)}).map(function(x){ return $A([ Date.padded2(x), x]); } ) ),
- {
- calendar_date_select: this,
- onchange: function() { this.calendar_date_select.updateSelectedDate( {minute: this.value }) },
- className: "minute"
- }
- );
-
- } else if (! this.options.get("buttons")) buttons_div.remove();
-
- if (this.options.get("buttons")) {
- buttons_div.build("span", {innerHTML: "&#160;"});
- if (this.options.get("time")=="mixed" || !this.options.get("time")) b = buttons_div.build("a", {
- innerHTML: _translations["Today"],
- href: "#",
- onclick: function() {this.today(false); return false;}.bindAsEventListener(this)
- });
-
- if (this.options.get("time")=="mixed") buttons_div.build("span", {innerHTML: "&#160;|&#160;", className:"button_seperator"})
-
- if (this.options.get("time")) b = buttons_div.build("a", {
- innerHTML: _translations["Now"],
- href: "#",
- onclick: function() {this.today(true); return false}.bindAsEventListener(this)
- });
-
- if (!this.options.get("embedded") && !this.closeOnClick())
- {
- buttons_div.build("span", {innerHTML: "&#160;|&#160;", className:"button_seperator"})
- buttons_div.build("a", { innerHTML: _translations["OK"], href: "#", onclick: function() {this.close(); return false;}.bindAsEventListener(this) });
- }
- if (this.options.get('clear_button')) {
- buttons_div.build("span", {innerHTML: "&#160;|&#160;", className:"button_seperator"})
- buttons_div.build("a", { innerHTML: _translations["Clear"], href: "#", onclick: function() {this.clearDate(); if (!this.options.get("embedded")) this.close(); return false;}.bindAsEventListener(this) });
- }
- }
- },
- refresh: function ()
- {
- this.refreshMonthYear();
- this.refreshCalendarGrid();
-
- this.setSelectedClass();
- this.updateFooter();
- },
- refreshCalendarGrid: function () {
- this.beginning_date = new Date(this.date).stripTime();
- this.beginning_date.setDate(1);
- this.beginning_date.setHours(12); // Prevent daylight savings time boundaries from showing a duplicate day
- var pre_days = this.beginning_date.getDay() // draw some days before the fact
- if (pre_days < 3) pre_days += 7;
- this.beginning_date.setDate(1 - pre_days + Date.first_day_of_week);
-
- var iterator = new Date(this.beginning_date);
-
- var today = new Date().stripTime();
- var this_month = this.date.getMonth();
- vdc = this.options.get("valid_date_check");
- for (var cell_index = 0;cell_index<42; cell_index++)
- {
- day = iterator.getDate(); month = iterator.getMonth();
- cell = this.calendar_day_grid[cell_index];
- Element.remove(cell.childNodes[0]); div = cell.build("div", {innerHTML:day});
- if (month!=this_month) div.className = "other";
- cell.day = day; cell.month = month; cell.year = iterator.getFullYear();
- if (vdc) { if (vdc(iterator.stripTime())) cell.removeClassName("disabled"); else cell.addClassName("disabled") };
- iterator.setDate( day + 1);
- }
-
- if (this.today_cell) this.today_cell.removeClassName("today");
-
- if ( $R( 0, 41 ).include(days_until = this.beginning_date.stripTime().daysDistance(today)) ) {
- this.today_cell = this.calendar_day_grid[days_until];
- this.today_cell.addClassName("today");
- }
- },
- refreshMonthYear: function() {
- var m = this.date.getMonth();
- var y = this.date.getFullYear();
- // set the month
- if (this.options.get("month_year") == "dropdowns")
- {
- this.month_select.setValue(m, false);
-
- var e = this.year_select.element;
- if (this.flexibleYearRange() && (!(this.year_select.setValue(y, false)) || e.selectedIndex <= 1 || e.selectedIndex >= e.options.length - 2 )) this.populateYearRange();
-
- this.year_select.setValue(y);
-
- } else {
- this.month_year_label.update( Date.months[m] + " " + y.toString() );
- }
- },
- populateYearRange: function() {
- this.year_select.populate(this.yearRange().toArray());
- },
- yearRange: function() {
- if (!this.flexibleYearRange())
- return $R(this.options.get("year_range")[0], this.options.get("year_range")[1]);
-
- var y = this.date.getFullYear();
- return $R(y - this.options.get("year_range"), y + this.options.get("year_range"));
- },
- flexibleYearRange: function() { return (typeof(this.options.get("year_range")) == "number"); },
- validYear: function(year) { if (this.flexibleYearRange()) { return true;} else { return this.yearRange().include(year);} },
- dayHover: function(element) {
- var hover_date = new Date(this.selected_date);
- hover_date.setFullYear(element.year, element.month, element.day);
- this.updateFooter(hover_date.toFormattedString(this.use_time));
- },
- dayHoverOut: function(element) { this.updateFooter(); },
- clearSelectedClass: function() {if (this.selected_cell) this.selected_cell.removeClassName("selected");},
- setSelectedClass: function() {
- if (!this.selection_made) return;
- this.clearSelectedClass()
- if ($R(0,42).include( days_until = this.beginning_date.stripTime().daysDistance(this.selected_date.stripTime()) )) {
- this.selected_cell = this.calendar_day_grid[days_until];
- this.selected_cell.addClassName("selected");
- }
- },
- reparse: function() { this.parseDate(); this.refresh(); },
- dateString: function() {
- return (this.selection_made) ? this.selected_date.toFormattedString(this.use_time) : "&#160;";
- },
- parseDate: function()
- {
- var value = $F(this.target_element).strip()
- var default_time = this.options.get("default_time");
- this.selection_made = (value != "" || default_time);
- this.date = value=="" ? NaN : Date.parseFormattedString(this.options.get("date") || value);
- if (isNaN(this.date) && !default_time)
- this.date = new Date();
- else if (isNaN(this.date) && default_time)
- this.date = (Object.prototype.toString.apply(default_time) === '[object Function]') ? default_time() : default_time;
-
- if (!this.validYear(this.date.getFullYear())) this.date.setYear( (this.date.getFullYear() < this.yearRange().start) ? this.yearRange().start : this.yearRange().end);
- this.selected_date = new Date(this.date);
- this.use_time = /[0-9]:[0-9]{2}/.exec(value) ? true : false;
- this.date.setDate(1);
- },
- updateFooter:function(text) { if (!text) text = this.dateString(); this.footer_div.purgeChildren(); this.footer_div.build("span", {innerHTML: text }); },
- clearDate:function() {
- if ((this.target_element.disabled || this.target_element.readOnly) && this.options.get("popup") != "force") return false;
- var last_value = this.target_element.value;
- this.target_element.value = "";
- this.clearSelectedClass();
- this.updateFooter('&#160;');
- if (last_value!=this.target_element.value) this.callback("onchange");
- },
- updateSelectedDate:function(partsOrElement, via_click) {
- var parts = $H(partsOrElement);
- if ((this.target_element.disabled || this.target_element.readOnly) && this.options.get("popup") != "force") return false;
- if (parts.get("day")) {
- var t_selected_date = this.selected_date, vdc = this.options.get("valid_date_check");
- t_selected_date.setFullYear(parts.get("year"), parts.get("month"), parts.get("day"));
-
- if (vdc && ! vdc(t_selected_date.stripTime())) { return false; }
- this.selected_date = t_selected_date;
- this.selection_made = true;
- }
-
- if (!isNaN(parts.get("hour"))) this.selected_date.setHours(parts.get("hour"));
- if (!isNaN(parts.get("minute"))) this.selected_date.setMinutes( Math.floor_to_interval(parts.get("minute"), this.options.get("minute_interval")) );
- if (parts.get("hour") === "" || parts.get("minute") === "")
- this.setUseTime(false);
- else if (!isNaN(parts.get("hour")) || !isNaN(parts.get("minute")))
- this.setUseTime(true);
-
- this.updateFooter();
- this.setSelectedClass();
-
- if (this.selection_made) this.updateValue();
- if (this.closeOnClick()) { this.close(); }
- if (via_click && !this.options.get("embedded")) {
- if ((new Date() - this.last_click_at) < 333) this.close();
- this.last_click_at = new Date();
- }
- },
- closeOnClick: function() {
- if (this.options.get("embedded")) return false;
- if (this.options.get("close_on_click")===nil )
- return (this.options.get("time")) ? false : true
- else
- return (this.options.get("close_on_click"))
- },
- navMonth: function(month) { (target_date = new Date(this.date)).setMonth(month); return (this.navTo(target_date)); },
- navYear: function(year) { (target_date = new Date(this.date)).setYear(year); return (this.navTo(target_date)); },
- navTo: function(date) {
- if (!this.validYear(date.getFullYear())) return false;
- this.date = date;
- this.date.setDate(1);
- this.refresh();
- this.callback("after_navigate", this.date);
- return true;
- },
- setUseTime: function(turn_on) {
- this.use_time = this.options.get("time") && (this.options.get("time")=="mixed" ? turn_on : true) // force use_time to true if time==true && time!="mixed"
- if (this.use_time && this.selected_date) { // only set hour/minute if a date is already selected
- var minute = Math.floor_to_interval(this.selected_date.getMinutes(), this.options.get("minute_interval"));
- var hour = this.selected_date.getHours();
-
- this.hour_select.setValue(hour);
- this.minute_select.setValue(minute)
- } else if (this.options.get("time")=="mixed") {
- this.hour_select.setValue(""); this.minute_select.setValue("");
- }
- },
- updateValue: function() {
- var last_value = this.target_element.value;
- this.target_element.value = this.dateString();
- if (last_value!=this.target_element.value) this.callback("onchange");
- },
- today: function(now) {
- var d = new Date(); this.date = new Date();
- var o = $H({ day: d.getDate(), month: d.getMonth(), year: d.getFullYear(), hour: d.getHours(), minute: d.getMinutes()});
- if ( ! now ) o = o.merge({hour: "", minute:""});
- this.updateSelectedDate(o, true);
- this.refresh();
- },
- close: function() {
- if (this.closed) return false;
- this.callback("before_close");
- this.target_element.calendar_date_select = nil;
- Event.stopObserving(document, "mousedown", this.closeIfClickedOut_handler);
- Event.stopObserving(document, "keypress", this.keyPress_handler);
- this.calendar_div.remove(); this.closed = true;
- if (this.iframe) this.iframe.remove();
- if (this.target_element.type != "hidden" && ! this.target_element.disabled) this.target_element.focus();
- this.callback("after_close");
- },
- closeIfClickedOut: function(e) {
- if (! $(Event.element(e)).descendantOf(this.calendar_div) ) this.close();
- },
- keyPress: function(e) {
- if (e.keyCode==Event.KEY_ESC) this.close();
- },
- callback: function(name, param) { if (this.options.get(name)) { this.options.get(name).bind(this.target_element)(param); } }
-}
35 vendor/assets/javascripts/calendar_date_select/format_american.js
View
@@ -1,35 +0,0 @@
-// American Format: 12/31/2000 5:00 pm
-// Thanks, Wes Hays
-Date.prototype.toFormattedString = function(include_time){
- str = Date.padded2(this.getMonth() + 1) + '/' +Date.padded2(this.getDate()) + '/' + this.getFullYear();
-
- if (include_time) { hour=this.getHours(); str += " " + this.getAMPMHour() + ":" + this.getPaddedMinutes() + " " + this.getAMPM() }
- return str;
-}
-
-Date.parseFormattedString = function (string) {
- // Test these with and without the time
- // 11/11/1111 12pm
- // 11/11/1111 1pm
- // 1/11/1111 10:10pm
- // 11/1/1111 01pm
- // 1/1/1111 01:11pm
- // 1/1/1111 1:11pm
- var regexp = "(([0-1]?[0-9])\/[0-3]?[0-9]\/[0-9]{4}) *([0-9]{1,2}(:[0-9]{2})? *(am|pm))?";
- string = string.strip();
- var d = string.match(new RegExp(regexp, "i"));
- if (d==null) {
- return Date.parse(string); // Give javascript a chance to parse it.
- }
-
- mdy = d[1].split('/');
- hrs = 0;
- mts = 0;
- if(d[3] != null && d[3].strip() != "") {
- hrs = parseInt(d[3].split('')[0], 10);
- if(d[5].toLowerCase() == 'pm') { hrs += 12; } // Add 12 more to hrs
- mts = d[4].split(':')[1];
- }
-
- return new Date(mdy[2], parseInt(mdy[0], 10)-1, mdy[1], hrs, mts, 0);
-}
31 vendor/assets/javascripts/calendar_date_select/format_danish.js
View
@@ -1,31 +0,0 @@
-// Formats date and time as "2000/01/20 17:00"
-Date.prototype.toFormattedString = function(include_time){
- str = Date.padded2(this.getDate()) + "/" + Date.padded2(this.getMonth() + 1) + "/" + this.getFullYear();
-
- if (include_time) {
- str += " " + this.getHours() + ":" + this.getPaddedMinutes();
- }
- return str;
-}
-
-// Parses date and time as "2000/01/20 17:00"
-Date.parseFormattedString = function(string) {
- var regexp = "([0-9]{2})/([0-9]{2})/([0-9]{4})" +
- "( ([0-9]{1,2}):([0-9]{2})(:([0-9]{2})(.([0-9]{3}))?)?" +
- ")?";
- var d = string.match(new RegExp(regexp, "i"));
- if (d==null) return Date.parse(string); // at least give javascript a crack at it.
- var offset = 0;
- var date = new Date(d[3], 0, 1);
- if (d[2]) { date.setMonth(d[2] - 1); }
- if (d[1]) { date.setDate(d[1]); }
- if (d[4]) {
- hours = parseInt(d[5], 10);
- date.setHours(hours);
- }
- if (d[6]) { date.setMinutes(d[6]); }
- //if (d[8]) { date.setSeconds(d[7]); }
- //if (d[9]) { date.setMiliseconds(Number("0." + d[8]) * 1000); }
-
- return date;
-}
27 vendor/assets/javascripts/calendar_date_select/format_db.js
View
@@ -1,27 +0,0 @@
-// DB No Seconds Format: 2007-12-05 12:00
-
-Date.padded2 = function(hour) { padded2 = hour.toString(); if ((parseInt(hour) < 10) || (parseInt(hour) == null)) padded2="0" + padded2; return padded2; }
-Date.prototype.getAMPMHour = function() { hour=Date.padded2(this.getHours()); return (hour == null) ? 00 : (hour > 24 ? hour - 24 : hour ) }
-Date.prototype.getAMPM = function() { return (this.getHours() < 12) ? "" : ""; }
-
-Date.prototype.toFormattedString = function(include_time){
- str = this.getFullYear() + "-" + (this.getMonth() + 1) + "-" + Date.padded2(this.getDate());
- if (include_time) { hour=this.getHours(); str += " " + this.getAMPMHour() + ":" + this.getPaddedMinutes() }
- return str;
-}
-
-Date.parseFormattedString = function (string) {
- var regexp = '([0-9]{4})-(([0-9]{1,2})-(([0-9]{1,2})( ([0-9]{1,2}):([0-9]{2})? *)?)?)?';
- var d = string.match(new RegExp(regexp, "i"));
- if (d==null) return Date.parse(string); // at least give javascript a crack at it.
- var offset = 0;
- var date = new Date(d[1], 0, 1);
- if (d[3]) { date.setMonth(d[3] - 1); }
- if (d[5]) { date.setDate(d[5]); }
- if (d[7]) {
- date.setHours(parseInt(d[7], 10));
- }
- if (d[8]) { date.setMinutes(d[8]); }
- if (d[10]) { date.setSeconds(d[10]); }
- return date;
-}
7 vendor/assets/javascripts/calendar_date_select/format_euro_24hr.js
View
@@ -1,7 +0,0 @@
-// Formats date and time as "01 January 2000 17:00"
-Date.prototype.toFormattedString = function(include_time)
-{
- str = Date.padded2(this.getDate()) + " " + Date.months[this.getMonth()] + " " + this.getFullYear();
- if (include_time) { str += " " + this.getHours() + ":" + this.getPaddedMinutes() }
- return str;
-}
7 vendor/assets/javascripts/calendar_date_select/format_euro_24hr_ymd.js
View
@@ -1,7 +0,0 @@
-// Formats date and time as "2000.01.20 17:00"
-Date.prototype.toFormattedString = function(include_time)
-{
- str = this.getFullYear() + "." + Date.padded2(this.getMonth()+1) + "." + Date.padded2(this.getDate());
- if (include_time) { str += " " + this.getHours() + ":" + this.getPaddedMinutes() }
- return str;
-}
32 vendor/assets/javascripts/calendar_date_select/format_finnish.js
View
@@ -1,32 +0,0 @@
-Date.padded2 = function(hour) { padded2 = hour.toString(); if ((parseInt(hour) < 10) || (parseInt(hour) == null)) padded2="0" + padded2; return padded2; }
-Date.prototype.getAMPMHour = function() { hour=Date.padded2(this.getHours()); return (hour == null) ? 00 : (hour > 24 ? hour - 24 : hour ) }
-Date.prototype.getAMPM = function() { return (this.getHours() < 12) ? "" : ""; }
-
-Date.prototype.toFormattedString = function(include_time){
- str = this.getDate() + "." + (this.getMonth() + 1) + "." + this.getFullYear();
- if (include_time) { hour=this.getHours(); str += " " + this.getAMPMHour() + ":" + this.getPaddedMinutes() }
- return str;
-}
-Date.parseFormattedString = function (string) {
- var regexp = '([0-9]{1,2})\.(([0-9]{1,2})\.(([0-9]{2,4})( ([0-9]{1,2}):([0-9]{2})? *)?)?)?';
- var d = string.match(new RegExp(regexp, "i"));
- if (d==null) return Date.parse(string); // at least give javascript a crack at it.
- var offset = 0;
- if (d[5] && d[5].length == 2) {
- // we got only two digits for the year...
- d[5] = Number(d[5]);
- if (d[5] > 30)
- d[5] += 1900;
- else
- d[5] += 2000;
- }
- var date = new Date(d[5], 0, 1);
- if (d[3]) { date.setMonth(d[3] - 1); }
- if (d[5]) { date.setDate(d[1]); }
- if (d[7]) {
- date.setHours(parseInt(d[7], 10));
- }
- if (d[8]) { date.setMinutes(d[8]); }
- if (d[10]) { date.setSeconds(d[10]); }
- return date;
-}
24 vendor/assets/javascripts/calendar_date_select/format_french.js
View
@@ -1,24 +0,0 @@
-// French Format: 31/12/2000 à 23:00
-// Thanks, Materazzi!
-
-Date.prototype.toFormattedString = function(include_time){
- str = this.getDate() + "/" + (this.getMonth() + 1) + "/" + this.getFullYear();
- if (include_time) { str += " à " + this.getHours() + ":" + this.getPaddedMinutes() }
- return str;
-}
-
-Date.parseFormattedString = function (string) {
- var regexp = '([0-9]{1,2})/(([0-9]{1,2})/(([0-9]{4})( ?à? ([0-9]{1,2}):([0-9]{2})? *)?)?)?';
- var d = string.match(new RegExp(regexp, "i"));
- if (d==null) return Date.parse(string); // at least give javascript a crack at it.
- var offset = 0;
- var date = new Date(d[5], 0, 1);
- if (d[3]) { date.setMonth(d[3] - 1); }
- if (d[5]) { date.setDate(d[1]); }
- if (d[7]) {
- date.setHours(parseInt(d[7], 10));
- }
- if (d[8]) { date.setMinutes(d[8]); }
- if (d[10]) { date.setSeconds(d[10]); }
- return date;
-}
37 vendor/assets/javascripts/calendar_date_select/format_hyphen_ampm.js
View
@@ -1,37 +0,0 @@
-Date.prototype.toFormattedString = function(include_time){
- str = this.getFullYear() + "-" + Date.padded2(this.getMonth() + 1) + "-" +Date.padded2(this.getDate());
-
-if (include_time) { hour=this.getHours(); str += " " + this.getAMPMHour() + ":" + this.getPaddedMinutes() + " " + this.getAMPM() }
-return str;
-}
-
-Date.parseFormattedString = function (string) {
- var regexp = "([0-9]{4})(-([0-9]{2})(-([0-9]{2})" +
- "( ([0-9]{1,2}):([0-9]{2})? *(pm|am)" +
- "?)?)?)?";
- var d = string.match(new RegExp(regexp, "i"));
- if (d==null) return Date.parse(string); // at least give javascript a crack at it.
- var offset = 0;
- var date = new Date(d[1], 0, 1);
- if (d[3]) { date.setMonth(d[3] - 1); }
- if (d[5]) { date.setDate(d[5]); }
- if (d[7]) {
- hours = parseInt(d[7], 10);
- offset=0;
- if (d[9]) {
- is_pm = (d[9].toLowerCase()=="pm");
- if (is_pm && hours <= 11) hours+=12;
- if (!is_pm && hours == 12) hours=0;
- }
- date.setHours(hours);
- }
- if (d[8]) { date.setMinutes(d[8]); }
- if (d[10]) { date.setSeconds(d[10]); }
- if (d[12]) { date.setMilliseconds(Number("0." + d[12]) * 1000); }
- if (d[14]) {
- offset = (Number(d[16]) * 60) + Number(d[17]);
- offset *= ((d[15] == '-') ? 1 : -1);
- }
-
- return date;
-}
29 vendor/assets/javascripts/calendar_date_select/format_iso_date.js
View
@@ -1,29 +0,0 @@
-// International date format (ISO 8601): yyyy-mm-dd
-// Including time (no seconds): yyyy-mm-dd HH:MM
-Date.prototype.toFormattedString = function(include_time) {
- var hour;
- var str = this.getFullYear() + "-" + Date.padded2(this.getMonth() + 1) + "-" +Date.padded2(this.getDate());
- if (include_time) {
- hour = Date.padded2(this.getHours());
- str += " " + hour + ":" + this.getPaddedMinutes();
- }
- return str;
-};
-
-// TODO: take care of timezone offsets
-// as the timezone is not displayed in the input,
-// this could be tricky (or just unnessesary)
-Date.parseFormattedString = function (string) {
- var regexp = "([0-9]{4})(-([0-9]{2})(-([0-9]{2})" +
- "([T| ]([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?" +
- "(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?";
- var d = string.match(new RegExp(regexp));
-
- var date = new Date(d[1], 0, 1);
-
- if (d[3]) { date.setMonth(d[3] - 1); }
- if (d[5]) { date.setDate(d[5]); }
- if (d[7]) { date.setHours(d[7]); }
- if (d[8]) { date.setMinutes(d[8]); }
- return date;
-};
24 vendor/assets/javascripts/calendar_date_select/format_italian.js
View
@@ -1,24 +0,0 @@
-// Italian Format: 31/12/2000 23:00
-// Thanks, Bigonazzi!
-
-Date.prototype.toFormattedString = function(include_time){
- str = this.getDate() + "/" + (this.getMonth() + 1) + "/" + this.getFullYear();
- if (include_time) { str += " " + this.getHours() + ":" + this.getPaddedMinutes() }
- return str;
-}
-
-Date.parseFormattedString = function (string) {
- var regexp = '([0-9]{1,2})/(([0-9]{1,2})/(([0-9]{4})( ([0-9]{1,2}):([0-9]{2})? *)?)?)?';
- var d = string.match(new RegExp(regexp, "i"));
- if (d==null) return Date.parse(string); // at least give javascript a crack at it.
- var offset = 0;
- var date = new Date(d[5], 0, 1);
- if (d[3]) { date.setMonth(d[3] - 1); }
- if (d[5]) { date.setDate(d[1]); }
- if (d[7]) {
- date.setHours(parseInt(d[7], 10));
- }
- if (d[8]) { date.setMinutes(d[8]); }
- if (d[10]) { date.setSeconds(d[10]); }
- return date;
-}
10 vendor/assets/javascripts/calendar_date_select/locale/ar.js
View
@@ -1,10 +0,0 @@
-Date.weekdays = ['سبت', 'أحد', 'إثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة'];
-Date.months = ['كانون ثاني', 'شباط', 'آذار', 'نيسان', 'أيار', 'حزيران', 'تموز', 'آب', 'أيلول', 'تشرين أول', 'تشرين ثاني', 'كانون أول'];
-Date.first_day_of_week = 6;
-
-_translations = {
- "OK": "نفذ",
- "Now": "الآن",
- "Today": "اليوم",
- "Clear": "إلغاء"
-}
11 vendor/assets/javascripts/calendar_date_select/locale/da.js
View
@@ -1,11 +0,0 @@
-Date.weekdays = $w('Ma Ti On To Fr Lø Sø');
-Date.months = $w('Januar Februar Marts April Maj Juni Juli August September Oktober November December');
-
-Date.first_day_of_week = 1;
-
-_translations = {
- "OK": "Vælg",
- "Now": "Nu",
- "Today": "I dag",
- "Clear": "Slet"
-}
11 vendor/assets/javascripts/calendar_date_select/locale/de.js
View
@@ -1,11 +0,0 @@
-Date.weekdays = $w('Mo Di Mi Do Fr Sa So');
-Date.months = $w('Januar Februar März April Mai Juni Juli August September Oktober November Dezember');
-
-Date.first_day_of_week = 1;
-
-_translations = {
- "OK": "OK",
- "Now": "Jetzt",
- "Today": "Heute",
- "Clear": "Löschen"
-}
11 vendor/assets/javascripts/calendar_date_select/locale/es.js
View
@@ -1,11 +0,0 @@
-Date.weekdays = $w("L M X J V S D");
-Date.months = $w("Enero Febrero Marzo Abril Mayo Junio Julio Agosto Septiembre Octubre Noviembre Diciembre" );
-
-Date.first_day_of_week = 1;
-
-_translations = {
- "OK": "Cancelar",
- "Now": "Ahora",
- "Clear": "Limpiar",
- "Today": "Hoy"
-}
10 vendor/assets/javascripts/calendar_date_select/locale/fi.js
View
@@ -1,10 +0,0 @@
-Date.weekdays = $w("Ma Ti Ke To Pe La Su");
-Date.months = $w("Tammikuu Helmikuu Maaliskuu Huhtikuu Toukokuu Kesäkuu Heinäkuu Elokuu Syyskuu Lokakuu Marraskuu Joulukuu" );
-
-Date.first_day_of_week = 1
-
-_translations = {
- "OK": "OK",
- "Now": "Nyt",
- "Today": "Tänään"
-}
11 vendor/assets/javascripts/calendar_date_select/locale/fr.js
View
@@ -1,11 +0,0 @@
-Date.weekdays = $w('L Ma Me J V S D');
-Date.months = $w('Janvier Février Mars Avril Mai Juin Juillet Août Septembre Octobre Novembre Décembre');
-
-Date.first_day_of_week = 1;
-
-_translations = {
- "OK": "OK",
- "Now": "Maintenant",
- "Today": "Aujourd'hui",
- "Clear": "Effacer",
-}
9 vendor/assets/javascripts/calendar_date_select/locale/it.js
View
@@ -1,9 +0,0 @@
-Date.weekdays = $w('Lu Ma Me Gi Ve Sa Do');
-Date.months = $w('Gennaio Febbraio Marzo Aprile Maggio Giugno Luglio Agosto Settembre Ottobre Novembre Dicembre');
-Date.first_day_of_week = 1;
-_translations = {
- "OK": "OK",
- "Now": "Ora",
- "Today": "Oggi",
- "Clear": "Cancella"
-}
11 vendor/assets/javascripts/calendar_date_select/locale/ja.js
View
@@ -1,11 +0,0 @@
-Date.weekdays = $w('日 月 火 水 木 金 土');
-Date.months = $w('1月 2月 3月 4月 5月 6月 7月 8月 9月 10月 11月 12月');
-
-Date.first_day_of_week = 0
-
-_translations = {
- "OK": "OK",
- "Now": "現在",
- "Today": "今日",
- "Clear": "クリア"
-}
11 vendor/assets/javascripts/calendar_date_select/locale/nl.js
View
@@ -1,11 +0,0 @@
-Date.weekdays = $w('Ma Di Wo Do Vr Za Zo');
-Date.months = $w('januari februari maart april mei juni juli augustus september oktober november december');
-
-Date.first_day_of_week = 1;
-
-_translations = {
- "OK": "OK",
- "Now": "Nu",
- "Today": "Vandaag",
- "Clear": "Wissen"
-}
11 vendor/assets/javascripts/calendar_date_select/locale/pl.js
View
@@ -1,11 +0,0 @@
-Date.weekdays = $w('P W Ś C P S N');
-Date.months = $w('Styczeń Luty Marzec Kwiecień Maj Czerwiec Lipiec Sierpień Wrzesień Październik Listopad Grudzień');
-
-Date.first_day_of_week = 1
-
-_translations = {
- "OK": "OK",
- "Now": "Teraz",
- "Clear": "Wyczyść",
- "Today": "Dziś"
-}
11 vendor/assets/javascripts/calendar_date_select/locale/pt.js
View
@@ -1,11 +0,0 @@
-Date.weekdays = $w('D S T Q Q S S');
-Date.months = $w('Janeiro Fevereiro Março Abril Maio Junho Julho Agosto Setembro Outubro Novembro Dezembro');
-
-Date.first_day_of_week = 0
-
-_translations = {
- "OK": "OK",
- "Now": "Agora",
- "Today": "Hoje",
- "Clear": "Limpar"
-}
10 vendor/assets/javascripts/calendar_date_select/locale/ru.js
View
@@ -1,10 +0,0 @@
-Date.weekdays = $w('Пн Вт Ср Чт Пт Сб Вс');
-Date.months = $w('Январь Февраль Март Апрель Май Июнь Июль Август Сентябрь Октябрь Ноябрь Декабрь');
-
-Date.first_day_of_week = 1
-
-_translations = {
- "OK": "OK",
- "Now": "Сейчас",
- "Today": "Сегодня"
-}
11 vendor/assets/javascripts/calendar_date_select/locale/sl.js
View
@@ -1,11 +0,0 @@
-Date.weekdays = $w('Po To Sr Če Pe So Ne');
-Date.months = $w('Januar Februar Marec April Maj Junij Julij Avgust September Oktober November December');
-
-Date.first_day_of_week = 1;
-
-_translations = {
- "OK": "OK",
- "Now": "Trenutno",
- "Today": "Danes",
- "Clear": "Pobriši"
-}
9 vendor/assets/javascripts/calendar_date_select/locale/sv.js
View
@@ -1,9 +0,0 @@
-Date.weekdays = $w('Må Ti On To Fr Lö Sö');
-Date.months = $w('Januari Februari Mars April Maj Juni Juli Augusti September Oktober November December');
-Date.first_day_of_week = 1;
-_translations = {
- "OK": "OK",
- "Now": "Nu",
- "Today": "Idag",
- "Clear": "Avbryt"
-}
1,530 vendor/assets/javascripts/jquery_ui_datepicker/jquery-ui-timepicker-addon.js
View
@@ -0,0 +1,1530 @@
+/*
+* jQuery timepicker addon
+* By: Trent Richardson [http://trentrichardson.com]
+* Version 1.0.1
+* Last Modified: 07/01/2012
+*
+* Copyright 2012 Trent Richardson
+* You may use this project under MIT or GPL licenses.
+* http://trentrichardson.com/Impromptu/GPL-LICENSE.txt
+* http://trentrichardson.com/Impromptu/MIT-LICENSE.txt
+*
+* HERES THE CSS:
+* .ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
+* .ui-timepicker-div dl { text-align: left; }
+* .ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }
+* .ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }
+* .ui-timepicker-div td { font-size: 90%; }
+* .ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
+*/
+
+/*jslint evil: true, maxlen: 300, white: false, undef: false, nomen: false, onevar: false */
+
+(function($) {
+
+// Prevent "Uncaught RangeError: Maximum call stack size exceeded"
+$.ui.timepicker = $.ui.timepicker || {};
+if ($.ui.timepicker.version) {
+ return;
+}
+
+$.extend($.ui, { timepicker: { version: "1.0.1" } });
+
+/* Time picker manager.
+ Use the singleton instance of this class, $.timepicker, to interact with the time picker.
+ Settings for (groups of) time pickers are maintained in an instance object,
+ allowing multiple different settings on the same page. */
+
+function Timepicker() {
+ this.regional = []; // Available regional settings, indexed by language code
+ this.regional[''] = { // Default regional settings
+ currentText: 'Now',
+ closeText: 'Done',
+ ampm: false,
+ amNames: ['AM', 'A'],
+ pmNames: ['PM', 'P'],
+ timeFormat: 'hh:mm tt',
+ timeSuffix: '',
+ timeOnlyTitle: 'Choose Time',
+ timeText: 'Time',
+ hourText: 'Hour',
+ minuteText: 'Minute',
+ secondText: 'Second',
+ millisecText: 'Millisecond',
+ timezoneText: 'Time Zone'
+ };
+ this._defaults = { // Global defaults for all the datetime picker instances
+ showButtonPanel: true,
+ timeOnly: false,
+ showHour: true,
+ showMinute: true,
+ showSecond: false,
+ showMillisec: false,
+ showTimezone: false,
+ showTime: true,
+ stepHour: 1,
+ stepMinute: 1,
+ stepSecond: 1,
+ stepMillisec: 1,
+ hour: 0,
+ minute: 0,
+ second: 0,
+ millisec: 0,
+ timezone: null,
+ useLocalTimezone: false,
+ defaultTimezone: "+0000",
+ hourMin: 0,
+ minuteMin: 0,
+ secondMin: 0,
+ millisecMin: 0,
+ hourMax: 23,
+ minuteMax: 59,
+ secondMax: 59,
+ millisecMax: 999,
+ minDateTime: null,
+ maxDateTime: null,
+ onSelect: null,
+ hourGrid: 0,
+ minuteGrid: 0,
+ secondGrid: 0,
+ millisecGrid: 0,
+ alwaysSetTime: true,
+ separator: ' ',
+ altFieldTimeOnly: true,
+ showTimepicker: true,
+ timezoneIso8601: false,
+ timezoneList: null,
+ addSliderAccess: false,
+ sliderAccessArgs: null
+ };
+ $.extend(this._defaults, this.regional['']);
+}
+
+$.extend(Timepicker.prototype, {
+ $input: null,
+ $altInput: null,
+ $timeObj: null,
+ inst: null,
+ hour_slider: null,
+ minute_slider: null,
+ second_slider: null,
+ millisec_slider: null,
+ timezone_select: null,
+ hour: 0,
+ minute: 0,
+ second: 0,
+ millisec: 0,
+ timezone: null,
+ defaultTimezone: "+0000",
+ hourMinOriginal: null,
+ minuteMinOriginal: null,
+ secondMinOriginal: null,
+ millisecMinOriginal: null,
+ hourMaxOriginal: null,
+ minuteMaxOriginal: null,
+ secondMaxOriginal: null,
+ millisecMaxOriginal: null,
+ ampm: '',
+ formattedDate: '',
+ formattedTime: '',
+ formattedDateTime: '',
+ timezoneList: null,
+
+ /* Override the default settings for all instances of the time picker.
+ @param settings object - the new settings to use as defaults (anonymous object)
+ @return the manager object */
+ setDefaults: function(settings) {
+ extendRemove(this._defaults, settings || {});
+ return this;
+ },
+
+ //########################################################################
+ // Create a new Timepicker instance
+ //########################################################################
+ _newInst: function($input, o) {
+ var tp_inst = new Timepicker(),
+ inlineSettings = {};
+
+ for (var attrName in this._defaults) {
+ var attrValue = $input.attr('time:' + attrName);
+ if (attrValue) {
+ try {
+ inlineSettings[attrName] = eval(attrValue);
+ } catch (err) {
+ inlineSettings[attrName] = attrValue;
+ }
+ }
+ }
+ tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, o, {
+ beforeShow: function(input, dp_inst) {
+ if ($.isFunction(o.beforeShow)) {
+ return o.beforeShow(input, dp_inst, tp_inst);
+ }
+ },
+ onChangeMonthYear: function(year, month, dp_inst) {
+ // Update the time as well : this prevents the time from disappearing from the $input field.
+ tp_inst._updateDateTime(dp_inst);
+ if ($.isFunction(o.onChangeMonthYear)) {
+ o.onChangeMonthYear.call($input[0], year, month, dp_inst, tp_inst);
+ }
+ },
+ onClose: function(dateText, dp_inst) {
+ if (tp_inst.timeDefined === true && $input.val() !== '') {
+ tp_inst._updateDateTime(dp_inst);
+ }
+ if ($.isFunction(o.onClose)) {
+ o.onClose.call($input[0], dateText, dp_inst, tp_inst);
+ }
+ },
+ timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker');
+ });
+ tp_inst.amNames = $.map(tp_inst._defaults.amNames, function(val) { return val.toUpperCase(); });
+ tp_inst.pmNames = $.map(tp_inst._defaults.pmNames, function(val) { return val.toUpperCase(); });
+
+ if (tp_inst._defaults.timezoneList === null) {
+ var timezoneList = [];
+ for (var i = -11; i <= 12; i++) {
+ timezoneList.push((i >= 0 ? '+' : '-') + ('0' + Math.abs(i).toString()).slice(-2) + '00');
+ }
+ if (tp_inst._defaults.timezoneIso8601) {
+ timezoneList = $.map(timezoneList, function(val) {
+ return val == '+0000' ? 'Z' : (val.substring(0, 3) + ':' + val.substring(3));
+ });
+ }
+ tp_inst._defaults.timezoneList = timezoneList;
+ }
+
+ tp_inst.timezone = tp_inst._defaults.timezone;
+ tp_inst.hour = tp_inst._defaults.hour;
+ tp_inst.minute = tp_inst._defaults.minute;
+ tp_inst.second = tp_inst._defaults.second;
+ tp_inst.millisec = tp_inst._defaults.millisec;
+ tp_inst.ampm = '';
+ tp_inst.$input = $input;
+
+ if (o.altField) {
+ tp_inst.$altInput = $(o.altField)
+ .css({ cursor: 'pointer' })
+ .focus(function(){ $input.trigger("focus"); });
+ }
+
+ if(tp_inst._defaults.minDate===0 || tp_inst._defaults.minDateTime===0)
+ {
+ tp_inst._defaults.minDate=new Date();
+ }
+ if(tp_inst._defaults.maxDate===0 || tp_inst._defaults.maxDateTime===0)
+ {
+ tp_inst._defaults.maxDate=new Date();
+ }
+
+ // datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime..
+ if(tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date) {
+ tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime());
+ }
+ if(tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date) {
+ tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime());
+ }
+ if(tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date) {
+ tp_inst._defaults.maxDateTime = new Date(tp_inst._defaults.maxDate.getTime());
+ }
+ if(tp_inst._defaults.maxDateTime !== undefined && tp_inst._defaults.maxDateTime instanceof Date) {
+ tp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime());
+ }
+ return tp_inst;
+ },
+
+ //########################################################################
+ // add our sliders to the calendar
+ //########################################################################
+ _addTimePicker: function(dp_inst) {
+ var currDT = (this.$altInput && this._defaults.altFieldTimeOnly) ?
+ this.$input.val() + ' ' + this.$altInput.val() :
+ this.$input.val();
+
+ this.timeDefined = this._parseTime(currDT);
+ this._limitMinMaxDateTime(dp_inst, false);
+ this._injectTimePicker();
+ },
+
+ //########################################################################
+ // parse the time string from input value or _setTime
+ //########################################################################
+ _parseTime: function(timeString, withDate) {
+ if (!this.inst) {
+ this.inst = $.datepicker._getInst(this.$input[0]);
+ }
+
+ if (withDate || !this._defaults.timeOnly)
+ {
+ var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat');
+ try {
+ var parseRes = parseDateTimeInternal(dp_dateFormat, this._defaults.timeFormat, timeString, $.datepicker._getFormatConfig(this.inst), this._defaults);
+ if (!parseRes.timeObj) { return false; }
+ $.extend(this, parseRes.timeObj);
+ } catch (err)
+ {
+ return false;
+ }
+ return true;
+ }
+ else
+ {
+ var timeObj = $.datepicker.parseTime(this._defaults.timeFormat, timeString, this._defaults);
+ if(!timeObj) { return false; }
+ $.extend(this, timeObj);
+ return true;
+ }
+ },
+
+ //########################################################################
+ // generate and inject html for timepicker into ui datepicker
+ //########################################################################
+ _injectTimePicker: function() {
+ var $dp = this.inst.dpDiv,
+ o = this._defaults,
+ tp_inst = this,
+ // Added by Peter Medeiros:
+ // - Figure out what the hour/minute/second max should be based on the step values.
+ // - Example: if stepMinute is 15, then minMax is 45.
+ hourMax = parseInt((o.hourMax - ((o.hourMax - o.hourMin) % o.stepHour)) ,10),
+ minMax = parseInt((o.minuteMax - ((o.minuteMax - o.minuteMin) % o.stepMinute)) ,10),
+ secMax = parseInt((o.secondMax - ((o.secondMax - o.secondMin) % o.stepSecond)) ,10),
+ millisecMax = parseInt((o.millisecMax - ((o.millisecMax - o.millisecMin) % o.stepMillisec)) ,10),
+ dp_id = this.inst.id.toString().replace(/([^A-Za-z0-9_])/g, '');
+
+ // Prevent displaying twice
+ //if ($dp.find("div#ui-timepicker-div-"+ dp_id).length === 0) {
+ if ($dp.find("div#ui-timepicker-div-"+ dp_id).length === 0 && o.showTimepicker) {
+ var noDisplay = ' style="display:none;"',
+ html = '<div class="ui-timepicker-div" id="ui-timepicker-div-' + dp_id + '"><dl>' +
+ '<dt class="ui_tpicker_time_label" id="ui_tpicker_time_label_' + dp_id + '"' +
+ ((o.showTime) ? '' : noDisplay) + '>' + o.timeText + '</dt>' +
+ '<dd class="ui_tpicker_time" id="ui_tpicker_time_' + dp_id + '"' +
+ ((o.showTime) ? '' : noDisplay) + '></dd>' +
+ '<dt class="ui_tpicker_hour_label" id="ui_tpicker_hour_label_' + dp_id + '"' +
+ ((o.showHour) ? '' : noDisplay) + '>' + o.hourText + '</dt>',
+ hourGridSize = 0,
+ minuteGridSize = 0,
+ secondGridSize = 0,
+ millisecGridSize = 0,
+ size = null;
+
+ // Hours
+ html += '<dd class="ui_tpicker_hour"><div id="ui_tpicker_hour_' + dp_id + '"' +
+ ((o.showHour) ? '' : noDisplay) + '></div>';
+ if (o.showHour && o.hourGrid > 0) {
+ html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
+
+ for (var h = o.hourMin; h <= hourMax; h += parseInt(o.hourGrid,10)) {
+ hourGridSize++;
+ var tmph = (o.ampm && h > 12) ? h-12 : h;
+ if (tmph < 10) { tmph = '0' + tmph; }
+ if (o.ampm) {
+ if (h === 0) {
+ tmph = 12 +'a';
+ } else {
+ if (h < 12) { tmph += 'a'; }
+ else { tmph += 'p'; }
+ }
+ }
+ html += '<td>' + tmph + '</td>';
+ }
+
+ html += '</tr></table></div>';
+ }
+ html += '</dd>';
+
+ // Minutes
+ html += '<dt class="ui_tpicker_minute_label" id="ui_tpicker_minute_label_' + dp_id + '"' +
+ ((o.showMinute) ? '' : noDisplay) + '>' + o.minuteText + '</dt>'+
+ '<dd class="ui_tpicker_minute"><div id="ui_tpicker_minute_' + dp_id + '"' +
+ ((o.showMinute) ? '' : noDisplay) + '></div>';
+
+ if (o.showMinute && o.minuteGrid > 0) {
+ html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
+
+ for (var m = o.minuteMin; m <= minMax; m += parseInt(o.minuteGrid,10)) {
+ minuteGridSize++;
+ html += '<td>' + ((m < 10) ? '0' : '') + m + '</td>';
+ }
+
+ html += '</tr></table></div>';
+ }
+ html += '</dd>';
+
+ // Seconds
+ html += '<dt class="ui_tpicker_second_label" id="ui_tpicker_second_label_' + dp_id + '"' +
+ ((o.showSecond) ? '' : noDisplay) + '>' + o.secondText + '</dt>'+
+ '<dd class="ui_tpicker_second"><div id="ui_tpicker_second_' + dp_id + '"'+
+ ((o.showSecond) ? '' : noDisplay) + '></div>';
+
+ if (o.showSecond && o.secondGrid > 0) {
+ html += '<div style="padding-left: 1px"><table><tr>';
+
+ for (var s = o.secondMin; s <= secMax; s += parseInt(o.secondGrid,10)) {
+ secondGridSize++;
+ html += '<td>' + ((s < 10) ? '0' : '') + s + '</td>';
+ }
+
+ html += '</tr></table></div>';
+ }
+ html += '</dd>';
+
+ // Milliseconds
+ html += '<dt class="ui_tpicker_millisec_label" id="ui_tpicker_millisec_label_' + dp_id + '"' +
+ ((o.showMillisec) ? '' : noDisplay) + '>' + o.millisecText + '</dt