barkest_core 1.5.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (308) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +13 -0
  3. data/Gemfile +22 -0
  4. data/Gemfile.lock +254 -0
  5. data/MIT-LICENSE +20 -0
  6. data/README.md +364 -0
  7. data/Rakefile +37 -0
  8. data/app/assets/fonts/barkest_core/ArchivoNarrow-Bold.ttf +0 -0
  9. data/app/assets/fonts/barkest_core/ArchivoNarrow-BoldItalic.ttf +0 -0
  10. data/app/assets/fonts/barkest_core/ArchivoNarrow-Italic.ttf +0 -0
  11. data/app/assets/fonts/barkest_core/ArchivoNarrow-Regular.ttf +0 -0
  12. data/app/assets/images/barkest_core/.keep +0 -0
  13. data/app/assets/images/barkest_core/barcode-B.svg +181 -0
  14. data/app/assets/javascripts/barkest_core/.keep +0 -0
  15. data/app/assets/javascripts/barkest_core/application.js +22 -0
  16. data/app/assets/javascripts/barkest_core/bootstrap-datepicker.js +1800 -0
  17. data/app/assets/javascripts/barkest_core/field_init.js +7 -0
  18. data/app/assets/javascripts/barkest_core/jquery.doubleScroll.js +112 -0
  19. data/app/assets/javascripts/barkest_core/masked_edit.js +25 -0
  20. data/app/assets/javascripts/barkest_core/system_status.js.erb +201 -0
  21. data/app/assets/stylesheets/barkest_core/.keep +0 -0
  22. data/app/assets/stylesheets/barkest_core/application.css +17 -0
  23. data/app/assets/stylesheets/barkest_core/custom.css.scss +264 -0
  24. data/app/assets/stylesheets/barkest_core/datepicker3.css +790 -0
  25. data/app/controllers/.keep +0 -0
  26. data/app/controllers/access_groups_controller.rb +74 -0
  27. data/app/controllers/account_activations_controller.rb +29 -0
  28. data/app/controllers/application_controller.rb +5 -0
  29. data/app/controllers/barkest_core/application_controller_base.rb +113 -0
  30. data/app/controllers/barkest_core/engine_controller_base.rb +15 -0
  31. data/app/controllers/barkest_core/testsub_controller.rb +21 -0
  32. data/app/controllers/contact_controller.rb +32 -0
  33. data/app/controllers/log_view_controller.rb +31 -0
  34. data/app/controllers/password_resets_controller.rb +126 -0
  35. data/app/controllers/sessions_controller.rb +64 -0
  36. data/app/controllers/status_controller.rb +150 -0
  37. data/app/controllers/system_config_controller.rb +238 -0
  38. data/app/controllers/system_update_controller.rb +164 -0
  39. data/app/controllers/test_access_controller.rb +44 -0
  40. data/app/controllers/test_report_controller.rb +75 -0
  41. data/app/controllers/users_controller.rb +218 -0
  42. data/app/helpers/.keep +0 -0
  43. data/app/helpers/barkest_core/application_helper.rb +134 -0
  44. data/app/helpers/barkest_core/form_helper.rb +469 -0
  45. data/app/helpers/barkest_core/html_helper.rb +70 -0
  46. data/app/helpers/barkest_core/misc_helper.rb +68 -0
  47. data/app/helpers/barkest_core/pdf_helper.rb +180 -0
  48. data/app/helpers/barkest_core/recaptcha_helper.rb +115 -0
  49. data/app/helpers/barkest_core/sessions_helper.rb +94 -0
  50. data/app/helpers/barkest_core/status_helper.rb +118 -0
  51. data/app/helpers/barkest_core/users_helper.rb +32 -0
  52. data/app/mailers/.keep +0 -0
  53. data/app/mailers/application_mailer.rb +5 -0
  54. data/app/mailers/barkest_core/application_mailer_base.rb +30 -0
  55. data/app/mailers/barkest_core/contact_form.rb +20 -0
  56. data/app/mailers/barkest_core/user_mailer.rb +44 -0
  57. data/app/models/.keep +0 -0
  58. data/app/models/access_group.rb +121 -0
  59. data/app/models/access_group_group_member.rb +13 -0
  60. data/app/models/access_group_user_member.rb +11 -0
  61. data/app/models/barkest_core/auth_config.rb +95 -0
  62. data/app/models/barkest_core/authorize_failure.rb +7 -0
  63. data/app/models/barkest_core/contact_message.rb +37 -0
  64. data/app/models/barkest_core/database_config.rb +223 -0
  65. data/app/models/barkest_core/db_table.rb +21 -0
  66. data/app/models/barkest_core/email_config.rb +132 -0
  67. data/app/models/barkest_core/global_status.rb +267 -0
  68. data/app/models/barkest_core/log_entry.rb +101 -0
  69. data/app/models/barkest_core/log_view_options.rb +51 -0
  70. data/app/models/barkest_core/ms_sql_db_definition.rb +441 -0
  71. data/app/models/barkest_core/ms_sql_definition.rb +221 -0
  72. data/app/models/barkest_core/ms_sql_function.rb +423 -0
  73. data/app/models/barkest_core/not_logged_in.rb +7 -0
  74. data/app/models/barkest_core/pdf_table_builder.rb +407 -0
  75. data/app/models/barkest_core/self_update_config.rb +37 -0
  76. data/app/models/barkest_core/user_alert.rb +29 -0
  77. data/app/models/barkest_core/user_alert_generators.rb +58 -0
  78. data/app/models/barkest_core/user_manager.rb +404 -0
  79. data/app/models/barkest_core/work_path.rb +74 -0
  80. data/app/models/disable_user.rb +18 -0
  81. data/app/models/ldap_access_group.rb +15 -0
  82. data/app/models/system_config.rb +99 -0
  83. data/app/models/user.rb +405 -0
  84. data/app/models/user_login_history.rb +11 -0
  85. data/app/views/.keep +0 -0
  86. data/app/views/access_groups/_form.html.erb +19 -0
  87. data/app/views/access_groups/edit.html.erb +2 -0
  88. data/app/views/access_groups/index.html.erb +32 -0
  89. data/app/views/access_groups/new.html.erb +2 -0
  90. data/app/views/access_groups/show.html.erb +4 -0
  91. data/app/views/barkest_core/contact_form/contact.html.erb +16 -0
  92. data/app/views/barkest_core/contact_form/contact.text.erb +13 -0
  93. data/app/views/barkest_core/testsub/_links.html.erb +5 -0
  94. data/app/views/barkest_core/testsub/page1.html.erb +3 -0
  95. data/app/views/barkest_core/testsub/page2.html.erb +2 -0
  96. data/app/views/barkest_core/testsub/page3.html.erb +2 -0
  97. data/app/views/barkest_core/user_mailer/account_activation.html.erb +7 -0
  98. data/app/views/barkest_core/user_mailer/account_activation.text.erb +6 -0
  99. data/app/views/barkest_core/user_mailer/invalid_password_reset.html.erb +3 -0
  100. data/app/views/barkest_core/user_mailer/invalid_password_reset.text.erb +5 -0
  101. data/app/views/barkest_core/user_mailer/password_reset.html.erb +8 -0
  102. data/app/views/barkest_core/user_mailer/password_reset.text.erb +7 -0
  103. data/app/views/contact/index.html.erb +24 -0
  104. data/app/views/layouts/_footer_copyright.html.erb +1 -0
  105. data/app/views/layouts/_menu_admin.html.erb +5 -0
  106. data/app/views/layouts/_menu_anon.html.erb +0 -0
  107. data/app/views/layouts/_menu_auth.html.erb +3 -0
  108. data/app/views/layouts/_menu_footer.html.erb +1 -0
  109. data/app/views/layouts/_nav_logo.html.erb +1 -0
  110. data/app/views/layouts/application.html.erb +2 -0
  111. data/app/views/layouts/barkest_core/_application.html.erb +24 -0
  112. data/app/views/layouts/barkest_core/_footer.html.erb +18 -0
  113. data/app/views/layouts/barkest_core/_header.html.erb +38 -0
  114. data/app/views/layouts/barkest_core/_html_mailer.html.erb +11 -0
  115. data/app/views/layouts/barkest_core/_menu_account.html.erb +14 -0
  116. data/app/views/layouts/barkest_core/_menu_sample.html.erb +1 -0
  117. data/app/views/layouts/barkest_core/_messages.html.erb +4 -0
  118. data/app/views/layouts/barkest_core/_shim.html.erb +4 -0
  119. data/app/views/layouts/barkest_core/_subheader.html.erb +1 -0
  120. data/app/views/layouts/barkest_core/_text_mailer.text.erb +4 -0
  121. data/app/views/layouts/mailer.html.erb +1 -0
  122. data/app/views/layouts/mailer.text.erb +1 -0
  123. data/app/views/log_view/index.html.erb +100 -0
  124. data/app/views/password_resets/edit.html.erb +20 -0
  125. data/app/views/password_resets/new.html.erb +14 -0
  126. data/app/views/sessions/new.html.erb +27 -0
  127. data/app/views/shared/_error_messages.html.erb +29 -0
  128. data/app/views/shared/_generic_user_alert.html.erb +4 -0
  129. data/app/views/status/current.html.erb +34 -0
  130. data/app/views/status/test.html.erb +50 -0
  131. data/app/views/system_config/index.html.erb +25 -0
  132. data/app/views/system_config/show_auth.html.erb +28 -0
  133. data/app/views/system_config/show_database.html.erb +36 -0
  134. data/app/views/system_config/show_email.html.erb +21 -0
  135. data/app/views/system_config/show_self_update.html.erb +13 -0
  136. data/app/views/system_update/index.html.erb +31 -0
  137. data/app/views/system_update/new.html.erb +2 -0
  138. data/app/views/test_access/allow_anon.html.erb +2 -0
  139. data/app/views/test_access/require_admin.html.erb +2 -0
  140. data/app/views/test_access/require_group_x.html.erb +2 -0
  141. data/app/views/test_access/require_user.html.erb +2 -0
  142. data/app/views/test_report/index.csv.csvrb +23 -0
  143. data/app/views/test_report/index.html.erb +6 -0
  144. data/app/views/test_report/index.pdf.prawn +50 -0
  145. data/app/views/test_report/index.xlsx.axlsx +28 -0
  146. data/app/views/users/_user.html.erb +57 -0
  147. data/app/views/users/_user_details.html.erb +15 -0
  148. data/app/views/users/_user_details_for_list.html.erb +1 -0
  149. data/app/views/users/_user_form.html.erb +13 -0
  150. data/app/views/users/disable_confirm.html.erb +19 -0
  151. data/app/views/users/edit.html.erb +15 -0
  152. data/app/views/users/index.html.erb +9 -0
  153. data/app/views/users/new.html.erb +10 -0
  154. data/app/views/users/show.html.erb +46 -0
  155. data/bin/rails +12 -0
  156. data/config/routes.rb +3 -0
  157. data/db/migrate/20160617172539_create_access_groups.rb +10 -0
  158. data/db/migrate/20160617172725_create_users.rb +26 -0
  159. data/db/migrate/20160617172833_create_user_login_histories.rb +12 -0
  160. data/db/migrate/20160622151720_create_access_group_user_members.rb +9 -0
  161. data/db/migrate/20160622151925_create_access_group_group_members.rb +9 -0
  162. data/db/migrate/20160701005706_create_ldap_access_groups.rb +11 -0
  163. data/db/migrate/20161108155029_create_system_configs.rb +11 -0
  164. data/db/seeds/barkest_core_01_create_users.rb +42 -0
  165. data/db/seeds.rb +53 -0
  166. data/lib/barkest_core/concerns/association_with_defaults.rb +55 -0
  167. data/lib/barkest_core/concerns/boolean_parser.rb +88 -0
  168. data/lib/barkest_core/concerns/date_parser.rb +181 -0
  169. data/lib/barkest_core/concerns/email_tester.rb +55 -0
  170. data/lib/barkest_core/concerns/encrypted_fields.rb +156 -0
  171. data/lib/barkest_core/concerns/named_model.rb +73 -0
  172. data/lib/barkest_core/concerns/number_parser.rb +145 -0
  173. data/lib/barkest_core/concerns/utc_conversion.rb +60 -0
  174. data/lib/barkest_core/engine.rb +105 -0
  175. data/lib/barkest_core/extensions/active_record_extensions.rb +120 -0
  176. data/lib/barkest_core/extensions/application_configuration_extensions.rb +38 -0
  177. data/lib/barkest_core/extensions/application_extensions.rb +50 -0
  178. data/lib/barkest_core/extensions/axlsx_extenstions.rb +157 -0
  179. data/lib/barkest_core/extensions/fixture_set_extensions.rb +107 -0
  180. data/lib/barkest_core/extensions/generator_extensions.rb +271 -0
  181. data/lib/barkest_core/extensions/main_app_extensions.rb +35 -0
  182. data/lib/barkest_core/extensions/prawn_document_extensions.rb +367 -0
  183. data/lib/barkest_core/extensions/prawn_table_extensions.rb +131 -0
  184. data/lib/barkest_core/extensions/router_extensions.rb +106 -0
  185. data/lib/barkest_core/extensions/simple_formatter_extensions.rb +66 -0
  186. data/lib/barkest_core/extensions/test_case_extensions.rb +348 -0
  187. data/lib/barkest_core/extensions/time_extensions.rb +164 -0
  188. data/lib/barkest_core/handlers/csv_handler.rb +30 -0
  189. data/lib/barkest_core/version.rb +3 -0
  190. data/lib/barkest_core.rb +324 -0
  191. data/lib/generators/barkest/install_generator.rb +102 -0
  192. data/lib/generators/barkest_core/actions/01_patch_application_controller.rb +55 -0
  193. data/lib/generators/barkest_core/actions/02_patch_application_mailer.rb +56 -0
  194. data/lib/generators/barkest_core/actions/03_patch_assets.rb +62 -0
  195. data/lib/generators/barkest_core/actions/04_patch_layouts.rb +36 -0
  196. data/lib/generators/barkest_core/actions/05_patch_routes.rb +93 -0
  197. data/lib/generators/barkest_core/actions/06_patch_seeds.rb +60 -0
  198. data/lib/generators/barkest_core/actions/07_copy_migrations.rb +51 -0
  199. data/lib/generators/barkest_core/actions/08_configure_database.rb +52 -0
  200. data/lib/generators/barkest_core/actions/09_configure_secrets.rb +29 -0
  201. data/lib/generators/barkest_core/actions/99_patch_gitignore.rb +57 -0
  202. data/lib/generators/barkest_core/install_generator.rb +17 -0
  203. data/test/barkest_core_test.rb +83 -0
  204. data/test/controllers/access_groups_controller_test.rb +53 -0
  205. data/test/controllers/contact_controller_test.rb +10 -0
  206. data/test/controllers/sessions_controller_test.rb +10 -0
  207. data/test/controllers/users_controller_test.rb +10 -0
  208. data/test/dummy/.gitignore +10 -0
  209. data/test/dummy/README.rdoc +28 -0
  210. data/test/dummy/Rakefile +6 -0
  211. data/test/dummy/app/assets/images/.keep +0 -0
  212. data/test/dummy/app/assets/javascripts/application.js +14 -0
  213. data/test/dummy/app/assets/stylesheets/application.css +16 -0
  214. data/test/dummy/app/controllers/application_controller.rb +5 -0
  215. data/test/dummy/app/controllers/concerns/.keep +0 -0
  216. data/test/dummy/app/helpers/application_helper.rb +2 -0
  217. data/test/dummy/app/mailers/.keep +0 -0
  218. data/test/dummy/app/mailers/application_mailer.rb +3 -0
  219. data/test/dummy/app/models/.keep +0 -0
  220. data/test/dummy/app/models/concerns/.keep +0 -0
  221. data/test/dummy/app/views/layouts/application.html.erb +1 -0
  222. data/test/dummy/app/views/layouts/mailer.html.erb +1 -0
  223. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  224. data/test/dummy/app/views/system_config/show_fake.html.erb +3 -0
  225. data/test/dummy/bin/bundle +3 -0
  226. data/test/dummy/bin/rails +4 -0
  227. data/test/dummy/bin/rake +4 -0
  228. data/test/dummy/bin/setup +29 -0
  229. data/test/dummy/config/application.rb +27 -0
  230. data/test/dummy/config/boot.rb +5 -0
  231. data/test/dummy/config/environment.rb +5 -0
  232. data/test/dummy/config/environments/development.rb +47 -0
  233. data/test/dummy/config/environments/production.rb +79 -0
  234. data/test/dummy/config/environments/test.rb +44 -0
  235. data/test/dummy/config/initializers/assets.rb +11 -0
  236. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  237. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  238. data/test/dummy/config/initializers/db_updater_ext.rb +33 -0
  239. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  240. data/test/dummy/config/initializers/inflections.rb +16 -0
  241. data/test/dummy/config/initializers/mime_types.rb +4 -0
  242. data/test/dummy/config/initializers/session_store.rb +3 -0
  243. data/test/dummy/config/initializers/sys_config_ext.rb +12 -0
  244. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  245. data/test/dummy/config/locales/en.yml +23 -0
  246. data/test/dummy/config/routes.rb +60 -0
  247. data/test/dummy/config.ru +4 -0
  248. data/test/dummy/db/schema.rb +95 -0
  249. data/test/dummy/db/seeds/barkest_core_01_create_users.rb +42 -0
  250. data/test/dummy/db/seeds.rb +51 -0
  251. data/test/dummy/lib/assets/.keep +0 -0
  252. data/test/dummy/log/.keep +0 -0
  253. data/test/dummy/public/404.html +67 -0
  254. data/test/dummy/public/422.html +67 -0
  255. data/test/dummy/public/500.html +66 -0
  256. data/test/dummy/public/favicon.ico +0 -0
  257. data/test/dummy/sql/my_test_view.sql +3 -0
  258. data/test/fixtures/access_groups.yml +21 -0
  259. data/test/fixtures/users.yml +71 -0
  260. data/test/helpers/barkest_core/sessions_helper_test.rb +22 -0
  261. data/test/integration/access_group_mgmt_test.rb +33 -0
  262. data/test/integration/access_test.rb +24 -0
  263. data/test/integration/account_activations_access_test.rb +12 -0
  264. data/test/integration/contact_test.rb +98 -0
  265. data/test/integration/extra_partial_test.rb +41 -0
  266. data/test/integration/log_view_access_test.rb +12 -0
  267. data/test/integration/password_resets_test.rb +101 -0
  268. data/test/integration/reports_test.rb +53 -0
  269. data/test/integration/status_access_test.rb +27 -0
  270. data/test/integration/system_config_access_test.rb +24 -0
  271. data/test/integration/system_update_access_test.rb +19 -0
  272. data/test/integration/users_access_test.rb +34 -0
  273. data/test/integration/users_edit_test.rb +178 -0
  274. data/test/integration/users_index_test.rb +62 -0
  275. data/test/integration/users_login_test.rb +67 -0
  276. data/test/integration/users_signup_test.rb +54 -0
  277. data/test/mailers/.keep +0 -0
  278. data/test/mailers/barkest_core/contact_form_test.rb +28 -0
  279. data/test/mailers/barkest_core/user_mailer_test.rb +43 -0
  280. data/test/mailers/previews/barkest_core/contact_form_preview.rb +17 -0
  281. data/test/mailers/previews/barkest_core/user_mailer_preview.rb +26 -0
  282. data/test/models/access_group_group_member_test.rb +28 -0
  283. data/test/models/access_group_test.rb +114 -0
  284. data/test/models/access_group_user_member_test.rb +28 -0
  285. data/test/models/barkest_core/auth_config_test.rb +57 -0
  286. data/test/models/barkest_core/bool_parser_test.rb +28 -0
  287. data/test/models/barkest_core/contact_message_test.rb +61 -0
  288. data/test/models/barkest_core/database_config_test.rb +33 -0
  289. data/test/models/barkest_core/date_parser_test.rb +110 -0
  290. data/test/models/barkest_core/email_config_test.rb +57 -0
  291. data/test/models/barkest_core/global_status_test.rb +50 -0
  292. data/test/models/barkest_core/ms_sql_db_updater_test.rb +115 -0
  293. data/test/models/barkest_core/ms_sql_definition_test.rb +102 -0
  294. data/test/models/barkest_core/ms_sql_function_test.rb +131 -0
  295. data/test/models/barkest_core/number_parser_test.rb +29 -0
  296. data/test/models/barkest_core/self_update_config_test.rb +29 -0
  297. data/test/models/barkest_core/user_alert_test.rb +19 -0
  298. data/test/models/barkest_core/user_manager_test.rb +34 -0
  299. data/test/models/barkest_core/work_path_test.rb +26 -0
  300. data/test/models/disable_user_test.rb +27 -0
  301. data/test/models/generic_time_test.rb +66 -0
  302. data/test/models/ldap_access_group_test.rb +31 -0
  303. data/test/models/pdf_table_builder_test.rb +6 -0
  304. data/test/models/system_config_test.rb +78 -0
  305. data/test/models/user_login_history_test.rb +37 -0
  306. data/test/models/user_test.rb +130 -0
  307. data/test/test_helper.rb +63 -0
  308. metadata +798 -0
data/Rakefile ADDED
@@ -0,0 +1,37 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'BarkestCore'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+ load 'rails/tasks/statistics.rake'
22
+
23
+
24
+
25
+ Bundler::GemHelper.install_tasks
26
+
27
+ require 'rake/testtask'
28
+
29
+ Rake::TestTask.new(:test) do |t|
30
+ t.libs << 'lib'
31
+ t.libs << 'test'
32
+ t.pattern = 'test/**/*_test.rb'
33
+ t.verbose = false
34
+ end
35
+
36
+
37
+ task default: :test
File without changes
@@ -0,0 +1,181 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg
3
+ version="1.1"
4
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
5
+ xmlns:cc="http://creativecommons.org/ns#"
6
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
7
+ xmlns:svg="http://www.w3.org/2000/svg"
8
+ xmlns:xlink="http://www.w3.org/1999/xlink"
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ width="250.56"
11
+ height="250.56"
12
+ viewBox="0, 0, 250.56, 250.56"
13
+ preserveAspectRatio="none"
14
+ id="svg2">
15
+ <defs
16
+ id="defs_2903A6EC"/>
17
+ <metadata
18
+ id="metadata7">
19
+ <rdf:RDF>
20
+ <cc:Work
21
+ rdf:about="">
22
+ <dc:format>image/svg+xml</dc:format>
23
+ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
24
+ <dc:title></dc:title>
25
+ </cc:Work>
26
+ </rdf:RDF>
27
+ </metadata>
28
+ <g
29
+ id="layer_Paper"
30
+ style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-opacity:1;fill-rule:nonzero;stroke-linecap:square;stroke-linejoin:miter;stroke-width:1;stroke-miterlimit:10">
31
+ <path
32
+ style="fill:#2400FF;stroke:none"
33
+ id="4BCF0CDB"
34
+ d="M159.091597222,18.36 C160.421064815,18.36 161.750532407,18.36 163.08,18.36 C189.72,18.36 216.36,45 216.36,71.64 C216.36,72.12 216.36,72.6 216.36,73.08 C216.36,99.72 189.72,126.36 163.08,126.36 C161.734618056,126.36 160.389236111,126.36 159.043854167,126.36
35
+ C158.901927083,126.36 158.76,126.218072917 158.76,126.076145833 C158.76,90.2812962963 158.76,54.4864467593 158.76,18.6915972222 C158.76,18.5257986111 158.925798611,18.36 159.091597222,18.36 z"/>
36
+ <path
37
+ style="fill:#2400FF;stroke:none"
38
+ id="FD5252EB"
39
+ d="M159.091597222,119.16 C162.821064815,119.16 166.550532407,119.16 170.28,119.16 C198.72,119.16 227.16,147.6 227.16,176.04 C227.16,176.52 227.16,177 227.16,177.48 C227.16,205.92 198.72,234.36 170.28,234.36
40
+ C166.534618056,234.36 162.789236111,234.36 159.043854167,234.36 C158.901927083,234.36 158.76,234.218072917 158.76,234.076145833 C158.76,195.881296296 158.76,157.686446759 158.76,119.491597222 C158.76,119.325798611 158.925798611,119.16 159.091597222,119.16
41
+ z"/>
42
+ <path
43
+ style="fill:none;stroke:#2400FF;stroke-width:3.6"
44
+ id="7E706A0C"
45
+ d="M19.8,1.8 C90.12,1.8 160.44,1.8 230.76,1.8 C239.76,1.8 248.76,10.8 248.76,19.8 C248.76,90.12 248.76,160.44 248.76,230.76 C248.76,239.76 239.76,248.76 230.76,248.76 C160.44,248.76 90.12,248.76 19.8,248.76
46
+ C10.8,248.76 1.8,239.76 1.8,230.76 C1.8,160.44 1.8,90.12 1.8,19.8 C1.8,10.8 10.8,1.8 19.8,1.8 z"/>
47
+ <rect
48
+ style="fill:#003CFF;stroke:none"
49
+ id="BA7610AC"
50
+ x="25.56"
51
+ y="18.36"
52
+ width="3.6"
53
+ height="216"/>
54
+ <rect
55
+ style="fill:#003CFF;stroke:none"
56
+ id="43594FCC"
57
+ x="31.32"
58
+ y="18.36"
59
+ width="2.16"
60
+ height="216"/>
61
+ <rect
62
+ style="fill:#003CFF;stroke:none"
63
+ id="111A00DC"
64
+ x="39.96"
65
+ y="18.36"
66
+ width="2.16"
67
+ height="216"/>
68
+ <rect
69
+ style="fill:#003CFF;stroke:none"
70
+ id="2BE5B0DC"
71
+ x="45"
72
+ y="18.36"
73
+ width="2.16"
74
+ height="216"/>
75
+ <rect
76
+ style="fill:#003CFF;stroke:none"
77
+ id="242361DC"
78
+ x="52.92"
79
+ y="18.36"
80
+ width="3.6"
81
+ height="216"/>
82
+ <rect
83
+ style="fill:#003CFF;stroke:none"
84
+ id="0B9402DC"
85
+ x="57.96"
86
+ y="18.36"
87
+ width="2.16"
88
+ height="216"/>
89
+ <rect
90
+ style="fill:#003CFF;stroke:none"
91
+ id="E51B82DC"
92
+ x="65.16"
93
+ y="18.36"
94
+ width="3.6"
95
+ height="216"/>
96
+ <rect
97
+ style="fill:#003CFF;stroke:none"
98
+ id="DE6733DC"
99
+ x="70.56"
100
+ y="18.36"
101
+ width="5.76"
102
+ height="216"/>
103
+ <rect
104
+ style="fill:#003CFF;stroke:none"
105
+ id="4BB8A3DC"
106
+ x="78.12"
107
+ y="18.36"
108
+ width="2.16"
109
+ height="216"/>
110
+ <rect
111
+ style="fill:#003CFF;stroke:none"
112
+ id="301134DC"
113
+ x="85.32"
114
+ y="18.36"
115
+ width="3.6"
116
+ height="216"/>
117
+ <rect
118
+ style="fill:#003CFF;stroke:none"
119
+ id="5492B4DC"
120
+ x="90.36"
121
+ y="18.36"
122
+ width="5.76"
123
+ height="216"/>
124
+ <rect
125
+ style="fill:#003CFF;stroke:none"
126
+ id="E72525DC"
127
+ x="101.16"
128
+ y="18.36"
129
+ width="2.16"
130
+ height="216"/>
131
+ <rect
132
+ style="fill:#003CFF;stroke:none"
133
+ id="390495DC"
134
+ x="104.76"
135
+ y="18.36"
136
+ width="3.6"
137
+ height="216"/>
138
+ <rect
139
+ style="fill:#003CFF;stroke:none"
140
+ id="65A516DC"
141
+ x="110.16"
142
+ y="18.36"
143
+ width="3.6"
144
+ height="216"/>
145
+ <rect
146
+ style="fill:#003CFF;stroke:none"
147
+ id="ACA986DC"
148
+ x="115.56"
149
+ y="18.36"
150
+ width="7.2"
151
+ height="216"/>
152
+ <rect
153
+ style="fill:#003CFF;stroke:none"
154
+ id="D941F6DC"
155
+ x="124.92"
156
+ y="18.36"
157
+ width="3.6"
158
+ height="216"/>
159
+ <rect
160
+ style="fill:#003CFF;stroke:none"
161
+ id="A1C6A7DC"
162
+ x="133.56"
163
+ y="18.36"
164
+ width="5.76"
165
+ height="216"/>
166
+ <rect
167
+ style="fill:#003CFF;stroke:none"
168
+ id="E57708DC"
169
+ x="140.76"
170
+ y="18.36"
171
+ width="2.16"
172
+ height="216"/>
173
+ <rect
174
+ style="fill:#003CFF;stroke:none"
175
+ id="662388DC"
176
+ x="144.36"
177
+ y="18.36"
178
+ width="3.6"
179
+ height="216"/>
180
+ </g>
181
+ </svg>
File without changes
@@ -0,0 +1,22 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require bootstrap
16
+ //= require barkest_core/bootstrap-datepicker
17
+ //= require barkest_core/jquery.doubleScroll
18
+ //= require barkest_core/masked_edit
19
+ //= require barkest_core/system_status
20
+ //= require_tree .
21
+ //= require barkest_core/field_init
22
+
@@ -0,0 +1,1800 @@
1
+ /*!
2
+ * Datepicker for Bootstrap v1.5.0-dev (https://github.com/eternicode/bootstrap-datepicker)
3
+ *
4
+ * Copyright 2012 Stefan Petre
5
+ * Improvements by Andrew Rowls
6
+ * Licensed under the Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0)
7
+ */(function($, undefined){
8
+
9
+ function UTCDate(){
10
+ return new Date(Date.UTC.apply(Date, arguments));
11
+ }
12
+ function UTCToday(){
13
+ var today = new Date();
14
+ return UTCDate(today.getFullYear(), today.getMonth(), today.getDate());
15
+ }
16
+ function isUTCEquals(date1, date2) {
17
+ return (
18
+ date1.getUTCFullYear() === date2.getUTCFullYear() &&
19
+ date1.getUTCMonth() === date2.getUTCMonth() &&
20
+ date1.getUTCDate() === date2.getUTCDate()
21
+ );
22
+ }
23
+ function alias(method){
24
+ return function(){
25
+ return this[method].apply(this, arguments);
26
+ };
27
+ }
28
+
29
+ var DateArray = (function(){
30
+ var extras = {
31
+ get: function(i){
32
+ return this.slice(i)[0];
33
+ },
34
+ contains: function(d){
35
+ // Array.indexOf is not cross-browser;
36
+ // $.inArray doesn't work with Dates
37
+ var val = d && d.valueOf();
38
+ for (var i=0, l=this.length; i < l; i++)
39
+ if (this[i].valueOf() === val)
40
+ return i;
41
+ return -1;
42
+ },
43
+ remove: function(i){
44
+ this.splice(i,1);
45
+ },
46
+ replace: function(new_array){
47
+ if (!new_array)
48
+ return;
49
+ if (!$.isArray(new_array))
50
+ new_array = [new_array];
51
+ this.clear();
52
+ this.push.apply(this, new_array);
53
+ },
54
+ clear: function(){
55
+ this.length = 0;
56
+ },
57
+ copy: function(){
58
+ var a = new DateArray();
59
+ a.replace(this);
60
+ return a;
61
+ }
62
+ };
63
+
64
+ return function(){
65
+ var a = [];
66
+ a.push.apply(a, arguments);
67
+ $.extend(a, extras);
68
+ return a;
69
+ };
70
+ })();
71
+
72
+
73
+ // Picker object
74
+
75
+ var Datepicker = function(element, options){
76
+ this._process_options(options);
77
+
78
+ this.dates = new DateArray();
79
+ this.viewDate = this.o.defaultViewDate;
80
+ this.focusDate = null;
81
+
82
+ this.element = $(element);
83
+ this.isInline = false;
84
+ this.isInput = this.element.is('input');
85
+ this.component = this.element.hasClass('date') ? this.element.find('.add-on, .input-group-addon, .btn') : false;
86
+ this.hasInput = this.component && this.element.find('input').length;
87
+ if (this.component && this.component.length === 0)
88
+ this.component = false;
89
+
90
+ this.picker = $(DPGlobal.template);
91
+ this._buildEvents();
92
+ this._attachEvents();
93
+
94
+ if (this.isInline){
95
+ this.picker.addClass('datepicker-inline').appendTo(this.element);
96
+ }
97
+ else {
98
+ this.picker.addClass('datepicker-dropdown dropdown-menu');
99
+ }
100
+
101
+ if (this.o.rtl){
102
+ this.picker.addClass('datepicker-rtl');
103
+ }
104
+
105
+ this.viewMode = this.o.startView;
106
+
107
+ if (this.o.calendarWeeks)
108
+ this.picker.find('tfoot .today, tfoot .clear')
109
+ .attr('colspan', function(i, val){
110
+ return parseInt(val) + 1;
111
+ });
112
+
113
+ this._allow_update = false;
114
+
115
+ this.setStartDate(this._o.startDate);
116
+ this.setEndDate(this._o.endDate);
117
+ this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled);
118
+ this.setDatesDisabled(this.o.datesDisabled);
119
+
120
+ this.fillDow();
121
+ this.fillMonths();
122
+
123
+ this._allow_update = true;
124
+
125
+ this.update();
126
+ this.showMode();
127
+
128
+ if (this.isInline){
129
+ this.show();
130
+ }
131
+ };
132
+
133
+ Datepicker.prototype = {
134
+ constructor: Datepicker,
135
+
136
+ _process_options: function(opts){
137
+ // Store raw options for reference
138
+ this._o = $.extend({}, this._o, opts);
139
+ // Processed options
140
+ var o = this.o = $.extend({}, this._o);
141
+
142
+ // Check if "de-DE" style date is available, if not language should
143
+ // fallback to 2 letter code eg "de"
144
+ var lang = o.language;
145
+ if (!dates[lang]){
146
+ lang = lang.split('-')[0];
147
+ if (!dates[lang])
148
+ lang = defaults.language;
149
+ }
150
+ o.language = lang;
151
+
152
+ switch (o.startView){
153
+ case 2:
154
+ case 'decade':
155
+ o.startView = 2;
156
+ break;
157
+ case 1:
158
+ case 'year':
159
+ o.startView = 1;
160
+ break;
161
+ default:
162
+ o.startView = 0;
163
+ }
164
+
165
+ switch (o.minViewMode){
166
+ case 1:
167
+ case 'months':
168
+ o.minViewMode = 1;
169
+ break;
170
+ case 2:
171
+ case 'years':
172
+ o.minViewMode = 2;
173
+ break;
174
+ default:
175
+ o.minViewMode = 0;
176
+ }
177
+
178
+ o.startView = Math.max(o.startView, o.minViewMode);
179
+
180
+ // true, false, or Number > 0
181
+ if (o.multidate !== true){
182
+ o.multidate = Number(o.multidate) || false;
183
+ if (o.multidate !== false)
184
+ o.multidate = Math.max(0, o.multidate);
185
+ }
186
+ o.multidateSeparator = String(o.multidateSeparator);
187
+
188
+ o.weekStart %= 7;
189
+ o.weekEnd = ((o.weekStart + 6) % 7);
190
+
191
+ var format = DPGlobal.parseFormat(o.format);
192
+ if (o.startDate !== -Infinity){
193
+ if (!!o.startDate){
194
+ if (o.startDate instanceof Date)
195
+ o.startDate = this._local_to_utc(this._zero_time(o.startDate));
196
+ else
197
+ o.startDate = DPGlobal.parseDate(o.startDate, format, o.language);
198
+ }
199
+ else {
200
+ o.startDate = -Infinity;
201
+ }
202
+ }
203
+ if (o.endDate !== Infinity){
204
+ if (!!o.endDate){
205
+ if (o.endDate instanceof Date)
206
+ o.endDate = this._local_to_utc(this._zero_time(o.endDate));
207
+ else
208
+ o.endDate = DPGlobal.parseDate(o.endDate, format, o.language);
209
+ }
210
+ else {
211
+ o.endDate = Infinity;
212
+ }
213
+ }
214
+
215
+ o.daysOfWeekDisabled = o.daysOfWeekDisabled||[];
216
+ if (!$.isArray(o.daysOfWeekDisabled))
217
+ o.daysOfWeekDisabled = o.daysOfWeekDisabled.split(/[,\s]*/);
218
+ o.daysOfWeekDisabled = $.map(o.daysOfWeekDisabled, function(d){
219
+ return parseInt(d, 10);
220
+ });
221
+
222
+ o.datesDisabled = o.datesDisabled||[];
223
+ if (!$.isArray(o.datesDisabled)) {
224
+ var datesDisabled = [];
225
+ datesDisabled.push(DPGlobal.parseDate(o.datesDisabled, format, o.language));
226
+ o.datesDisabled = datesDisabled;
227
+ }
228
+ o.datesDisabled = $.map(o.datesDisabled,function(d){
229
+ return DPGlobal.parseDate(d, format, o.language);
230
+ });
231
+
232
+ var plc = String(o.orientation).toLowerCase().split(/\s+/g),
233
+ _plc = o.orientation.toLowerCase();
234
+ plc = $.grep(plc, function(word){
235
+ return /^auto|left|right|top|bottom$/.test(word);
236
+ });
237
+ o.orientation = {x: 'auto', y: 'auto'};
238
+ if (!_plc || _plc === 'auto')
239
+ ; // no action
240
+ else if (plc.length === 1){
241
+ switch (plc[0]){
242
+ case 'top':
243
+ case 'bottom':
244
+ o.orientation.y = plc[0];
245
+ break;
246
+ case 'left':
247
+ case 'right':
248
+ o.orientation.x = plc[0];
249
+ break;
250
+ }
251
+ }
252
+ else {
253
+ _plc = $.grep(plc, function(word){
254
+ return /^left|right$/.test(word);
255
+ });
256
+ o.orientation.x = _plc[0] || 'auto';
257
+
258
+ _plc = $.grep(plc, function(word){
259
+ return /^top|bottom$/.test(word);
260
+ });
261
+ o.orientation.y = _plc[0] || 'auto';
262
+ }
263
+ if (o.defaultViewDate) {
264
+ var year = o.defaultViewDate.year || new Date().getFullYear();
265
+ var month = o.defaultViewDate.month || 0;
266
+ var day = o.defaultViewDate.day || 1;
267
+ o.defaultViewDate = UTCDate(year, month, day);
268
+ } else {
269
+ o.defaultViewDate = UTCToday();
270
+ }
271
+ o.showOnFocus = o.showOnFocus !== undefined ? o.showOnFocus : true;
272
+ },
273
+ _events: [],
274
+ _secondaryEvents: [],
275
+ _applyEvents: function(evs){
276
+ for (var i=0, el, ch, ev; i < evs.length; i++){
277
+ el = evs[i][0];
278
+ if (evs[i].length === 2){
279
+ ch = undefined;
280
+ ev = evs[i][1];
281
+ }
282
+ else if (evs[i].length === 3){
283
+ ch = evs[i][1];
284
+ ev = evs[i][2];
285
+ }
286
+ el.on(ev, ch);
287
+ }
288
+ },
289
+ _unapplyEvents: function(evs){
290
+ for (var i=0, el, ev, ch; i < evs.length; i++){
291
+ el = evs[i][0];
292
+ if (evs[i].length === 2){
293
+ ch = undefined;
294
+ ev = evs[i][1];
295
+ }
296
+ else if (evs[i].length === 3){
297
+ ch = evs[i][1];
298
+ ev = evs[i][2];
299
+ }
300
+ el.off(ev, ch);
301
+ }
302
+ },
303
+ _buildEvents: function(){
304
+ var events = {
305
+ keyup: $.proxy(function(e){
306
+ if ($.inArray(e.keyCode, [27, 37, 39, 38, 40, 32, 13, 9]) === -1)
307
+ this.update();
308
+ }, this),
309
+ keydown: $.proxy(this.keydown, this),
310
+ paste: $.proxy(this.paste, this)
311
+ };
312
+
313
+ if (this.o.showOnFocus === true) {
314
+ events.focus = $.proxy(this.show, this);
315
+ }
316
+
317
+ if (this.isInput) { // single input
318
+ this._events = [
319
+ [this.element, events]
320
+ ];
321
+ }
322
+ else if (this.component && this.hasInput) { // component: input + button
323
+ this._events = [
324
+ // For components that are not readonly, allow keyboard nav
325
+ [this.element.find('input'), events],
326
+ [this.component, {
327
+ click: $.proxy(this.show, this)
328
+ }]
329
+ ];
330
+ }
331
+ else if (this.element.is('div')){ // inline datepicker
332
+ this.isInline = true;
333
+ }
334
+ else {
335
+ this._events = [
336
+ [this.element, {
337
+ click: $.proxy(this.show, this)
338
+ }]
339
+ ];
340
+ }
341
+ this._events.push(
342
+ // Component: listen for blur on element descendants
343
+ [this.element, '*', {
344
+ blur: $.proxy(function(e){
345
+ this._focused_from = e.target;
346
+ }, this)
347
+ }],
348
+ // Input: listen for blur on element
349
+ [this.element, {
350
+ blur: $.proxy(function(e){
351
+ this._focused_from = e.target;
352
+ }, this)
353
+ }]
354
+ );
355
+
356
+ this._secondaryEvents = [
357
+ [this.picker, {
358
+ click: $.proxy(this.click, this)
359
+ }],
360
+ [$(window), {
361
+ resize: $.proxy(this.place, this)
362
+ }],
363
+ [$(document), {
364
+ mousedown: $.proxy(function(e){
365
+ // Clicked outside the datepicker, hide it
366
+ if (!(
367
+ this.element.is(e.target) ||
368
+ this.element.find(e.target).length ||
369
+ this.picker.is(e.target) ||
370
+ this.picker.find(e.target).length
371
+ )){
372
+ this.hide();
373
+ }
374
+ }, this)
375
+ }]
376
+ ];
377
+ },
378
+ _attachEvents: function(){
379
+ this._detachEvents();
380
+ this._applyEvents(this._events);
381
+ },
382
+ _detachEvents: function(){
383
+ this._unapplyEvents(this._events);
384
+ },
385
+ _attachSecondaryEvents: function(){
386
+ this._detachSecondaryEvents();
387
+ this._applyEvents(this._secondaryEvents);
388
+ },
389
+ _detachSecondaryEvents: function(){
390
+ this._unapplyEvents(this._secondaryEvents);
391
+ },
392
+ _trigger: function(event, altdate){
393
+ var date = altdate || this.dates.get(-1),
394
+ local_date = this._utc_to_local(date);
395
+
396
+ this.element.trigger({
397
+ type: event,
398
+ date: local_date,
399
+ dates: $.map(this.dates, this._utc_to_local),
400
+ format: $.proxy(function(ix, format){
401
+ if (arguments.length === 0){
402
+ ix = this.dates.length - 1;
403
+ format = this.o.format;
404
+ }
405
+ else if (typeof ix === 'string'){
406
+ format = ix;
407
+ ix = this.dates.length - 1;
408
+ }
409
+ format = format || this.o.format;
410
+ var date = this.dates.get(ix);
411
+ return DPGlobal.formatDate(date, format, this.o.language);
412
+ }, this)
413
+ });
414
+ },
415
+
416
+ show: function(){
417
+ if (this.element.attr('readonly') && this.o.enableOnReadonly === false)
418
+ return;
419
+ if (!this.isInline)
420
+ this.picker.appendTo(this.o.container);
421
+ this.place();
422
+ this.picker.show();
423
+ this._attachSecondaryEvents();
424
+ this._trigger('show');
425
+ if ((window.navigator.msMaxTouchPoints || 'ontouchstart' in document) && this.o.disableTouchKeyboard) {
426
+ $(this.element).blur();
427
+ }
428
+ return this;
429
+ },
430
+
431
+ hide: function(){
432
+ if (this.isInline)
433
+ return this;
434
+ if (!this.picker.is(':visible'))
435
+ return this;
436
+ this.focusDate = null;
437
+ this.picker.hide().detach();
438
+ this._detachSecondaryEvents();
439
+ this.viewMode = this.o.startView;
440
+ this.showMode();
441
+
442
+ if (
443
+ this.o.forceParse &&
444
+ (
445
+ this.isInput && this.element.val() ||
446
+ this.hasInput && this.element.find('input').val()
447
+ )
448
+ )
449
+ this.setValue();
450
+ this._trigger('hide');
451
+ return this;
452
+ },
453
+
454
+ remove: function(){
455
+ this.hide();
456
+ this._detachEvents();
457
+ this._detachSecondaryEvents();
458
+ this.picker.remove();
459
+ delete this.element.data().datepicker;
460
+ if (!this.isInput){
461
+ delete this.element.data().date;
462
+ }
463
+ return this;
464
+ },
465
+
466
+ paste: function(evt){
467
+ var dateString;
468
+ if (evt.originalEvent.clipboardData && evt.originalEvent.clipboardData.types
469
+ && $.inArray('text/plain', evt.originalEvent.clipboardData.types) !== -1) {
470
+ dateString = evt.originalEvent.clipboardData.getData('text/plain');
471
+ }
472
+ else if (window.clipboardData) {
473
+ dateString = window.clipboardData.getData('Text');
474
+ }
475
+ else {
476
+ return;
477
+ }
478
+ this.setDate(dateString);
479
+ this.update();
480
+ evt.preventDefault();
481
+ },
482
+
483
+ _utc_to_local: function(utc){
484
+ return utc && new Date(utc.getTime() + (utc.getTimezoneOffset()*60000));
485
+ },
486
+ _local_to_utc: function(local){
487
+ return local && new Date(local.getTime() - (local.getTimezoneOffset()*60000));
488
+ },
489
+ _zero_time: function(local){
490
+ return local && new Date(local.getFullYear(), local.getMonth(), local.getDate());
491
+ },
492
+ _zero_utc_time: function(utc){
493
+ return utc && new Date(Date.UTC(utc.getUTCFullYear(), utc.getUTCMonth(), utc.getUTCDate()));
494
+ },
495
+
496
+ getDates: function(){
497
+ return $.map(this.dates, this._utc_to_local);
498
+ },
499
+
500
+ getUTCDates: function(){
501
+ return $.map(this.dates, function(d){
502
+ return new Date(d);
503
+ });
504
+ },
505
+
506
+ getDate: function(){
507
+ return this._utc_to_local(this.getUTCDate());
508
+ },
509
+
510
+ getUTCDate: function(){
511
+ var selected_date = this.dates.get(-1);
512
+ if (typeof selected_date !== 'undefined') {
513
+ return new Date(selected_date);
514
+ } else {
515
+ return null;
516
+ }
517
+ },
518
+
519
+ clearDates: function(){
520
+ var element;
521
+ if (this.isInput) {
522
+ element = this.element;
523
+ } else if (this.component) {
524
+ element = this.element.find('input');
525
+ }
526
+
527
+ if (element) {
528
+ element.val('').change();
529
+ }
530
+
531
+ this.update();
532
+ this._trigger('changeDate');
533
+
534
+ if (this.o.autoclose) {
535
+ this.hide();
536
+ }
537
+ },
538
+ setDates: function(){
539
+ var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
540
+ this.update.apply(this, args);
541
+ this._trigger('changeDate');
542
+ this.setValue();
543
+ return this;
544
+ },
545
+
546
+ setUTCDates: function(){
547
+ var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
548
+ this.update.apply(this, $.map(args, this._utc_to_local));
549
+ this._trigger('changeDate');
550
+ this.setValue();
551
+ return this;
552
+ },
553
+
554
+ setDate: alias('setDates'),
555
+ setUTCDate: alias('setUTCDates'),
556
+
557
+ setValue: function(){
558
+ var formatted = this.getFormattedDate();
559
+ if (!this.isInput){
560
+ if (this.component){
561
+ this.element.find('input').val(formatted).change();
562
+ }
563
+ }
564
+ else {
565
+ this.element.val(formatted).change();
566
+ }
567
+ return this;
568
+ },
569
+
570
+ getFormattedDate: function(format){
571
+ if (format === undefined)
572
+ format = this.o.format;
573
+
574
+ var lang = this.o.language;
575
+ return $.map(this.dates, function(d){
576
+ return DPGlobal.formatDate(d, format, lang);
577
+ }).join(this.o.multidateSeparator);
578
+ },
579
+
580
+ setStartDate: function(startDate){
581
+ this._process_options({startDate: startDate});
582
+ this.update();
583
+ this.updateNavArrows();
584
+ return this;
585
+ },
586
+
587
+ setEndDate: function(endDate){
588
+ this._process_options({endDate: endDate});
589
+ this.update();
590
+ this.updateNavArrows();
591
+ return this;
592
+ },
593
+
594
+ setDaysOfWeekDisabled: function(daysOfWeekDisabled){
595
+ this._process_options({daysOfWeekDisabled: daysOfWeekDisabled});
596
+ this.update();
597
+ this.updateNavArrows();
598
+ return this;
599
+ },
600
+
601
+ setDatesDisabled: function(datesDisabled){
602
+ this._process_options({datesDisabled: datesDisabled});
603
+ this.update();
604
+ this.updateNavArrows();
605
+ },
606
+
607
+ place: function(){
608
+ if (this.isInline)
609
+ return this;
610
+ var calendarWidth = this.picker.outerWidth(),
611
+ calendarHeight = this.picker.outerHeight(),
612
+ visualPadding = 10,
613
+ windowWidth = $(this.o.container).width(),
614
+ windowHeight = $(this.o.container).height(),
615
+ scrollTop = $(this.o.container).scrollTop(),
616
+ appendOffset = $(this.o.container).offset();
617
+
618
+ var parentsZindex = [];
619
+ this.element.parents().each(function(){
620
+ var itemZIndex = $(this).css('z-index');
621
+ if (itemZIndex !== 'auto' && itemZIndex !== 0) parentsZindex.push(parseInt(itemZIndex));
622
+ });
623
+ var zIndex = Math.max.apply(Math, parentsZindex) + 10;
624
+ var offset = this.component ? this.component.parent().offset() : this.element.offset();
625
+ var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(false);
626
+ var width = this.component ? this.component.outerWidth(true) : this.element.outerWidth(false);
627
+ var left = offset.left - appendOffset.left,
628
+ top = offset.top - appendOffset.top;
629
+
630
+ this.picker.removeClass(
631
+ 'datepicker-orient-top datepicker-orient-bottom '+
632
+ 'datepicker-orient-right datepicker-orient-left'
633
+ );
634
+
635
+ if (this.o.orientation.x !== 'auto'){
636
+ this.picker.addClass('datepicker-orient-' + this.o.orientation.x);
637
+ if (this.o.orientation.x === 'right')
638
+ left -= calendarWidth - width;
639
+ }
640
+ // auto x orientation is best-placement: if it crosses a window
641
+ // edge, fudge it sideways
642
+ else {
643
+ if (offset.left < 0) {
644
+ // component is outside the window on the left side. Move it into visible range
645
+ this.picker.addClass('datepicker-orient-left');
646
+ left -= offset.left - visualPadding;
647
+ } else if (left + calendarWidth > windowWidth) {
648
+ // the calendar passes the widow right edge. Align it to component right side
649
+ this.picker.addClass('datepicker-orient-right');
650
+ left = offset.left + width - calendarWidth;
651
+ } else {
652
+ // Default to left
653
+ this.picker.addClass('datepicker-orient-left');
654
+ }
655
+ }
656
+
657
+ // auto y orientation is best-situation: top or bottom, no fudging,
658
+ // decision based on which shows more of the calendar
659
+ var yorient = this.o.orientation.y,
660
+ top_overflow, bottom_overflow;
661
+ if (yorient === 'auto'){
662
+ top_overflow = -scrollTop + top - calendarHeight - 100; // (-100) to prefer the downward orientation.
663
+ bottom_overflow = scrollTop + windowHeight - (top + height + calendarHeight);
664
+ if (Math.max(top_overflow, bottom_overflow) === bottom_overflow)
665
+ yorient = 'top';
666
+ else
667
+ yorient = 'bottom';
668
+ }
669
+ this.picker.addClass('datepicker-orient-' + yorient);
670
+ if (yorient === 'top')
671
+ top += height;
672
+ else
673
+ top -= calendarHeight + parseInt(this.picker.css('padding-top'));
674
+
675
+ if (this.o.rtl) {
676
+ var right = windowWidth - (left + width);
677
+ this.picker.css({
678
+ top: top,
679
+ right: right,
680
+ zIndex: zIndex
681
+ });
682
+ } else {
683
+ this.picker.css({
684
+ top: top,
685
+ left: left,
686
+ zIndex: zIndex
687
+ });
688
+ }
689
+ return this;
690
+ },
691
+
692
+ _allow_update: true,
693
+ update: function(){
694
+ if (!this._allow_update)
695
+ return this;
696
+
697
+ var oldDates = this.dates.copy(),
698
+ dates = [],
699
+ fromArgs = false;
700
+ if (arguments.length){
701
+ $.each(arguments, $.proxy(function(i, date){
702
+ if (date instanceof Date)
703
+ date = this._local_to_utc(date);
704
+ dates.push(date);
705
+ }, this));
706
+ fromArgs = true;
707
+ }
708
+ else {
709
+ dates = this.isInput
710
+ ? this.element.val()
711
+ : this.element.data('date') || this.element.find('input').val();
712
+ if (dates && this.o.multidate)
713
+ dates = dates.split(this.o.multidateSeparator);
714
+ else
715
+ dates = [dates];
716
+ delete this.element.data().date;
717
+ }
718
+
719
+ dates = $.map(dates, $.proxy(function(date){
720
+ return DPGlobal.parseDate(date, this.o.format, this.o.language);
721
+ }, this));
722
+ dates = $.grep(dates, $.proxy(function(date){
723
+ return (
724
+ date < this.o.startDate ||
725
+ date > this.o.endDate ||
726
+ !date
727
+ );
728
+ }, this), true);
729
+ this.dates.replace(dates);
730
+
731
+ if (this.dates.length)
732
+ this.viewDate = new Date(this.dates.get(-1));
733
+ else if (this.viewDate < this.o.startDate)
734
+ this.viewDate = new Date(this.o.startDate);
735
+ else if (this.viewDate > this.o.endDate)
736
+ this.viewDate = new Date(this.o.endDate);
737
+
738
+ if (fromArgs){
739
+ // setting date by clicking
740
+ this.setValue();
741
+ }
742
+ else if (dates.length){
743
+ // setting date by typing
744
+ if (String(oldDates) !== String(this.dates))
745
+ this._trigger('changeDate');
746
+ }
747
+ if (!this.dates.length && oldDates.length)
748
+ this._trigger('clearDate');
749
+
750
+ this.fill();
751
+ return this;
752
+ },
753
+
754
+ fillDow: function(){
755
+ var dowCnt = this.o.weekStart,
756
+ html = '<tr>';
757
+ if (this.o.calendarWeeks){
758
+ this.picker.find('.datepicker-days thead tr:first-child .datepicker-switch')
759
+ .attr('colspan', function(i, val){
760
+ return parseInt(val) + 1;
761
+ });
762
+ var cell = '<th class="cw">&#160;</th>';
763
+ html += cell;
764
+ }
765
+ while (dowCnt < this.o.weekStart + 7){
766
+ html += '<th class="dow">'+dates[this.o.language].daysMin[(dowCnt++)%7]+'</th>';
767
+ }
768
+ html += '</tr>';
769
+ this.picker.find('.datepicker-days thead').append(html);
770
+ },
771
+
772
+ fillMonths: function(){
773
+ var html = '',
774
+ i = 0;
775
+ while (i < 12){
776
+ html += '<span class="month">'+dates[this.o.language].monthsShort[i++]+'</span>';
777
+ }
778
+ this.picker.find('.datepicker-months td').html(html);
779
+ },
780
+
781
+ setRange: function(range){
782
+ if (!range || !range.length)
783
+ delete this.range;
784
+ else
785
+ this.range = $.map(range, function(d){
786
+ return d.valueOf();
787
+ });
788
+ this.fill();
789
+ },
790
+
791
+ getClassNames: function(date){
792
+ var cls = [],
793
+ year = this.viewDate.getUTCFullYear(),
794
+ month = this.viewDate.getUTCMonth(),
795
+ today = new Date();
796
+ if (date.getUTCFullYear() < year || (date.getUTCFullYear() === year && date.getUTCMonth() < month)){
797
+ cls.push('old');
798
+ }
799
+ else if (date.getUTCFullYear() > year || (date.getUTCFullYear() === year && date.getUTCMonth() > month)){
800
+ cls.push('new');
801
+ }
802
+ if (this.focusDate && date.valueOf() === this.focusDate.valueOf())
803
+ cls.push('focused');
804
+ // Compare internal UTC date with local today, not UTC today
805
+ if (this.o.todayHighlight &&
806
+ date.getUTCFullYear() === today.getFullYear() &&
807
+ date.getUTCMonth() === today.getMonth() &&
808
+ date.getUTCDate() === today.getDate()){
809
+ cls.push('today');
810
+ }
811
+ if (this.dates.contains(date) !== -1)
812
+ cls.push('active');
813
+ if (date.valueOf() < this.o.startDate || date.valueOf() > this.o.endDate ||
814
+ $.inArray(date.getUTCDay(), this.o.daysOfWeekDisabled) !== -1){
815
+ cls.push('disabled');
816
+ }
817
+ if (this.o.datesDisabled.length > 0 &&
818
+ $.grep(this.o.datesDisabled, function(d){
819
+ return isUTCEquals(date, d); }).length > 0) {
820
+ cls.push('disabled', 'disabled-date');
821
+ }
822
+
823
+ if (this.range){
824
+ if (date > this.range[0] && date < this.range[this.range.length-1]){
825
+ cls.push('range');
826
+ }
827
+ if ($.inArray(date.valueOf(), this.range) !== -1){
828
+ cls.push('selected');
829
+ }
830
+ }
831
+ return cls;
832
+ },
833
+
834
+ fill: function(){
835
+ var d = new Date(this.viewDate),
836
+ year = d.getUTCFullYear(),
837
+ month = d.getUTCMonth(),
838
+ startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity,
839
+ startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity,
840
+ endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity,
841
+ endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity,
842
+ todaytxt = dates[this.o.language].today || dates['en'].today || '',
843
+ cleartxt = dates[this.o.language].clear || dates['en'].clear || '',
844
+ tooltip;
845
+ if (isNaN(year) || isNaN(month))
846
+ return;
847
+ this.picker.find('.datepicker-days thead .datepicker-switch')
848
+ .text(dates[this.o.language].months[month]+' '+year);
849
+ this.picker.find('tfoot .today')
850
+ .text(todaytxt)
851
+ .toggle(this.o.todayBtn !== false);
852
+ this.picker.find('tfoot .clear')
853
+ .text(cleartxt)
854
+ .toggle(this.o.clearBtn !== false);
855
+ this.updateNavArrows();
856
+ this.fillMonths();
857
+ var prevMonth = UTCDate(year, month-1, 28),
858
+ day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth());
859
+ prevMonth.setUTCDate(day);
860
+ prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.o.weekStart + 7)%7);
861
+ var nextMonth = new Date(prevMonth);
862
+ nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);
863
+ nextMonth = nextMonth.valueOf();
864
+ var html = [];
865
+ var clsName;
866
+ while (prevMonth.valueOf() < nextMonth){
867
+ if (prevMonth.getUTCDay() === this.o.weekStart){
868
+ html.push('<tr>');
869
+ if (this.o.calendarWeeks){
870
+ // ISO 8601: First week contains first thursday.
871
+ // ISO also states week starts on Monday, but we can be more abstract here.
872
+ var
873
+ // Start of current week: based on weekstart/current date
874
+ ws = new Date(+prevMonth + (this.o.weekStart - prevMonth.getUTCDay() - 7) % 7 * 864e5),
875
+ // Thursday of this week
876
+ th = new Date(Number(ws) + (7 + 4 - ws.getUTCDay()) % 7 * 864e5),
877
+ // First Thursday of year, year from thursday
878
+ yth = new Date(Number(yth = UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay())%7*864e5),
879
+ // Calendar week: ms between thursdays, div ms per day, div 7 days
880
+ calWeek = (th - yth) / 864e5 / 7 + 1;
881
+ html.push('<td class="cw">'+ calWeek +'</td>');
882
+
883
+ }
884
+ }
885
+ clsName = this.getClassNames(prevMonth);
886
+ clsName.push('day');
887
+
888
+ if (this.o.beforeShowDay !== $.noop){
889
+ var before = this.o.beforeShowDay(this._utc_to_local(prevMonth));
890
+ if (before === undefined)
891
+ before = {};
892
+ else if (typeof(before) === 'boolean')
893
+ before = {enabled: before};
894
+ else if (typeof(before) === 'string')
895
+ before = {classes: before};
896
+ if (before.enabled === false)
897
+ clsName.push('disabled');
898
+ if (before.classes)
899
+ clsName = clsName.concat(before.classes.split(/\s+/));
900
+ if (before.tooltip)
901
+ tooltip = before.tooltip;
902
+ }
903
+
904
+ clsName = $.unique(clsName);
905
+ html.push('<td class="'+clsName.join(' ')+'"' + (tooltip ? ' title="'+tooltip+'"' : '') + '>'+prevMonth.getUTCDate() + '</td>');
906
+ tooltip = null;
907
+ if (prevMonth.getUTCDay() === this.o.weekEnd){
908
+ html.push('</tr>');
909
+ }
910
+ prevMonth.setUTCDate(prevMonth.getUTCDate()+1);
911
+ }
912
+ this.picker.find('.datepicker-days tbody').empty().append(html.join(''));
913
+
914
+ var months = this.picker.find('.datepicker-months')
915
+ .find('th:eq(1)')
916
+ .text(year)
917
+ .end()
918
+ .find('span').removeClass('active');
919
+
920
+ $.each(this.dates, function(i, d){
921
+ if (d.getUTCFullYear() === year)
922
+ months.eq(d.getUTCMonth()).addClass('active');
923
+ });
924
+
925
+ if (year < startYear || year > endYear){
926
+ months.addClass('disabled');
927
+ }
928
+ if (year === startYear){
929
+ months.slice(0, startMonth).addClass('disabled');
930
+ }
931
+ if (year === endYear){
932
+ months.slice(endMonth+1).addClass('disabled');
933
+ }
934
+
935
+ if (this.o.beforeShowMonth !== $.noop){
936
+ var that = this;
937
+ $.each(months, function(i, month){
938
+ if (!$(month).hasClass('disabled')) {
939
+ var moDate = new Date(year, i, 1);
940
+ var before = that.o.beforeShowMonth(moDate);
941
+ if (before === false)
942
+ $(month).addClass('disabled');
943
+ }
944
+ });
945
+ }
946
+
947
+ html = '';
948
+ year = parseInt(year/10, 10) * 10;
949
+ var yearCont = this.picker.find('.datepicker-years')
950
+ .find('th:eq(1)')
951
+ .text(year + '-' + (year + 9))
952
+ .end()
953
+ .find('td');
954
+ year -= 1;
955
+ var years = $.map(this.dates, function(d){
956
+ return d.getUTCFullYear();
957
+ }),
958
+ classes;
959
+ for (var i = -1; i < 11; i++){
960
+ classes = ['year'];
961
+ if (i === -1)
962
+ classes.push('old');
963
+ else if (i === 10)
964
+ classes.push('new');
965
+ if ($.inArray(year, years) !== -1)
966
+ classes.push('active');
967
+ if (year < startYear || year > endYear)
968
+ classes.push('disabled');
969
+ html += '<span class="' + classes.join(' ') + '">' + year + '</span>';
970
+ year += 1;
971
+ }
972
+ yearCont.html(html);
973
+ },
974
+
975
+ updateNavArrows: function(){
976
+ if (!this._allow_update)
977
+ return;
978
+
979
+ var d = new Date(this.viewDate),
980
+ year = d.getUTCFullYear(),
981
+ month = d.getUTCMonth();
982
+ switch (this.viewMode){
983
+ case 0:
984
+ if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear() && month <= this.o.startDate.getUTCMonth()){
985
+ this.picker.find('.prev').css({visibility: 'hidden'});
986
+ }
987
+ else {
988
+ this.picker.find('.prev').css({visibility: 'visible'});
989
+ }
990
+ if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear() && month >= this.o.endDate.getUTCMonth()){
991
+ this.picker.find('.next').css({visibility: 'hidden'});
992
+ }
993
+ else {
994
+ this.picker.find('.next').css({visibility: 'visible'});
995
+ }
996
+ break;
997
+ case 1:
998
+ case 2:
999
+ if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear()){
1000
+ this.picker.find('.prev').css({visibility: 'hidden'});
1001
+ }
1002
+ else {
1003
+ this.picker.find('.prev').css({visibility: 'visible'});
1004
+ }
1005
+ if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear()){
1006
+ this.picker.find('.next').css({visibility: 'hidden'});
1007
+ }
1008
+ else {
1009
+ this.picker.find('.next').css({visibility: 'visible'});
1010
+ }
1011
+ break;
1012
+ }
1013
+ },
1014
+
1015
+ click: function(e){
1016
+ e.preventDefault();
1017
+ var target = $(e.target).closest('span, td, th'),
1018
+ year, month, day;
1019
+ if (target.length === 1){
1020
+ switch (target[0].nodeName.toLowerCase()){
1021
+ case 'th':
1022
+ switch (target[0].className){
1023
+ case 'datepicker-switch':
1024
+ this.showMode(1);
1025
+ break;
1026
+ case 'prev':
1027
+ case 'next':
1028
+ var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1);
1029
+ switch (this.viewMode){
1030
+ case 0:
1031
+ this.viewDate = this.moveMonth(this.viewDate, dir);
1032
+ this._trigger('changeMonth', this.viewDate);
1033
+ break;
1034
+ case 1:
1035
+ case 2:
1036
+ this.viewDate = this.moveYear(this.viewDate, dir);
1037
+ if (this.viewMode === 1)
1038
+ this._trigger('changeYear', this.viewDate);
1039
+ break;
1040
+ }
1041
+ this.fill();
1042
+ break;
1043
+ case 'today':
1044
+ var date = new Date();
1045
+ date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
1046
+
1047
+ this.showMode(-2);
1048
+ var which = this.o.todayBtn === 'linked' ? null : 'view';
1049
+ this._setDate(date, which);
1050
+ break;
1051
+ case 'clear':
1052
+ this.clearDates();
1053
+ break;
1054
+ }
1055
+ break;
1056
+ case 'span':
1057
+ if (!target.hasClass('disabled')){
1058
+ this.viewDate.setUTCDate(1);
1059
+ if (target.hasClass('month')){
1060
+ day = 1;
1061
+ month = target.parent().find('span').index(target);
1062
+ year = this.viewDate.getUTCFullYear();
1063
+ this.viewDate.setUTCMonth(month);
1064
+ this._trigger('changeMonth', this.viewDate);
1065
+ if (this.o.minViewMode === 1){
1066
+ this._setDate(UTCDate(year, month, day));
1067
+ }
1068
+ }
1069
+ else {
1070
+ day = 1;
1071
+ month = 0;
1072
+ year = parseInt(target.text(), 10)||0;
1073
+ this.viewDate.setUTCFullYear(year);
1074
+ this._trigger('changeYear', this.viewDate);
1075
+ if (this.o.minViewMode === 2){
1076
+ this._setDate(UTCDate(year, month, day));
1077
+ }
1078
+ }
1079
+ this.showMode(-1);
1080
+ this.fill();
1081
+ }
1082
+ break;
1083
+ case 'td':
1084
+ if (target.hasClass('day') && !target.hasClass('disabled')){
1085
+ day = parseInt(target.text(), 10)||1;
1086
+ year = this.viewDate.getUTCFullYear();
1087
+ month = this.viewDate.getUTCMonth();
1088
+ if (target.hasClass('old')){
1089
+ if (month === 0){
1090
+ month = 11;
1091
+ year -= 1;
1092
+ }
1093
+ else {
1094
+ month -= 1;
1095
+ }
1096
+ }
1097
+ else if (target.hasClass('new')){
1098
+ if (month === 11){
1099
+ month = 0;
1100
+ year += 1;
1101
+ }
1102
+ else {
1103
+ month += 1;
1104
+ }
1105
+ }
1106
+ this._setDate(UTCDate(year, month, day));
1107
+ }
1108
+ break;
1109
+ }
1110
+ }
1111
+ if (this.picker.is(':visible') && this._focused_from){
1112
+ $(this._focused_from).focus();
1113
+ }
1114
+ delete this._focused_from;
1115
+ },
1116
+
1117
+ _toggle_multidate: function(date){
1118
+ var ix = this.dates.contains(date);
1119
+ if (!date){
1120
+ this.dates.clear();
1121
+ }
1122
+
1123
+ if (ix !== -1){
1124
+ if (this.o.multidate === true || this.o.multidate > 1 || this.o.toggleActive){
1125
+ this.dates.remove(ix);
1126
+ }
1127
+ } else if (this.o.multidate === false) {
1128
+ this.dates.clear();
1129
+ this.dates.push(date);
1130
+ }
1131
+ else {
1132
+ this.dates.push(date);
1133
+ }
1134
+
1135
+ if (typeof this.o.multidate === 'number')
1136
+ while (this.dates.length > this.o.multidate)
1137
+ this.dates.remove(0);
1138
+ },
1139
+
1140
+ _setDate: function(date, which){
1141
+ if (!which || which === 'date')
1142
+ this._toggle_multidate(date && new Date(date));
1143
+ if (!which || which === 'view')
1144
+ this.viewDate = date && new Date(date);
1145
+
1146
+ this.fill();
1147
+ this.setValue();
1148
+ if (!which || which !== 'view') {
1149
+ this._trigger('changeDate');
1150
+ }
1151
+ var element;
1152
+ if (this.isInput){
1153
+ element = this.element;
1154
+ }
1155
+ else if (this.component){
1156
+ element = this.element.find('input');
1157
+ }
1158
+ if (element){
1159
+ element.change();
1160
+ }
1161
+ if (this.o.autoclose && (!which || which === 'date')){
1162
+ this.hide();
1163
+ }
1164
+ },
1165
+
1166
+ moveMonth: function(date, dir){
1167
+ if (!date)
1168
+ return undefined;
1169
+ if (!dir)
1170
+ return date;
1171
+ var new_date = new Date(date.valueOf()),
1172
+ day = new_date.getUTCDate(),
1173
+ month = new_date.getUTCMonth(),
1174
+ mag = Math.abs(dir),
1175
+ new_month, test;
1176
+ dir = dir > 0 ? 1 : -1;
1177
+ if (mag === 1){
1178
+ test = dir === -1
1179
+ // If going back one month, make sure month is not current month
1180
+ // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)
1181
+ ? function(){
1182
+ return new_date.getUTCMonth() === month;
1183
+ }
1184
+ // If going forward one month, make sure month is as expected
1185
+ // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)
1186
+ : function(){
1187
+ return new_date.getUTCMonth() !== new_month;
1188
+ };
1189
+ new_month = month + dir;
1190
+ new_date.setUTCMonth(new_month);
1191
+ // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11
1192
+ if (new_month < 0 || new_month > 11)
1193
+ new_month = (new_month + 12) % 12;
1194
+ }
1195
+ else {
1196
+ // For magnitudes >1, move one month at a time...
1197
+ for (var i=0; i < mag; i++)
1198
+ // ...which might decrease the day (eg, Jan 31 to Feb 28, etc)...
1199
+ new_date = this.moveMonth(new_date, dir);
1200
+ // ...then reset the day, keeping it in the new month
1201
+ new_month = new_date.getUTCMonth();
1202
+ new_date.setUTCDate(day);
1203
+ test = function(){
1204
+ return new_month !== new_date.getUTCMonth();
1205
+ };
1206
+ }
1207
+ // Common date-resetting loop -- if date is beyond end of month, make it
1208
+ // end of month
1209
+ while (test()){
1210
+ new_date.setUTCDate(--day);
1211
+ new_date.setUTCMonth(new_month);
1212
+ }
1213
+ return new_date;
1214
+ },
1215
+
1216
+ moveYear: function(date, dir){
1217
+ return this.moveMonth(date, dir*12);
1218
+ },
1219
+
1220
+ dateWithinRange: function(date){
1221
+ return date >= this.o.startDate && date <= this.o.endDate;
1222
+ },
1223
+
1224
+ keydown: function(e){
1225
+ if (!this.picker.is(':visible')){
1226
+ if (e.keyCode === 40 || e.keyCode === 27) // allow down to re-show picker
1227
+ this.show();
1228
+ return;
1229
+ }
1230
+ var dateChanged = false,
1231
+ dir, newDate, newViewDate,
1232
+ focusDate = this.focusDate || this.viewDate;
1233
+ switch (e.keyCode){
1234
+ case 27: // escape
1235
+ if (this.focusDate){
1236
+ this.focusDate = null;
1237
+ this.viewDate = this.dates.get(-1) || this.viewDate;
1238
+ this.fill();
1239
+ }
1240
+ else
1241
+ this.hide();
1242
+ e.preventDefault();
1243
+ break;
1244
+ case 37: // left
1245
+ case 39: // right
1246
+ if (!this.o.keyboardNavigation)
1247
+ break;
1248
+ dir = e.keyCode === 37 ? -1 : 1;
1249
+ if (e.ctrlKey){
1250
+ newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir);
1251
+ newViewDate = this.moveYear(focusDate, dir);
1252
+ this._trigger('changeYear', this.viewDate);
1253
+ }
1254
+ else if (e.shiftKey){
1255
+ newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir);
1256
+ newViewDate = this.moveMonth(focusDate, dir);
1257
+ this._trigger('changeMonth', this.viewDate);
1258
+ }
1259
+ else {
1260
+ newDate = new Date(this.dates.get(-1) || UTCToday());
1261
+ newDate.setUTCDate(newDate.getUTCDate() + dir);
1262
+ newViewDate = new Date(focusDate);
1263
+ newViewDate.setUTCDate(focusDate.getUTCDate() + dir);
1264
+ }
1265
+ if (this.dateWithinRange(newViewDate)){
1266
+ this.focusDate = this.viewDate = newViewDate;
1267
+ this.setValue();
1268
+ this.fill();
1269
+ e.preventDefault();
1270
+ }
1271
+ break;
1272
+ case 38: // up
1273
+ case 40: // down
1274
+ if (!this.o.keyboardNavigation)
1275
+ break;
1276
+ dir = e.keyCode === 38 ? -1 : 1;
1277
+ if (e.ctrlKey){
1278
+ newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir);
1279
+ newViewDate = this.moveYear(focusDate, dir);
1280
+ this._trigger('changeYear', this.viewDate);
1281
+ }
1282
+ else if (e.shiftKey){
1283
+ newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir);
1284
+ newViewDate = this.moveMonth(focusDate, dir);
1285
+ this._trigger('changeMonth', this.viewDate);
1286
+ }
1287
+ else {
1288
+ newDate = new Date(this.dates.get(-1) || UTCToday());
1289
+ newDate.setUTCDate(newDate.getUTCDate() + dir * 7);
1290
+ newViewDate = new Date(focusDate);
1291
+ newViewDate.setUTCDate(focusDate.getUTCDate() + dir * 7);
1292
+ }
1293
+ if (this.dateWithinRange(newViewDate)){
1294
+ this.focusDate = this.viewDate = newViewDate;
1295
+ this.setValue();
1296
+ this.fill();
1297
+ e.preventDefault();
1298
+ }
1299
+ break;
1300
+ case 32: // spacebar
1301
+ // Spacebar is used in manually typing dates in some formats.
1302
+ // As such, its behavior should not be hijacked.
1303
+ break;
1304
+ case 13: // enter
1305
+ focusDate = this.focusDate || this.dates.get(-1) || this.viewDate;
1306
+ if (this.o.keyboardNavigation) {
1307
+ this._toggle_multidate(focusDate);
1308
+ dateChanged = true;
1309
+ }
1310
+ this.focusDate = null;
1311
+ this.viewDate = this.dates.get(-1) || this.viewDate;
1312
+ this.setValue();
1313
+ this.fill();
1314
+ if (this.picker.is(':visible')){
1315
+ e.preventDefault();
1316
+ if (typeof e.stopPropagation === 'function') {
1317
+ e.stopPropagation(); // All modern browsers, IE9+
1318
+ } else {
1319
+ e.cancelBubble = true; // IE6,7,8 ignore "stopPropagation"
1320
+ }
1321
+ if (this.o.autoclose)
1322
+ this.hide();
1323
+ }
1324
+ break;
1325
+ case 9: // tab
1326
+ this.focusDate = null;
1327
+ this.viewDate = this.dates.get(-1) || this.viewDate;
1328
+ this.fill();
1329
+ this.hide();
1330
+ break;
1331
+ }
1332
+ if (dateChanged){
1333
+ if (this.dates.length)
1334
+ this._trigger('changeDate');
1335
+ else
1336
+ this._trigger('clearDate');
1337
+ var element;
1338
+ if (this.isInput){
1339
+ element = this.element;
1340
+ }
1341
+ else if (this.component){
1342
+ element = this.element.find('input');
1343
+ }
1344
+ if (element){
1345
+ element.change();
1346
+ }
1347
+ }
1348
+ },
1349
+
1350
+ showMode: function(dir){
1351
+ if (dir){
1352
+ this.viewMode = Math.max(this.o.minViewMode, Math.min(2, this.viewMode + dir));
1353
+ }
1354
+ this.picker
1355
+ .children('div')
1356
+ .hide()
1357
+ .filter('.datepicker-' + DPGlobal.modes[this.viewMode].clsName)
1358
+ .css('display', 'block');
1359
+ this.updateNavArrows();
1360
+ }
1361
+ };
1362
+
1363
+ var DateRangePicker = function(element, options){
1364
+ this.element = $(element);
1365
+ this.inputs = $.map(options.inputs, function(i){
1366
+ return i.jquery ? i[0] : i;
1367
+ });
1368
+ delete options.inputs;
1369
+
1370
+ datepickerPlugin.call($(this.inputs), options)
1371
+ .on('changeDate', $.proxy(this.dateUpdated, this));
1372
+
1373
+ this.pickers = $.map(this.inputs, function(i){
1374
+ return $(i).data('datepicker');
1375
+ });
1376
+ this.updateDates();
1377
+ };
1378
+ DateRangePicker.prototype = {
1379
+ updateDates: function(){
1380
+ this.dates = $.map(this.pickers, function(i){
1381
+ return i.getUTCDate();
1382
+ });
1383
+ this.updateRanges();
1384
+ },
1385
+ updateRanges: function(){
1386
+ var range = $.map(this.dates, function(d){
1387
+ return d.valueOf();
1388
+ });
1389
+ $.each(this.pickers, function(i, p){
1390
+ p.setRange(range);
1391
+ });
1392
+ },
1393
+ dateUpdated: function(e){
1394
+ // `this.updating` is a workaround for preventing infinite recursion
1395
+ // between `changeDate` triggering and `setUTCDate` calling. Until
1396
+ // there is a better mechanism.
1397
+ if (this.updating)
1398
+ return;
1399
+ this.updating = true;
1400
+
1401
+ var dp = $(e.target).data('datepicker'),
1402
+ new_date = dp.getUTCDate(),
1403
+ i = $.inArray(e.target, this.inputs),
1404
+ j = i - 1,
1405
+ k = i + 1,
1406
+ l = this.inputs.length;
1407
+ if (i === -1)
1408
+ return;
1409
+
1410
+ $.each(this.pickers, function(i, p){
1411
+ if (!p.getUTCDate())
1412
+ p.setUTCDate(new_date);
1413
+ });
1414
+
1415
+ if (new_date < this.dates[j]){
1416
+ // Date being moved earlier/left
1417
+ while (j >= 0 && new_date < this.dates[j]){
1418
+ this.pickers[j--].setUTCDate(new_date);
1419
+ }
1420
+ }
1421
+ else if (new_date > this.dates[k]){
1422
+ // Date being moved later/right
1423
+ while (k < l && new_date > this.dates[k]){
1424
+ this.pickers[k++].setUTCDate(new_date);
1425
+ }
1426
+ }
1427
+ this.updateDates();
1428
+
1429
+ delete this.updating;
1430
+ },
1431
+ remove: function(){
1432
+ $.map(this.pickers, function(p){ p.remove(); });
1433
+ delete this.element.data().datepicker;
1434
+ }
1435
+ };
1436
+
1437
+ function opts_from_el(el, prefix){
1438
+ // Derive options from element data-attrs
1439
+ var data = $(el).data(),
1440
+ out = {}, inkey,
1441
+ replace = new RegExp('^' + prefix.toLowerCase() + '([A-Z])');
1442
+ prefix = new RegExp('^' + prefix.toLowerCase());
1443
+ function re_lower(_,a){
1444
+ return a.toLowerCase();
1445
+ }
1446
+ for (var key in data)
1447
+ if (prefix.test(key)){
1448
+ inkey = key.replace(replace, re_lower);
1449
+ out[inkey] = data[key];
1450
+ }
1451
+ return out;
1452
+ }
1453
+
1454
+ function opts_from_locale(lang){
1455
+ // Derive options from locale plugins
1456
+ var out = {};
1457
+ // Check if "de-DE" style date is available, if not language should
1458
+ // fallback to 2 letter code eg "de"
1459
+ if (!dates[lang]){
1460
+ lang = lang.split('-')[0];
1461
+ if (!dates[lang])
1462
+ return;
1463
+ }
1464
+ var d = dates[lang];
1465
+ $.each(locale_opts, function(i,k){
1466
+ if (k in d)
1467
+ out[k] = d[k];
1468
+ });
1469
+ return out;
1470
+ }
1471
+
1472
+ var old = $.fn.datepicker;
1473
+ var datepickerPlugin = function(option){
1474
+ var args = Array.apply(null, arguments);
1475
+ args.shift();
1476
+ var internal_return;
1477
+ this.each(function(){
1478
+ var $this = $(this),
1479
+ data = $this.data('datepicker'),
1480
+ options = typeof option === 'object' && option;
1481
+ if (!data){
1482
+ var elopts = opts_from_el(this, 'date'),
1483
+ // Preliminary otions
1484
+ xopts = $.extend({}, defaults, elopts, options),
1485
+ locopts = opts_from_locale(xopts.language),
1486
+ // Options priority: js args, data-attrs, locales, defaults
1487
+ opts = $.extend({}, defaults, locopts, elopts, options);
1488
+ if ($this.hasClass('input-daterange') || opts.inputs){
1489
+ var ropts = {
1490
+ inputs: opts.inputs || $this.find('input').toArray()
1491
+ };
1492
+ $this.data('datepicker', (data = new DateRangePicker(this, $.extend(opts, ropts))));
1493
+ }
1494
+ else {
1495
+ $this.data('datepicker', (data = new Datepicker(this, opts)));
1496
+ }
1497
+ }
1498
+ if (typeof option === 'string' && typeof data[option] === 'function'){
1499
+ internal_return = data[option].apply(data, args);
1500
+ if (internal_return !== undefined)
1501
+ return false;
1502
+ }
1503
+ });
1504
+ if (internal_return !== undefined)
1505
+ return internal_return;
1506
+ else
1507
+ return this;
1508
+ };
1509
+ $.fn.datepicker = datepickerPlugin;
1510
+
1511
+ var defaults = $.fn.datepicker.defaults = {
1512
+ autoclose: false,
1513
+ beforeShowDay: $.noop,
1514
+ beforeShowMonth: $.noop,
1515
+ calendarWeeks: false,
1516
+ clearBtn: false,
1517
+ toggleActive: false,
1518
+ daysOfWeekDisabled: [],
1519
+ datesDisabled: [],
1520
+ endDate: Infinity,
1521
+ forceParse: true,
1522
+ format: 'mm/dd/yyyy',
1523
+ keyboardNavigation: true,
1524
+ language: 'en',
1525
+ minViewMode: 0,
1526
+ multidate: false,
1527
+ multidateSeparator: ',',
1528
+ orientation: "auto",
1529
+ rtl: false,
1530
+ startDate: -Infinity,
1531
+ startView: 0,
1532
+ todayBtn: false,
1533
+ todayHighlight: false,
1534
+ weekStart: 0,
1535
+ disableTouchKeyboard: false,
1536
+ enableOnReadonly: true,
1537
+ container: 'body'
1538
+ };
1539
+ var locale_opts = $.fn.datepicker.locale_opts = [
1540
+ 'format',
1541
+ 'rtl',
1542
+ 'weekStart'
1543
+ ];
1544
+ $.fn.datepicker.Constructor = Datepicker;
1545
+ var dates = $.fn.datepicker.dates = {
1546
+ en: {
1547
+ days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
1548
+ daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
1549
+ daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
1550
+ months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
1551
+ monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
1552
+ today: "Today",
1553
+ clear: "Clear"
1554
+ }
1555
+ };
1556
+
1557
+ var DPGlobal = {
1558
+ modes: [
1559
+ {
1560
+ clsName: 'days',
1561
+ navFnc: 'Month',
1562
+ navStep: 1
1563
+ },
1564
+ {
1565
+ clsName: 'months',
1566
+ navFnc: 'FullYear',
1567
+ navStep: 1
1568
+ },
1569
+ {
1570
+ clsName: 'years',
1571
+ navFnc: 'FullYear',
1572
+ navStep: 10
1573
+ }],
1574
+ isLeapYear: function(year){
1575
+ return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0));
1576
+ },
1577
+ getDaysInMonth: function(year, month){
1578
+ return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
1579
+ },
1580
+ validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g,
1581
+ nonpunctuation: /[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,
1582
+ parseFormat: function(format){
1583
+ // IE treats \0 as a string end in inputs (truncating the value),
1584
+ // so it's a bad format delimiter, anyway
1585
+ var separators = format.replace(this.validParts, '\0').split('\0'),
1586
+ parts = format.match(this.validParts);
1587
+ if (!separators || !separators.length || !parts || parts.length === 0){
1588
+ throw new Error("Invalid date format.");
1589
+ }
1590
+ return {separators: separators, parts: parts};
1591
+ },
1592
+ parseDate: function(date, format, language){
1593
+ if (!date)
1594
+ return undefined;
1595
+ if (date instanceof Date)
1596
+ return date;
1597
+ if (typeof format === 'string')
1598
+ format = DPGlobal.parseFormat(format);
1599
+ var part_re = /([\-+]\d+)([dmwy])/,
1600
+ parts = date.match(/([\-+]\d+)([dmwy])/g),
1601
+ part, dir, i;
1602
+ if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)){
1603
+ date = new Date();
1604
+ for (i=0; i < parts.length; i++){
1605
+ part = part_re.exec(parts[i]);
1606
+ dir = parseInt(part[1]);
1607
+ switch (part[2]){
1608
+ case 'd':
1609
+ date.setUTCDate(date.getUTCDate() + dir);
1610
+ break;
1611
+ case 'm':
1612
+ date = Datepicker.prototype.moveMonth.call(Datepicker.prototype, date, dir);
1613
+ break;
1614
+ case 'w':
1615
+ date.setUTCDate(date.getUTCDate() + dir * 7);
1616
+ break;
1617
+ case 'y':
1618
+ date = Datepicker.prototype.moveYear.call(Datepicker.prototype, date, dir);
1619
+ break;
1620
+ }
1621
+ }
1622
+ return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 0, 0, 0);
1623
+ }
1624
+ parts = date && date.match(this.nonpunctuation) || [];
1625
+ date = new Date();
1626
+ var parsed = {},
1627
+ setters_order = ['yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'],
1628
+ setters_map = {
1629
+ yyyy: function(d,v){
1630
+ return d.setUTCFullYear(v);
1631
+ },
1632
+ yy: function(d,v){
1633
+ return d.setUTCFullYear(2000+v);
1634
+ },
1635
+ m: function(d,v){
1636
+ if (isNaN(d))
1637
+ return d;
1638
+ v -= 1;
1639
+ while (v < 0) v += 12;
1640
+ v %= 12;
1641
+ d.setUTCMonth(v);
1642
+ while (d.getUTCMonth() !== v)
1643
+ d.setUTCDate(d.getUTCDate()-1);
1644
+ return d;
1645
+ },
1646
+ d: function(d,v){
1647
+ return d.setUTCDate(v);
1648
+ }
1649
+ },
1650
+ val, filtered;
1651
+ setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m'];
1652
+ setters_map['dd'] = setters_map['d'];
1653
+ date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
1654
+ var fparts = format.parts.slice();
1655
+ // Remove noop parts
1656
+ if (parts.length !== fparts.length){
1657
+ fparts = $(fparts).filter(function(i,p){
1658
+ return $.inArray(p, setters_order) !== -1;
1659
+ }).toArray();
1660
+ }
1661
+ // Process remainder
1662
+ function match_part(){
1663
+ var m = this.slice(0, parts[i].length),
1664
+ p = parts[i].slice(0, m.length);
1665
+ return m.toLowerCase() === p.toLowerCase();
1666
+ }
1667
+ if (parts.length === fparts.length){
1668
+ var cnt;
1669
+ for (i=0, cnt = fparts.length; i < cnt; i++){
1670
+ val = parseInt(parts[i], 10);
1671
+ part = fparts[i];
1672
+ if (isNaN(val)){
1673
+ switch (part){
1674
+ case 'MM':
1675
+ filtered = $(dates[language].months).filter(match_part);
1676
+ val = $.inArray(filtered[0], dates[language].months) + 1;
1677
+ break;
1678
+ case 'M':
1679
+ filtered = $(dates[language].monthsShort).filter(match_part);
1680
+ val = $.inArray(filtered[0], dates[language].monthsShort) + 1;
1681
+ break;
1682
+ }
1683
+ }
1684
+ parsed[part] = val;
1685
+ }
1686
+ var _date, s;
1687
+ for (i=0; i < setters_order.length; i++){
1688
+ s = setters_order[i];
1689
+ if (s in parsed && !isNaN(parsed[s])){
1690
+ _date = new Date(date);
1691
+ setters_map[s](_date, parsed[s]);
1692
+ if (!isNaN(_date))
1693
+ date = _date;
1694
+ }
1695
+ }
1696
+ }
1697
+ return date;
1698
+ },
1699
+ formatDate: function(date, format, language){
1700
+ if (!date)
1701
+ return '';
1702
+ if (typeof format === 'string')
1703
+ format = DPGlobal.parseFormat(format);
1704
+ var val = {
1705
+ d: date.getUTCDate(),
1706
+ D: dates[language].daysShort[date.getUTCDay()],
1707
+ DD: dates[language].days[date.getUTCDay()],
1708
+ m: date.getUTCMonth() + 1,
1709
+ M: dates[language].monthsShort[date.getUTCMonth()],
1710
+ MM: dates[language].months[date.getUTCMonth()],
1711
+ yy: date.getUTCFullYear().toString().substring(2),
1712
+ yyyy: date.getUTCFullYear()
1713
+ };
1714
+ val.dd = (val.d < 10 ? '0' : '') + val.d;
1715
+ val.mm = (val.m < 10 ? '0' : '') + val.m;
1716
+ date = [];
1717
+ var seps = $.extend([], format.separators);
1718
+ for (var i=0, cnt = format.parts.length; i <= cnt; i++){
1719
+ if (seps.length)
1720
+ date.push(seps.shift());
1721
+ date.push(val[format.parts[i]]);
1722
+ }
1723
+ return date.join('');
1724
+ },
1725
+ headTemplate: '<thead>'+
1726
+ '<tr>'+
1727
+ '<th class="prev">&#171;</th>'+
1728
+ '<th colspan="5" class="datepicker-switch"></th>'+
1729
+ '<th class="next">&#187;</th>'+
1730
+ '</tr>'+
1731
+ '</thead>',
1732
+ contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>',
1733
+ footTemplate: '<tfoot>'+
1734
+ '<tr>'+
1735
+ '<th colspan="7" class="today"></th>'+
1736
+ '</tr>'+
1737
+ '<tr>'+
1738
+ '<th colspan="7" class="clear"></th>'+
1739
+ '</tr>'+
1740
+ '</tfoot>'
1741
+ };
1742
+ DPGlobal.template = '<div class="datepicker">'+
1743
+ '<div class="datepicker-days">'+
1744
+ '<table class=" table-condensed">'+
1745
+ DPGlobal.headTemplate+
1746
+ '<tbody></tbody>'+
1747
+ DPGlobal.footTemplate+
1748
+ '</table>'+
1749
+ '</div>'+
1750
+ '<div class="datepicker-months">'+
1751
+ '<table class="table-condensed">'+
1752
+ DPGlobal.headTemplate+
1753
+ DPGlobal.contTemplate+
1754
+ DPGlobal.footTemplate+
1755
+ '</table>'+
1756
+ '</div>'+
1757
+ '<div class="datepicker-years">'+
1758
+ '<table class="table-condensed">'+
1759
+ DPGlobal.headTemplate+
1760
+ DPGlobal.contTemplate+
1761
+ DPGlobal.footTemplate+
1762
+ '</table>'+
1763
+ '</div>'+
1764
+ '</div>';
1765
+
1766
+ $.fn.datepicker.DPGlobal = DPGlobal;
1767
+
1768
+
1769
+ /* DATEPICKER NO CONFLICT
1770
+ * =================== */
1771
+
1772
+ $.fn.datepicker.noConflict = function(){
1773
+ $.fn.datepicker = old;
1774
+ return this;
1775
+ };
1776
+
1777
+ /* DATEPICKER VERSION
1778
+ * =================== */
1779
+ $.fn.datepicker.version = "1.5.0";
1780
+
1781
+ /* DATEPICKER DATA-API
1782
+ * ================== */
1783
+
1784
+ $(document).on(
1785
+ 'focus.datepicker.data-api click.datepicker.data-api',
1786
+ '[data-provide="datepicker"]',
1787
+ function(e){
1788
+ var $this = $(this);
1789
+ if ($this.data('datepicker'))
1790
+ return;
1791
+ e.preventDefault();
1792
+ // component click requires us to explicitly show it
1793
+ datepickerPlugin.call($this, 'show');
1794
+ }
1795
+ );
1796
+ $(function(){
1797
+ datepickerPlugin.call($('[data-provide="datepicker-inline"]'));
1798
+ });
1799
+
1800
+ }(window.jQuery));