locomotivecms 3.0.0.pre.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (906) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +63 -0
  3. data/LICENSE +21 -0
  4. data/README.md +76 -0
  5. data/app/api/locomotive/api.rb +55 -0
  6. data/app/api/locomotive/api/entities/account_entity.rb +17 -0
  7. data/app/api/locomotive/api/entities/base_entity.rb +26 -0
  8. data/app/api/locomotive/api/entities/content_asset_entity.rb +44 -0
  9. data/app/api/locomotive/api/entities/content_entry_entity.rb +85 -0
  10. data/app/api/locomotive/api/entities/content_type_entity.rb +31 -0
  11. data/app/api/locomotive/api/entities/content_type_field_entity.rb +34 -0
  12. data/app/api/locomotive/api/entities/editable_element_entity.rb +17 -0
  13. data/app/api/locomotive/api/entities/membership_entity.rb +30 -0
  14. data/app/api/locomotive/api/entities/page_entity.rb +56 -0
  15. data/app/api/locomotive/api/entities/site_entity.rb +22 -0
  16. data/app/api/locomotive/api/entities/snippet_entity.rb +13 -0
  17. data/app/api/locomotive/api/entities/theme_asset_entity.rb +36 -0
  18. data/app/api/locomotive/api/entities/translation_entity.rb +14 -0
  19. data/app/api/locomotive/api/exception_rescuers.rb +42 -0
  20. data/app/api/locomotive/api/forms/account_form.rb +13 -0
  21. data/app/api/locomotive/api/forms/base_form.rb +79 -0
  22. data/app/api/locomotive/api/forms/content_asset_form.rb +13 -0
  23. data/app/api/locomotive/api/forms/content_entry_form.rb +94 -0
  24. data/app/api/locomotive/api/forms/content_type_field_form.rb +58 -0
  25. data/app/api/locomotive/api/forms/content_type_form.rb +55 -0
  26. data/app/api/locomotive/api/forms/editable_element_form.rb +33 -0
  27. data/app/api/locomotive/api/forms/membership_form.rb +11 -0
  28. data/app/api/locomotive/api/forms/my_account_form.rb +14 -0
  29. data/app/api/locomotive/api/forms/page_form.rb +69 -0
  30. data/app/api/locomotive/api/forms/site_form.rb +24 -0
  31. data/app/api/locomotive/api/forms/snippet_form.rb +14 -0
  32. data/app/api/locomotive/api/forms/theme_asset_form.rb +13 -0
  33. data/app/api/locomotive/api/forms/translation_form.rb +13 -0
  34. data/app/api/locomotive/api/helpers/authentication_helper.rb +39 -0
  35. data/app/api/locomotive/api/helpers/pagination_helper.rb +16 -0
  36. data/app/api/locomotive/api/helpers/params_helper.rb +14 -0
  37. data/app/api/locomotive/api/helpers/persistence_helper.rb +140 -0
  38. data/app/api/locomotive/api/middlewares/locale_middleware.rb +38 -0
  39. data/app/api/locomotive/api/middlewares/logger_middleware.rb +46 -0
  40. data/app/api/locomotive/api/resources/account_resource.rb +93 -0
  41. data/app/api/locomotive/api/resources/content_asset_resource.rb +84 -0
  42. data/app/api/locomotive/api/resources/content_entry_resource.rb +109 -0
  43. data/app/api/locomotive/api/resources/content_type_resource.rb +139 -0
  44. data/app/api/locomotive/api/resources/current_site_resource.rb +62 -0
  45. data/app/api/locomotive/api/resources/membership_resource.rb +88 -0
  46. data/app/api/locomotive/api/resources/my_account_resource.rb +72 -0
  47. data/app/api/locomotive/api/resources/page_resource.rb +123 -0
  48. data/app/api/locomotive/api/resources/site_resource.rb +124 -0
  49. data/app/api/locomotive/api/resources/snippet_resource.rb +93 -0
  50. data/app/api/locomotive/api/resources/theme_asset_resource.rb +96 -0
  51. data/app/api/locomotive/api/resources/token_resource.rb +29 -0
  52. data/app/api/locomotive/api/resources/translation_resource.rb +95 -0
  53. data/app/api/locomotive/api/resources/version_resource.rb +19 -0
  54. data/app/assets/images/locomotive/background/body.png +0 -0
  55. data/app/assets/images/locomotive/datepicker/ui-widget-content-top.png +0 -0
  56. data/app/assets/images/locomotive/form/error-arrow.png +0 -0
  57. data/app/assets/images/locomotive/form/input-sep.png +0 -0
  58. data/app/assets/images/locomotive/icons/flags/bf.png +0 -0
  59. data/app/assets/images/locomotive/icons/flags/bg.png +0 -0
  60. data/app/assets/images/locomotive/icons/flags/cs.png +0 -0
  61. data/app/assets/images/locomotive/icons/flags/de.png +0 -0
  62. data/app/assets/images/locomotive/icons/flags/en.png +0 -0
  63. data/app/assets/images/locomotive/icons/flags/es.png +0 -0
  64. data/app/assets/images/locomotive/icons/flags/et.png +0 -0
  65. data/app/assets/images/locomotive/icons/flags/fr.png +0 -0
  66. data/app/assets/images/locomotive/icons/flags/it.png +0 -0
  67. data/app/assets/images/locomotive/icons/flags/ja.png +0 -0
  68. data/app/assets/images/locomotive/icons/flags/mg.png +0 -0
  69. data/app/assets/images/locomotive/icons/flags/nb.png +0 -0
  70. data/app/assets/images/locomotive/icons/flags/nl.png +0 -0
  71. data/app/assets/images/locomotive/icons/flags/pl.png +0 -0
  72. data/app/assets/images/locomotive/icons/flags/pt-BR.png +0 -0
  73. data/app/assets/images/locomotive/icons/flags/pt.png +0 -0
  74. data/app/assets/images/locomotive/icons/flags/ru.png +0 -0
  75. data/app/assets/images/locomotive/icons/flags/sk.png +0 -0
  76. data/app/assets/images/locomotive/icons/flags/sr.png +0 -0
  77. data/app/assets/images/locomotive/icons/flags/zh-CN.png +0 -0
  78. data/app/assets/images/locomotive/icons/start.png +0 -0
  79. data/app/assets/images/locomotive/list/empty.png +0 -0
  80. data/app/assets/images/locomotive/list/item-left.png +0 -0
  81. data/app/assets/images/locomotive/logo.png +0 -0
  82. data/app/assets/images/locomotive/nocoffee.png +0 -0
  83. data/app/assets/images/locomotive/plugins/sites_picker_top_arrow.png +0 -0
  84. data/app/assets/images/locomotive/rails.png +0 -0
  85. data/app/assets/images/locomotive/site.png +0 -0
  86. data/app/assets/images/locomotive/user.png +0 -0
  87. data/app/assets/javascripts/locomotive.js +21 -0
  88. data/app/assets/javascripts/locomotive/application.js.coffee +8 -0
  89. data/app/assets/javascripts/locomotive/not_logged_in.js.coffee +1 -0
  90. data/app/assets/javascripts/locomotive/utils/backbone_patches.js.coffee +6 -0
  91. data/app/assets/javascripts/locomotive/utils/core_ext.js +75 -0
  92. data/app/assets/javascripts/locomotive/utils/layout_utils.js.coffee +25 -0
  93. data/app/assets/javascripts/locomotive/utils/rails_ujs.js.coffee +20 -0
  94. data/app/assets/javascripts/locomotive/utils/select2.js.coffee +45 -0
  95. data/app/assets/javascripts/locomotive/utils/wysihtml5.js.coffee +39 -0
  96. data/app/assets/javascripts/locomotive/views/accounts/new_view.js.coffee +7 -0
  97. data/app/assets/javascripts/locomotive/views/application_view.js.coffee +120 -0
  98. data/app/assets/javascripts/locomotive/views/content_assets/dropzone_view.js.coffee +80 -0
  99. data/app/assets/javascripts/locomotive/views/content_assets/edit_image_view.js.coffee +149 -0
  100. data/app/assets/javascripts/locomotive/views/content_assets/index_view.js.coffee +59 -0
  101. data/app/assets/javascripts/locomotive/views/content_assets/picker_view.js.coffee +81 -0
  102. data/app/assets/javascripts/locomotive/views/content_entries/edit_view.js.coffee +5 -0
  103. data/app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee +15 -0
  104. data/app/assets/javascripts/locomotive/views/content_entries/new_view.js.coffee +4 -0
  105. data/app/assets/javascripts/locomotive/views/current_site/edit_view.js.coffee +7 -0
  106. data/app/assets/javascripts/locomotive/views/custom_fields/select_options/edit_view.js.coffee +46 -0
  107. data/app/assets/javascripts/locomotive/views/dashboard/show_view.js.coffee +5 -0
  108. data/app/assets/javascripts/locomotive/views/editable_elements/index_view.js.coffee +5 -0
  109. data/app/assets/javascripts/locomotive/views/inputs/array_view.js.coffee +124 -0
  110. data/app/assets/javascripts/locomotive/views/inputs/document_picker_view.js.coffee +24 -0
  111. data/app/assets/javascripts/locomotive/views/inputs/file_view.js.coffee +85 -0
  112. data/app/assets/javascripts/locomotive/views/inputs/rte/file_view.js.coffee +116 -0
  113. data/app/assets/javascripts/locomotive/views/inputs/rte/link_view.js.coffee +83 -0
  114. data/app/assets/javascripts/locomotive/views/inputs/rte_view.js.coffee.erb +54 -0
  115. data/app/assets/javascripts/locomotive/views/memberships/edit_view.js.coffee +7 -0
  116. data/app/assets/javascripts/locomotive/views/memberships/new_view.js.coffee +7 -0
  117. data/app/assets/javascripts/locomotive/views/my_account/edit_view.js.coffee +44 -0
  118. data/app/assets/javascripts/locomotive/views/pages/_form_view.js.coffee +163 -0
  119. data/app/assets/javascripts/locomotive/views/pages/edit_view.js.coffee +48 -0
  120. data/app/assets/javascripts/locomotive/views/pages/index_view.js.coffee +11 -0
  121. data/app/assets/javascripts/locomotive/views/pages/list_view.js.coffee +79 -0
  122. data/app/assets/javascripts/locomotive/views/pages/new_view.js.coffee +8 -0
  123. data/app/assets/javascripts/locomotive/views/shared/drawer_view.js.coffee +82 -0
  124. data/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee +251 -0
  125. data/app/assets/javascripts/locomotive/views/shared/header_view.js.coffee +12 -0
  126. data/app/assets/javascripts/locomotive/views/shared/list_item_view.js.coffee +22 -0
  127. data/app/assets/javascripts/locomotive/views/shared/list_view.js.coffee +40 -0
  128. data/app/assets/javascripts/locomotive/views/shared/sidebar_view.js.coffee +11 -0
  129. data/app/assets/javascripts/locomotive/views/sites/new_view.js.coffee +5 -0
  130. data/app/assets/stylesheets/locomotive/application.scss +29 -0
  131. data/app/assets/stylesheets/locomotive/base/_all.scss +6 -0
  132. data/app/assets/stylesheets/locomotive/base/_buttons.scss +13 -0
  133. data/app/assets/stylesheets/locomotive/base/_fonts.scss +29 -0
  134. data/app/assets/stylesheets/locomotive/base/_form.scss +13 -0
  135. data/app/assets/stylesheets/locomotive/base/_iframe.scss +4 -0
  136. data/app/assets/stylesheets/locomotive/base/_nav.scss +38 -0
  137. data/app/assets/stylesheets/locomotive/base/_typography.scss +5 -0
  138. data/app/assets/stylesheets/locomotive/base/form/_api_key.scss +25 -0
  139. data/app/assets/stylesheets/locomotive/base/form/_array_input.scss +137 -0
  140. data/app/assets/stylesheets/locomotive/base/form/_base.scss +70 -0
  141. data/app/assets/stylesheets/locomotive/base/form/_code.scss +15 -0
  142. data/app/assets/stylesheets/locomotive/base/form/_date.scss +11 -0
  143. data/app/assets/stylesheets/locomotive/base/form/_document_picker.scss +87 -0
  144. data/app/assets/stylesheets/locomotive/base/form/_file_input.scss +80 -0
  145. data/app/assets/stylesheets/locomotive/base/form/_popover.scss +44 -0
  146. data/app/assets/stylesheets/locomotive/base/form/_rte.scss +30 -0
  147. data/app/assets/stylesheets/locomotive/base/form/_select2.scss +107 -0
  148. data/app/assets/stylesheets/locomotive/base/form/_toggle.scss +62 -0
  149. data/app/assets/stylesheets/locomotive/base/not_logged_in/_all.scss +4 -0
  150. data/app/assets/stylesheets/locomotive/base/not_logged_in/_buttons.scss +10 -0
  151. data/app/assets/stylesheets/locomotive/base/not_logged_in/_form.scss +72 -0
  152. data/app/assets/stylesheets/locomotive/base/not_logged_in/_messages.scss +4 -0
  153. data/app/assets/stylesheets/locomotive/base/not_logged_in/_typography.scss +12 -0
  154. data/app/assets/stylesheets/locomotive/components/_content_assets.scss +186 -0
  155. data/app/assets/stylesheets/locomotive/components/_drawer.scss +34 -0
  156. data/app/assets/stylesheets/locomotive/components/_header.scss +3 -0
  157. data/app/assets/stylesheets/locomotive/components/_list.scss +102 -0
  158. data/app/assets/stylesheets/locomotive/components/_main.scss +31 -0
  159. data/app/assets/stylesheets/locomotive/components/_misc.scss +1 -0
  160. data/app/assets/stylesheets/locomotive/components/_sidebar.scss +5 -0
  161. data/app/assets/stylesheets/locomotive/components/_sites.scss +130 -0
  162. data/app/assets/stylesheets/locomotive/components/_transitions.scss +78 -0
  163. data/app/assets/stylesheets/locomotive/components/header/_account.scss +57 -0
  164. data/app/assets/stylesheets/locomotive/components/header/_base.scss +109 -0
  165. data/app/assets/stylesheets/locomotive/components/header/_responsive.scss +34 -0
  166. data/app/assets/stylesheets/locomotive/components/misc/_nav.scss +62 -0
  167. data/app/assets/stylesheets/locomotive/components/not_logged_in/_passwords.scss +9 -0
  168. data/app/assets/stylesheets/locomotive/components/not_logged_in/_sign_in_and_up.scss +24 -0
  169. data/app/assets/stylesheets/locomotive/components/sidebar/_base.scss +57 -0
  170. data/app/assets/stylesheets/locomotive/components/sidebar/_content_types.scss +30 -0
  171. data/app/assets/stylesheets/locomotive/components/sidebar/_link.scss +36 -0
  172. data/app/assets/stylesheets/locomotive/components/sidebar/_my_account.scss +21 -0
  173. data/app/assets/stylesheets/locomotive/components/sidebar/_pages_tree.scss +108 -0
  174. data/app/assets/stylesheets/locomotive/globals/_all.scss +3 -0
  175. data/app/assets/stylesheets/locomotive/globals/_bootstrap.scss +841 -0
  176. data/app/assets/stylesheets/locomotive/globals/_colors.scss +1 -0
  177. data/app/assets/stylesheets/locomotive/globals/_mixins.scss +65 -0
  178. data/app/assets/stylesheets/locomotive/globals/_variables.scss +114 -0
  179. data/app/assets/stylesheets/locomotive/layouts/_main.scss +62 -0
  180. data/app/assets/stylesheets/locomotive/layouts/_not_logged_in.scss +34 -0
  181. data/app/assets/stylesheets/locomotive/layouts/_responsive.scss +12 -0
  182. data/app/assets/stylesheets/locomotive/not_logged_in.scss +11 -0
  183. data/app/cells/locomotive/content_locale_picker/show.html.haml +7 -0
  184. data/app/cells/locomotive/content_locale_picker_cell.rb +21 -0
  185. data/app/controllers/locomotive/accounts_controller.rb +26 -0
  186. data/app/controllers/locomotive/api/accounts_controller.rb +60 -0
  187. data/app/controllers/locomotive/api/base_controller.rb +35 -0
  188. data/app/controllers/locomotive/api/content_assets_controller.rb +51 -0
  189. data/app/controllers/locomotive/api/content_entries_controller.rb +71 -0
  190. data/app/controllers/locomotive/api/content_types_controller.rb +52 -0
  191. data/app/controllers/locomotive/api/current_site_controller.rb +34 -0
  192. data/app/controllers/locomotive/api/memberships_controller.rb +52 -0
  193. data/app/controllers/locomotive/api/my_account_controller.rb +46 -0
  194. data/app/controllers/locomotive/api/pages_controller.rb +53 -0
  195. data/app/controllers/locomotive/api/sites_controller.rb +58 -0
  196. data/app/controllers/locomotive/api/snippets_controller.rb +52 -0
  197. data/app/controllers/locomotive/api/theme_assets_controller.rb +51 -0
  198. data/app/controllers/locomotive/api/tokens_controller.rb +36 -0
  199. data/app/controllers/locomotive/api/translations_controller.rb +51 -0
  200. data/app/controllers/locomotive/api/version_controller.rb +11 -0
  201. data/app/controllers/locomotive/base_controller.rb +24 -0
  202. data/app/controllers/locomotive/concerns/account_controller.rb +40 -0
  203. data/app/controllers/locomotive/concerns/authorization_controller.rb +31 -0
  204. data/app/controllers/locomotive/concerns/exception_controller.rb +32 -0
  205. data/app/controllers/locomotive/concerns/locale_helpers_controller.rb +60 -0
  206. data/app/controllers/locomotive/concerns/membership_controller.rb +35 -0
  207. data/app/controllers/locomotive/concerns/site_dispatcher_controller.rb +42 -0
  208. data/app/controllers/locomotive/concerns/store_location_controller.rb +33 -0
  209. data/app/controllers/locomotive/concerns/timezone_controller.rb +13 -0
  210. data/app/controllers/locomotive/concerns/token_authentication_controller.rb +48 -0
  211. data/app/controllers/locomotive/concerns/url_helpers_controller.rb +32 -0
  212. data/app/controllers/locomotive/concerns/within_site_controller.rb +61 -0
  213. data/app/controllers/locomotive/content_assets_controller.rb +82 -0
  214. data/app/controllers/locomotive/content_entries_controller.rb +110 -0
  215. data/app/controllers/locomotive/current_site_controller.rb +62 -0
  216. data/app/controllers/locomotive/custom_fields/select_options_controller.rb +54 -0
  217. data/app/controllers/locomotive/dashboard_controller.rb +10 -0
  218. data/app/controllers/locomotive/editable_elements_controller.rb +25 -0
  219. data/app/controllers/locomotive/memberships_controller.rb +55 -0
  220. data/app/controllers/locomotive/my_account_controller.rb +40 -0
  221. data/app/controllers/locomotive/pages_controller.rb +66 -0
  222. data/app/controllers/locomotive/passwords_controller.rb +19 -0
  223. data/app/controllers/locomotive/registrations_controller.rb +21 -0
  224. data/app/controllers/locomotive/sessions_controller.rb +31 -0
  225. data/app/controllers/locomotive/sites_controller.rb +37 -0
  226. data/app/controllers/locomotive/translations_controller.rb +54 -0
  227. data/app/helpers/locomotive/accounts_helper.rb +9 -0
  228. data/app/helpers/locomotive/base_helper.rb +223 -0
  229. data/app/helpers/locomotive/content_assets_helper.rb +31 -0
  230. data/app/helpers/locomotive/content_entries_helper.rb +71 -0
  231. data/app/helpers/locomotive/content_types_helper.rb +46 -0
  232. data/app/helpers/locomotive/custom_fields_helper.rb +190 -0
  233. data/app/helpers/locomotive/installation_helper.rb +9 -0
  234. data/app/helpers/locomotive/memberships_helper.rb +19 -0
  235. data/app/helpers/locomotive/my_account_helper.rb +17 -0
  236. data/app/helpers/locomotive/pages_helper.rb +61 -0
  237. data/app/helpers/locomotive/shared/accounts_helper.rb +20 -0
  238. data/app/helpers/locomotive/shared/pages_helper.rb +87 -0
  239. data/app/helpers/locomotive/shared/sites_helper.rb +15 -0
  240. data/app/helpers/locomotive/sites_helper.rb +31 -0
  241. data/app/helpers/locomotive/translations_helper.rb +19 -0
  242. data/app/inputs/locomotive/api_key_input.rb +24 -0
  243. data/app/inputs/locomotive/array_input.rb +85 -0
  244. data/app/inputs/locomotive/code_input.rb +51 -0
  245. data/app/inputs/locomotive/document_picker_input.rb +52 -0
  246. data/app/inputs/locomotive/editable_select_input.rb +11 -0
  247. data/app/inputs/locomotive/file_input.rb +88 -0
  248. data/app/inputs/locomotive/locale_input.rb +41 -0
  249. data/app/inputs/locomotive/locales_input.rb +9 -0
  250. data/app/inputs/locomotive/rte_input.rb +51 -0
  251. data/app/inputs/locomotive/small_code_input.rb +23 -0
  252. data/app/inputs/locomotive/toggle_input.rb +21 -0
  253. data/app/mailers/locomotive/devise_mailer.rb +10 -0
  254. data/app/mailers/locomotive/notifications.rb +19 -0
  255. data/app/models/locomotive/account.rb +97 -0
  256. data/app/models/locomotive/concerns/account/api_key.rb +97 -0
  257. data/app/models/locomotive/concerns/account/devise_patch.rb +30 -0
  258. data/app/models/locomotive/concerns/asset/checksum.rb +33 -0
  259. data/app/models/locomotive/concerns/asset/types.rb +36 -0
  260. data/app/models/locomotive/concerns/asset/vignette.rb +35 -0
  261. data/app/models/locomotive/concerns/content_entry/counter.rb +27 -0
  262. data/app/models/locomotive/concerns/content_entry/csv.rb +82 -0
  263. data/app/models/locomotive/concerns/content_entry/localized.rb +80 -0
  264. data/app/models/locomotive/concerns/content_entry/next_previous.rb +49 -0
  265. data/app/models/locomotive/concerns/content_entry/notifications.rb +33 -0
  266. data/app/models/locomotive/concerns/content_entry/slug.rb +86 -0
  267. data/app/models/locomotive/concerns/content_type/class_helpers.rb +73 -0
  268. data/app/models/locomotive/concerns/content_type/default_values.rb +66 -0
  269. data/app/models/locomotive/concerns/content_type/group_by.rb +46 -0
  270. data/app/models/locomotive/concerns/content_type/item_template.rb +49 -0
  271. data/app/models/locomotive/concerns/content_type/label.rb +22 -0
  272. data/app/models/locomotive/concerns/content_type/order_by.rb +44 -0
  273. data/app/models/locomotive/concerns/content_type/sync.rb +78 -0
  274. data/app/models/locomotive/concerns/page/editable_elements.rb +134 -0
  275. data/app/models/locomotive/concerns/page/layout.rb +42 -0
  276. data/app/models/locomotive/concerns/page/listed.rb +18 -0
  277. data/app/models/locomotive/concerns/page/parse.rb +133 -0
  278. data/app/models/locomotive/concerns/page/redirect.rb +25 -0
  279. data/app/models/locomotive/concerns/page/render.rb +99 -0
  280. data/app/models/locomotive/concerns/page/templatized.rb +208 -0
  281. data/app/models/locomotive/concerns/page/tree.rb +108 -0
  282. data/app/models/locomotive/concerns/shared/seo.rb +16 -0
  283. data/app/models/locomotive/concerns/shared/slug.rb +34 -0
  284. data/app/models/locomotive/concerns/shared/userstamp.rb +15 -0
  285. data/app/models/locomotive/concerns/site/access_points.rb +75 -0
  286. data/app/models/locomotive/concerns/site/locales.rb +139 -0
  287. data/app/models/locomotive/concerns/site/timezone.rb +32 -0
  288. data/app/models/locomotive/content_asset.rb +45 -0
  289. data/app/models/locomotive/content_entry.rb +155 -0
  290. data/app/models/locomotive/content_type.rb +132 -0
  291. data/app/models/locomotive/editable_control.rb +52 -0
  292. data/app/models/locomotive/editable_element.rb +151 -0
  293. data/app/models/locomotive/editable_file.rb +91 -0
  294. data/app/models/locomotive/editable_long_text.rb +5 -0
  295. data/app/models/locomotive/editable_short_text.rb +5 -0
  296. data/app/models/locomotive/editable_text.rb +93 -0
  297. data/app/models/locomotive/membership.rb +52 -0
  298. data/app/models/locomotive/page.rb +149 -0
  299. data/app/models/locomotive/site.rb +116 -0
  300. data/app/models/locomotive/snippet.rb +28 -0
  301. data/app/models/locomotive/theme_asset.rb +187 -0
  302. data/app/models/locomotive/translation.rb +41 -0
  303. data/app/policies/locomotive/account_policy.rb +33 -0
  304. data/app/policies/locomotive/application_policy.rb +79 -0
  305. data/app/policies/locomotive/content_asset_policy.rb +21 -0
  306. data/app/policies/locomotive/content_entry_policy.rb +21 -0
  307. data/app/policies/locomotive/content_type_policy.rb +21 -0
  308. data/app/policies/locomotive/membership_policy.rb +36 -0
  309. data/app/policies/locomotive/page_policy.rb +21 -0
  310. data/app/policies/locomotive/site_policy.rb +62 -0
  311. data/app/policies/locomotive/snippet_policy.rb +21 -0
  312. data/app/policies/locomotive/theme_asset_policy.rb +21 -0
  313. data/app/policies/locomotive/translation_policy.rb +21 -0
  314. data/app/presenters/locomotive/account_presenter.rb +20 -0
  315. data/app/presenters/locomotive/base_presenter.rb +144 -0
  316. data/app/presenters/locomotive/content_asset_presenter.rb +51 -0
  317. data/app/presenters/locomotive/content_entry_presenter.rb +177 -0
  318. data/app/presenters/locomotive/content_field_presenter.rb +76 -0
  319. data/app/presenters/locomotive/content_type_presenter.rb +82 -0
  320. data/app/presenters/locomotive/editable_control_presenter.rb +19 -0
  321. data/app/presenters/locomotive/editable_element_presenter.rb +46 -0
  322. data/app/presenters/locomotive/editable_file_presenter.rb +36 -0
  323. data/app/presenters/locomotive/editable_text_presenter.rb +40 -0
  324. data/app/presenters/locomotive/membership_presenter.rb +35 -0
  325. data/app/presenters/locomotive/page_presenter.rb +81 -0
  326. data/app/presenters/locomotive/site_presenter.rb +40 -0
  327. data/app/presenters/locomotive/snippet_presenter.rb +22 -0
  328. data/app/presenters/locomotive/theme_asset_presenter.rb +61 -0
  329. data/app/presenters/locomotive/translation_presenter.rb +9 -0
  330. data/app/services/locomotive/content_asset_service.rb +22 -0
  331. data/app/services/locomotive/content_entry_service.rb +175 -0
  332. data/app/services/locomotive/content_type_service.rb +15 -0
  333. data/app/services/locomotive/custom_field_finder_service.rb +8 -0
  334. data/app/services/locomotive/custom_field_service.rb +26 -0
  335. data/app/services/locomotive/membership_service.rb +45 -0
  336. data/app/services/locomotive/page_parsing_service.rb +67 -0
  337. data/app/services/locomotive/page_service.rb +64 -0
  338. data/app/services/locomotive/site_service.rb +41 -0
  339. data/app/uploaders/locomotive/content_asset_uploader.rb +13 -0
  340. data/app/uploaders/locomotive/editable_file_uploader.rb +15 -0
  341. data/app/uploaders/locomotive/picture_uploader.rb +17 -0
  342. data/app/uploaders/locomotive/theme_asset_uploader.rb +35 -0
  343. data/app/views/locomotive/accounts/new.html.haml +17 -0
  344. data/app/views/locomotive/content_assets/_dropzone.html.haml +13 -0
  345. data/app/views/locomotive/content_assets/_list.html.haml +36 -0
  346. data/app/views/locomotive/content_assets/_nav.html.haml +17 -0
  347. data/app/views/locomotive/content_assets/_search_form.html.haml +5 -0
  348. data/app/views/locomotive/content_assets/edit_in_drawer.html.haml +26 -0
  349. data/app/views/locomotive/content_assets/index.html.haml +19 -0
  350. data/app/views/locomotive/content_assets/index_in_drawer.html.haml +20 -0
  351. data/app/views/locomotive/content_entries/_entry.html.haml +22 -0
  352. data/app/views/locomotive/content_entries/_list.html.haml +29 -0
  353. data/app/views/locomotive/content_entries/edit.html.haml +14 -0
  354. data/app/views/locomotive/content_entries/form/_actions.html.haml +1 -0
  355. data/app/views/locomotive/content_entries/form/_advanced.html.haml +5 -0
  356. data/app/views/locomotive/content_entries/form/_main.html.haml +4 -0
  357. data/app/views/locomotive/content_entries/form/_panes.html.haml +4 -0
  358. data/app/views/locomotive/content_entries/form/_seo.html.haml +6 -0
  359. data/app/views/locomotive/content_entries/form/_tabs.html.haml +9 -0
  360. data/app/views/locomotive/content_entries/index.html.haml +43 -0
  361. data/app/views/locomotive/content_entries/new.html.haml +14 -0
  362. data/app/views/locomotive/current_site/_domain.html.haml +15 -0
  363. data/app/views/locomotive/current_site/_locale.html.haml +18 -0
  364. data/app/views/locomotive/current_site/_membership.html.haml +21 -0
  365. data/app/views/locomotive/current_site/edit.html.haml +13 -0
  366. data/app/views/locomotive/current_site/form/_access_points.html.haml +7 -0
  367. data/app/views/locomotive/current_site/form/_advanced.html.haml +17 -0
  368. data/app/views/locomotive/current_site/form/_main.html.haml +7 -0
  369. data/app/views/locomotive/current_site/form/_panes.html.haml +4 -0
  370. data/app/views/locomotive/current_site/form/_seo.html.haml +7 -0
  371. data/app/views/locomotive/current_site/form/_tabs.html.haml +14 -0
  372. data/app/views/locomotive/custom_fields/select_options/_option.html.haml +25 -0
  373. data/app/views/locomotive/custom_fields/select_options/edit.html.haml +14 -0
  374. data/app/views/locomotive/dashboard/show.html.haml +0 -0
  375. data/app/views/locomotive/devise_mailer/reset_password_instructions.html.haml +12 -0
  376. data/app/views/locomotive/editable_elements/index.html.haml +2 -0
  377. data/app/views/locomotive/errors/404.html.haml +7 -0
  378. data/app/views/locomotive/errors/500.html.haml +7 -0
  379. data/app/views/locomotive/errors/no_page.html.haml +1 -0
  380. data/app/views/locomotive/errors/no_site.html.haml +1 -0
  381. data/app/views/locomotive/layouts/application.html.haml +42 -0
  382. data/app/views/locomotive/layouts/error.html.haml +1 -0
  383. data/app/views/locomotive/layouts/not_logged_in.html.haml +18 -0
  384. data/app/views/locomotive/layouts/preview.html.haml +31 -0
  385. data/app/views/locomotive/layouts/without_site.html.haml +18 -0
  386. data/app/views/locomotive/memberships/edit.html.haml +15 -0
  387. data/app/views/locomotive/memberships/new.html.haml +15 -0
  388. data/app/views/locomotive/my_account/edit.html.haml +14 -0
  389. data/app/views/locomotive/my_account/form/_actions.html.haml +6 -0
  390. data/app/views/locomotive/my_account/form/_api.html.haml +3 -0
  391. data/app/views/locomotive/my_account/form/_credentials.html.haml +8 -0
  392. data/app/views/locomotive/my_account/form/_main.html.haml +6 -0
  393. data/app/views/locomotive/my_account/form/_panes.html.haml +4 -0
  394. data/app/views/locomotive/my_account/form/_tabs.html.haml +7 -0
  395. data/app/views/locomotive/notifications/new_content_entry.html.haml +31 -0
  396. data/app/views/locomotive/pages/_editable_elements.html.haml +64 -0
  397. data/app/views/locomotive/pages/_form.html.haml +66 -0
  398. data/app/views/locomotive/pages/_page.html.haml +44 -0
  399. data/app/views/locomotive/pages/edit.html.haml +14 -0
  400. data/app/views/locomotive/pages/form/_actions.html.haml +1 -0
  401. data/app/views/locomotive/pages/form/_main.html.haml +12 -0
  402. data/app/views/locomotive/pages/form/_panes.html.haml +4 -0
  403. data/app/views/locomotive/pages/form/_seo.html.haml +6 -0
  404. data/app/views/locomotive/pages/form/_tabs.html.haml +12 -0
  405. data/app/views/locomotive/pages/index.html.haml +22 -0
  406. data/app/views/locomotive/pages/new.html.haml +19 -0
  407. data/app/views/locomotive/pages/show.html.haml +2 -0
  408. data/app/views/locomotive/passwords/edit.html.haml +18 -0
  409. data/app/views/locomotive/passwords/new.html.haml +17 -0
  410. data/app/views/locomotive/public/sitemaps/show.xml.builder +31 -0
  411. data/app/views/locomotive/registrations/new.html.haml +19 -0
  412. data/app/views/locomotive/sessions/new.html.haml +22 -0
  413. data/app/views/locomotive/shared/_footer.html.haml +2 -0
  414. data/app/views/locomotive/shared/_form_actions.html.haml +14 -0
  415. data/app/views/locomotive/shared/_head.html.haml +40 -0
  416. data/app/views/locomotive/shared/_header.html.haml +30 -0
  417. data/app/views/locomotive/shared/_locale_picker_link.html.haml +6 -0
  418. data/app/views/locomotive/shared/_main_app_head.html.haml +1 -0
  419. data/app/views/locomotive/shared/_main_app_head_before_backbone.html.haml +1 -0
  420. data/app/views/locomotive/shared/_main_app_header.html.haml +1 -0
  421. data/app/views/locomotive/shared/_sidebar.html.haml +13 -0
  422. data/app/views/locomotive/shared/_sidebar_without_site.html.haml +3 -0
  423. data/app/views/locomotive/shared/actions/_contents.html.haml +7 -0
  424. data/app/views/locomotive/shared/header/_account.html.haml +7 -0
  425. data/app/views/locomotive/shared/header/_account_menu.html.haml +5 -0
  426. data/app/views/locomotive/shared/header/_brand.html.haml +4 -0
  427. data/app/views/locomotive/shared/header/_site.html.haml +8 -0
  428. data/app/views/locomotive/shared/rte/_image_popover.html.haml +18 -0
  429. data/app/views/locomotive/shared/rte/_link_popover.html.haml +19 -0
  430. data/app/views/locomotive/shared/rte/_toolbar.html.haml +62 -0
  431. data/app/views/locomotive/shared/sidebar/_content_types.html.haml +15 -0
  432. data/app/views/locomotive/shared/sidebar/_link.html.haml +10 -0
  433. data/app/views/locomotive/shared/sidebar/_my_account.html.haml +8 -0
  434. data/app/views/locomotive/shared/sidebar/_page.html.haml +25 -0
  435. data/app/views/locomotive/shared/sidebar/_pages.html.haml +11 -0
  436. data/app/views/locomotive/sites/_site.html.haml +16 -0
  437. data/app/views/locomotive/sites/index.html.haml +23 -0
  438. data/app/views/locomotive/sites/new.html.haml +12 -0
  439. data/app/views/locomotive/translations/_form.html.haml +12 -0
  440. data/app/views/locomotive/translations/edit.html.haml +15 -0
  441. data/app/views/locomotive/translations/index.html.haml +30 -0
  442. data/app/views/locomotive/translations/new.html.haml +12 -0
  443. data/config/cucumber.yml +8 -0
  444. data/config/initializers/csv_renderer.rb +10 -0
  445. data/config/initializers/deny_phantomjs_ttf.rb +29 -0
  446. data/config/initializers/devise.rb +15 -0
  447. data/config/initializers/haml.rb +2 -0
  448. data/config/initializers/locomotive_loaded_first.rb +19 -0
  449. data/config/initializers/simple_form.rb +73 -0
  450. data/config/locales/admin_ui.bg.yml +351 -0
  451. data/config/locales/admin_ui.cs.yml +363 -0
  452. data/config/locales/admin_ui.de.yml +341 -0
  453. data/config/locales/admin_ui.en.yml +385 -0
  454. data/config/locales/admin_ui.es.yml +327 -0
  455. data/config/locales/admin_ui.et.yml +335 -0
  456. data/config/locales/admin_ui.fr.yml +360 -0
  457. data/config/locales/admin_ui.it.yml +324 -0
  458. data/config/locales/admin_ui.ja.yml +341 -0
  459. data/config/locales/admin_ui.nb.yml +322 -0
  460. data/config/locales/admin_ui.nl.yml +290 -0
  461. data/config/locales/admin_ui.pl.yml +326 -0
  462. data/config/locales/admin_ui.pt-BR.yml +319 -0
  463. data/config/locales/admin_ui.pt.yml +320 -0
  464. data/config/locales/admin_ui.ru.yml +342 -0
  465. data/config/locales/admin_ui.sk.yml +363 -0
  466. data/config/locales/admin_ui.sr.yml +356 -0
  467. data/config/locales/admin_ui.zh-CN.yml +352 -0
  468. data/config/locales/carrierwave.bg.yml +4 -0
  469. data/config/locales/carrierwave.cs.yml +4 -0
  470. data/config/locales/carrierwave.de.yml +4 -0
  471. data/config/locales/carrierwave.en.yml +4 -0
  472. data/config/locales/carrierwave.es.yml +4 -0
  473. data/config/locales/carrierwave.et.yml +4 -0
  474. data/config/locales/carrierwave.fr.yml +4 -0
  475. data/config/locales/carrierwave.it.yml +4 -0
  476. data/config/locales/carrierwave.ja.yml +4 -0
  477. data/config/locales/carrierwave.nb.yml +4 -0
  478. data/config/locales/carrierwave.nl.yml +4 -0
  479. data/config/locales/carrierwave.pl.yml +4 -0
  480. data/config/locales/carrierwave.pt-BR.yml +4 -0
  481. data/config/locales/carrierwave.pt.yml +4 -0
  482. data/config/locales/carrierwave.ru.yml +4 -0
  483. data/config/locales/carrierwave.sk.yml +4 -0
  484. data/config/locales/carrierwave.sr.yml +4 -0
  485. data/config/locales/carrierwave.zh-CN.yml +4 -0
  486. data/config/locales/default.bg.yml +231 -0
  487. data/config/locales/default.cs.yml +249 -0
  488. data/config/locales/default.de.yml +252 -0
  489. data/config/locales/default.en.yml +57 -0
  490. data/config/locales/default.es.yml +219 -0
  491. data/config/locales/default.et.yml +240 -0
  492. data/config/locales/default.fr.yml +229 -0
  493. data/config/locales/default.it.yml +246 -0
  494. data/config/locales/default.ja.yml +98 -0
  495. data/config/locales/default.nb.yml +313 -0
  496. data/config/locales/default.nl.yml +175 -0
  497. data/config/locales/default.pl.yml +317 -0
  498. data/config/locales/default.pt-BR.yml +212 -0
  499. data/config/locales/default.pt.yml +212 -0
  500. data/config/locales/default.ru.yml +293 -0
  501. data/config/locales/default.sk.yml +249 -0
  502. data/config/locales/default.sr.yml +276 -0
  503. data/config/locales/default.zh-CN.yml +226 -0
  504. data/config/locales/devise.bg.yml +64 -0
  505. data/config/locales/devise.cs.yml +64 -0
  506. data/config/locales/devise.de.yml +63 -0
  507. data/config/locales/devise.en.yml +64 -0
  508. data/config/locales/devise.es.yml +64 -0
  509. data/config/locales/devise.et.yml +65 -0
  510. data/config/locales/devise.fr.yml +68 -0
  511. data/config/locales/devise.it.yml +64 -0
  512. data/config/locales/devise.ja.yml +63 -0
  513. data/config/locales/devise.nb.yml +65 -0
  514. data/config/locales/devise.nl.yml +64 -0
  515. data/config/locales/devise.pl.yml +64 -0
  516. data/config/locales/devise.pt-BR.yml +62 -0
  517. data/config/locales/devise.pt.yml +62 -0
  518. data/config/locales/devise.ru.yml +64 -0
  519. data/config/locales/devise.sk.yml +64 -0
  520. data/config/locales/devise.sr.yml +64 -0
  521. data/config/locales/devise.zh-CN.yml +64 -0
  522. data/config/locales/flash.bg.yml +115 -0
  523. data/config/locales/flash.cs.yml +115 -0
  524. data/config/locales/flash.de.yml +106 -0
  525. data/config/locales/flash.en.yml +118 -0
  526. data/config/locales/flash.es.yml +106 -0
  527. data/config/locales/flash.et.yml +106 -0
  528. data/config/locales/flash.fr.yml +106 -0
  529. data/config/locales/flash.it.yml +106 -0
  530. data/config/locales/flash.ja.yml +115 -0
  531. data/config/locales/flash.nb.yml +106 -0
  532. data/config/locales/flash.nl.yml +106 -0
  533. data/config/locales/flash.pl.yml +106 -0
  534. data/config/locales/flash.pt-BR.yml +106 -0
  535. data/config/locales/flash.pt.yml +106 -0
  536. data/config/locales/flash.ru.yml +106 -0
  537. data/config/locales/flash.sk.yml +115 -0
  538. data/config/locales/flash.sr.yml +115 -0
  539. data/config/locales/flash.zh-CN.yml +115 -0
  540. data/config/locales/formtastic.bg.yml +113 -0
  541. data/config/locales/formtastic.cs.yml +125 -0
  542. data/config/locales/formtastic.de.yml +106 -0
  543. data/config/locales/formtastic.es.yml +84 -0
  544. data/config/locales/formtastic.et.yml +103 -0
  545. data/config/locales/formtastic.fr.yml +109 -0
  546. data/config/locales/formtastic.it.yml +99 -0
  547. data/config/locales/formtastic.ja.yml +103 -0
  548. data/config/locales/formtastic.nb.yml +103 -0
  549. data/config/locales/formtastic.nl.yml +85 -0
  550. data/config/locales/formtastic.pl.yml +105 -0
  551. data/config/locales/formtastic.pt-BR.yml +70 -0
  552. data/config/locales/formtastic.pt.yml +70 -0
  553. data/config/locales/formtastic.ru.yml +106 -0
  554. data/config/locales/formtastic.sk.yml +125 -0
  555. data/config/locales/formtastic.sr.yml +112 -0
  556. data/config/locales/formtastic.zh-CN.yml +112 -0
  557. data/config/locales/inputs.en.yml +14 -0
  558. data/config/locales/simple_form.en.yml +170 -0
  559. data/config/routes.rb +69 -0
  560. data/features/api/accounts.feature +43 -0
  561. data/features/api/authentication.feature +41 -0
  562. data/features/api/authorization/accounts.feature +165 -0
  563. data/features/api/authorization/content_assets.feature +147 -0
  564. data/features/api/authorization/content_entries.feature +202 -0
  565. data/features/api/authorization/content_types.feature +237 -0
  566. data/features/api/authorization/current_site.feature +30 -0
  567. data/features/api/authorization/memberships.feature +225 -0
  568. data/features/api/authorization/pages.feature +189 -0
  569. data/features/api/authorization/sites.feature +212 -0
  570. data/features/api/authorization/snippets.feature +179 -0
  571. data/features/api/authorization/theme_assets.feature +185 -0
  572. data/features/api/authorization/translations.feature +253 -0
  573. data/features/api/content_entries.feature +184 -0
  574. data/features/api/content_types.feature +156 -0
  575. data/features/api/editable_elements.feature +190 -0
  576. data/features/api/entries_custom_fields.feature +150 -0
  577. data/features/api/memberships.feature +26 -0
  578. data/features/api/pages.feature +72 -0
  579. data/features/backoffice/authorization/account_settings.feature +28 -0
  580. data/features/backoffice/authorization/content_type.feature +35 -0
  581. data/features/backoffice/authorization/current_site.feature +53 -0
  582. data/features/backoffice/authorization/inline_front_end_editing.feature +46 -0
  583. data/features/backoffice/authorization/pages.feature +95 -0
  584. data/features/backoffice/authorization/theme_assets.feature +50 -0
  585. data/features/backoffice/content_types/edit.feature +20 -0
  586. data/features/backoffice/content_types/email.feature +26 -0
  587. data/features/backoffice/content_types/has_many.feature +80 -0
  588. data/features/backoffice/content_types/integer.feature +26 -0
  589. data/features/backoffice/content_types/localized.feature +63 -0
  590. data/features/backoffice/content_types/many_to_many.feature +70 -0
  591. data/features/backoffice/content_types/tags.feature +22 -0
  592. data/features/backoffice/content_types/uniqueness.feature +29 -0
  593. data/features/backoffice/contents.feature +93 -0
  594. data/features/backoffice/editable_elements.feature +22 -0
  595. data/features/backoffice/installation.feature +33 -0
  596. data/features/backoffice/login.feature +33 -0
  597. data/features/backoffice/mounting.feature +13 -0
  598. data/features/backoffice/my_account.feature +22 -0
  599. data/features/backoffice/pages.feature +73 -0
  600. data/features/backoffice/regressions.feature +19 -0
  601. data/features/backoffice/site.feature +71 -0
  602. data/features/backoffice/snippets.feature +39 -0
  603. data/features/backoffice/theme_assets.feature +72 -0
  604. data/features/backoffice/translations.feature +50 -0
  605. data/features/public/basic.feature +30 -0
  606. data/features/public/contact_form.feature +98 -0
  607. data/features/public/content_entries.feature +69 -0
  608. data/features/public/editable_elements.feature +138 -0
  609. data/features/public/has_many.feature +8 -0
  610. data/features/public/inheritance.feature +157 -0
  611. data/features/public/inline_front_end_editing.feature +26 -0
  612. data/features/public/many_to_many.feature +64 -0
  613. data/features/public/new_contact_form.feature +95 -0
  614. data/features/public/pages.feature +116 -0
  615. data/features/public/pagination.feature +8 -0
  616. data/features/public/robots.feature +22 -0
  617. data/features/public/session.feature +40 -0
  618. data/features/public/sitemap.feature +74 -0
  619. data/features/public/snippets.feature +21 -0
  620. data/features/public/tablerow.feature +42 -0
  621. data/features/public/tags.feature +45 -0
  622. data/features/step_definitions/api_steps.rb +179 -0
  623. data/features/step_definitions/backoffice/mounting_steps.rb +22 -0
  624. data/features/step_definitions/backoffice_steps.rb +47 -0
  625. data/features/step_definitions/content_assets_steps.rb +12 -0
  626. data/features/step_definitions/content_types_steps.rb +135 -0
  627. data/features/step_definitions/current_site_steps.rb +43 -0
  628. data/features/step_definitions/editable_elements_steps.rb +24 -0
  629. data/features/step_definitions/membership_steps.rb +19 -0
  630. data/features/step_definitions/more_web_steps.rb +131 -0
  631. data/features/step_definitions/page_steps.rb +133 -0
  632. data/features/step_definitions/pagination_steps.rb +35 -0
  633. data/features/step_definitions/pickle_steps.rb +100 -0
  634. data/features/step_definitions/relationships_steps.rb +110 -0
  635. data/features/step_definitions/site_steps.rb +111 -0
  636. data/features/step_definitions/snippet_steps.rb +37 -0
  637. data/features/step_definitions/theme_asset_steps.rb +64 -0
  638. data/features/step_definitions/translation_steps.rb +7 -0
  639. data/features/step_definitions/web_steps.rb +225 -0
  640. data/features/step_definitions/within_steps.rb +14 -0
  641. data/features/support/cleaner.rb +4 -0
  642. data/features/support/env.rb +82 -0
  643. data/features/support/factory_girl.rb +2 -0
  644. data/features/support/http.rb +22 -0
  645. data/features/support/locales.rb +5 -0
  646. data/features/support/paths.rb +62 -0
  647. data/features/support/pickle.rb +24 -0
  648. data/features/support/selectors.rb +57 -0
  649. data/lib/generators/locomotive/install/install_generator.rb +49 -0
  650. data/lib/generators/locomotive/install/templates/README +25 -0
  651. data/lib/generators/locomotive/install/templates/carrierwave.rb +28 -0
  652. data/lib/generators/locomotive/install/templates/devise.rb +190 -0
  653. data/lib/generators/locomotive/install/templates/dragonfly.rb +22 -0
  654. data/lib/generators/locomotive/install/templates/locomotive.rb +54 -0
  655. data/lib/generators/locomotive/install/templates/mongoid.yml +81 -0
  656. data/lib/locomotive.rb +77 -0
  657. data/lib/locomotive/action_controller.rb +3 -0
  658. data/lib/locomotive/action_controller/responder.rb +79 -0
  659. data/lib/locomotive/action_controller/ssl.rb +15 -0
  660. data/lib/locomotive/carrierwave.rb +14 -0
  661. data/lib/locomotive/carrierwave/asset.rb +72 -0
  662. data/lib/locomotive/carrierwave/base.rb +15 -0
  663. data/lib/locomotive/carrierwave/patches.rb +32 -0
  664. data/lib/locomotive/configuration.rb +96 -0
  665. data/lib/locomotive/core_ext.rb +79 -0
  666. data/lib/locomotive/custom_fields.rb +70 -0
  667. data/lib/locomotive/dependencies.rb +39 -0
  668. data/lib/locomotive/devise.rb +22 -0
  669. data/lib/locomotive/dragonfly.rb +63 -0
  670. data/lib/locomotive/engine.rb +60 -0
  671. data/lib/locomotive/haml.rb +1 -0
  672. data/lib/locomotive/kaminari.rb +36 -0
  673. data/lib/locomotive/logger.rb +11 -0
  674. data/lib/locomotive/middlewares.rb +2 -0
  675. data/lib/locomotive/middlewares/permalink.rb +22 -0
  676. data/lib/locomotive/middlewares/site.rb +58 -0
  677. data/lib/locomotive/mongoid.rb +4 -0
  678. data/lib/locomotive/mongoid/document.rb +19 -0
  679. data/lib/locomotive/mongoid/liquid.rb +39 -0
  680. data/lib/locomotive/mongoid/patches.rb +182 -0
  681. data/lib/locomotive/mongoid/presenter.rb +76 -0
  682. data/lib/locomotive/presentable.rb +216 -0
  683. data/lib/locomotive/previous_liquid/asset_host.rb +51 -0
  684. data/lib/locomotive/previous_liquid/drops/base.rb +40 -0
  685. data/lib/locomotive/previous_liquid/drops/content_entry.rb +78 -0
  686. data/lib/locomotive/previous_liquid/drops/content_types.rb +119 -0
  687. data/lib/locomotive/previous_liquid/drops/current_user.rb +21 -0
  688. data/lib/locomotive/previous_liquid/drops/page.rb +115 -0
  689. data/lib/locomotive/previous_liquid/drops/proxy_collection.rb +64 -0
  690. data/lib/locomotive/previous_liquid/drops/session_proxy.rb +16 -0
  691. data/lib/locomotive/previous_liquid/drops/site.rb +29 -0
  692. data/lib/locomotive/previous_liquid/drops/uploader.rb +21 -0
  693. data/lib/locomotive/previous_liquid/errors.rb +8 -0
  694. data/lib/locomotive/previous_liquid/filters/base.rb +61 -0
  695. data/lib/locomotive/previous_liquid/filters/date.rb +82 -0
  696. data/lib/locomotive/previous_liquid/filters/html.rb +117 -0
  697. data/lib/locomotive/previous_liquid/filters/misc.rb +75 -0
  698. data/lib/locomotive/previous_liquid/filters/resize.rb +18 -0
  699. data/lib/locomotive/previous_liquid/filters/text.rb +53 -0
  700. data/lib/locomotive/previous_liquid/filters/translate.rb +38 -0
  701. data/lib/locomotive/previous_liquid/patches.rb +21 -0
  702. data/lib/locomotive/previous_liquid/tags/consume.rb +104 -0
  703. data/lib/locomotive/previous_liquid/tags/csrf.rb +40 -0
  704. data/lib/locomotive/previous_liquid/tags/editable.rb +4 -0
  705. data/lib/locomotive/previous_liquid/tags/editable/base.rb +88 -0
  706. data/lib/locomotive/previous_liquid/tags/editable/control.rb +41 -0
  707. data/lib/locomotive/previous_liquid/tags/editable/file.rb +43 -0
  708. data/lib/locomotive/previous_liquid/tags/editable/text.rb +79 -0
  709. data/lib/locomotive/previous_liquid/tags/extends.rb +47 -0
  710. data/lib/locomotive/previous_liquid/tags/fetch_page.rb +36 -0
  711. data/lib/locomotive/previous_liquid/tags/google_analytics.rb +39 -0
  712. data/lib/locomotive/previous_liquid/tags/hybrid.rb +25 -0
  713. data/lib/locomotive/previous_liquid/tags/inherited_block.rb +31 -0
  714. data/lib/locomotive/previous_liquid/tags/inline_editor.rb +40 -0
  715. data/lib/locomotive/previous_liquid/tags/javascript.rb +16 -0
  716. data/lib/locomotive/previous_liquid/tags/link_to.rb +43 -0
  717. data/lib/locomotive/previous_liquid/tags/locale_switcher.rb +83 -0
  718. data/lib/locomotive/previous_liquid/tags/model_form.rb +75 -0
  719. data/lib/locomotive/previous_liquid/tags/nav.rb +164 -0
  720. data/lib/locomotive/previous_liquid/tags/paginate.rb +114 -0
  721. data/lib/locomotive/previous_liquid/tags/path_helper.rb +85 -0
  722. data/lib/locomotive/previous_liquid/tags/path_to.rb +21 -0
  723. data/lib/locomotive/previous_liquid/tags/seo.rb +72 -0
  724. data/lib/locomotive/previous_liquid/tags/session_assign.rb +39 -0
  725. data/lib/locomotive/previous_liquid/tags/snippet.rb +75 -0
  726. data/lib/locomotive/previous_liquid/tags/with_scope.rb +65 -0
  727. data/lib/locomotive/rails.rb +1 -0
  728. data/lib/locomotive/rails/action_view.rb +6 -0
  729. data/lib/locomotive/regexps.rb +13 -0
  730. data/lib/locomotive/simple_form.rb +137 -0
  731. data/lib/locomotive/simple_token_authentication.rb +11 -0
  732. data/lib/locomotive/steam_adaptor.rb +26 -0
  733. data/lib/locomotive/version.rb +3 -0
  734. data/lib/locomotivecms.rb +1 -0
  735. data/lib/tasks/development.rake +59 -0
  736. data/lib/tasks/locomotive.rake +126 -0
  737. data/public/favicon.ico +0 -0
  738. data/spec/dummy/Rakefile +6 -0
  739. data/spec/dummy/app/assets/javascripts/application.js +9 -0
  740. data/spec/dummy/app/assets/javascripts/locomotive_misc.js.coffee +2 -0
  741. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  742. data/spec/dummy/app/cells/locomotive/main_menu_cell.rb +9 -0
  743. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  744. data/spec/dummy/app/controllers/foo_controller.rb +6 -0
  745. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  746. data/spec/dummy/app/models/foo.rb +7 -0
  747. data/spec/dummy/app/views/foo/index.html.haml +1 -0
  748. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  749. data/spec/dummy/app/views/locomotive/shared/_main_app_head.html.haml +1 -0
  750. data/spec/dummy/config.ru +7 -0
  751. data/spec/dummy/config/application.rb +49 -0
  752. data/spec/dummy/config/boot.rb +10 -0
  753. data/spec/dummy/config/environment.rb +5 -0
  754. data/spec/dummy/config/environments/development.rb +46 -0
  755. data/spec/dummy/config/environments/production.rb +44 -0
  756. data/spec/dummy/config/environments/test.rb +39 -0
  757. data/spec/dummy/config/initializers/assets.rb +13 -0
  758. data/spec/dummy/config/initializers/carrierwave.rb +8 -0
  759. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  760. data/spec/dummy/config/initializers/devise.rb +190 -0
  761. data/spec/dummy/config/initializers/dragonfly.rb +24 -0
  762. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  763. data/spec/dummy/config/initializers/haml.rb +2 -0
  764. data/spec/dummy/config/initializers/locomotive.rb +57 -0
  765. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  766. data/spec/dummy/config/initializers/session_store.rb +3 -0
  767. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  768. data/spec/dummy/config/locales/en.yml +10 -0
  769. data/spec/dummy/config/locales/fr.yml +10 -0
  770. data/spec/dummy/config/mongoid.yml +117 -0
  771. data/spec/dummy/config/routes.rb +14 -0
  772. data/spec/dummy/config/secrets.yml +25 -0
  773. data/spec/dummy/public/404.html +26 -0
  774. data/spec/dummy/public/422.html +26 -0
  775. data/spec/dummy/public/500.html +26 -0
  776. data/spec/dummy/script/rails +6 -0
  777. data/spec/fixtures/assets/5k.png +0 -0
  778. data/spec/fixtures/assets/5k@2x.png +0 -0
  779. data/spec/fixtures/assets/5k_2.png +0 -0
  780. data/spec/fixtures/assets/application.js +1 -0
  781. data/spec/fixtures/assets/main.css +1 -0
  782. data/spec/fixtures/assets/specs.pdf +0 -0
  783. data/spec/fixtures/assets/wrong.txt +1 -0
  784. data/spec/fixtures/images/logo1.jpg +0 -0
  785. data/spec/fixtures/images/logo2.jpg +0 -0
  786. data/spec/fixtures/images/rails.png +0 -0
  787. data/spec/fixtures/images/rails_2.png +0 -0
  788. data/spec/fixtures/portfolio/Gemfile +21 -0
  789. data/spec/fixtures/portfolio/app/content_types/messages.yml +57 -0
  790. data/spec/fixtures/portfolio/app/content_types/projects.yml +74 -0
  791. data/spec/fixtures/portfolio/app/views/pages/404.liquid.haml +10 -0
  792. data/spec/fixtures/portfolio/app/views/pages/index.liquid.haml +213 -0
  793. data/spec/fixtures/portfolio/app/views/snippets/footer.liquid.haml +2 -0
  794. data/spec/fixtures/portfolio/config.ru +3 -0
  795. data/spec/fixtures/portfolio/config/deploy.yml +18 -0
  796. data/spec/fixtures/portfolio/config/site.yml +33 -0
  797. data/spec/fixtures/portfolio/config/translations.yml +8 -0
  798. data/spec/fixtures/portfolio/data/messages.yml +1 -0
  799. data/spec/fixtures/portfolio/data/projects.yml +41 -0
  800. data/spec/fixtures/portfolio/icon.png +0 -0
  801. data/spec/fixtures/portfolio/public/javascripts/bootstrap.min.js +6 -0
  802. data/spec/fixtures/portfolio/public/javascripts/cbpAnimatedHeader.js +44 -0
  803. data/spec/fixtures/portfolio/public/javascripts/cbpAnimatedHeader.min.js +11 -0
  804. data/spec/fixtures/portfolio/public/javascripts/classie.js +80 -0
  805. data/spec/fixtures/portfolio/public/javascripts/contact_me.js +65 -0
  806. data/spec/fixtures/portfolio/public/javascripts/freelancer.js +37 -0
  807. data/spec/fixtures/portfolio/public/javascripts/jqBootstrapValidation.js +912 -0
  808. data/spec/fixtures/portfolio/public/samples/portfolio/cabin.png +0 -0
  809. data/spec/fixtures/portfolio/public/samples/portfolio/cake.png +0 -0
  810. data/spec/fixtures/portfolio/public/samples/portfolio/circus.png +0 -0
  811. data/spec/fixtures/portfolio/public/samples/portfolio/game.png +0 -0
  812. data/spec/fixtures/portfolio/public/samples/portfolio/safe.png +0 -0
  813. data/spec/fixtures/portfolio/public/samples/portfolio/submarine.png +0 -0
  814. data/spec/fixtures/portfolio/public/samples/profile.png +0 -0
  815. data/spec/fixtures/portfolio/public/stylesheets/bootstrap.min.css +7 -0
  816. data/spec/fixtures/portfolio/public/stylesheets/freelancer.css +445 -0
  817. data/spec/lib/action_view_spec.rb +15 -0
  818. data/spec/lib/core_ext_spec.rb +37 -0
  819. data/spec/lib/locomotive/configuration_spec.rb +15 -0
  820. data/spec/lib/locomotive/liquid/tags/editable/file_spec.rb +72 -0
  821. data/spec/lib/locomotive/liquid/tags/editable/text_spec.rb +85 -0
  822. data/spec/lib/locomotive/liquid/tags/extends_spec.rb +58 -0
  823. data/spec/mailers/locomotive/notifications_spec.rb +47 -0
  824. data/spec/models/locomotive/account_spec.rb +125 -0
  825. data/spec/models/locomotive/concerns/content_entry/counter_spec.rb +53 -0
  826. data/spec/models/locomotive/concerns/content_entry/csv_spec.rb +30 -0
  827. data/spec/models/locomotive/concerns/page/editable_elements_spec.rb +73 -0
  828. data/spec/models/locomotive/concerns/page/layout_spec.rb +50 -0
  829. data/spec/models/locomotive/concerns/page/redirect_spec.rb +28 -0
  830. data/spec/models/locomotive/concerns/page/render_spec.rb +84 -0
  831. data/spec/models/locomotive/concerns/site/access_points_spec.rb +15 -0
  832. data/spec/models/locomotive/concerns/site/locales_spec.rb +52 -0
  833. data/spec/models/locomotive/content_asset_spec.rb +58 -0
  834. data/spec/models/locomotive/content_entry_spec.rb +411 -0
  835. data/spec/models/locomotive/content_type_spec.rb +405 -0
  836. data/spec/models/locomotive/editable_control_spec.rb +79 -0
  837. data/spec/models/locomotive/editable_file_spec.rb +94 -0
  838. data/spec/models/locomotive/editable_text_spec.rb +219 -0
  839. data/spec/models/locomotive/membership_spec.rb +43 -0
  840. data/spec/models/locomotive/page_spec.rb +432 -0
  841. data/spec/models/locomotive/site_spec.rb +206 -0
  842. data/spec/models/locomotive/snippet_spec.rb +19 -0
  843. data/spec/models/locomotive/theme_asset_spec.rb +168 -0
  844. data/spec/requests/admin_ssl_spec.rb +51 -0
  845. data/spec/requests/site_spec.rb +36 -0
  846. data/spec/support/asset_host_stubs.rb +17 -0
  847. data/spec/support/carrierwave.rb +39 -0
  848. data/spec/support/controller.rb +32 -0
  849. data/spec/support/entity.rb +3 -0
  850. data/spec/support/factories.rb +313 -0
  851. data/spec/support/locomotive.rb +35 -0
  852. data/spec/support/matchers.rb +98 -0
  853. data/spec/support/middlewares.rb +3 -0
  854. data/spec/support/pundit_matcher.rb +50 -0
  855. data/spec/support/response.rb +12 -0
  856. data/spec/support/sequences.rb +16 -0
  857. data/spec/support/shared_contexts/api_header_setup.rb +7 -0
  858. data/spec/support/shared_contexts/api_site_setup.rb +13 -0
  859. data/vendor/assets/images/select2-spinner.gif +0 -0
  860. data/vendor/assets/images/select2.png +0 -0
  861. data/vendor/assets/images/select2x2.png +0 -0
  862. data/vendor/assets/javascripts/locomotive/bootstrap-datetimepicker.js +1395 -0
  863. data/vendor/assets/javascripts/locomotive/bootstrap-growl.js +312 -0
  864. data/vendor/assets/javascripts/locomotive/bootstrap-switch.js +532 -0
  865. data/vendor/assets/javascripts/locomotive/bootstrap-tagsinput.min.js +6 -0
  866. data/vendor/assets/javascripts/locomotive/canvas-to-blob.min.js +1 -0
  867. data/vendor/assets/javascripts/locomotive/cmd.js +31 -0
  868. data/vendor/assets/javascripts/locomotive/cookies.js +117 -0
  869. data/vendor/assets/javascripts/locomotive/cropper.js +9 -0
  870. data/vendor/assets/javascripts/locomotive/datepicker_i18n.js.erb +28 -0
  871. data/vendor/assets/javascripts/locomotive/editable_field.js +50 -0
  872. data/vendor/assets/javascripts/locomotive/form_submit_notification.js +39 -0
  873. data/vendor/assets/javascripts/locomotive/jquery-ui-timepicker-addon.js +2134 -0
  874. data/vendor/assets/javascripts/locomotive/liquid_mode.js +42 -0
  875. data/vendor/assets/javascripts/locomotive/moment.js +2808 -0
  876. data/vendor/assets/javascripts/locomotive/resize.js +9 -0
  877. data/vendor/assets/javascripts/locomotive/resizeImage.js +235 -0
  878. data/vendor/assets/javascripts/locomotive/slugify.js +47 -0
  879. data/vendor/assets/javascripts/locomotive/subscribe.js +367 -0
  880. data/vendor/assets/javascripts/locomotive/vendor.js +3 -0
  881. data/vendor/assets/javascripts/locomotive/wysihtml5/parser_rules/advanced.js +562 -0
  882. data/vendor/assets/javascripts/locomotive/wysihtml5/parser_rules/advanced_unwrap.js +666 -0
  883. data/vendor/assets/javascripts/locomotive/wysihtml5x-toolbar.js +15080 -0
  884. data/vendor/assets/stylesheets/locomotive/bootstrap-datetimepicker.css +235 -0
  885. data/vendor/assets/stylesheets/locomotive/bootstrap-switch.css +206 -0
  886. data/vendor/assets/stylesheets/locomotive/bootstrap-tagsinput.css +46 -0
  887. data/vendor/assets/stylesheets/locomotive/cropper.css +9 -0
  888. data/vendor/assets/stylesheets/locomotive/jquery/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  889. data/vendor/assets/stylesheets/locomotive/jquery/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  890. data/vendor/assets/stylesheets/locomotive/jquery/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  891. data/vendor/assets/stylesheets/locomotive/jquery/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  892. data/vendor/assets/stylesheets/locomotive/jquery/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  893. data/vendor/assets/stylesheets/locomotive/jquery/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  894. data/vendor/assets/stylesheets/locomotive/jquery/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  895. data/vendor/assets/stylesheets/locomotive/jquery/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  896. data/vendor/assets/stylesheets/locomotive/jquery/images/ui-icons_222222_256x240.png +0 -0
  897. data/vendor/assets/stylesheets/locomotive/jquery/images/ui-icons_2e83ff_256x240.png +0 -0
  898. data/vendor/assets/stylesheets/locomotive/jquery/images/ui-icons_454545_256x240.png +0 -0
  899. data/vendor/assets/stylesheets/locomotive/jquery/images/ui-icons_888888_256x240.png +0 -0
  900. data/vendor/assets/stylesheets/locomotive/jquery/images/ui-icons_cd0a0a_256x240.png +0 -0
  901. data/vendor/assets/stylesheets/locomotive/jquery/images/ui-icons_ffffff_256x240.png +0 -0
  902. data/vendor/assets/stylesheets/locomotive/jquery/ui.css.scss +406 -0
  903. data/vendor/assets/stylesheets/locomotive/liquid_mode.css +7 -0
  904. data/vendor/assets/stylesheets/locomotive/wysihtml5_editor.css +133 -0
  905. data/vendor/assets/stylesheets/locomotive/wysihtml5_reset.css +7 -0
  906. metadata +1735 -0
@@ -0,0 +1,6 @@
1
+ /*
2
+ * bootstrap-tagsinput v0.4.2 by Tim Schlechter
3
+ *
4
+ */
5
+
6
+ !function(a){"use strict";function b(b,c){this.itemsArray=[],this.$element=a(b),this.$element.hide(),this.isSelect="SELECT"===b.tagName,this.multiple=this.isSelect&&b.hasAttribute("multiple"),this.objectItems=c&&c.itemValue,this.placeholderText=b.hasAttribute("placeholder")?this.$element.attr("placeholder"):"",this.inputSize=Math.max(1,this.placeholderText.length),this.$container=a('<div class="bootstrap-tagsinput"></div>'),this.$input=a('<input type="text" placeholder="'+this.placeholderText+'"/>').appendTo(this.$container),this.$element.after(this.$container);var d=(this.inputSize<3?3:this.inputSize)+"em";this.$input.get(0).style.cssText="width: "+d+" !important;",this.build(c)}function c(a,b){if("function"!=typeof a[b]){var c=a[b];a[b]=function(a){return a[c]}}}function d(a,b){if("function"!=typeof a[b]){var c=a[b];a[b]=function(){return c}}}function e(a){return a?i.text(a).html():""}function f(a){var b=0;if(document.selection){a.focus();var c=document.selection.createRange();c.moveStart("character",-a.value.length),b=c.text.length}else(a.selectionStart||"0"==a.selectionStart)&&(b=a.selectionStart);return b}function g(b,c){var d=!1;return a.each(c,function(a,c){if("number"==typeof c&&b.which===c)return d=!0,!1;if(b.which===c.which){var e=!c.hasOwnProperty("altKey")||b.altKey===c.altKey,f=!c.hasOwnProperty("shiftKey")||b.shiftKey===c.shiftKey,g=!c.hasOwnProperty("ctrlKey")||b.ctrlKey===c.ctrlKey;if(e&&f&&g)return d=!0,!1}}),d}var h={tagClass:function(){return"label label-info"},itemValue:function(a){return a?a.toString():a},itemText:function(a){return this.itemValue(a)},freeInput:!0,addOnBlur:!0,maxTags:void 0,maxChars:void 0,confirmKeys:[13,44],onTagExists:function(a,b){b.hide().fadeIn()},trimValue:!1,allowDuplicates:!1};b.prototype={constructor:b,add:function(b,c){var d=this;if(!(d.options.maxTags&&d.itemsArray.length>=d.options.maxTags||b!==!1&&!b)){if("string"==typeof b&&d.options.trimValue&&(b=a.trim(b)),"object"==typeof b&&!d.objectItems)throw"Can't add objects when itemValue option is not set";if(!b.toString().match(/^\s*$/)){if(d.isSelect&&!d.multiple&&d.itemsArray.length>0&&d.remove(d.itemsArray[0]),"string"==typeof b&&"INPUT"===this.$element[0].tagName){var f=b.split(",");if(f.length>1){for(var g=0;g<f.length;g++)this.add(f[g],!0);return void(c||d.pushVal())}}var h=d.options.itemValue(b),i=d.options.itemText(b),j=d.options.tagClass(b),k=a.grep(d.itemsArray,function(a){return d.options.itemValue(a)===h})[0];if(!k||d.options.allowDuplicates){if(!(d.items().toString().length+b.length+1>d.options.maxInputLength)){var l=a.Event("beforeItemAdd",{item:b,cancel:!1});if(d.$element.trigger(l),!l.cancel){d.itemsArray.push(b);var m=a('<span class="tag '+e(j)+'">'+e(i)+'<span data-role="remove"></span></span>');if(m.data("item",b),d.findInputWrapper().before(m),m.after(" "),d.isSelect&&!a('option[value="'+encodeURIComponent(h)+'"]',d.$element)[0]){var n=a("<option selected>"+e(i)+"</option>");n.data("item",b),n.attr("value",h),d.$element.append(n)}c||d.pushVal(),(d.options.maxTags===d.itemsArray.length||d.items().toString().length===d.options.maxInputLength)&&d.$container.addClass("bootstrap-tagsinput-max"),d.$element.trigger(a.Event("itemAdded",{item:b}))}}}else if(d.options.onTagExists){var o=a(".tag",d.$container).filter(function(){return a(this).data("item")===k});d.options.onTagExists(b,o)}}}},remove:function(b,c){var d=this;if(d.objectItems&&(b="object"==typeof b?a.grep(d.itemsArray,function(a){return d.options.itemValue(a)==d.options.itemValue(b)}):a.grep(d.itemsArray,function(a){return d.options.itemValue(a)==b}),b=b[b.length-1]),b){var e=a.Event("beforeItemRemove",{item:b,cancel:!1});if(d.$element.trigger(e),e.cancel)return;a(".tag",d.$container).filter(function(){return a(this).data("item")===b}).remove(),a("option",d.$element).filter(function(){return a(this).data("item")===b}).remove(),-1!==a.inArray(b,d.itemsArray)&&d.itemsArray.splice(a.inArray(b,d.itemsArray),1)}c||d.pushVal(),d.options.maxTags>d.itemsArray.length&&d.$container.removeClass("bootstrap-tagsinput-max"),d.$element.trigger(a.Event("itemRemoved",{item:b}))},removeAll:function(){var b=this;for(a(".tag",b.$container).remove(),a("option",b.$element).remove();b.itemsArray.length>0;)b.itemsArray.pop();b.pushVal()},refresh:function(){var b=this;a(".tag",b.$container).each(function(){var c=a(this),d=c.data("item"),f=b.options.itemValue(d),g=b.options.itemText(d),h=b.options.tagClass(d);if(c.attr("class",null),c.addClass("tag "+e(h)),c.contents().filter(function(){return 3==this.nodeType})[0].nodeValue=e(g),b.isSelect){var i=a("option",b.$element).filter(function(){return a(this).data("item")===d});i.attr("value",f)}})},items:function(){return this.itemsArray},pushVal:function(){var b=this,c=a.map(b.items(),function(a){return b.options.itemValue(a).toString()});b.$element.val(c,!0).trigger("change")},build:function(b){var e=this;if(e.options=a.extend({},h,b),e.objectItems&&(e.options.freeInput=!1),c(e.options,"itemValue"),c(e.options,"itemText"),d(e.options,"tagClass"),e.options.typeahead){var i=e.options.typeahead||{};d(i,"source"),e.$input.typeahead(a.extend({},i,{source:function(b,c){function d(a){for(var b=[],d=0;d<a.length;d++){var g=e.options.itemText(a[d]);f[g]=a[d],b.push(g)}c(b)}this.map={};var f=this.map,g=i.source(b);a.isFunction(g.success)?g.success(d):a.isFunction(g.then)?g.then(d):a.when(g).then(d)},updater:function(a){e.add(this.map[a])},matcher:function(a){return-1!==a.toLowerCase().indexOf(this.query.trim().toLowerCase())},sorter:function(a){return a.sort()},highlighter:function(a){var b=new RegExp("("+this.query+")","gi");return a.replace(b,"<strong>$1</strong>")}}))}if(e.options.typeaheadjs){var j=e.options.typeaheadjs||{};e.$input.typeahead(null,j).on("typeahead:selected",a.proxy(function(a,b){e.add(j.valueKey?b[j.valueKey]:b),e.$input.typeahead("val","")},e))}e.$container.on("click",a.proxy(function(){e.$element.attr("disabled")||e.$input.removeAttr("disabled"),e.$input.focus()},e)),e.options.addOnBlur&&e.options.freeInput&&e.$input.on("focusout",a.proxy(function(){0===a(".typeahead, .twitter-typeahead",e.$container).length&&(e.add(e.$input.val()),e.$input.val(""))},e)),e.$container.on("keydown","input",a.proxy(function(b){var c=a(b.target),d=e.findInputWrapper();if(e.$element.attr("disabled"))return void e.$input.attr("disabled","disabled");switch(b.which){case 8:if(0===f(c[0])){var g=d.prev();g&&e.remove(g.data("item"))}break;case 46:if(0===f(c[0])){var h=d.next();h&&e.remove(h.data("item"))}break;case 37:var i=d.prev();0===c.val().length&&i[0]&&(i.before(d),c.focus());break;case 39:var j=d.next();0===c.val().length&&j[0]&&(j.after(d),c.focus())}{var k=c.val().length;Math.ceil(k/5)}c.attr("size",Math.max(this.inputSize,c.val().length))},e)),e.$container.on("keypress","input",a.proxy(function(b){var c=a(b.target);if(e.$element.attr("disabled"))return void e.$input.attr("disabled","disabled");var d=c.val(),f=e.options.maxChars&&d.length>=e.options.maxChars;e.options.freeInput&&(g(b,e.options.confirmKeys)||f)&&(e.add(f?d.substr(0,e.options.maxChars):d),c.val(""),b.preventDefault());{var h=c.val().length;Math.ceil(h/5)}c.attr("size",Math.max(this.inputSize,c.val().length))},e)),e.$container.on("click","[data-role=remove]",a.proxy(function(b){e.$element.attr("disabled")||e.remove(a(b.target).closest(".tag").data("item"))},e)),e.options.itemValue===h.itemValue&&("INPUT"===e.$element[0].tagName?e.add(e.$element.val()):a("option",e.$element).each(function(){e.add(a(this).attr("value"),!0)}))},destroy:function(){var a=this;a.$container.off("keypress","input"),a.$container.off("click","[role=remove]"),a.$container.remove(),a.$element.removeData("tagsinput"),a.$element.show()},focus:function(){this.$input.focus()},input:function(){return this.$input},findInputWrapper:function(){for(var b=this.$input[0],c=this.$container[0];b&&b.parentNode!==c;)b=b.parentNode;return a(b)}},a.fn.tagsinput=function(c,d){var e=[];return this.each(function(){var f=a(this).data("tagsinput");if(f)if(c||d){if(void 0!==f[c]){var g=f[c](d);void 0!==g&&e.push(g)}}else e.push(f);else f=new b(this,c),a(this).data("tagsinput",f),e.push(f),"SELECT"===this.tagName&&a("option",a(this)).attr("selected","selected"),a(this).val(a(this).val())}),"string"==typeof c?e.length>1?e:e[0]:e},a.fn.tagsinput.Constructor=b;var i=a("<div />");a(function(){a("input[data-role=tagsinput], select[multiple][data-role=tagsinput]").tagsinput()})}(window.jQuery);
@@ -0,0 +1 @@
1
+ !function(a){"use strict";var b=a.HTMLCanvasElement&&a.HTMLCanvasElement.prototype,c=a.Blob&&function(){try{return Boolean(new Blob)}catch(a){return!1}}(),d=c&&a.Uint8Array&&function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(a){return!1}}(),e=a.BlobBuilder||a.WebKitBlobBuilder||a.MozBlobBuilder||a.MSBlobBuilder,f=(c||e)&&a.atob&&a.ArrayBuffer&&a.Uint8Array&&function(a){var b,f,g,h,i,j;for(b=a.split(",")[0].indexOf("base64")>=0?atob(a.split(",")[1]):decodeURIComponent(a.split(",")[1]),f=new ArrayBuffer(b.length),g=new Uint8Array(f),h=0;h<b.length;h+=1)g[h]=b.charCodeAt(h);return i=a.split(",")[0].split(":")[1].split(";")[0],c?new Blob([d?g:f],{type:i}):(j=new e,j.append(f),j.getBlob(i))};a.HTMLCanvasElement&&!b.toBlob&&(b.mozGetAsFile?b.toBlob=function(a,c,d){d&&b.toDataURL&&f?a(f(this.toDataURL(c,d))):a(this.mozGetAsFile("blob",c))}:b.toDataURL&&f&&(b.toBlob=function(a,b,c){a(f(this.toDataURL(b,c)))})),"function"==typeof define&&define.amd?define(function(){return f}):a.dataURLtoBlob=f}(this);
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Version 0.0.1
3
+ * Catch the CTRL+S keys combination and trigger a callback
4
+ * Didier Lafforgue
5
+ */
6
+
7
+ $.cmd = function(key, callback, args, options) {
8
+ var keyCode = key.charCodeAt(0);
9
+ var altKeyCode = keyCode + (32 * (keyCode < 97 ? 1 : -1));
10
+
11
+ options = (options || { ignoreCase: false });
12
+
13
+ if (!options.ignoreCase) altKeyCode = null;
14
+
15
+ doc = options.document || window.document;
16
+
17
+ $(doc).keydown(function(e) {
18
+ var isCtrl = false;
19
+
20
+ if (!args) args = []; // IE barks when args is null
21
+
22
+ if (e.ctrlKey || e.metaKey) isCtrl = true;
23
+
24
+ if ((keyCode == e.which || altKeyCode == e.which) && isCtrl) {
25
+ e.preventDefault();
26
+ callback.apply(this, args);
27
+ return false;
28
+ }
29
+ });
30
+
31
+ };
@@ -0,0 +1,117 @@
1
+ /*!
2
+ * jQuery Cookie Plugin v1.4.1
3
+ * https://github.com/carhartl/jquery-cookie
4
+ *
5
+ * Copyright 2006, 2014 Klaus Hartl
6
+ * Released under the MIT license
7
+ */
8
+ (function (factory) {
9
+ if (typeof define === 'function' && define.amd) {
10
+ // AMD
11
+ define(['jquery'], factory);
12
+ } else if (typeof exports === 'object') {
13
+ // CommonJS
14
+ factory(require('jquery'));
15
+ } else {
16
+ // Browser globals
17
+ factory(jQuery);
18
+ }
19
+ }(function ($) {
20
+
21
+ var pluses = /\+/g;
22
+
23
+ function encode(s) {
24
+ return config.raw ? s : encodeURIComponent(s);
25
+ }
26
+
27
+ function decode(s) {
28
+ return config.raw ? s : decodeURIComponent(s);
29
+ }
30
+
31
+ function stringifyCookieValue(value) {
32
+ return encode(config.json ? JSON.stringify(value) : String(value));
33
+ }
34
+
35
+ function parseCookieValue(s) {
36
+ if (s.indexOf('"') === 0) {
37
+ // This is a quoted cookie as according to RFC2068, unescape...
38
+ s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
39
+ }
40
+
41
+ try {
42
+ // Replace server-side written pluses with spaces.
43
+ // If we can't decode the cookie, ignore it, it's unusable.
44
+ // If we can't parse the cookie, ignore it, it's unusable.
45
+ s = decodeURIComponent(s.replace(pluses, ' '));
46
+ return config.json ? JSON.parse(s) : s;
47
+ } catch(e) {}
48
+ }
49
+
50
+ function read(s, converter) {
51
+ var value = config.raw ? s : parseCookieValue(s);
52
+ return $.isFunction(converter) ? converter(value) : value;
53
+ }
54
+
55
+ var config = $.cookie = function (key, value, options) {
56
+
57
+ // Write
58
+
59
+ if (arguments.length > 1 && !$.isFunction(value)) {
60
+ options = $.extend({}, config.defaults, options);
61
+
62
+ if (typeof options.expires === 'number') {
63
+ var days = options.expires, t = options.expires = new Date();
64
+ t.setTime(+t + days * 864e+5);
65
+ }
66
+
67
+ return (document.cookie = [
68
+ encode(key), '=', stringifyCookieValue(value),
69
+ options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
70
+ options.path ? '; path=' + options.path : '',
71
+ options.domain ? '; domain=' + options.domain : '',
72
+ options.secure ? '; secure' : ''
73
+ ].join(''));
74
+ }
75
+
76
+ // Read
77
+
78
+ var result = key ? undefined : {};
79
+
80
+ // To prevent the for loop in the first place assign an empty array
81
+ // in case there are no cookies at all. Also prevents odd result when
82
+ // calling $.cookie().
83
+ var cookies = document.cookie ? document.cookie.split('; ') : [];
84
+
85
+ for (var i = 0, l = cookies.length; i < l; i++) {
86
+ var parts = cookies[i].split('=');
87
+ var name = decode(parts.shift());
88
+ var cookie = parts.join('=');
89
+
90
+ if (key && key === name) {
91
+ // If second argument (value) is a function it's a converter...
92
+ result = read(cookie, value);
93
+ break;
94
+ }
95
+
96
+ // Prevent storing a cookie that we couldn't decode.
97
+ if (!key && (cookie = read(cookie)) !== undefined) {
98
+ result[name] = cookie;
99
+ }
100
+ }
101
+
102
+ return result;
103
+ };
104
+
105
+ config.defaults = {};
106
+
107
+ $.removeCookie = function (key, options) {
108
+ if ($.cookie(key) === undefined) {
109
+ return false;
110
+ }
111
+
112
+ // Must not alter options, thus extending a fresh object...
113
+ $.cookie(key, '', $.extend({}, options, { expires: -1 }));
114
+ return !$.cookie(key);
115
+ };
116
+
117
+ }));
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * Cropper v0.7.6-beta
3
+ * https://github.com/fengyuanchen/cropper
4
+ *
5
+ * Copyright 2014 Fengyuan Chen
6
+ * Released under the MIT license
7
+ */
8
+
9
+ !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){"use strict";var b=a(window),c=a(document),d=window.location,e=!0,f=!1,g=null,h=0/0,i=1/0,j="undefined",k="directive",l=".cropper",m=/^(e|n|w|s|ne|nw|sw|se|all|crop|move|zoom)$/,n=/^(x|y|width|height)$/,o=/^(naturalWidth|naturalHeight|width|height|aspectRatio|ratio|rotate)$/,p="cropper-modal",q="cropper-hidden",r="cropper-invisible",s="cropper-move",t="cropper-crop",u="cropper-disabled",v="mousedown touchstart",w="mousemove touchmove",x="mouseup mouseleave touchend touchleave touchcancel",y="wheel mousewheel DOMMouseScroll",z="resize"+l,A="dblclick",B="build"+l,C="built"+l,D="dragstart"+l,E="dragmove"+l,F="dragend"+l,G=function(a){return"number"==typeof a},H=function(b,c){this.element=b,this.$element=a(b),this.defaults=a.extend({},H.DEFAULTS,a.isPlainObject(c)?c:{}),this.$original=g,this.ready=f,this.built=f,this.cropped=f,this.rotated=f,this.disabled=f,this.replaced=f,this.init()},I=Math.round,J=Math.sqrt,K=Math.min,L=Math.max,M=Math.abs,N=Math.sin,O=Math.cos,P=parseFloat;H.prototype={constructor:H,support:{canvas:a.isFunction(a("<canvas>")[0].getContext)},init:function(){var b=this.defaults;a.each(b,function(a,c){switch(a){case"aspectRatio":b[a]=M(P(c))||h;break;case"autoCropArea":b[a]=M(P(c))||.8;break;case"minWidth":case"minHeight":b[a]=M(P(c))||0;break;case"maxWidth":case"maxHeight":b[a]=M(P(c))||i}}),this.image={rotate:0},this.load()},load:function(){var b,c,d=this,f=this.$element,g=this.element,h=this.image,i="";f.is("img")?c=f.prop("src"):f.is("canvas")&&this.support.canvas&&(c=g.toDataURL()),c&&(this.replaced&&(h.rotate=0),this.defaults.checkImageOrigin&&(f.prop("crossOrigin")||this.isCrossOriginURL(c))&&(i=" crossOrigin"),this.$clone=b=a("<img"+i+' src="'+c+'">'),b.one("load",function(){h.naturalWidth=this.naturalWidth||b.width(),h.naturalHeight=this.naturalHeight||b.height(),h.aspectRatio=h.naturalWidth/h.naturalHeight,d.url=c,d.ready=e,d.build()}),b.addClass(r).prependTo("body"))},isCrossOriginURL:function(a){var b=a.match(/^(https?:)\/\/([^\:\/\?#]+):?(\d*)/i);return!b||b[1]===d.protocol&&b[2]===d.hostname&&b[3]===d.port?f:e},build:function(){var b,d,f=this.$element,g=this.defaults;this.ready&&(this.built&&this.unbuild(),f.one(B,g.build),b=a.Event(B),f.trigger(b),b.isDefaultPrevented()||(this.$cropper=d=a(H.TEMPLATE),f.addClass(q),this.$clone.removeClass(r).prependTo(d),this.rotated||(this.$original=this.$clone.clone(),this.$original.addClass(q).prependTo(this.$cropper),this.originalImage=a.extend({},this.image)),this.$container=f.parent(),this.$container.append(d),this.$canvas=d.find(".cropper-canvas"),this.$dragger=d.find(".cropper-dragger"),this.$viewer=d.find(".cropper-viewer"),g.autoCrop?this.cropped=e:this.$dragger.addClass(q),g.dragCrop&&this.setDragMode("crop"),g.modal&&this.$canvas.addClass(p),!g.dashed&&this.$dragger.find(".cropper-dashed").addClass(q),!g.movable&&this.$dragger.find(".cropper-face").data(k,"move"),!g.resizable&&this.$dragger.find(".cropper-line, .cropper-point").addClass(q),this.$scope=g.multiple?this.$cropper:c,this.addListeners(),this.initPreview(),this.built=e,this.update(),f.one(C,g.built),f.trigger(C)))},unbuild:function(){this.built&&(this.built=f,this.removeListeners(),this.$preview.empty(),this.$preview=g,this.$dragger=g,this.$canvas=g,this.$container=g,this.$cropper.remove(),this.$cropper=g)},update:function(a){this.initContainer(),this.initCropper(),this.initImage(),this.initDragger(),a?(this.setData(a,e),this.setDragMode("crop")):this.setData(this.defaults.data)},resize:function(){clearTimeout(this.resizing),this.resizing=setTimeout(a.proxy(this.update,this,this.getData()),200)},preview:function(){var b=this.image,c=this.dragger,d=b.width,e=b.height,f=c.left-b.left,g=c.top-b.top;this.$viewer.find("img").css({width:I(d),height:I(e),marginLeft:-I(f),marginTop:-I(g)}),this.$preview.each(function(){var b=a(this),h=b.width()/c.width;b.find("img").css({width:I(d*h),height:I(e*h),marginLeft:-I(f*h),marginTop:-I(g*h)})})},addListeners:function(){var c=this.defaults;this.$element.on(D,c.dragstart).on(E,c.dragmove).on(F,c.dragend),this.$cropper.on(v,this._dragstart=a.proxy(this.dragstart,this)).on(A,this._dblclick=a.proxy(this.dblclick,this)),c.zoomable&&this.$cropper.on(y,this._wheel=a.proxy(this.wheel,this)),this.$scope.on(w,this._dragmove=a.proxy(this.dragmove,this)).on(x,this._dragend=a.proxy(this.dragend,this)),b.on(z,this._resize=a.proxy(this.resize,this))},removeListeners:function(){var a=this.defaults;this.$element.off(D,a.dragstart).off(E,a.dragmove).off(F,a.dragend),this.$cropper.off(v,this._dragstart).off(A,this._dblclick),a.zoomable&&this.$cropper.off(y,this._wheel),this.$scope.off(w,this._dragmove).off(x,this._dragend),b.off(z,this._resize)},initPreview:function(){var b='<img src="'+this.url+'">';this.$preview=a(this.defaults.preview),this.$viewer.html(b),this.$preview.html(b).find("img").css("cssText","min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;")},initContainer:function(){var a=this.$container;this.container={width:L(a.width(),300),height:L(a.height(),150)}},initCropper:function(){var a,b=this.container,c=this.image;c.naturalWidth*b.height/c.naturalHeight-b.width>=0?(a={width:b.width,height:b.width/c.aspectRatio,left:0},a.top=(b.height-a.height)/2):(a={width:b.height*c.aspectRatio,height:b.height,top:0},a.left=(b.width-a.width)/2),this.$cropper.css({width:I(a.width),height:I(a.height),left:I(a.left),top:I(a.top)}),this.cropper=a},initImage:function(){var b=this.image,c=this.cropper,d={_width:c.width,_height:c.height,width:c.width,height:c.height,left:0,top:0,ratio:c.width/b.naturalWidth};this.defaultImage=a.extend({},b,d),b._width!==c.width||b._height!==c.height?a.extend(b,d):(b=a.extend({},d,b),this.replaced&&(this.replaced=f,b.ratio=d.ratio)),this.image=b,this.renderImage()},renderImage:function(a){var b=this.image;"zoom"===a&&(b.left-=(b.width-b.oldWidth)/2,b.top-=(b.height-b.oldHeight)/2),b.left=K(L(b.left,b._width-b.width),0),b.top=K(L(b.top,b._height-b.height),0),this.$clone.css({width:I(b.width),height:I(b.height),marginLeft:I(b.left),marginTop:I(b.top)}),a&&(this.defaults.done(this.getData()),this.preview())},initDragger:function(){var b,c=this.defaults,d=this.cropper,e=c.aspectRatio||this.image.aspectRatio,f=this.image.ratio;b=d.height*e-d.width>=0?{height:d.width/e,width:d.width,left:0,top:(d.height-d.width/e)/2,maxWidth:d.width,maxHeight:d.width/e}:{height:d.height,width:d.height*e,left:(d.width-d.height*e)/2,top:0,maxWidth:d.height*e,maxHeight:d.height},b.minWidth=0,b.minHeight=0,c.aspectRatio?(isFinite(c.maxWidth)?(b.maxWidth=K(b.maxWidth,c.maxWidth*f),b.maxHeight=b.maxWidth/e):isFinite(c.maxHeight)&&(b.maxHeight=K(b.maxHeight,c.maxHeight*f),b.maxWidth=b.maxHeight*e),c.minWidth>0?(b.minWidth=L(0,c.minWidth*f),b.minHeight=b.minWidth/e):c.minHeight>0&&(b.minHeight=L(0,c.minHeight*f),b.minWidth=b.minHeight*e)):(b.maxWidth=K(b.maxWidth,c.maxWidth*f),b.maxHeight=K(b.maxHeight,c.maxHeight*f),b.minWidth=L(0,c.minWidth*f),b.minHeight=L(0,c.minHeight*f)),b.minWidth=K(b.maxWidth,b.minWidth),b.minHeight=K(b.maxHeight,b.minHeight),b.height*=c.autoCropArea,b.width*=c.autoCropArea,b.left=(d.width-b.width)/2,b.top=(d.height-b.height)/2,b.oldLeft=b.left,b.oldTop=b.top,this.defaultDragger=b,this.dragger=a.extend({},b)},renderDragger:function(){var a=this.dragger,b=this.cropper;a.width>a.maxWidth?(a.width=a.maxWidth,a.left=a.oldLeft):a.width<a.minWidth&&(a.width=a.minWidth,a.left=a.oldLeft),a.height>a.maxHeight?(a.height=a.maxHeight,a.top=a.oldTop):a.height<a.minHeight&&(a.height=a.minHeight,a.top=a.oldTop),a.left=K(L(a.left,0),b.width-a.width),a.top=K(L(a.top,0),b.height-a.height),a.oldLeft=a.left,a.oldTop=a.top,this.dragger=a,this.disabled||this.defaults.done(this.getData()),this.$dragger.css({width:I(a.width),height:I(a.height),left:I(a.left),top:I(a.top)}),this.preview()},reset:function(b){this.cropped&&(b&&(this.defaults.data={}),this.image=a.extend({},this.defaultImage),this.renderImage(),this.dragger=a.extend({},this.defaultDragger),this.setData(this.defaults.data))},clear:function(){this.cropped&&(this.cropped=f,this.setData({x:0,y:0,width:0,height:0}),this.$canvas.removeClass(p),this.$dragger.addClass(q))},destroy:function(){var a=this.$element;this.ready&&(this.unbuild(),a.removeClass(q).removeData("cropper"),this.rotated&&a.attr("src",this.$original.attr("src")))},replace:function(b,c){var d,g=this,h=this.$element,i=this.element;b&&b!==this.url&&b!==h.attr("src")&&(c||(this.rotated=f,this.replaced=e),h.is("img")?(h.attr("src",b),this.load()):h.is("canvas")&&this.support.canvas&&(d=i.getContext("2d"),a('<img src="'+b+'">').one("load",function(){i.width=this.width,i.height=this.height,d.clearRect(0,0,i.width,i.height),d.drawImage(this,0,0),g.load()})))},setData:function(b,c){var d=this.cropper,e=this.dragger,f=this.image,h=this.defaults.aspectRatio;this.built&&typeof b!==j&&((b===g||a.isEmptyObject(b))&&(e=a.extend({},this.defaultDragger)),a.isPlainObject(b)&&!a.isEmptyObject(b)&&(c||(this.defaults.data=b),b=this.transformData(b),G(b.x)&&b.x<=d.width-f.left&&(e.left=b.x+f.left),G(b.y)&&b.y<=d.height-f.top&&(e.top=b.y+f.top),h?G(b.width)&&b.width<=e.maxWidth&&b.width>=e.minWidth?(e.width=b.width,e.height=e.width/h):G(b.height)&&b.height<=e.maxHeight&&b.height>=e.minHeight&&(e.height=b.height,e.width=e.height*h):(G(b.width)&&b.width<=e.maxWidth&&b.width>=e.minWidth&&(e.width=b.width),G(b.height)&&b.height<=e.maxHeight&&b.height>=e.minHeight&&(e.height=b.height))),this.dragger=e,this.renderDragger())},getData:function(a){var b=this.dragger,c=this.image,d={};return this.built&&(d={x:b.left-c.left,y:b.top-c.top,width:b.width,height:b.height},d=this.transformData(d,e,a)),d},transformData:function(b,c,d){var e=this.image.ratio,f={};return a.each(b,function(a,b){b=P(b),n.test(a)&&!isNaN(b)&&(f[a]=c?d?I(b/e):b/e:b*e)}),f},setAspectRatio:function(a){var b="auto"===a;a=P(a),(b||!isNaN(a)&&a>0)&&(this.defaults.aspectRatio=b?h:a,this.built&&(this.initDragger(),this.renderDragger()))},getImageData:function(){var b={};return this.ready&&a.each(this.image,function(a,c){o.test(a)&&(b[a]=c)}),b},getDataURL:function(b,c,d){var e,f=a("<canvas>")[0],g=this.getData(),h="";return a.isPlainObject(b)||(d=c,c=b,b={}),b=a.extend({width:g.width,height:g.height},b),this.cropped&&this.support.canvas&&(f.width=b.width,f.height=b.height,e=f.getContext("2d"),"image/jpeg"===c&&(e.fillStyle="#fff",e.fillRect(0,0,b.width,b.height)),e.drawImage(this.$clone[0],g.x,g.y,g.width,g.height,0,0,b.width,b.height),h=f.toDataURL(c,d)),h},setDragMode:function(a){var b=this.$canvas,c=this.defaults,d=f,g=f;if(this.built&&!this.disabled){switch(a){case"crop":c.dragCrop&&(d=e,b.data(k,a));break;case"move":g=e,b.data(k,a);break;default:b.removeData(k)}b.toggleClass(t,d).toggleClass(s,g)}},enable:function(){this.built&&(this.disabled=f,this.$cropper.removeClass(u))},disable:function(){this.built&&(this.disabled=e,this.$cropper.addClass(u))},rotate:function(a){var b=this.image;a=P(a)||0,this.built&&0!==a&&!this.disabled&&this.defaults.rotatable&&this.support.canvas&&(this.rotated=e,a=b.rotate=(b.rotate+a)%360,this.replace(this.getRotatedDataURL(a),!0))},getRotatedDataURL:function(b){var c=a("<canvas>")[0],d=c.getContext("2d"),e=b*Math.PI/180,f=M(b)%180,g=f>90?180-f:f,h=g*Math.PI/180,i=this.originalImage,j=i.naturalWidth,k=i.naturalHeight,l=M(j*O(h)+k*N(h)),m=M(j*N(h)+k*O(h));return c.width=l,c.height=m,d.save(),d.translate(l/2,m/2),d.rotate(e),d.drawImage(this.$original[0],-j/2,-k/2,j,k),d.restore(),c.toDataURL()},zoom:function(a){var b,c,d,e=this.image;a=P(a),this.built&&a&&!this.disabled&&this.defaults.zoomable&&(b=e.width*(1+a),c=e.height*(1+a),d=b/e._width,d>10||(1>d&&(b=e._width,c=e._height),this.setDragMode(1>=d?"crop":"move"),e.oldWidth=e.width,e.oldHeight=e.height,e.width=b,e.height=c,e.ratio=e.width/e.naturalWidth,this.renderImage("zoom")))},dblclick:function(){this.disabled||this.setDragMode(this.$canvas.hasClass(t)?"move":"crop")},wheel:function(a){var b,c=a.originalEvent,d=117.25,e=5,f=166.66665649414062,g=.1;this.disabled||(a.preventDefault(),c.deltaY?(b=c.deltaY,b=b%e===0?b/e:b%d===0?b/d:b/f):b=c.wheelDelta?-c.wheelDelta/120:c.detail?c.detail/3:0,this.zoom(b*g))},dragstart:function(b){var c,d,g,h=b.originalEvent.touches,i=b;if(!this.disabled){if(h){if(g=h.length,g>1){if(!this.defaults.zoomable||2!==g)return;i=h[1],this.startX2=i.pageX,this.startY2=i.pageY,c="zoom"}i=h[0]}if(c=c||a(i.target).data(k),m.test(c)){if(b.preventDefault(),d=a.Event(D),this.$element.trigger(d),d.isDefaultPrevented())return;this.directive=c,this.cropping=f,this.startX=i.pageX,this.startY=i.pageY,"crop"===c&&(this.cropping=e,this.$canvas.addClass(p))}}},dragmove:function(b){var c,d,e=b.originalEvent.touches,f=b;if(!this.disabled){if(e){if(d=e.length,d>1){if(!this.defaults.zoomable||2!==d)return;f=e[1],this.endX2=f.pageX,this.endY2=f.pageY}f=e[0]}if(this.directive){if(b.preventDefault(),c=a.Event(E),this.$element.trigger(c),c.isDefaultPrevented())return;this.endX=f.pageX,this.endY=f.pageY,this.dragging()}}},dragend:function(b){var c;if(!this.disabled&&this.directive){if(b.preventDefault(),c=a.Event(F),this.$element.trigger(c),c.isDefaultPrevented())return;this.cropping&&(this.cropping=f,this.$canvas.toggleClass(p,this.cropped&&this.defaults.modal)),this.directive=""}},dragging:function(){var a,b=this.directive,c=this.image,d=this.cropper,g=d.width,h=d.height,i=this.dragger,j=i.width,k=i.height,l=i.left,m=i.top,n=l+j,o=m+k,p=e,r=this.defaults,s=r.aspectRatio,t={x:this.endX-this.startX,y:this.endY-this.startY};switch(s&&(t.X=t.y*s,t.Y=t.x/s),b){case"all":l+=t.x,m+=t.y;break;case"e":if(t.x>=0&&(n>=g||s&&(0>=m||o>=h))){p=f;break}j+=t.x,s&&(k=j/s,m-=t.Y/2),0>j&&(b="w",j=0);break;case"n":if(t.y<=0&&(0>=m||s&&(0>=l||n>=g))){p=f;break}k-=t.y,m+=t.y,s&&(j=k*s,l+=t.X/2),0>k&&(b="s",k=0);break;case"w":if(t.x<=0&&(0>=l||s&&(0>=m||o>=h))){p=f;break}j-=t.x,l+=t.x,s&&(k=j/s,m+=t.Y/2),0>j&&(b="e",j=0);break;case"s":if(t.y>=0&&(o>=h||s&&(0>=l||n>=g))){p=f;break}k+=t.y,s&&(j=k*s,l-=t.X/2),0>k&&(b="n",k=0);break;case"ne":if(s){if(t.y<=0&&(0>=m||n>=g)){p=f;break}k-=t.y,m+=t.y,j=k*s}else t.x>=0?g>n?j+=t.x:t.y<=0&&0>=m&&(p=f):j+=t.x,t.y<=0?m>0&&(k-=t.y,m+=t.y):(k-=t.y,m+=t.y);0>k&&(b="sw",k=0,j=0);break;case"nw":if(s){if(t.y<=0&&(0>=m||0>=l)){p=f;break}k-=t.y,m+=t.y,j=k*s,l+=t.X}else t.x<=0?l>0?(j-=t.x,l+=t.x):t.y<=0&&0>=m&&(p=f):(j-=t.x,l+=t.x),t.y<=0?m>0&&(k-=t.y,m+=t.y):(k-=t.y,m+=t.y);0>k&&(b="se",k=0,j=0);break;case"sw":if(s){if(t.x<=0&&(0>=l||o>=h)){p=f;break}j-=t.x,l+=t.x,k=j/s}else t.x<=0?l>0?(j-=t.x,l+=t.x):t.y>=0&&o>=h&&(p=f):(j-=t.x,l+=t.x),t.y>=0?h>o&&(k+=t.y):k+=t.y;0>j&&(b="ne",k=0,j=0);break;case"se":if(s){if(t.x>=0&&(n>=g||o>=h)){p=f;break}j+=t.x,k=j/s}else t.x>=0?g>n?j+=t.x:t.y>=0&&o>=h&&(p=f):j+=t.x,t.y>=0?h>o&&(k+=t.y):k+=t.y;0>j&&(b="nw",k=0,j=0);break;case"move":c.left+=t.x,c.top+=t.y,this.renderImage("move"),p=f;break;case"zoom":r.zoomable&&(this.zoom(function(a,b,c,d,e,f){return(J(e*e+f*f)-J(c*c+d*d))/J(a*a+b*b)}(c.width,c.height,M(this.startX-this.startX2),M(this.startY-this.startY2),M(this.endX-this.endX2),M(this.endY-this.endY2))),this.endX2=this.startX2,this.endY2=this.startY2);break;case"crop":t.x&&t.y&&(a=this.$cropper.offset(),l=this.startX-a.left,m=this.startY-a.top,j=i.minWidth,k=i.minHeight,t.x>0?t.y>0?b="se":(b="ne",m-=k):t.y>0?(b="sw",l-=j):(b="nw",l-=j,m-=k),this.cropped||(this.cropped=e,this.$dragger.removeClass(q)))}p&&(i.width=j,i.height=k,i.left=l,i.top=m,this.directive=b,this.renderDragger()),this.startX=this.endX,this.startY=this.endY}},H.TEMPLATE=function(a,b){return b=b.split(","),a.replace(/\d+/g,function(a){return b[a]})}('<0 6="5-container"><0 6="5-canvas"></0><0 6="5-dragger"><1 6="5-viewer"></1><1 6="5-8 8-h"></1><1 6="5-8 8-v"></1><1 6="5-face" 3-2="all"></1><1 6="5-7 7-e" 3-2="e"></1><1 6="5-7 7-n" 3-2="n"></1><1 6="5-7 7-w" 3-2="w"></1><1 6="5-7 7-s" 3-2="s"></1><1 6="5-4 4-e" 3-2="e"></1><1 6="5-4 4-n" 3-2="n"></1><1 6="5-4 4-w" 3-2="w"></1><1 6="5-4 4-s" 3-2="s"></1><1 6="5-4 4-ne" 3-2="ne"></1><1 6="5-4 4-nw" 3-2="nw"></1><1 6="5-4 4-sw" 3-2="sw"></1><1 6="5-4 4-se" 3-2="se"></1></0></0>',"div,span,directive,data,point,cropper,class,line,dashed"),H.DEFAULTS={aspectRatio:"auto",autoCropArea:.8,data:{},done:a.noop,preview:"",multiple:f,autoCrop:e,dragCrop:e,dashed:e,modal:e,movable:e,resizable:e,zoomable:e,rotatable:e,checkImageOrigin:e,minWidth:0,minHeight:0,maxWidth:i,maxHeight:i,build:g,built:g,dragstart:g,dragmove:g,dragend:g},H.setDefaults=function(b){a.extend(H.DEFAULTS,b)},H.other=a.fn.cropper,a.fn.cropper=function(b){var c,d=[].slice.call(arguments,1);return this.each(function(){var e,f=a(this),g=f.data("cropper");g||f.data("cropper",g=new H(this,b)),"string"==typeof b&&a.isFunction(e=g[b])&&(c=e.apply(g,d))}),typeof c!==j?c:this},a.fn.cropper.Constructor=H,a.fn.cropper.setDefaults=H.setDefaults,a.fn.cropper.noConflict=function(){return a.fn.cropper=H.other,this}});
@@ -0,0 +1,28 @@
1
+ <%# encoding: utf-8 %>
2
+
3
+ <%# FIXME: Assets precompilation requires to load the I18n since we disable the config.assets.initialize_on_precompile option %>
4
+ <% if !I18n.backend.initialized? && I18n.t('locomotive.locales.en', :locale => :en, :default => '').blank? %>
5
+ <% I18n.load_path += Dir[Locomotive::Engine.root.join('config', 'locales', '**/*.{rb,yml}').to_s] %>
6
+ <% I18n.reload! %>
7
+ <% end %>
8
+
9
+ jQuery(function($){
10
+ <% Locomotive.config.locales.each do |locale| %>
11
+ <% I18n.with_locale(locale) do %>
12
+ $.datepicker.regional['<%= locale %>'] = {
13
+ closeText: '<%= I18n.t('date_picker.close_text', :default => 'Close') %>',
14
+ prevText: '<%= I18n.t('date_picker.prev_text', :default => '&#x3c;Prev') %>',
15
+ nextText: '<%= I18n.t('date_picker.next_text', :default => 'Next&#x3e;') %>',
16
+ currentText: '<%= I18n.t('date_picker.current_text', :default => 'Current') %>',
17
+ monthNames: [<%= I18n.t('date.month_names').delete_if { |m| m.blank? }.map { |m| "'#{m.capitalize}'" }.join(', ') %>],
18
+ monthNamesShort: [<%= I18n.t('date.abbr_month_names').delete_if { |m| m.blank? }.map { |m| "'#{m.capitalize.gsub(/\.$/, '')}'" }.join(', ') %>],
19
+ dayNames: [<%= I18n.t('date.day_names').delete_if { |d| d.blank? }.map { |d| "'#{d.capitalize}'" }.join(', ') %>],
20
+ dayNamesShort: [<%= I18n.t('date.abbr_day_names').delete_if { |d| d.blank? }.map { |d| "'#{d.capitalize}'" }.join(', ') %>],
21
+ dayNamesMin: [<%= I18n.t('date.abbr_day_names').delete_if { |d| d.blank? }.map { |d| "'#{d[0..1].capitalize}'" }.join(', ') %>],
22
+ dateFormat: '<%= I18n.t('date.formats.default').gsub('%d', 'dd').gsub('%m', 'mm').gsub('%Y', 'yy') %>',
23
+ firstDay: 1,
24
+ isRTL: false
25
+ };
26
+ <% end %>
27
+ <% end %>
28
+ });
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Version 0.0.1
3
+ * tiny effect to display an input field when clicking on a label
4
+ * Didier Lafforgue
5
+ */
6
+ $.fn.editableField = function(settings) {
7
+
8
+ var destroy = false;
9
+
10
+ if ('destroy' == settings) {
11
+ destroy = true
12
+ } else {
13
+ settings = $.extend({}, settings);
14
+ }
15
+
16
+ function getText(element) {
17
+ if (element.is('select')) {
18
+ return element[0].options[element[0].options.selectedIndex].text;
19
+ } else {
20
+ return element.val();
21
+ }
22
+ }
23
+
24
+ return this.each(function() {
25
+ if (destroy) {
26
+ $(this).unbind('mouseenter').unbind('mouseleave');
27
+ $(this).prev('.editable').unbind('click').remove();
28
+ } else {
29
+ var input = $(this).hide();
30
+ var label = $('<em></em>').addClass('editable').html(getText(input));
31
+ var timer = null;
32
+
33
+ input.before(label);
34
+
35
+ label.bind('click', function() {
36
+ label.hide();
37
+ input.show().focus();
38
+ });
39
+
40
+ input.hover(function() {
41
+ clearTimeout(timer);
42
+ }, function() {
43
+ timer = setTimeout(function() { input.hide(); label.show() }, 1000);
44
+ }).change(function() {
45
+ input.hide();
46
+ label.show().html(getText(input))
47
+ });
48
+ }
49
+ });
50
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Version 0.0.1
3
+ * Display a message letting the user know the form is being submitted
4
+ * Didier Lafforgue
5
+ */
6
+ $.fn.formSubmitNotification = function(settings) {
7
+
8
+ function show() {
9
+ $('#form-submit-notification').fadeIn()
10
+ }
11
+
12
+ function hide() {
13
+ $('#form-submit-notification').fadeOut()
14
+ }
15
+
16
+ function create(message) {
17
+ if ($('#form-submit-notification').size() == 0) {
18
+ var element = $("<div id=\"form-submit-notification\"><div>" + message + "</div></div>").hide();
19
+ $('body').append(element);
20
+ }
21
+ }
22
+
23
+ return this.each(function() {
24
+ var form = $(this);
25
+ var message = form.data('sending-form-message') || form.data('sending_form_message');
26
+
27
+ if (typeof(message) == 'undefined')
28
+ message = form.find('input[type=submit]').data('sending-form-message');
29
+
30
+ if (typeof(message) == 'undefined')
31
+ return ;
32
+
33
+ create(message);
34
+
35
+ form.bind('ajax:beforeSend', function(event) { show() });
36
+ form.bind('ajax:complete', function(event) { hide() });
37
+
38
+ });
39
+ }
@@ -0,0 +1,2134 @@
1
+ // /*! jQuery Timepicker Addon - v1.4 - 2013-08-11
2
+ // * http://trentrichardson.com/examples/timepicker
3
+ // * Copyright (c) 2013 Trent Richardson; Licensed MIT */
4
+ // (function ($) {
5
+
6
+ // /*
7
+ // * Lets not redefine timepicker, Prevent "Uncaught RangeError: Maximum call stack size exceeded"
8
+ // */
9
+ // $.ui.timepicker = $.ui.timepicker || {};
10
+ // if ($.ui.timepicker.version) {
11
+ // return;
12
+ // }
13
+
14
+ // /*
15
+ // * Extend jQueryUI, get it started with our version number
16
+ // */
17
+ // $.extend($.ui, {
18
+ // timepicker: {
19
+ // version: "1.4"
20
+ // }
21
+ // });
22
+
23
+ // /*
24
+ // * Timepicker manager.
25
+ // * Use the singleton instance of this class, $.timepicker, to interact with the time picker.
26
+ // * Settings for (groups of) time pickers are maintained in an instance object,
27
+ // * allowing multiple different settings on the same page.
28
+ // */
29
+ // var Timepicker = function () {
30
+ // this.regional = []; // Available regional settings, indexed by language code
31
+ // this.regional[''] = { // Default regional settings
32
+ // currentText: 'Now',
33
+ // closeText: 'Done',
34
+ // amNames: ['AM', 'A'],
35
+ // pmNames: ['PM', 'P'],
36
+ // timeFormat: 'HH:mm',
37
+ // timeSuffix: '',
38
+ // timeOnlyTitle: 'Choose Time',
39
+ // timeText: 'Time',
40
+ // hourText: 'Hour',
41
+ // minuteText: 'Minute',
42
+ // secondText: 'Second',
43
+ // millisecText: 'Millisecond',
44
+ // microsecText: 'Microsecond',
45
+ // timezoneText: 'Time Zone',
46
+ // isRTL: false
47
+ // };
48
+ // this._defaults = { // Global defaults for all the datetime picker instances
49
+ // showButtonPanel: true,
50
+ // timeOnly: false,
51
+ // showHour: null,
52
+ // showMinute: null,
53
+ // showSecond: null,
54
+ // showMillisec: null,
55
+ // showMicrosec: null,
56
+ // showTimezone: null,
57
+ // showTime: true,
58
+ // stepHour: 1,
59
+ // stepMinute: 1,
60
+ // stepSecond: 1,
61
+ // stepMillisec: 1,
62
+ // stepMicrosec: 1,
63
+ // hour: 0,
64
+ // minute: 0,
65
+ // second: 0,
66
+ // millisec: 0,
67
+ // microsec: 0,
68
+ // timezone: null,
69
+ // hourMin: 0,
70
+ // minuteMin: 0,
71
+ // secondMin: 0,
72
+ // millisecMin: 0,
73
+ // microsecMin: 0,
74
+ // hourMax: 23,
75
+ // minuteMax: 59,
76
+ // secondMax: 59,
77
+ // millisecMax: 999,
78
+ // microsecMax: 999,
79
+ // minDateTime: null,
80
+ // maxDateTime: null,
81
+ // onSelect: null,
82
+ // hourGrid: 0,
83
+ // minuteGrid: 0,
84
+ // secondGrid: 0,
85
+ // millisecGrid: 0,
86
+ // microsecGrid: 0,
87
+ // alwaysSetTime: true,
88
+ // separator: ' ',
89
+ // altFieldTimeOnly: true,
90
+ // altTimeFormat: null,
91
+ // altSeparator: null,
92
+ // altTimeSuffix: null,
93
+ // pickerTimeFormat: null,
94
+ // pickerTimeSuffix: null,
95
+ // showTimepicker: true,
96
+ // timezoneList: null,
97
+ // addSliderAccess: false,
98
+ // sliderAccessArgs: null,
99
+ // controlType: 'slider',
100
+ // defaultValue: null,
101
+ // parse: 'strict'
102
+ // };
103
+ // $.extend(this._defaults, this.regional['']);
104
+ // };
105
+
106
+ // $.extend(Timepicker.prototype, {
107
+ // $input: null,
108
+ // $altInput: null,
109
+ // $timeObj: null,
110
+ // inst: null,
111
+ // hour_slider: null,
112
+ // minute_slider: null,
113
+ // second_slider: null,
114
+ // millisec_slider: null,
115
+ // microsec_slider: null,
116
+ // timezone_select: null,
117
+ // hour: 0,
118
+ // minute: 0,
119
+ // second: 0,
120
+ // millisec: 0,
121
+ // microsec: 0,
122
+ // timezone: null,
123
+ // hourMinOriginal: null,
124
+ // minuteMinOriginal: null,
125
+ // secondMinOriginal: null,
126
+ // millisecMinOriginal: null,
127
+ // microsecMinOriginal: null,
128
+ // hourMaxOriginal: null,
129
+ // minuteMaxOriginal: null,
130
+ // secondMaxOriginal: null,
131
+ // millisecMaxOriginal: null,
132
+ // microsecMaxOriginal: null,
133
+ // ampm: '',
134
+ // formattedDate: '',
135
+ // formattedTime: '',
136
+ // formattedDateTime: '',
137
+ // timezoneList: null,
138
+ // units: ['hour', 'minute', 'second', 'millisec', 'microsec'],
139
+ // support: {},
140
+ // control: null,
141
+
142
+ // /*
143
+ // * Override the default settings for all instances of the time picker.
144
+ // * @param {Object} settings object - the new settings to use as defaults (anonymous object)
145
+ // * @return {Object} the manager object
146
+ // */
147
+ // setDefaults: function (settings) {
148
+ // extendRemove(this._defaults, settings || {});
149
+ // return this;
150
+ // },
151
+
152
+ // /*
153
+ // * Create a new Timepicker instance
154
+ // */
155
+ // _newInst: function ($input, opts) {
156
+ // var tp_inst = new Timepicker(),
157
+ // inlineSettings = {},
158
+ // fns = {},
159
+ // overrides, i;
160
+
161
+ // for (var attrName in this._defaults) {
162
+ // if (this._defaults.hasOwnProperty(attrName)) {
163
+ // var attrValue = $input.attr('time:' + attrName);
164
+ // if (attrValue) {
165
+ // try {
166
+ // inlineSettings[attrName] = eval(attrValue);
167
+ // } catch (err) {
168
+ // inlineSettings[attrName] = attrValue;
169
+ // }
170
+ // }
171
+ // }
172
+ // }
173
+
174
+ // overrides = {
175
+ // beforeShow: function (input, dp_inst) {
176
+ // if ($.isFunction(tp_inst._defaults.evnts.beforeShow)) {
177
+ // return tp_inst._defaults.evnts.beforeShow.call($input[0], input, dp_inst, tp_inst);
178
+ // }
179
+ // },
180
+ // onChangeMonthYear: function (year, month, dp_inst) {
181
+ // // Update the time as well : this prevents the time from disappearing from the $input field.
182
+ // tp_inst._updateDateTime(dp_inst);
183
+ // if ($.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)) {
184
+ // tp_inst._defaults.evnts.onChangeMonthYear.call($input[0], year, month, dp_inst, tp_inst);
185
+ // }
186
+ // },
187
+ // onClose: function (dateText, dp_inst) {
188
+ // if (tp_inst.timeDefined === true && $input.val() !== '') {
189
+ // tp_inst._updateDateTime(dp_inst);
190
+ // }
191
+ // if ($.isFunction(tp_inst._defaults.evnts.onClose)) {
192
+ // tp_inst._defaults.evnts.onClose.call($input[0], dateText, dp_inst, tp_inst);
193
+ // }
194
+ // }
195
+ // };
196
+ // for (i in overrides) {
197
+ // if (overrides.hasOwnProperty(i)) {
198
+ // fns[i] = opts[i] || null;
199
+ // }
200
+ // }
201
+
202
+ // tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, opts, overrides, {
203
+ // evnts: fns,
204
+ // timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker');
205
+ // });
206
+ // tp_inst.amNames = $.map(tp_inst._defaults.amNames, function (val) {
207
+ // return val.toUpperCase();
208
+ // });
209
+ // tp_inst.pmNames = $.map(tp_inst._defaults.pmNames, function (val) {
210
+ // return val.toUpperCase();
211
+ // });
212
+
213
+ // // detect which units are supported
214
+ // tp_inst.support = detectSupport(
215
+ // tp_inst._defaults.timeFormat +
216
+ // (tp_inst._defaults.pickerTimeFormat ? tp_inst._defaults.pickerTimeFormat : '') +
217
+ // (tp_inst._defaults.altTimeFormat ? tp_inst._defaults.altTimeFormat : ''));
218
+
219
+ // // controlType is string - key to our this._controls
220
+ // if (typeof(tp_inst._defaults.controlType) === 'string') {
221
+ // if (tp_inst._defaults.controlType === 'slider' && typeof($.ui.slider) === 'undefined') {
222
+ // tp_inst._defaults.controlType = 'select';
223
+ // }
224
+ // tp_inst.control = tp_inst._controls[tp_inst._defaults.controlType];
225
+ // }
226
+ // // controlType is an object and must implement create, options, value methods
227
+ // else {
228
+ // tp_inst.control = tp_inst._defaults.controlType;
229
+ // }
230
+
231
+ // // prep the timezone options
232
+ // var timezoneList = [-720, -660, -600, -570, -540, -480, -420, -360, -300, -270, -240, -210, -180, -120, -60,
233
+ // 0, 60, 120, 180, 210, 240, 270, 300, 330, 345, 360, 390, 420, 480, 525, 540, 570, 600, 630, 660, 690, 720, 765, 780, 840];
234
+ // if (tp_inst._defaults.timezoneList !== null) {
235
+ // timezoneList = tp_inst._defaults.timezoneList;
236
+ // }
237
+ // var tzl = timezoneList.length, tzi = 0, tzv = null;
238
+ // if (tzl > 0 && typeof timezoneList[0] !== 'object') {
239
+ // for (; tzi < tzl; tzi++) {
240
+ // tzv = timezoneList[tzi];
241
+ // timezoneList[tzi] = { value: tzv, label: $.timepicker.timezoneOffsetString(tzv, tp_inst.support.iso8601) };
242
+ // }
243
+ // }
244
+ // tp_inst._defaults.timezoneList = timezoneList;
245
+
246
+ // // set the default units
247
+ // tp_inst.timezone = tp_inst._defaults.timezone !== null ? $.timepicker.timezoneOffsetNumber(tp_inst._defaults.timezone) :
248
+ // ((new Date()).getTimezoneOffset() * -1);
249
+ // tp_inst.hour = tp_inst._defaults.hour < tp_inst._defaults.hourMin ? tp_inst._defaults.hourMin :
250
+ // tp_inst._defaults.hour > tp_inst._defaults.hourMax ? tp_inst._defaults.hourMax : tp_inst._defaults.hour;
251
+ // tp_inst.minute = tp_inst._defaults.minute < tp_inst._defaults.minuteMin ? tp_inst._defaults.minuteMin :
252
+ // tp_inst._defaults.minute > tp_inst._defaults.minuteMax ? tp_inst._defaults.minuteMax : tp_inst._defaults.minute;
253
+ // tp_inst.second = tp_inst._defaults.second < tp_inst._defaults.secondMin ? tp_inst._defaults.secondMin :
254
+ // tp_inst._defaults.second > tp_inst._defaults.secondMax ? tp_inst._defaults.secondMax : tp_inst._defaults.second;
255
+ // tp_inst.millisec = tp_inst._defaults.millisec < tp_inst._defaults.millisecMin ? tp_inst._defaults.millisecMin :
256
+ // tp_inst._defaults.millisec > tp_inst._defaults.millisecMax ? tp_inst._defaults.millisecMax : tp_inst._defaults.millisec;
257
+ // tp_inst.microsec = tp_inst._defaults.microsec < tp_inst._defaults.microsecMin ? tp_inst._defaults.microsecMin :
258
+ // tp_inst._defaults.microsec > tp_inst._defaults.microsecMax ? tp_inst._defaults.microsecMax : tp_inst._defaults.microsec;
259
+ // tp_inst.ampm = '';
260
+ // tp_inst.$input = $input;
261
+
262
+ // if (tp_inst._defaults.altField) {
263
+ // tp_inst.$altInput = $(tp_inst._defaults.altField).css({
264
+ // cursor: 'pointer'
265
+ // }).focus(function () {
266
+ // $input.trigger("focus");
267
+ // });
268
+ // }
269
+
270
+ // if (tp_inst._defaults.minDate === 0 || tp_inst._defaults.minDateTime === 0) {
271
+ // tp_inst._defaults.minDate = new Date();
272
+ // }
273
+ // if (tp_inst._defaults.maxDate === 0 || tp_inst._defaults.maxDateTime === 0) {
274
+ // tp_inst._defaults.maxDate = new Date();
275
+ // }
276
+
277
+ // // datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime..
278
+ // if (tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date) {
279
+ // tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime());
280
+ // }
281
+ // if (tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date) {
282
+ // tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime());
283
+ // }
284
+ // if (tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date) {
285
+ // tp_inst._defaults.maxDateTime = new Date(tp_inst._defaults.maxDate.getTime());
286
+ // }
287
+ // if (tp_inst._defaults.maxDateTime !== undefined && tp_inst._defaults.maxDateTime instanceof Date) {
288
+ // tp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime());
289
+ // }
290
+ // tp_inst.$input.bind('focus', function () {
291
+ // tp_inst._onFocus();
292
+ // });
293
+
294
+ // return tp_inst;
295
+ // },
296
+
297
+ // /*
298
+ // * add our sliders to the calendar
299
+ // */
300
+ // _addTimePicker: function (dp_inst) {
301
+ // var currDT = (this.$altInput && this._defaults.altFieldTimeOnly) ? this.$input.val() + ' ' + this.$altInput.val() : this.$input.val();
302
+
303
+ // this.timeDefined = this._parseTime(currDT);
304
+ // this._limitMinMaxDateTime(dp_inst, false);
305
+ // this._injectTimePicker();
306
+ // },
307
+
308
+ // /*
309
+ // * parse the time string from input value or _setTime
310
+ // */
311
+ // _parseTime: function (timeString, withDate) {
312
+ // if (!this.inst) {
313
+ // this.inst = $.datepicker._getInst(this.$input[0]);
314
+ // }
315
+
316
+ // if (withDate || !this._defaults.timeOnly) {
317
+ // var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat');
318
+ // try {
319
+ // var parseRes = parseDateTimeInternal(dp_dateFormat, this._defaults.timeFormat, timeString, $.datepicker._getFormatConfig(this.inst), this._defaults);
320
+ // if (!parseRes.timeObj) {
321
+ // return false;
322
+ // }
323
+ // $.extend(this, parseRes.timeObj);
324
+ // } catch (err) {
325
+ // $.timepicker.log("Error parsing the date/time string: " + err +
326
+ // "\ndate/time string = " + timeString +
327
+ // "\ntimeFormat = " + this._defaults.timeFormat +
328
+ // "\ndateFormat = " + dp_dateFormat);
329
+ // return false;
330
+ // }
331
+ // return true;
332
+ // } else {
333
+ // var timeObj = $.datepicker.parseTime(this._defaults.timeFormat, timeString, this._defaults);
334
+ // if (!timeObj) {
335
+ // return false;
336
+ // }
337
+ // $.extend(this, timeObj);
338
+ // return true;
339
+ // }
340
+ // },
341
+
342
+ // /*
343
+ // * generate and inject html for timepicker into ui datepicker
344
+ // */
345
+ // _injectTimePicker: function () {
346
+ // var $dp = this.inst.dpDiv,
347
+ // o = this.inst.settings,
348
+ // tp_inst = this,
349
+ // litem = '',
350
+ // uitem = '',
351
+ // show = null,
352
+ // max = {},
353
+ // gridSize = {},
354
+ // size = null,
355
+ // i = 0,
356
+ // l = 0;
357
+
358
+ // // Prevent displaying twice
359
+ // if ($dp.find("div.ui-timepicker-div").length === 0 && o.showTimepicker) {
360
+ // var noDisplay = ' style="display:none;"',
361
+ // html = '<div class="ui-timepicker-div' + (o.isRTL ? ' ui-timepicker-rtl' : '') + '"><dl>' + '<dt class="ui_tpicker_time_label"' + ((o.showTime) ? '' : noDisplay) + '>' + o.timeText + '</dt>' +
362
+ // '<dd class="ui_tpicker_time"' + ((o.showTime) ? '' : noDisplay) + '></dd>';
363
+
364
+ // // Create the markup
365
+ // for (i = 0, l = this.units.length; i < l; i++) {
366
+ // litem = this.units[i];
367
+ // uitem = litem.substr(0, 1).toUpperCase() + litem.substr(1);
368
+ // show = o['show' + uitem] !== null ? o['show' + uitem] : this.support[litem];
369
+
370
+ // // Added by Peter Medeiros:
371
+ // // - Figure out what the hour/minute/second max should be based on the step values.
372
+ // // - Example: if stepMinute is 15, then minMax is 45.
373
+ // max[litem] = parseInt((o[litem + 'Max'] - ((o[litem + 'Max'] - o[litem + 'Min']) % o['step' + uitem])), 10);
374
+ // gridSize[litem] = 0;
375
+
376
+ // html += '<dt class="ui_tpicker_' + litem + '_label"' + (show ? '' : noDisplay) + '>' + o[litem + 'Text'] + '</dt>' +
377
+ // '<dd class="ui_tpicker_' + litem + '"><div class="ui_tpicker_' + litem + '_slider"' + (show ? '' : noDisplay) + '></div>';
378
+
379
+ // if (show && o[litem + 'Grid'] > 0) {
380
+ // html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
381
+
382
+ // if (litem === 'hour') {
383
+ // for (var h = o[litem + 'Min']; h <= max[litem]; h += parseInt(o[litem + 'Grid'], 10)) {
384
+ // gridSize[litem]++;
385
+ // var tmph = $.datepicker.formatTime(this.support.ampm ? 'hht' : 'HH', {hour: h}, o);
386
+ // html += '<td data-for="' + litem + '">' + tmph + '</td>';
387
+ // }
388
+ // }
389
+ // else {
390
+ // for (var m = o[litem + 'Min']; m <= max[litem]; m += parseInt(o[litem + 'Grid'], 10)) {
391
+ // gridSize[litem]++;
392
+ // html += '<td data-for="' + litem + '">' + ((m < 10) ? '0' : '') + m + '</td>';
393
+ // }
394
+ // }
395
+
396
+ // html += '</tr></table></div>';
397
+ // }
398
+ // html += '</dd>';
399
+ // }
400
+
401
+ // // Timezone
402
+ // var showTz = o.showTimezone !== null ? o.showTimezone : this.support.timezone;
403
+ // html += '<dt class="ui_tpicker_timezone_label"' + (showTz ? '' : noDisplay) + '>' + o.timezoneText + '</dt>';
404
+ // html += '<dd class="ui_tpicker_timezone" ' + (showTz ? '' : noDisplay) + '></dd>';
405
+
406
+ // // Create the elements from string
407
+ // html += '</dl></div>';
408
+ // var $tp = $(html);
409
+
410
+ // // if we only want time picker...
411
+ // if (o.timeOnly === true) {
412
+ // $tp.prepend('<div class="ui-widget-header ui-helper-clearfix ui-corner-all">' + '<div class="ui-datepicker-title">' + o.timeOnlyTitle + '</div>' + '</div>');
413
+ // $dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide();
414
+ // }
415
+
416
+ // // add sliders, adjust grids, add events
417
+ // for (i = 0, l = tp_inst.units.length; i < l; i++) {
418
+ // litem = tp_inst.units[i];
419
+ // uitem = litem.substr(0, 1).toUpperCase() + litem.substr(1);
420
+ // show = o['show' + uitem] !== null ? o['show' + uitem] : this.support[litem];
421
+
422
+ // // add the slider
423
+ // tp_inst[litem + '_slider'] = tp_inst.control.create(tp_inst, $tp.find('.ui_tpicker_' + litem + '_slider'), litem, tp_inst[litem], o[litem + 'Min'], max[litem], o['step' + uitem]);
424
+
425
+ // // adjust the grid and add click event
426
+ // if (show && o[litem + 'Grid'] > 0) {
427
+ // size = 100 * gridSize[litem] * o[litem + 'Grid'] / (max[litem] - o[litem + 'Min']);
428
+ // $tp.find('.ui_tpicker_' + litem + ' table').css({
429
+ // width: size + "%",
430
+ // marginLeft: o.isRTL ? '0' : ((size / (-2 * gridSize[litem])) + "%"),
431
+ // marginRight: o.isRTL ? ((size / (-2 * gridSize[litem])) + "%") : '0',
432
+ // borderCollapse: 'collapse'
433
+ // }).find("td").click(function (e) {
434
+ // var $t = $(this),
435
+ // h = $t.html(),
436
+ // n = parseInt(h.replace(/[^0-9]/g), 10),
437
+ // ap = h.replace(/[^apm]/ig),
438
+ // f = $t.data('for'); // loses scope, so we use data-for
439
+
440
+ // if (f === 'hour') {
441
+ // if (ap.indexOf('p') !== -1 && n < 12) {
442
+ // n += 12;
443
+ // }
444
+ // else {
445
+ // if (ap.indexOf('a') !== -1 && n === 12) {
446
+ // n = 0;
447
+ // }
448
+ // }
449
+ // }
450
+
451
+ // tp_inst.control.value(tp_inst, tp_inst[f + '_slider'], litem, n);
452
+
453
+ // tp_inst._onTimeChange();
454
+ // tp_inst._onSelectHandler();
455
+ // }).css({
456
+ // cursor: 'pointer',
457
+ // width: (100 / gridSize[litem]) + '%',
458
+ // textAlign: 'center',
459
+ // overflow: 'hidden'
460
+ // });
461
+ // } // end if grid > 0
462
+ // } // end for loop
463
+
464
+ // // Add timezone options
465
+ // this.timezone_select = $tp.find('.ui_tpicker_timezone').append('<select></select>').find("select");
466
+ // $.fn.append.apply(this.timezone_select,
467
+ // $.map(o.timezoneList, function (val, idx) {
468
+ // return $("<option />").val(typeof val === "object" ? val.value : val).text(typeof val === "object" ? val.label : val);
469
+ // }));
470
+ // if (typeof(this.timezone) !== "undefined" && this.timezone !== null && this.timezone !== "") {
471
+ // var local_timezone = (new Date(this.inst.selectedYear, this.inst.selectedMonth, this.inst.selectedDay, 12)).getTimezoneOffset() * -1;
472
+ // if (local_timezone === this.timezone) {
473
+ // selectLocalTimezone(tp_inst);
474
+ // } else {
475
+ // this.timezone_select.val(this.timezone);
476
+ // }
477
+ // } else {
478
+ // if (typeof(this.hour) !== "undefined" && this.hour !== null && this.hour !== "") {
479
+ // this.timezone_select.val(o.timezone);
480
+ // } else {
481
+ // selectLocalTimezone(tp_inst);
482
+ // }
483
+ // }
484
+ // this.timezone_select.change(function () {
485
+ // tp_inst._onTimeChange();
486
+ // tp_inst._onSelectHandler();
487
+ // });
488
+ // // End timezone options
489
+
490
+ // // inject timepicker into datepicker
491
+ // var $buttonPanel = $dp.find('.ui-datepicker-buttonpane');
492
+ // if ($buttonPanel.length) {
493
+ // $buttonPanel.before($tp);
494
+ // } else {
495
+ // $dp.append($tp);
496
+ // }
497
+
498
+ // this.$timeObj = $tp.find('.ui_tpicker_time');
499
+
500
+ // if (this.inst !== null) {
501
+ // var timeDefined = this.timeDefined;
502
+ // this._onTimeChange();
503
+ // this.timeDefined = timeDefined;
504
+ // }
505
+
506
+ // // slideAccess integration: http://trentrichardson.com/2011/11/11/jquery-ui-sliders-and-touch-accessibility/
507
+ // if (this._defaults.addSliderAccess) {
508
+ // var sliderAccessArgs = this._defaults.sliderAccessArgs,
509
+ // rtl = this._defaults.isRTL;
510
+ // sliderAccessArgs.isRTL = rtl;
511
+
512
+ // setTimeout(function () { // fix for inline mode
513
+ // if ($tp.find('.ui-slider-access').length === 0) {
514
+ // $tp.find('.ui-slider:visible').sliderAccess(sliderAccessArgs);
515
+
516
+ // // fix any grids since sliders are shorter
517
+ // var sliderAccessWidth = $tp.find('.ui-slider-access:eq(0)').outerWidth(true);
518
+ // if (sliderAccessWidth) {
519
+ // $tp.find('table:visible').each(function () {
520
+ // var $g = $(this),
521
+ // oldWidth = $g.outerWidth(),
522
+ // oldMarginLeft = $g.css(rtl ? 'marginRight' : 'marginLeft').toString().replace('%', ''),
523
+ // newWidth = oldWidth - sliderAccessWidth,
524
+ // newMarginLeft = ((oldMarginLeft * newWidth) / oldWidth) + '%',
525
+ // css = { width: newWidth, marginRight: 0, marginLeft: 0 };
526
+ // css[rtl ? 'marginRight' : 'marginLeft'] = newMarginLeft;
527
+ // $g.css(css);
528
+ // });
529
+ // }
530
+ // }
531
+ // }, 10);
532
+ // }
533
+ // // end slideAccess integration
534
+
535
+ // tp_inst._limitMinMaxDateTime(this.inst, true);
536
+ // }
537
+ // },
538
+
539
+ // /*
540
+ // * This function tries to limit the ability to go outside the
541
+ // * min/max date range
542
+ // */
543
+ // _limitMinMaxDateTime: function (dp_inst, adjustSliders) {
544
+ // var o = this._defaults,
545
+ // dp_date = new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay);
546
+
547
+ // if (!this._defaults.showTimepicker) {
548
+ // return;
549
+ // } // No time so nothing to check here
550
+
551
+ // if ($.datepicker._get(dp_inst, 'minDateTime') !== null && $.datepicker._get(dp_inst, 'minDateTime') !== undefined && dp_date) {
552
+ // var minDateTime = $.datepicker._get(dp_inst, 'minDateTime'),
553
+ // minDateTimeDate = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), 0, 0, 0, 0);
554
+
555
+ // if (this.hourMinOriginal === null || this.minuteMinOriginal === null || this.secondMinOriginal === null || this.millisecMinOriginal === null || this.microsecMinOriginal === null) {
556
+ // this.hourMinOriginal = o.hourMin;
557
+ // this.minuteMinOriginal = o.minuteMin;
558
+ // this.secondMinOriginal = o.secondMin;
559
+ // this.millisecMinOriginal = o.millisecMin;
560
+ // this.microsecMinOriginal = o.microsecMin;
561
+ // }
562
+
563
+ // if (dp_inst.settings.timeOnly || minDateTimeDate.getTime() === dp_date.getTime()) {
564
+ // this._defaults.hourMin = minDateTime.getHours();
565
+ // if (this.hour <= this._defaults.hourMin) {
566
+ // this.hour = this._defaults.hourMin;
567
+ // this._defaults.minuteMin = minDateTime.getMinutes();
568
+ // if (this.minute <= this._defaults.minuteMin) {
569
+ // this.minute = this._defaults.minuteMin;
570
+ // this._defaults.secondMin = minDateTime.getSeconds();
571
+ // if (this.second <= this._defaults.secondMin) {
572
+ // this.second = this._defaults.secondMin;
573
+ // this._defaults.millisecMin = minDateTime.getMilliseconds();
574
+ // if (this.millisec <= this._defaults.millisecMin) {
575
+ // this.millisec = this._defaults.millisecMin;
576
+ // this._defaults.microsecMin = minDateTime.getMicroseconds();
577
+ // } else {
578
+ // if (this.microsec < this._defaults.microsecMin) {
579
+ // this.microsec = this._defaults.microsecMin;
580
+ // }
581
+ // this._defaults.microsecMin = this.microsecMinOriginal;
582
+ // }
583
+ // } else {
584
+ // this._defaults.millisecMin = this.millisecMinOriginal;
585
+ // this._defaults.microsecMin = this.microsecMinOriginal;
586
+ // }
587
+ // } else {
588
+ // this._defaults.secondMin = this.secondMinOriginal;
589
+ // this._defaults.millisecMin = this.millisecMinOriginal;
590
+ // this._defaults.microsecMin = this.microsecMinOriginal;
591
+ // }
592
+ // } else {
593
+ // this._defaults.minuteMin = this.minuteMinOriginal;
594
+ // this._defaults.secondMin = this.secondMinOriginal;
595
+ // this._defaults.millisecMin = this.millisecMinOriginal;
596
+ // this._defaults.microsecMin = this.microsecMinOriginal;
597
+ // }
598
+ // } else {
599
+ // this._defaults.hourMin = this.hourMinOriginal;
600
+ // this._defaults.minuteMin = this.minuteMinOriginal;
601
+ // this._defaults.secondMin = this.secondMinOriginal;
602
+ // this._defaults.millisecMin = this.millisecMinOriginal;
603
+ // this._defaults.microsecMin = this.microsecMinOriginal;
604
+ // }
605
+ // }
606
+
607
+ // if ($.datepicker._get(dp_inst, 'maxDateTime') !== null && $.datepicker._get(dp_inst, 'maxDateTime') !== undefined && dp_date) {
608
+ // var maxDateTime = $.datepicker._get(dp_inst, 'maxDateTime'),
609
+ // maxDateTimeDate = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), 0, 0, 0, 0);
610
+
611
+ // if (this.hourMaxOriginal === null || this.minuteMaxOriginal === null || this.secondMaxOriginal === null || this.millisecMaxOriginal === null) {
612
+ // this.hourMaxOriginal = o.hourMax;
613
+ // this.minuteMaxOriginal = o.minuteMax;
614
+ // this.secondMaxOriginal = o.secondMax;
615
+ // this.millisecMaxOriginal = o.millisecMax;
616
+ // this.microsecMaxOriginal = o.microsecMax;
617
+ // }
618
+
619
+ // if (dp_inst.settings.timeOnly || maxDateTimeDate.getTime() === dp_date.getTime()) {
620
+ // this._defaults.hourMax = maxDateTime.getHours();
621
+ // if (this.hour >= this._defaults.hourMax) {
622
+ // this.hour = this._defaults.hourMax;
623
+ // this._defaults.minuteMax = maxDateTime.getMinutes();
624
+ // if (this.minute >= this._defaults.minuteMax) {
625
+ // this.minute = this._defaults.minuteMax;
626
+ // this._defaults.secondMax = maxDateTime.getSeconds();
627
+ // if (this.second >= this._defaults.secondMax) {
628
+ // this.second = this._defaults.secondMax;
629
+ // this._defaults.millisecMax = maxDateTime.getMilliseconds();
630
+ // if (this.millisec >= this._defaults.millisecMax) {
631
+ // this.millisec = this._defaults.millisecMax;
632
+ // this._defaults.microsecMax = maxDateTime.getMicroseconds();
633
+ // } else {
634
+ // if (this.microsec > this._defaults.microsecMax) {
635
+ // this.microsec = this._defaults.microsecMax;
636
+ // }
637
+ // this._defaults.microsecMax = this.microsecMaxOriginal;
638
+ // }
639
+ // } else {
640
+ // this._defaults.millisecMax = this.millisecMaxOriginal;
641
+ // this._defaults.microsecMax = this.microsecMaxOriginal;
642
+ // }
643
+ // } else {
644
+ // this._defaults.secondMax = this.secondMaxOriginal;
645
+ // this._defaults.millisecMax = this.millisecMaxOriginal;
646
+ // this._defaults.microsecMax = this.microsecMaxOriginal;
647
+ // }
648
+ // } else {
649
+ // this._defaults.minuteMax = this.minuteMaxOriginal;
650
+ // this._defaults.secondMax = this.secondMaxOriginal;
651
+ // this._defaults.millisecMax = this.millisecMaxOriginal;
652
+ // this._defaults.microsecMax = this.microsecMaxOriginal;
653
+ // }
654
+ // } else {
655
+ // this._defaults.hourMax = this.hourMaxOriginal;
656
+ // this._defaults.minuteMax = this.minuteMaxOriginal;
657
+ // this._defaults.secondMax = this.secondMaxOriginal;
658
+ // this._defaults.millisecMax = this.millisecMaxOriginal;
659
+ // this._defaults.microsecMax = this.microsecMaxOriginal;
660
+ // }
661
+ // }
662
+
663
+ // if (adjustSliders !== undefined && adjustSliders === true) {
664
+ // var hourMax = parseInt((this._defaults.hourMax - ((this._defaults.hourMax - this._defaults.hourMin) % this._defaults.stepHour)), 10),
665
+ // minMax = parseInt((this._defaults.minuteMax - ((this._defaults.minuteMax - this._defaults.minuteMin) % this._defaults.stepMinute)), 10),
666
+ // secMax = parseInt((this._defaults.secondMax - ((this._defaults.secondMax - this._defaults.secondMin) % this._defaults.stepSecond)), 10),
667
+ // millisecMax = parseInt((this._defaults.millisecMax - ((this._defaults.millisecMax - this._defaults.millisecMin) % this._defaults.stepMillisec)), 10),
668
+ // microsecMax = parseInt((this._defaults.microsecMax - ((this._defaults.microsecMax - this._defaults.microsecMin) % this._defaults.stepMicrosec)), 10);
669
+
670
+ // if (this.hour_slider) {
671
+ // this.control.options(this, this.hour_slider, 'hour', { min: this._defaults.hourMin, max: hourMax });
672
+ // this.control.value(this, this.hour_slider, 'hour', this.hour - (this.hour % this._defaults.stepHour));
673
+ // }
674
+ // if (this.minute_slider) {
675
+ // this.control.options(this, this.minute_slider, 'minute', { min: this._defaults.minuteMin, max: minMax });
676
+ // this.control.value(this, this.minute_slider, 'minute', this.minute - (this.minute % this._defaults.stepMinute));
677
+ // }
678
+ // if (this.second_slider) {
679
+ // this.control.options(this, this.second_slider, 'second', { min: this._defaults.secondMin, max: secMax });
680
+ // this.control.value(this, this.second_slider, 'second', this.second - (this.second % this._defaults.stepSecond));
681
+ // }
682
+ // if (this.millisec_slider) {
683
+ // this.control.options(this, this.millisec_slider, 'millisec', { min: this._defaults.millisecMin, max: millisecMax });
684
+ // this.control.value(this, this.millisec_slider, 'millisec', this.millisec - (this.millisec % this._defaults.stepMillisec));
685
+ // }
686
+ // if (this.microsec_slider) {
687
+ // this.control.options(this, this.microsec_slider, 'microsec', { min: this._defaults.microsecMin, max: microsecMax });
688
+ // this.control.value(this, this.microsec_slider, 'microsec', this.microsec - (this.microsec % this._defaults.stepMicrosec));
689
+ // }
690
+ // }
691
+
692
+ // },
693
+
694
+ // /*
695
+ // * when a slider moves, set the internal time...
696
+ // * on time change is also called when the time is updated in the text field
697
+ // */
698
+ // _onTimeChange: function () {
699
+ // if (!this._defaults.showTimepicker) {
700
+ // return;
701
+ // }
702
+ // var hour = (this.hour_slider) ? this.control.value(this, this.hour_slider, 'hour') : false,
703
+ // minute = (this.minute_slider) ? this.control.value(this, this.minute_slider, 'minute') : false,
704
+ // second = (this.second_slider) ? this.control.value(this, this.second_slider, 'second') : false,
705
+ // millisec = (this.millisec_slider) ? this.control.value(this, this.millisec_slider, 'millisec') : false,
706
+ // microsec = (this.microsec_slider) ? this.control.value(this, this.microsec_slider, 'microsec') : false,
707
+ // timezone = (this.timezone_select) ? this.timezone_select.val() : false,
708
+ // o = this._defaults,
709
+ // pickerTimeFormat = o.pickerTimeFormat || o.timeFormat,
710
+ // pickerTimeSuffix = o.pickerTimeSuffix || o.timeSuffix;
711
+
712
+ // if (typeof(hour) === 'object') {
713
+ // hour = false;
714
+ // }
715
+ // if (typeof(minute) === 'object') {
716
+ // minute = false;
717
+ // }
718
+ // if (typeof(second) === 'object') {
719
+ // second = false;
720
+ // }
721
+ // if (typeof(millisec) === 'object') {
722
+ // millisec = false;
723
+ // }
724
+ // if (typeof(microsec) === 'object') {
725
+ // microsec = false;
726
+ // }
727
+ // if (typeof(timezone) === 'object') {
728
+ // timezone = false;
729
+ // }
730
+
731
+ // if (hour !== false) {
732
+ // hour = parseInt(hour, 10);
733
+ // }
734
+ // if (minute !== false) {
735
+ // minute = parseInt(minute, 10);
736
+ // }
737
+ // if (second !== false) {
738
+ // second = parseInt(second, 10);
739
+ // }
740
+ // if (millisec !== false) {
741
+ // millisec = parseInt(millisec, 10);
742
+ // }
743
+ // if (microsec !== false) {
744
+ // microsec = parseInt(microsec, 10);
745
+ // }
746
+
747
+ // var ampm = o[hour < 12 ? 'amNames' : 'pmNames'][0];
748
+
749
+ // // If the update was done in the input field, the input field should not be updated.
750
+ // // If the update was done using the sliders, update the input field.
751
+ // var hasChanged = (hour !== this.hour || minute !== this.minute || second !== this.second || millisec !== this.millisec || microsec !== this.microsec ||
752
+ // (this.ampm.length > 0 && (hour < 12) !== ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1)) || (this.timezone !== null && timezone !== this.timezone));
753
+
754
+ // if (hasChanged) {
755
+
756
+ // if (hour !== false) {
757
+ // this.hour = hour;
758
+ // }
759
+ // if (minute !== false) {
760
+ // this.minute = minute;
761
+ // }
762
+ // if (second !== false) {
763
+ // this.second = second;
764
+ // }
765
+ // if (millisec !== false) {
766
+ // this.millisec = millisec;
767
+ // }
768
+ // if (microsec !== false) {
769
+ // this.microsec = microsec;
770
+ // }
771
+ // if (timezone !== false) {
772
+ // this.timezone = timezone;
773
+ // }
774
+
775
+ // if (!this.inst) {
776
+ // this.inst = $.datepicker._getInst(this.$input[0]);
777
+ // }
778
+
779
+ // this._limitMinMaxDateTime(this.inst, true);
780
+ // }
781
+ // if (this.support.ampm) {
782
+ // this.ampm = ampm;
783
+ // }
784
+
785
+ // // Updates the time within the timepicker
786
+ // this.formattedTime = $.datepicker.formatTime(o.timeFormat, this, o);
787
+ // if (this.$timeObj) {
788
+ // if (pickerTimeFormat === o.timeFormat) {
789
+ // this.$timeObj.text(this.formattedTime + pickerTimeSuffix);
790
+ // }
791
+ // else {
792
+ // this.$timeObj.text($.datepicker.formatTime(pickerTimeFormat, this, o) + pickerTimeSuffix);
793
+ // }
794
+ // }
795
+
796
+ // this.timeDefined = true;
797
+ // if (hasChanged) {
798
+ // this._updateDateTime();
799
+ // }
800
+ // },
801
+
802
+ // /*
803
+ // * call custom onSelect.
804
+ // * bind to sliders slidestop, and grid click.
805
+ // */
806
+ // _onSelectHandler: function () {
807
+ // var onSelect = this._defaults.onSelect || this.inst.settings.onSelect;
808
+ // var inputEl = this.$input ? this.$input[0] : null;
809
+ // if (onSelect && inputEl) {
810
+ // onSelect.apply(inputEl, [this.formattedDateTime, this]);
811
+ // }
812
+ // },
813
+
814
+ // /*
815
+ // * update our input with the new date time..
816
+ // */
817
+ // _updateDateTime: function (dp_inst) {
818
+ // dp_inst = this.inst || dp_inst;
819
+ // var dtTmp = (dp_inst.currentYear > 0?
820
+ // new Date(dp_inst.currentYear, dp_inst.currentMonth, dp_inst.currentDay) :
821
+ // new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
822
+ // dt = $.datepicker._daylightSavingAdjust(dtTmp),
823
+ // //dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
824
+ // //dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.currentYear, dp_inst.currentMonth, dp_inst.currentDay)),
825
+ // dateFmt = $.datepicker._get(dp_inst, 'dateFormat'),
826
+ // formatCfg = $.datepicker._getFormatConfig(dp_inst),
827
+ // timeAvailable = dt !== null && this.timeDefined;
828
+ // this.formattedDate = $.datepicker.formatDate(dateFmt, (dt === null ? new Date() : dt), formatCfg);
829
+ // var formattedDateTime = this.formattedDate;
830
+
831
+ // // if a slider was changed but datepicker doesn't have a value yet, set it
832
+ // if (dp_inst.lastVa === "") {
833
+ // dp_inst.currentYear = dp_inst.selectedYear;
834
+ // dp_inst.currentMonth = dp_inst.selectedMonth;
835
+ // dp_inst.currentDay = dp_inst.selectedDay;
836
+ // }
837
+
838
+ // /*
839
+ // * remove following lines to force every changes in date picker to change the input value
840
+ // * Bug descriptions: when an input field has a default value, and click on the field to pop up the date picker.
841
+ // * If the user manually empty the value in the input field, the date picker will never change selected value.
842
+ // */
843
+ // //if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0)) {
844
+ // // return;
845
+ // //}
846
+
847
+ // if (this._defaults.timeOnly === true) {
848
+ // formattedDateTime = this.formattedTime;
849
+ // } else if (this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) {
850
+ // formattedDateTime += this._defaults.separator + this.formattedTime + this._defaults.timeSuffix;
851
+ // }
852
+
853
+ // this.formattedDateTime = formattedDateTime;
854
+
855
+ // if (!this._defaults.showTimepicker) {
856
+ // this.$input.val(this.formattedDate);
857
+ // } else if (this.$altInput && this._defaults.timeOnly === false && this._defaults.altFieldTimeOnly === true) {
858
+ // this.$altInput.val(this.formattedTime);
859
+ // this.$input.val(this.formattedDate);
860
+ // } else if (this.$altInput) {
861
+ // this.$input.val(formattedDateTime);
862
+ // var altFormattedDateTime = '',
863
+ // altSeparator = this._defaults.altSeparator ? this._defaults.altSeparator : this._defaults.separator,
864
+ // altTimeSuffix = this._defaults.altTimeSuffix ? this._defaults.altTimeSuffix : this._defaults.timeSuffix;
865
+
866
+ // if (!this._defaults.timeOnly) {
867
+ // if (this._defaults.altFormat) {
868
+ // altFormattedDateTime = $.datepicker.formatDate(this._defaults.altFormat, (dt === null ? new Date() : dt), formatCfg);
869
+ // }
870
+ // else {
871
+ // altFormattedDateTime = this.formattedDate;
872
+ // }
873
+
874
+ // if (altFormattedDateTime) {
875
+ // altFormattedDateTime += altSeparator;
876
+ // }
877
+ // }
878
+
879
+ // if (this._defaults.altTimeFormat) {
880
+ // altFormattedDateTime += $.datepicker.formatTime(this._defaults.altTimeFormat, this, this._defaults) + altTimeSuffix;
881
+ // }
882
+ // else {
883
+ // altFormattedDateTime += this.formattedTime + altTimeSuffix;
884
+ // }
885
+ // this.$altInput.val(altFormattedDateTime);
886
+ // } else {
887
+ // this.$input.val(formattedDateTime);
888
+ // }
889
+
890
+ // this.$input.trigger("change");
891
+ // },
892
+
893
+ // _onFocus: function () {
894
+ // if (!this.$input.val() && this._defaults.defaultValue) {
895
+ // this.$input.val(this._defaults.defaultValue);
896
+ // var inst = $.datepicker._getInst(this.$input.get(0)),
897
+ // tp_inst = $.datepicker._get(inst, 'timepicker');
898
+ // if (tp_inst) {
899
+ // if (tp_inst._defaults.timeOnly && (inst.input.val() !== inst.lastVal)) {
900
+ // try {
901
+ // $.datepicker._updateDatepicker(inst);
902
+ // } catch (err) {
903
+ // $.timepicker.log(err);
904
+ // }
905
+ // }
906
+ // }
907
+ // }
908
+ // },
909
+
910
+ // /*
911
+ // * Small abstraction to control types
912
+ // * We can add more, just be sure to follow the pattern: create, options, value
913
+ // */
914
+ // _controls: {
915
+ // // slider methods
916
+ // slider: {
917
+ // create: function (tp_inst, obj, unit, val, min, max, step) {
918
+ // var rtl = tp_inst._defaults.isRTL; // if rtl go -60->0 instead of 0->60
919
+ // return obj.prop('slide', null).slider({
920
+ // orientation: "horizontal",
921
+ // value: rtl ? val * -1 : val,
922
+ // min: rtl ? max * -1 : min,
923
+ // max: rtl ? min * -1 : max,
924
+ // step: step,
925
+ // slide: function (event, ui) {
926
+ // tp_inst.control.value(tp_inst, $(this), unit, rtl ? ui.value * -1 : ui.value);
927
+ // tp_inst._onTimeChange();
928
+ // },
929
+ // stop: function (event, ui) {
930
+ // tp_inst._onSelectHandler();
931
+ // }
932
+ // });
933
+ // },
934
+ // options: function (tp_inst, obj, unit, opts, val) {
935
+ // if (tp_inst._defaults.isRTL) {
936
+ // if (typeof(opts) === 'string') {
937
+ // if (opts === 'min' || opts === 'max') {
938
+ // if (val !== undefined) {
939
+ // return obj.slider(opts, val * -1);
940
+ // }
941
+ // return Math.abs(obj.slider(opts));
942
+ // }
943
+ // return obj.slider(opts);
944
+ // }
945
+ // var min = opts.min,
946
+ // max = opts.max;
947
+ // opts.min = opts.max = null;
948
+ // if (min !== undefined) {
949
+ // opts.max = min * -1;
950
+ // }
951
+ // if (max !== undefined) {
952
+ // opts.min = max * -1;
953
+ // }
954
+ // return obj.slider(opts);
955
+ // }
956
+ // if (typeof(opts) === 'string' && val !== undefined) {
957
+ // return obj.slider(opts, val);
958
+ // }
959
+ // return obj.slider(opts);
960
+ // },
961
+ // value: function (tp_inst, obj, unit, val) {
962
+ // if (tp_inst._defaults.isRTL) {
963
+ // if (val !== undefined) {
964
+ // return obj.slider('value', val * -1);
965
+ // }
966
+ // return Math.abs(obj.slider('value'));
967
+ // }
968
+ // if (val !== undefined) {
969
+ // return obj.slider('value', val);
970
+ // }
971
+ // return obj.slider('value');
972
+ // }
973
+ // },
974
+ // // select methods
975
+ // select: {
976
+ // create: function (tp_inst, obj, unit, val, min, max, step) {
977
+ // var sel = '<select class="ui-timepicker-select" data-unit="' + unit + '" data-min="' + min + '" data-max="' + max + '" data-step="' + step + '">',
978
+ // format = tp_inst._defaults.pickerTimeFormat || tp_inst._defaults.timeFormat;
979
+
980
+ // for (var i = min; i <= max; i += step) {
981
+ // sel += '<option value="' + i + '"' + (i === val ? ' selected' : '') + '>';
982
+ // if (unit === 'hour') {
983
+ // sel += $.datepicker.formatTime($.trim(format.replace(/[^ht ]/ig, '')), {hour: i}, tp_inst._defaults);
984
+ // }
985
+ // else if (unit === 'millisec' || unit === 'microsec' || i >= 10) { sel += i; }
986
+ // else {sel += '0' + i.toString(); }
987
+ // sel += '</option>';
988
+ // }
989
+ // sel += '</select>';
990
+
991
+ // obj.children('select').remove();
992
+
993
+ // $(sel).appendTo(obj).change(function (e) {
994
+ // tp_inst._onTimeChange();
995
+ // tp_inst._onSelectHandler();
996
+ // });
997
+
998
+ // return obj;
999
+ // },
1000
+ // options: function (tp_inst, obj, unit, opts, val) {
1001
+ // var o = {},
1002
+ // $t = obj.children('select');
1003
+ // if (typeof(opts) === 'string') {
1004
+ // if (val === undefined) {
1005
+ // return $t.data(opts);
1006
+ // }
1007
+ // o[opts] = val;
1008
+ // }
1009
+ // else { o = opts; }
1010
+ // return tp_inst.control.create(tp_inst, obj, $t.data('unit'), $t.val(), o.min || $t.data('min'), o.max || $t.data('max'), o.step || $t.data('step'));
1011
+ // },
1012
+ // value: function (tp_inst, obj, unit, val) {
1013
+ // var $t = obj.children('select');
1014
+ // if (val !== undefined) {
1015
+ // return $t.val(val);
1016
+ // }
1017
+ // return $t.val();
1018
+ // }
1019
+ // }
1020
+ // } // end _controls
1021
+
1022
+ // });
1023
+
1024
+ // $.fn.extend({
1025
+ // /*
1026
+ // * shorthand just to use timepicker.
1027
+ // */
1028
+ // timepicker: function (o) {
1029
+ // o = o || {};
1030
+ // var tmp_args = Array.prototype.slice.call(arguments);
1031
+
1032
+ // if (typeof o === 'object') {
1033
+ // tmp_args[0] = $.extend(o, {
1034
+ // timeOnly: true
1035
+ // });
1036
+ // }
1037
+
1038
+ // return $(this).each(function () {
1039
+ // $.fn.datetimepicker.apply($(this), tmp_args);
1040
+ // });
1041
+ // },
1042
+
1043
+ // /*
1044
+ // * extend timepicker to datepicker
1045
+ // */
1046
+ // datetimepicker: function (o) {
1047
+ // o = o || {};
1048
+ // var tmp_args = arguments;
1049
+
1050
+ // if (typeof(o) === 'string') {
1051
+ // if (o === 'getDate') {
1052
+ // return $.fn.datepicker.apply($(this[0]), tmp_args);
1053
+ // } else {
1054
+ // return this.each(function () {
1055
+ // var $t = $(this);
1056
+ // $t.datepicker.apply($t, tmp_args);
1057
+ // });
1058
+ // }
1059
+ // } else {
1060
+ // return this.each(function () {
1061
+ // var $t = $(this);
1062
+ // $t.datepicker($.timepicker._newInst($t, o)._defaults);
1063
+ // });
1064
+ // }
1065
+ // }
1066
+ // });
1067
+
1068
+ // /*
1069
+ // * Public Utility to parse date and time
1070
+ // */
1071
+ // $.datepicker.parseDateTime = function (dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
1072
+ // var parseRes = parseDateTimeInternal(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings);
1073
+ // if (parseRes.timeObj) {
1074
+ // var t = parseRes.timeObj;
1075
+ // parseRes.date.setHours(t.hour, t.minute, t.second, t.millisec);
1076
+ // parseRes.date.setMicroseconds(t.microsec);
1077
+ // }
1078
+
1079
+ // return parseRes.date;
1080
+ // };
1081
+
1082
+ // /*
1083
+ // * Public utility to parse time
1084
+ // */
1085
+ // $.datepicker.parseTime = function (timeFormat, timeString, options) {
1086
+ // var o = extendRemove(extendRemove({}, $.timepicker._defaults), options || {}),
1087
+ // iso8601 = (timeFormat.replace(/\'.*?\'/g, '').indexOf('Z') !== -1);
1088
+
1089
+ // // Strict parse requires the timeString to match the timeFormat exactly
1090
+ // var strictParse = function (f, s, o) {
1091
+
1092
+ // // pattern for standard and localized AM/PM markers
1093
+ // var getPatternAmpm = function (amNames, pmNames) {
1094
+ // var markers = [];
1095
+ // if (amNames) {
1096
+ // $.merge(markers, amNames);
1097
+ // }
1098
+ // if (pmNames) {
1099
+ // $.merge(markers, pmNames);
1100
+ // }
1101
+ // markers = $.map(markers, function (val) {
1102
+ // return val.replace(/[.*+?|()\[\]{}\\]/g, '\\$&');
1103
+ // });
1104
+ // return '(' + markers.join('|') + ')?';
1105
+ // };
1106
+
1107
+ // // figure out position of time elements.. cause js cant do named captures
1108
+ // var getFormatPositions = function (timeFormat) {
1109
+ // var finds = timeFormat.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|c{1}|t{1,2}|z|'.*?')/g),
1110
+ // orders = {
1111
+ // h: -1,
1112
+ // m: -1,
1113
+ // s: -1,
1114
+ // l: -1,
1115
+ // c: -1,
1116
+ // t: -1,
1117
+ // z: -1
1118
+ // };
1119
+
1120
+ // if (finds) {
1121
+ // for (var i = 0; i < finds.length; i++) {
1122
+ // if (orders[finds[i].toString().charAt(0)] === -1) {
1123
+ // orders[finds[i].toString().charAt(0)] = i + 1;
1124
+ // }
1125
+ // }
1126
+ // }
1127
+ // return orders;
1128
+ // };
1129
+
1130
+ // var regstr = '^' + f.toString()
1131
+ // .replace(/([hH]{1,2}|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g, function (match) {
1132
+ // var ml = match.length;
1133
+ // switch (match.charAt(0).toLowerCase()) {
1134
+ // case 'h':
1135
+ // return ml === 1 ? '(\\d?\\d)' : '(\\d{' + ml + '})';
1136
+ // case 'm':
1137
+ // return ml === 1 ? '(\\d?\\d)' : '(\\d{' + ml + '})';
1138
+ // case 's':
1139
+ // return ml === 1 ? '(\\d?\\d)' : '(\\d{' + ml + '})';
1140
+ // case 'l':
1141
+ // return '(\\d?\\d?\\d)';
1142
+ // case 'c':
1143
+ // return '(\\d?\\d?\\d)';
1144
+ // case 'z':
1145
+ // return '(z|[-+]\\d\\d:?\\d\\d|\\S+)?';
1146
+ // case 't':
1147
+ // return getPatternAmpm(o.amNames, o.pmNames);
1148
+ // default: // literal escaped in quotes
1149
+ // return '(' + match.replace(/\'/g, "").replace(/(\.|\$|\^|\\|\/|\(|\)|\[|\]|\?|\+|\*)/g, function (m) { return "\\" + m; }) + ')?';
1150
+ // }
1151
+ // })
1152
+ // .replace(/\s/g, '\\s?') +
1153
+ // o.timeSuffix + '$',
1154
+ // order = getFormatPositions(f),
1155
+ // ampm = '',
1156
+ // treg;
1157
+
1158
+ // treg = s.match(new RegExp(regstr, 'i'));
1159
+
1160
+ // var resTime = {
1161
+ // hour: 0,
1162
+ // minute: 0,
1163
+ // second: 0,
1164
+ // millisec: 0,
1165
+ // microsec: 0
1166
+ // };
1167
+
1168
+ // if (treg) {
1169
+ // if (order.t !== -1) {
1170
+ // if (treg[order.t] === undefined || treg[order.t].length === 0) {
1171
+ // ampm = '';
1172
+ // resTime.ampm = '';
1173
+ // } else {
1174
+ // ampm = $.inArray(treg[order.t].toUpperCase(), o.amNames) !== -1 ? 'AM' : 'PM';
1175
+ // resTime.ampm = o[ampm === 'AM' ? 'amNames' : 'pmNames'][0];
1176
+ // }
1177
+ // }
1178
+
1179
+ // if (order.h !== -1) {
1180
+ // if (ampm === 'AM' && treg[order.h] === '12') {
1181
+ // resTime.hour = 0; // 12am = 0 hour
1182
+ // } else {
1183
+ // if (ampm === 'PM' && treg[order.h] !== '12') {
1184
+ // resTime.hour = parseInt(treg[order.h], 10) + 12; // 12pm = 12 hour, any other pm = hour + 12
1185
+ // } else {
1186
+ // resTime.hour = Number(treg[order.h]);
1187
+ // }
1188
+ // }
1189
+ // }
1190
+
1191
+ // if (order.m !== -1) {
1192
+ // resTime.minute = Number(treg[order.m]);
1193
+ // }
1194
+ // if (order.s !== -1) {
1195
+ // resTime.second = Number(treg[order.s]);
1196
+ // }
1197
+ // if (order.l !== -1) {
1198
+ // resTime.millisec = Number(treg[order.l]);
1199
+ // }
1200
+ // if (order.c !== -1) {
1201
+ // resTime.microsec = Number(treg[order.c]);
1202
+ // }
1203
+ // if (order.z !== -1 && treg[order.z] !== undefined) {
1204
+ // resTime.timezone = $.timepicker.timezoneOffsetNumber(treg[order.z]);
1205
+ // }
1206
+
1207
+
1208
+ // return resTime;
1209
+ // }
1210
+ // return false;
1211
+ // };// end strictParse
1212
+
1213
+ // // First try JS Date, if that fails, use strictParse
1214
+ // var looseParse = function (f, s, o) {
1215
+ // try {
1216
+ // var d = new Date('2012-01-01 ' + s);
1217
+ // if (isNaN(d.getTime())) {
1218
+ // d = new Date('2012-01-01T' + s);
1219
+ // if (isNaN(d.getTime())) {
1220
+ // d = new Date('01/01/2012 ' + s);
1221
+ // if (isNaN(d.getTime())) {
1222
+ // throw "Unable to parse time with native Date: " + s;
1223
+ // }
1224
+ // }
1225
+ // }
1226
+
1227
+ // return {
1228
+ // hour: d.getHours(),
1229
+ // minute: d.getMinutes(),
1230
+ // second: d.getSeconds(),
1231
+ // millisec: d.getMilliseconds(),
1232
+ // microsec: d.getMicroseconds(),
1233
+ // timezone: d.getTimezoneOffset() * -1
1234
+ // };
1235
+ // }
1236
+ // catch (err) {
1237
+ // try {
1238
+ // return strictParse(f, s, o);
1239
+ // }
1240
+ // catch (err2) {
1241
+ // $.timepicker.log("Unable to parse \ntimeString: " + s + "\ntimeFormat: " + f);
1242
+ // }
1243
+ // }
1244
+ // return false;
1245
+ // }; // end looseParse
1246
+
1247
+ // if (typeof o.parse === "function") {
1248
+ // return o.parse(timeFormat, timeString, o);
1249
+ // }
1250
+ // if (o.parse === 'loose') {
1251
+ // return looseParse(timeFormat, timeString, o);
1252
+ // }
1253
+ // return strictParse(timeFormat, timeString, o);
1254
+ // };
1255
+
1256
+ // /**
1257
+ // * Public utility to format the time
1258
+ // * @param {string} format format of the time
1259
+ // * @param {Object} time Object not a Date for timezones
1260
+ // * @param {Object} [options] essentially the regional[].. amNames, pmNames, ampm
1261
+ // * @returns {string} the formatted time
1262
+ // */
1263
+ // $.datepicker.formatTime = function (format, time, options) {
1264
+ // options = options || {};
1265
+ // options = $.extend({}, $.timepicker._defaults, options);
1266
+ // time = $.extend({
1267
+ // hour: 0,
1268
+ // minute: 0,
1269
+ // second: 0,
1270
+ // millisec: 0,
1271
+ // microsec: 0,
1272
+ // timezone: null
1273
+ // }, time);
1274
+
1275
+ // var tmptime = format,
1276
+ // ampmName = options.amNames[0],
1277
+ // hour = parseInt(time.hour, 10);
1278
+
1279
+ // if (hour > 11) {
1280
+ // ampmName = options.pmNames[0];
1281
+ // }
1282
+
1283
+ // tmptime = tmptime.replace(/(?:HH?|hh?|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g, function (match) {
1284
+ // switch (match) {
1285
+ // case 'HH':
1286
+ // return ('0' + hour).slice(-2);
1287
+ // case 'H':
1288
+ // return hour;
1289
+ // case 'hh':
1290
+ // return ('0' + convert24to12(hour)).slice(-2);
1291
+ // case 'h':
1292
+ // return convert24to12(hour);
1293
+ // case 'mm':
1294
+ // return ('0' + time.minute).slice(-2);
1295
+ // case 'm':
1296
+ // return time.minute;
1297
+ // case 'ss':
1298
+ // return ('0' + time.second).slice(-2);
1299
+ // case 's':
1300
+ // return time.second;
1301
+ // case 'l':
1302
+ // return ('00' + time.millisec).slice(-3);
1303
+ // case 'c':
1304
+ // return ('00' + time.microsec).slice(-3);
1305
+ // case 'z':
1306
+ // return $.timepicker.timezoneOffsetString(time.timezone === null ? options.timezone : time.timezone, false);
1307
+ // case 'Z':
1308
+ // return $.timepicker.timezoneOffsetString(time.timezone === null ? options.timezone : time.timezone, true);
1309
+ // case 'T':
1310
+ // return ampmName.charAt(0).toUpperCase();
1311
+ // case 'TT':
1312
+ // return ampmName.toUpperCase();
1313
+ // case 't':
1314
+ // return ampmName.charAt(0).toLowerCase();
1315
+ // case 'tt':
1316
+ // return ampmName.toLowerCase();
1317
+ // default:
1318
+ // return match.replace(/'/g, "");
1319
+ // }
1320
+ // });
1321
+
1322
+ // return tmptime;
1323
+ // };
1324
+
1325
+ // /*
1326
+ // * the bad hack :/ override datepicker so it doesn't close on select
1327
+ // // inspired: http://stackoverflow.com/questions/1252512/jquery-datepicker-prevent-closing-picker-when-clicking-a-date/1762378#1762378
1328
+ // */
1329
+ // $.datepicker._base_selectDate = $.datepicker._selectDate;
1330
+ // $.datepicker._selectDate = function (id, dateStr) {
1331
+ // var inst = this._getInst($(id)[0]),
1332
+ // tp_inst = this._get(inst, 'timepicker');
1333
+
1334
+ // if (tp_inst) {
1335
+ // tp_inst._limitMinMaxDateTime(inst, true);
1336
+ // inst.inline = inst.stay_open = true;
1337
+ // //This way the onSelect handler called from calendarpicker get the full dateTime
1338
+ // this._base_selectDate(id, dateStr);
1339
+ // inst.inline = inst.stay_open = false;
1340
+ // this._notifyChange(inst);
1341
+ // this._updateDatepicker(inst);
1342
+ // } else {
1343
+ // this._base_selectDate(id, dateStr);
1344
+ // }
1345
+ // };
1346
+
1347
+ // /*
1348
+ // * second bad hack :/ override datepicker so it triggers an event when changing the input field
1349
+ // * and does not redraw the datepicker on every selectDate event
1350
+ // */
1351
+ // $.datepicker._base_updateDatepicker = $.datepicker._updateDatepicker;
1352
+ // $.datepicker._updateDatepicker = function (inst) {
1353
+
1354
+ // // don't popup the datepicker if there is another instance already opened
1355
+ // var input = inst.input[0];
1356
+ // if ($.datepicker._curInst && $.datepicker._curInst !== inst && $.datepicker._datepickerShowing && $.datepicker._lastInput !== input) {
1357
+ // return;
1358
+ // }
1359
+
1360
+ // if (typeof(inst.stay_open) !== 'boolean' || inst.stay_open === false) {
1361
+
1362
+ // this._base_updateDatepicker(inst);
1363
+
1364
+ // // Reload the time control when changing something in the input text field.
1365
+ // var tp_inst = this._get(inst, 'timepicker');
1366
+ // if (tp_inst) {
1367
+ // tp_inst._addTimePicker(inst);
1368
+ // }
1369
+ // }
1370
+ // };
1371
+
1372
+ // /*
1373
+ // * third bad hack :/ override datepicker so it allows spaces and colon in the input field
1374
+ // */
1375
+ // $.datepicker._base_doKeyPress = $.datepicker._doKeyPress;
1376
+ // $.datepicker._doKeyPress = function (event) {
1377
+ // var inst = $.datepicker._getInst(event.target),
1378
+ // tp_inst = $.datepicker._get(inst, 'timepicker');
1379
+
1380
+ // if (tp_inst) {
1381
+ // if ($.datepicker._get(inst, 'constrainInput')) {
1382
+ // var ampm = tp_inst.support.ampm,
1383
+ // tz = tp_inst._defaults.showTimezone !== null ? tp_inst._defaults.showTimezone : tp_inst.support.timezone,
1384
+ // dateChars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')),
1385
+ // datetimeChars = tp_inst._defaults.timeFormat.toString()
1386
+ // .replace(/[hms]/g, '')
1387
+ // .replace(/TT/g, ampm ? 'APM' : '')
1388
+ // .replace(/Tt/g, ampm ? 'AaPpMm' : '')
1389
+ // .replace(/tT/g, ampm ? 'AaPpMm' : '')
1390
+ // .replace(/T/g, ampm ? 'AP' : '')
1391
+ // .replace(/tt/g, ampm ? 'apm' : '')
1392
+ // .replace(/t/g, ampm ? 'ap' : '') +
1393
+ // " " + tp_inst._defaults.separator +
1394
+ // tp_inst._defaults.timeSuffix +
1395
+ // (tz ? tp_inst._defaults.timezoneList.join('') : '') +
1396
+ // (tp_inst._defaults.amNames.join('')) + (tp_inst._defaults.pmNames.join('')) +
1397
+ // dateChars,
1398
+ // chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode);
1399
+ // return event.ctrlKey || (chr < ' ' || !dateChars || datetimeChars.indexOf(chr) > -1);
1400
+ // }
1401
+ // }
1402
+
1403
+ // return $.datepicker._base_doKeyPress(event);
1404
+ // };
1405
+
1406
+ // /*
1407
+ // * Fourth bad hack :/ override _updateAlternate function used in inline mode to init altField
1408
+ // * Update any alternate field to synchronise with the main field.
1409
+ // */
1410
+ // $.datepicker._base_updateAlternate = $.datepicker._updateAlternate;
1411
+ // $.datepicker._updateAlternate = function (inst) {
1412
+ // var tp_inst = this._get(inst, 'timepicker');
1413
+ // if (tp_inst) {
1414
+ // var altField = tp_inst._defaults.altField;
1415
+ // if (altField) { // update alternate field too
1416
+ // var altFormat = tp_inst._defaults.altFormat || tp_inst._defaults.dateFormat,
1417
+ // date = this._getDate(inst),
1418
+ // formatCfg = $.datepicker._getFormatConfig(inst),
1419
+ // altFormattedDateTime = '',
1420
+ // altSeparator = tp_inst._defaults.altSeparator ? tp_inst._defaults.altSeparator : tp_inst._defaults.separator,
1421
+ // altTimeSuffix = tp_inst._defaults.altTimeSuffix ? tp_inst._defaults.altTimeSuffix : tp_inst._defaults.timeSuffix,
1422
+ // altTimeFormat = tp_inst._defaults.altTimeFormat !== null ? tp_inst._defaults.altTimeFormat : tp_inst._defaults.timeFormat;
1423
+
1424
+ // altFormattedDateTime += $.datepicker.formatTime(altTimeFormat, tp_inst, tp_inst._defaults) + altTimeSuffix;
1425
+ // if (!tp_inst._defaults.timeOnly && !tp_inst._defaults.altFieldTimeOnly && date !== null) {
1426
+ // if (tp_inst._defaults.altFormat) {
1427
+ // altFormattedDateTime = $.datepicker.formatDate(tp_inst._defaults.altFormat, date, formatCfg) + altSeparator + altFormattedDateTime;
1428
+ // }
1429
+ // else {
1430
+ // altFormattedDateTime = tp_inst.formattedDate + altSeparator + altFormattedDateTime;
1431
+ // }
1432
+ // }
1433
+ // $(altField).val(altFormattedDateTime);
1434
+ // }
1435
+ // }
1436
+ // else {
1437
+ // $.datepicker._base_updateAlternate(inst);
1438
+ // }
1439
+ // };
1440
+
1441
+ // /*
1442
+ // * Override key up event to sync manual input changes.
1443
+ // */
1444
+ // $.datepicker._base_doKeyUp = $.datepicker._doKeyUp;
1445
+ // $.datepicker._doKeyUp = function (event) {
1446
+ // var inst = $.datepicker._getInst(event.target),
1447
+ // tp_inst = $.datepicker._get(inst, 'timepicker');
1448
+
1449
+ // if (tp_inst) {
1450
+ // if (tp_inst._defaults.timeOnly && (inst.input.val() !== inst.lastVal)) {
1451
+ // try {
1452
+ // $.datepicker._updateDatepicker(inst);
1453
+ // } catch (err) {
1454
+ // $.timepicker.log(err);
1455
+ // }
1456
+ // }
1457
+ // }
1458
+
1459
+ // return $.datepicker._base_doKeyUp(event);
1460
+ // };
1461
+
1462
+ // /*
1463
+ // * override "Today" button to also grab the time.
1464
+ // */
1465
+ // $.datepicker._base_gotoToday = $.datepicker._gotoToday;
1466
+ // $.datepicker._gotoToday = function (id) {
1467
+ // var inst = this._getInst($(id)[0]),
1468
+ // $dp = inst.dpDiv;
1469
+ // this._base_gotoToday(id);
1470
+ // var tp_inst = this._get(inst, 'timepicker');
1471
+ // selectLocalTimezone(tp_inst);
1472
+ // var now = new Date();
1473
+ // this._setTime(inst, now);
1474
+ // $('.ui-datepicker-today', $dp).click();
1475
+ // };
1476
+
1477
+ // /*
1478
+ // * Disable & enable the Time in the datetimepicker
1479
+ // */
1480
+ // $.datepicker._disableTimepickerDatepicker = function (target) {
1481
+ // var inst = this._getInst(target);
1482
+ // if (!inst) {
1483
+ // return;
1484
+ // }
1485
+
1486
+ // var tp_inst = this._get(inst, 'timepicker');
1487
+ // $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
1488
+ // if (tp_inst) {
1489
+ // inst.settings.showTimepicker = false;
1490
+ // tp_inst._defaults.showTimepicker = false;
1491
+ // tp_inst._updateDateTime(inst);
1492
+ // }
1493
+ // };
1494
+
1495
+ // $.datepicker._enableTimepickerDatepicker = function (target) {
1496
+ // var inst = this._getInst(target);
1497
+ // if (!inst) {
1498
+ // return;
1499
+ // }
1500
+
1501
+ // var tp_inst = this._get(inst, 'timepicker');
1502
+ // $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
1503
+ // if (tp_inst) {
1504
+ // inst.settings.showTimepicker = true;
1505
+ // tp_inst._defaults.showTimepicker = true;
1506
+ // tp_inst._addTimePicker(inst); // Could be disabled on page load
1507
+ // tp_inst._updateDateTime(inst);
1508
+ // }
1509
+ // };
1510
+
1511
+ // /*
1512
+ // * Create our own set time function
1513
+ // */
1514
+ // $.datepicker._setTime = function (inst, date) {
1515
+ // var tp_inst = this._get(inst, 'timepicker');
1516
+ // if (tp_inst) {
1517
+ // var defaults = tp_inst._defaults;
1518
+
1519
+ // // calling _setTime with no date sets time to defaults
1520
+ // tp_inst.hour = date ? date.getHours() : defaults.hour;
1521
+ // tp_inst.minute = date ? date.getMinutes() : defaults.minute;
1522
+ // tp_inst.second = date ? date.getSeconds() : defaults.second;
1523
+ // tp_inst.millisec = date ? date.getMilliseconds() : defaults.millisec;
1524
+ // tp_inst.microsec = date ? date.getMicroseconds() : defaults.microsec;
1525
+
1526
+ // //check if within min/max times..
1527
+ // tp_inst._limitMinMaxDateTime(inst, true);
1528
+
1529
+ // tp_inst._onTimeChange();
1530
+ // tp_inst._updateDateTime(inst);
1531
+ // }
1532
+ // };
1533
+
1534
+ // /*
1535
+ // * Create new public method to set only time, callable as $().datepicker('setTime', date)
1536
+ // */
1537
+ // $.datepicker._setTimeDatepicker = function (target, date, withDate) {
1538
+ // var inst = this._getInst(target);
1539
+ // if (!inst) {
1540
+ // return;
1541
+ // }
1542
+
1543
+ // var tp_inst = this._get(inst, 'timepicker');
1544
+
1545
+ // if (tp_inst) {
1546
+ // this._setDateFromField(inst);
1547
+ // var tp_date;
1548
+ // if (date) {
1549
+ // if (typeof date === "string") {
1550
+ // tp_inst._parseTime(date, withDate);
1551
+ // tp_date = new Date();
1552
+ // tp_date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
1553
+ // tp_date.setMicroseconds(tp_inst.microsec);
1554
+ // } else {
1555
+ // tp_date = new Date(date.getTime());
1556
+ // tp_date.setMicroseconds(date.getMicroseconds());
1557
+ // }
1558
+ // if (tp_date.toString() === 'Invalid Date') {
1559
+ // tp_date = undefined;
1560
+ // }
1561
+ // this._setTime(inst, tp_date);
1562
+ // }
1563
+ // }
1564
+
1565
+ // };
1566
+
1567
+ // /*
1568
+ // * override setDate() to allow setting time too within Date object
1569
+ // */
1570
+ // $.datepicker._base_setDateDatepicker = $.datepicker._setDateDatepicker;
1571
+ // $.datepicker._setDateDatepicker = function (target, date) {
1572
+ // var inst = this._getInst(target);
1573
+ // if (!inst) {
1574
+ // return;
1575
+ // }
1576
+
1577
+ // if (typeof(date) === 'string') {
1578
+ // date = new Date(date);
1579
+ // if (!date.getTime()) {
1580
+ // $.timepicker.log("Error creating Date object from string.");
1581
+ // }
1582
+ // }
1583
+
1584
+ // var tp_inst = this._get(inst, 'timepicker');
1585
+ // var tp_date;
1586
+ // if (date instanceof Date) {
1587
+ // tp_date = new Date(date.getTime());
1588
+ // tp_date.setMicroseconds(date.getMicroseconds());
1589
+ // } else {
1590
+ // tp_date = date;
1591
+ // }
1592
+
1593
+ // // This is important if you are using the timezone option, javascript's Date
1594
+ // // object will only return the timezone offset for the current locale, so we
1595
+ // // adjust it accordingly. If not using timezone option this won't matter..
1596
+ // // If a timezone is different in tp, keep the timezone as is
1597
+ // if (tp_inst) {
1598
+ // // look out for DST if tz wasn't specified
1599
+ // if (!tp_inst.support.timezone && tp_inst._defaults.timezone === null) {
1600
+ // tp_inst.timezone = tp_date.getTimezoneOffset() * -1;
1601
+ // }
1602
+ // date = $.timepicker.timezoneAdjust(date, tp_inst.timezone);
1603
+ // tp_date = $.timepicker.timezoneAdjust(tp_date, tp_inst.timezone);
1604
+ // }
1605
+
1606
+ // this._updateDatepicker(inst);
1607
+ // this._base_setDateDatepicker.apply(this, arguments);
1608
+ // this._setTimeDatepicker(target, tp_date, true);
1609
+ // };
1610
+
1611
+ // /*
1612
+ // * override getDate() to allow getting time too within Date object
1613
+ // */
1614
+ // $.datepicker._base_getDateDatepicker = $.datepicker._getDateDatepicker;
1615
+ // $.datepicker._getDateDatepicker = function (target, noDefault) {
1616
+ // var inst = this._getInst(target);
1617
+ // if (!inst) {
1618
+ // return;
1619
+ // }
1620
+
1621
+ // var tp_inst = this._get(inst, 'timepicker');
1622
+
1623
+ // if (tp_inst) {
1624
+ // // if it hasn't yet been defined, grab from field
1625
+ // if (inst.lastVal === undefined) {
1626
+ // this._setDateFromField(inst, noDefault);
1627
+ // }
1628
+
1629
+ // var date = this._getDate(inst);
1630
+ // if (date && tp_inst._parseTime($(target).val(), tp_inst.timeOnly)) {
1631
+ // date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
1632
+ // date.setMicroseconds(tp_inst.microsec);
1633
+
1634
+ // // This is important if you are using the timezone option, javascript's Date
1635
+ // // object will only return the timezone offset for the current locale, so we
1636
+ // // adjust it accordingly. If not using timezone option this won't matter..
1637
+ // if (tp_inst.timezone != null) {
1638
+ // // look out for DST if tz wasn't specified
1639
+ // if (!tp_inst.support.timezone && tp_inst._defaults.timezone === null) {
1640
+ // tp_inst.timezone = date.getTimezoneOffset() * -1;
1641
+ // }
1642
+ // date = $.timepicker.timezoneAdjust(date, tp_inst.timezone);
1643
+ // }
1644
+ // }
1645
+ // return date;
1646
+ // }
1647
+ // return this._base_getDateDatepicker(target, noDefault);
1648
+ // };
1649
+
1650
+ // /*
1651
+ // * override parseDate() because UI 1.8.14 throws an error about "Extra characters"
1652
+ // * An option in datapicker to ignore extra format characters would be nicer.
1653
+ // */
1654
+ // $.datepicker._base_parseDate = $.datepicker.parseDate;
1655
+ // $.datepicker.parseDate = function (format, value, settings) {
1656
+ // var date;
1657
+ // try {
1658
+ // date = this._base_parseDate(format, value, settings);
1659
+ // } catch (err) {
1660
+ // // Hack! The error message ends with a colon, a space, and
1661
+ // // the "extra" characters. We rely on that instead of
1662
+ // // attempting to perfectly reproduce the parsing algorithm.
1663
+ // if (err.indexOf(":") >= 0) {
1664
+ // date = this._base_parseDate(format, value.substring(0, value.length - (err.length - err.indexOf(':') - 2)), settings);
1665
+ // $.timepicker.log("Error parsing the date string: " + err + "\ndate string = " + value + "\ndate format = " + format);
1666
+ // } else {
1667
+ // throw err;
1668
+ // }
1669
+ // }
1670
+ // return date;
1671
+ // };
1672
+
1673
+ // /*
1674
+ // * override formatDate to set date with time to the input
1675
+ // */
1676
+ // $.datepicker._base_formatDate = $.datepicker._formatDate;
1677
+ // $.datepicker._formatDate = function (inst, day, month, year) {
1678
+ // var tp_inst = this._get(inst, 'timepicker');
1679
+ // if (tp_inst) {
1680
+ // tp_inst._updateDateTime(inst);
1681
+ // return tp_inst.$input.val();
1682
+ // }
1683
+ // return this._base_formatDate(inst);
1684
+ // };
1685
+
1686
+ // /*
1687
+ // * override options setter to add time to maxDate(Time) and minDate(Time). MaxDate
1688
+ // */
1689
+ // $.datepicker._base_optionDatepicker = $.datepicker._optionDatepicker;
1690
+ // $.datepicker._optionDatepicker = function (target, name, value) {
1691
+ // var inst = this._getInst(target),
1692
+ // name_clone;
1693
+ // if (!inst) {
1694
+ // return null;
1695
+ // }
1696
+
1697
+ // var tp_inst = this._get(inst, 'timepicker');
1698
+ // if (tp_inst) {
1699
+ // var min = null,
1700
+ // max = null,
1701
+ // onselect = null,
1702
+ // overrides = tp_inst._defaults.evnts,
1703
+ // fns = {},
1704
+ // prop;
1705
+ // if (typeof name === 'string') { // if min/max was set with the string
1706
+ // if (name === 'minDate' || name === 'minDateTime') {
1707
+ // min = value;
1708
+ // } else if (name === 'maxDate' || name === 'maxDateTime') {
1709
+ // max = value;
1710
+ // } else if (name === 'onSelect') {
1711
+ // onselect = value;
1712
+ // } else if (overrides.hasOwnProperty(name)) {
1713
+ // if (typeof (value) === 'undefined') {
1714
+ // return overrides[name];
1715
+ // }
1716
+ // fns[name] = value;
1717
+ // name_clone = {}; //empty results in exiting function after overrides updated
1718
+ // }
1719
+ // } else if (typeof name === 'object') { //if min/max was set with the JSON
1720
+ // if (name.minDate) {
1721
+ // min = name.minDate;
1722
+ // } else if (name.minDateTime) {
1723
+ // min = name.minDateTime;
1724
+ // } else if (name.maxDate) {
1725
+ // max = name.maxDate;
1726
+ // } else if (name.maxDateTime) {
1727
+ // max = name.maxDateTime;
1728
+ // }
1729
+ // for (prop in overrides) {
1730
+ // if (overrides.hasOwnProperty(prop) && name[prop]) {
1731
+ // fns[prop] = name[prop];
1732
+ // }
1733
+ // }
1734
+ // }
1735
+ // for (prop in fns) {
1736
+ // if (fns.hasOwnProperty(prop)) {
1737
+ // overrides[prop] = fns[prop];
1738
+ // if (!name_clone) { name_clone = $.extend({}, name); }
1739
+ // delete name_clone[prop];
1740
+ // }
1741
+ // }
1742
+ // if (name_clone && isEmptyObject(name_clone)) { return; }
1743
+ // if (min) { //if min was set
1744
+ // if (min === 0) {
1745
+ // min = new Date();
1746
+ // } else {
1747
+ // min = new Date(min);
1748
+ // }
1749
+ // tp_inst._defaults.minDate = min;
1750
+ // tp_inst._defaults.minDateTime = min;
1751
+ // } else if (max) { //if max was set
1752
+ // if (max === 0) {
1753
+ // max = new Date();
1754
+ // } else {
1755
+ // max = new Date(max);
1756
+ // }
1757
+ // tp_inst._defaults.maxDate = max;
1758
+ // tp_inst._defaults.maxDateTime = max;
1759
+ // } else if (onselect) {
1760
+ // tp_inst._defaults.onSelect = onselect;
1761
+ // }
1762
+ // }
1763
+ // if (value === undefined) {
1764
+ // return this._base_optionDatepicker.call($.datepicker, target, name);
1765
+ // }
1766
+ // return this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value);
1767
+ // };
1768
+
1769
+ // /*
1770
+ // * jQuery isEmptyObject does not check hasOwnProperty - if someone has added to the object prototype,
1771
+ // * it will return false for all objects
1772
+ // */
1773
+ // var isEmptyObject = function (obj) {
1774
+ // var prop;
1775
+ // for (prop in obj) {
1776
+ // if (obj.hasOwnProperty(prop)) {
1777
+ // return false;
1778
+ // }
1779
+ // }
1780
+ // return true;
1781
+ // };
1782
+
1783
+ // /*
1784
+ // * jQuery extend now ignores nulls!
1785
+ // */
1786
+ // var extendRemove = function (target, props) {
1787
+ // $.extend(target, props);
1788
+ // for (var name in props) {
1789
+ // if (props[name] === null || props[name] === undefined) {
1790
+ // target[name] = props[name];
1791
+ // }
1792
+ // }
1793
+ // return target;
1794
+ // };
1795
+
1796
+ // /*
1797
+ // * Determine by the time format which units are supported
1798
+ // * Returns an object of booleans for each unit
1799
+ // */
1800
+ // var detectSupport = function (timeFormat) {
1801
+ // var tf = timeFormat.replace(/'.*?'/g, '').toLowerCase(), // removes literals
1802
+ // isIn = function (f, t) { // does the format contain the token?
1803
+ // return f.indexOf(t) !== -1 ? true : false;
1804
+ // };
1805
+ // return {
1806
+ // hour: isIn(tf, 'h'),
1807
+ // minute: isIn(tf, 'm'),
1808
+ // second: isIn(tf, 's'),
1809
+ // millisec: isIn(tf, 'l'),
1810
+ // microsec: isIn(tf, 'c'),
1811
+ // timezone: isIn(tf, 'z'),
1812
+ // ampm: isIn(tf, 't') && isIn(timeFormat, 'h'),
1813
+ // iso8601: isIn(timeFormat, 'Z')
1814
+ // };
1815
+ // };
1816
+
1817
+ // /*
1818
+ // * Converts 24 hour format into 12 hour
1819
+ // * Returns 12 hour without leading 0
1820
+ // */
1821
+ // var convert24to12 = function (hour) {
1822
+ // hour %= 12;
1823
+
1824
+ // if (hour === 0) {
1825
+ // hour = 12;
1826
+ // }
1827
+
1828
+ // return String(hour);
1829
+ // };
1830
+
1831
+ // var computeEffectiveSetting = function (settings, property) {
1832
+ // return settings && settings[property] ? settings[property] : $.timepicker._defaults[property];
1833
+ // };
1834
+
1835
+ // /*
1836
+ // * Splits datetime string into date and time substrings.
1837
+ // * Throws exception when date can't be parsed
1838
+ // * Returns {dateString: dateString, timeString: timeString}
1839
+ // */
1840
+ // var splitDateTime = function (dateTimeString, timeSettings) {
1841
+ // // The idea is to get the number separator occurrences in datetime and the time format requested (since time has
1842
+ // // fewer unknowns, mostly numbers and am/pm). We will use the time pattern to split.
1843
+ // var separator = computeEffectiveSetting(timeSettings, 'separator'),
1844
+ // format = computeEffectiveSetting(timeSettings, 'timeFormat'),
1845
+ // timeParts = format.split(separator), // how many occurrences of separator may be in our format?
1846
+ // timePartsLen = timeParts.length,
1847
+ // allParts = dateTimeString.split(separator),
1848
+ // allPartsLen = allParts.length;
1849
+
1850
+ // if (allPartsLen > 1) {
1851
+ // return {
1852
+ // dateString: allParts.splice(0, allPartsLen - timePartsLen).join(separator),
1853
+ // timeString: allParts.splice(0, timePartsLen).join(separator)
1854
+ // };
1855
+ // }
1856
+
1857
+ // return {
1858
+ // dateString: dateTimeString,
1859
+ // timeString: ''
1860
+ // };
1861
+ // };
1862
+
1863
+ // /*
1864
+ // * Internal function to parse datetime interval
1865
+ // * Returns: {date: Date, timeObj: Object}, where
1866
+ // * date - parsed date without time (type Date)
1867
+ // * timeObj = {hour: , minute: , second: , millisec: , microsec: } - parsed time. Optional
1868
+ // */
1869
+ // var parseDateTimeInternal = function (dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
1870
+ // var date,
1871
+ // parts,
1872
+ // parsedTime;
1873
+
1874
+ // parts = splitDateTime(dateTimeString, timeSettings);
1875
+ // date = $.datepicker._base_parseDate(dateFormat, parts.dateString, dateSettings);
1876
+
1877
+ // if (parts.timeString === '') {
1878
+ // return {
1879
+ // date: date
1880
+ // };
1881
+ // }
1882
+
1883
+ // parsedTime = $.datepicker.parseTime(timeFormat, parts.timeString, timeSettings);
1884
+
1885
+ // if (!parsedTime) {
1886
+ // throw 'Wrong time format';
1887
+ // }
1888
+
1889
+ // return {
1890
+ // date: date,
1891
+ // timeObj: parsedTime
1892
+ // };
1893
+ // };
1894
+
1895
+ // /*
1896
+ // * Internal function to set timezone_select to the local timezone
1897
+ // */
1898
+ // var selectLocalTimezone = function (tp_inst, date) {
1899
+ // if (tp_inst && tp_inst.timezone_select) {
1900
+ // var now = date || new Date();
1901
+ // tp_inst.timezone_select.val(-now.getTimezoneOffset());
1902
+ // }
1903
+ // };
1904
+
1905
+ // /*
1906
+ // * Create a Singleton Instance
1907
+ // */
1908
+ // $.timepicker = new Timepicker();
1909
+
1910
+ // /**
1911
+ // * Get the timezone offset as string from a date object (eg '+0530' for UTC+5.5)
1912
+ // * @param {number} tzMinutes if not a number, less than -720 (-1200), or greater than 840 (+1400) this value is returned
1913
+ // * @param {boolean} iso8601 if true formats in accordance to iso8601 "+12:45"
1914
+ // * @return {string}
1915
+ // */
1916
+ // $.timepicker.timezoneOffsetString = function (tzMinutes, iso8601) {
1917
+ // if (isNaN(tzMinutes) || tzMinutes > 840 || tzMinutes < -720) {
1918
+ // return tzMinutes;
1919
+ // }
1920
+
1921
+ // var off = tzMinutes,
1922
+ // minutes = off % 60,
1923
+ // hours = (off - minutes) / 60,
1924
+ // iso = iso8601 ? ':' : '',
1925
+ // tz = (off >= 0 ? '+' : '-') + ('0' + Math.abs(hours)).slice(-2) + iso + ('0' + Math.abs(minutes)).slice(-2);
1926
+
1927
+ // if (tz === '+00:00') {
1928
+ // return 'Z';
1929
+ // }
1930
+ // return tz;
1931
+ // };
1932
+
1933
+ // /**
1934
+ // * Get the number in minutes that represents a timezone string
1935
+ // * @param {string} tzString formatted like "+0500", "-1245", "Z"
1936
+ // * @return {number} the offset minutes or the original string if it doesn't match expectations
1937
+ // */
1938
+ // $.timepicker.timezoneOffsetNumber = function (tzString) {
1939
+ // var normalized = tzString.toString().replace(':', ''); // excuse any iso8601, end up with "+1245"
1940
+
1941
+ // if (normalized.toUpperCase() === 'Z') { // if iso8601 with Z, its 0 minute offset
1942
+ // return 0;
1943
+ // }
1944
+
1945
+ // if (!/^(\-|\+)\d{4}$/.test(normalized)) { // possibly a user defined tz, so just give it back
1946
+ // return tzString;
1947
+ // }
1948
+
1949
+ // return ((normalized.substr(0, 1) === '-' ? -1 : 1) * // plus or minus
1950
+ // ((parseInt(normalized.substr(1, 2), 10) * 60) + // hours (converted to minutes)
1951
+ // parseInt(normalized.substr(3, 2), 10))); // minutes
1952
+ // };
1953
+
1954
+ // /**
1955
+ // * No way to set timezone in js Date, so we must adjust the minutes to compensate. (think setDate, getDate)
1956
+ // * @param {Date} date
1957
+ // * @param {string} toTimezone formatted like "+0500", "-1245"
1958
+ // * @return {Date}
1959
+ // */
1960
+ // $.timepicker.timezoneAdjust = function (date, toTimezone) {
1961
+ // var toTz = $.timepicker.timezoneOffsetNumber(toTimezone);
1962
+ // if (!isNaN(toTz)) {
1963
+ // date.setMinutes(date.getMinutes() + -date.getTimezoneOffset() - toTz);
1964
+ // }
1965
+ // return date;
1966
+ // };
1967
+
1968
+ // /**
1969
+ // * Calls `timepicker()` on the `startTime` and `endTime` elements, and configures them to
1970
+ // * enforce date range limits.
1971
+ // * n.b. The input value must be correctly formatted (reformatting is not supported)
1972
+ // * @param {Element} startTime
1973
+ // * @param {Element} endTime
1974
+ // * @param {Object} options Options for the timepicker() call
1975
+ // * @return {jQuery}
1976
+ // */
1977
+ // $.timepicker.timeRange = function (startTime, endTime, options) {
1978
+ // return $.timepicker.handleRange('timepicker', startTime, endTime, options);
1979
+ // };
1980
+
1981
+ // /**
1982
+ // * Calls `datetimepicker` on the `startTime` and `endTime` elements, and configures them to
1983
+ // * enforce date range limits.
1984
+ // * @param {Element} startTime
1985
+ // * @param {Element} endTime
1986
+ // * @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
1987
+ // * a boolean value that can be used to reformat the input values to the `dateFormat`.
1988
+ // * @param {string} method Can be used to specify the type of picker to be added
1989
+ // * @return {jQuery}
1990
+ // */
1991
+ // $.timepicker.datetimeRange = function (startTime, endTime, options) {
1992
+ // $.timepicker.handleRange('datetimepicker', startTime, endTime, options);
1993
+ // };
1994
+
1995
+ // /**
1996
+ // * Calls `datepicker` on the `startTime` and `endTime` elements, and configures them to
1997
+ // * enforce date range limits.
1998
+ // * @param {Element} startTime
1999
+ // * @param {Element} endTime
2000
+ // * @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
2001
+ // * a boolean value that can be used to reformat the input values to the `dateFormat`.
2002
+ // * @return {jQuery}
2003
+ // */
2004
+ // $.timepicker.dateRange = function (startTime, endTime, options) {
2005
+ // $.timepicker.handleRange('datepicker', startTime, endTime, options);
2006
+ // };
2007
+
2008
+ // /**
2009
+ // * Calls `method` on the `startTime` and `endTime` elements, and configures them to
2010
+ // * enforce date range limits.
2011
+ // * @param {string} method Can be used to specify the type of picker to be added
2012
+ // * @param {Element} startTime
2013
+ // * @param {Element} endTime
2014
+ // * @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
2015
+ // * a boolean value that can be used to reformat the input values to the `dateFormat`.
2016
+ // * @return {jQuery}
2017
+ // */
2018
+ // $.timepicker.handleRange = function (method, startTime, endTime, options) {
2019
+ // options = $.extend({}, {
2020
+ // minInterval: 0, // min allowed interval in milliseconds
2021
+ // maxInterval: 0, // max allowed interval in milliseconds
2022
+ // start: {}, // options for start picker
2023
+ // end: {} // options for end picker
2024
+ // }, options);
2025
+
2026
+ // function checkDates(changed, other) {
2027
+ // var startdt = startTime[method]('getDate'),
2028
+ // enddt = endTime[method]('getDate'),
2029
+ // changeddt = changed[method]('getDate');
2030
+
2031
+ // if (startdt !== null) {
2032
+ // var minDate = new Date(startdt.getTime()),
2033
+ // maxDate = new Date(startdt.getTime());
2034
+
2035
+ // minDate.setMilliseconds(minDate.getMilliseconds() + options.minInterval);
2036
+ // maxDate.setMilliseconds(maxDate.getMilliseconds() + options.maxInterval);
2037
+
2038
+ // if (options.minInterval > 0 && minDate > enddt) { // minInterval check
2039
+ // endTime[method]('setDate', minDate);
2040
+ // }
2041
+ // else if (options.maxInterval > 0 && maxDate < enddt) { // max interval check
2042
+ // endTime[method]('setDate', maxDate);
2043
+ // }
2044
+ // else if (startdt > enddt) {
2045
+ // other[method]('setDate', changeddt);
2046
+ // }
2047
+ // }
2048
+ // }
2049
+
2050
+ // function selected(changed, other, option) {
2051
+ // if (!changed.val()) {
2052
+ // return;
2053
+ // }
2054
+ // var date = changed[method].call(changed, 'getDate');
2055
+ // if (date !== null && options.minInterval > 0) {
2056
+ // if (option === 'minDate') {
2057
+ // date.setMilliseconds(date.getMilliseconds() + options.minInterval);
2058
+ // }
2059
+ // if (option === 'maxDate') {
2060
+ // date.setMilliseconds(date.getMilliseconds() - options.minInterval);
2061
+ // }
2062
+ // }
2063
+ // if (date.getTime) {
2064
+ // other[method].call(other, 'option', option, date);
2065
+ // }
2066
+ // }
2067
+
2068
+ // $.fn[method].call(startTime, $.extend({
2069
+ // onClose: function (dateText, inst) {
2070
+ // checkDates($(this), endTime);
2071
+ // },
2072
+ // onSelect: function (selectedDateTime) {
2073
+ // selected($(this), endTime, 'minDate');
2074
+ // }
2075
+ // }, options, options.start));
2076
+ // $.fn[method].call(endTime, $.extend({
2077
+ // onClose: function (dateText, inst) {
2078
+ // checkDates($(this), startTime);
2079
+ // },
2080
+ // onSelect: function (selectedDateTime) {
2081
+ // selected($(this), startTime, 'maxDate');
2082
+ // }
2083
+ // }, options, options.end));
2084
+
2085
+ // checkDates(startTime, endTime);
2086
+ // selected(startTime, endTime, 'minDate');
2087
+ // selected(endTime, startTime, 'maxDate');
2088
+ // return $([startTime.get(0), endTime.get(0)]);
2089
+ // };
2090
+
2091
+ // /**
2092
+ // * Log error or data to the console during error or debugging
2093
+ // * @param {Object} err pass any type object to log to the console during error or debugging
2094
+ // * @return {void}
2095
+ // */
2096
+ // $.timepicker.log = function (err) {
2097
+ // if (window.console) {
2098
+ // window.console.log(err);
2099
+ // }
2100
+ // };
2101
+
2102
+ // /*
2103
+ // * Add util object to allow access to private methods for testability.
2104
+ // */
2105
+ // $.timepicker._util = {
2106
+ // _extendRemove: extendRemove,
2107
+ // _isEmptyObject: isEmptyObject,
2108
+ // _convert24to12: convert24to12,
2109
+ // _detectSupport: detectSupport,
2110
+ // _selectLocalTimezone: selectLocalTimezone,
2111
+ // _computeEffectiveSetting: computeEffectiveSetting,
2112
+ // _splitDateTime: splitDateTime,
2113
+ // _parseDateTimeInternal: parseDateTimeInternal
2114
+ // };
2115
+
2116
+ // /*
2117
+ // * Microsecond support
2118
+ // */
2119
+ // if (!Date.prototype.getMicroseconds) {
2120
+ // Date.prototype.microseconds = 0;
2121
+ // Date.prototype.getMicroseconds = function () { return this.microseconds; };
2122
+ // Date.prototype.setMicroseconds = function (m) {
2123
+ // this.setMilliseconds(this.getMilliseconds() + Math.floor(m / 1000));
2124
+ // this.microseconds = m % 1000;
2125
+ // return this;
2126
+ // };
2127
+ // }
2128
+
2129
+ // /*
2130
+ // * Keep up with the version
2131
+ // */
2132
+ // $.timepicker.version = "1.4";
2133
+
2134
+ // })(jQuery);