renalware-core 2.0.153 → 2.0.155

Sign up to get free protection for your applications and to get access to all the features.
Files changed (286) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/renalware/components/navigation.js +0 -7
  3. data/app/assets/javascripts/renalware/components/sortable.js +3 -0
  4. data/app/assets/javascripts/renalware/core.js.erb +0 -2
  5. data/app/assets/javascripts/renalware/rollup_compiled.css +69147 -50289
  6. data/app/assets/javascripts/renalware/rollup_compiled.js +10 -14
  7. data/app/assets/stylesheets/renalware/base/_variables.scss +1 -0
  8. data/app/assets/stylesheets/renalware/lib/_foundation_and_overrides.scss +1 -620
  9. data/app/assets/stylesheets/renalware/lib/_select2-foundation5-overrides.scss +1 -1
  10. data/app/assets/stylesheets/renalware/modules/_medications.scss +9 -9
  11. data/app/assets/stylesheets/renalware/modules/_patients.scss +4 -0
  12. data/app/assets/stylesheets/renalware/modules/_users.scss +2 -1
  13. data/app/assets/stylesheets/renalware/partials/_forms.scss +11 -0
  14. data/app/assets/stylesheets/renalware/partials/_navigation.scss +15 -12
  15. data/app/assets/stylesheets/renalware/partials/_simple_form.scss +1 -1
  16. data/app/assets/stylesheets/renalware/partials/_tables.scss +15 -8
  17. data/app/assets/stylesheets/renalware/partials/_toggle.scss +0 -66
  18. data/app/assets/stylesheets/renalware/partials/_toggling.scss +18 -0
  19. data/app/assets/stylesheets/renalware/partials/_trix.scss +12 -0
  20. data/app/components/renalware/admissions/active_consult_alert_component.html.slim +4 -0
  21. data/app/components/renalware/admissions/active_consult_alert_component.rb +25 -0
  22. data/app/components/renalware/article_component.html.slim +5 -0
  23. data/app/components/renalware/article_component.rb +12 -0
  24. data/app/components/renalware/events/event_list_component.rb +6 -1
  25. data/app/components/renalware/medications/tabbed_prescriptions_list_component.html.slim +41 -0
  26. data/app/components/renalware/medications/tabbed_prescriptions_list_component.rb +47 -0
  27. data/app/components/renalware/patients/messages_component.html.slim +45 -0
  28. data/app/components/renalware/patients/messages_component.rb +52 -0
  29. data/app/components/renalware/pd/adequacy_results_component.html.slim +3 -5
  30. data/app/components/renalware/system/admin_menu_component.html.slim +3 -1
  31. data/app/components/renalware/users/last_signin_component.html.slim +3 -0
  32. data/app/components/renalware/users/last_signin_component.rb +23 -0
  33. data/app/controllers/renalware/admin/playgrounds_controller.rb +1 -1
  34. data/app/controllers/renalware/admin/users_controller.rb +1 -0
  35. data/app/controllers/renalware/drugs/drugs_controller.rb +4 -0
  36. data/app/controllers/renalware/hd/historical_profiles_controller.rb +1 -1
  37. data/app/controllers/renalware/medications/prescriptions_controller.rb +5 -2
  38. data/app/controllers/renalware/messaging/internal/messages_controller.rb +14 -5
  39. data/app/controllers/renalware/pathology/observation_descriptions_controller.rb +58 -0
  40. data/app/controllers/renalware/patients/mdms_controller.rb +104 -0
  41. data/app/controllers/renalware/system/view_metadata_controller.rb +61 -0
  42. data/app/controllers/renalware/users_controller.rb +25 -0
  43. data/app/helpers/renalware/drugs_helper.rb +6 -0
  44. data/app/helpers/renalware/layout_helper.rb +1 -1
  45. data/app/models/concerns/renalware/sortable.rb +49 -0
  46. data/app/models/renalware/accesses/patient.rb +2 -2
  47. data/app/models/renalware/accesses/plan.rb +1 -1
  48. data/app/models/renalware/admissions/request.rb +1 -0
  49. data/app/models/renalware/clinical/body_composition.rb +1 -1
  50. data/app/models/renalware/clinical/dry_weight.rb +1 -1
  51. data/app/models/renalware/clinics/clinic_visit.rb +5 -4
  52. data/app/models/renalware/feeds/files/create_feed_file.rb +1 -1
  53. data/app/models/renalware/hd/patient.rb +1 -1
  54. data/app/models/renalware/hd/preference_set.rb +1 -1
  55. data/app/models/renalware/hd/profile.rb +4 -4
  56. data/app/models/renalware/hd/schedule_definition.rb +1 -1
  57. data/app/models/renalware/hd/session.rb +2 -2
  58. data/app/models/renalware/hd/session_forms/batch_compile_pdfs.rb +1 -1
  59. data/app/models/renalware/hd/station.rb +2 -1
  60. data/app/models/renalware/letters/description.rb +2 -0
  61. data/app/models/renalware/letters/letter.rb +1 -1
  62. data/app/models/renalware/letters/part/prescriptions.rb +12 -3
  63. data/app/models/renalware/letters/pdf_letter_cache.rb +1 -1
  64. data/app/models/renalware/letters/printing/batch_compile_pdfs.rb +1 -1
  65. data/app/models/renalware/letters/recipient_params_processor.rb +1 -1
  66. data/app/models/renalware/medications/prescription.rb +0 -4
  67. data/app/models/renalware/messaging/internal/message_form.rb +1 -0
  68. data/app/models/renalware/messaging/internal/message_form_builder.rb +2 -1
  69. data/app/models/renalware/pathology/current_observations_for_descriptions_query.rb +3 -3
  70. data/app/models/renalware/pathology/measurement_unit.rb +13 -0
  71. data/app/models/renalware/pathology/observation_description.rb +23 -5
  72. data/app/models/renalware/pathology/observation_descriptions_by_code_query.rb +1 -1
  73. data/app/models/renalware/pathology/observation_requests_attributes_builder.rb +45 -5
  74. data/app/models/renalware/pathology/observations_within_date_range_query.rb +1 -1
  75. data/app/models/renalware/patient.rb +2 -2
  76. data/app/models/renalware/patients/bookmark.rb +2 -2
  77. data/app/models/renalware/patients/mdm_menu.rb +41 -0
  78. data/app/models/renalware/patients/mdm_patients_query.rb +1 -1
  79. data/app/models/renalware/patients/search_query.rb +1 -1
  80. data/app/models/renalware/patients/worry.rb +0 -1
  81. data/app/models/renalware/pd/mdm_patients_query.rb +1 -1
  82. data/app/models/renalware/problems/problem.rb +2 -1
  83. data/app/models/renalware/snippets/snippet_query.rb +1 -1
  84. data/app/models/renalware/surveys/question.rb +1 -2
  85. data/app/models/renalware/system/column_definition.rb +43 -0
  86. data/app/models/renalware/system/filter_definition.rb +29 -0
  87. data/app/models/renalware/system/update_user.rb +5 -0
  88. data/app/models/renalware/system/version.rb +11 -0
  89. data/app/models/renalware/system/view_metadata.rb +25 -0
  90. data/app/models/renalware/transplants/donation.rb +1 -1
  91. data/app/models/renalware/transplants/donor_followup.rb +0 -1
  92. data/app/models/renalware/transplants/failure_cause_description.rb +1 -1
  93. data/app/models/renalware/transplants/mdm_patients_query.rb +2 -2
  94. data/app/models/renalware/transplants/patient.rb +1 -1
  95. data/app/models/renalware/transplants/recipient_followup.rb +1 -3
  96. data/app/models/renalware/transplants/registration.rb +1 -3
  97. data/app/models/renalware/transplants/registrations/wait_list_query.rb +4 -4
  98. data/app/models/renalware/ukrdc/measurement_unit.rb +21 -0
  99. data/app/models/renalware/ukrdc/outgoing/rendering/lab_order.rb +30 -2
  100. data/app/models/renalware/ukrdc/paths.rb +1 -1
  101. data/app/models/renalware/ukrdc/treatment_timeline/prepare_tables.rb +1 -1
  102. data/app/models/renalware/ukrdc/treatment_timeline/remap_model_table_names_to_their_prepared_equivalents.rb +1 -1
  103. data/app/policies/application_policy.rb +1 -1
  104. data/app/policies/renalware/medications/prescription_policy.rb +35 -0
  105. data/app/policies/renalware/system/view_metadata_policy.rb +17 -0
  106. data/app/presenters/concerns/renalware/accountable_presentation.rb +33 -0
  107. data/app/presenters/renalware/clinics/visit_presenter.rb +11 -0
  108. data/app/presenters/renalware/events/event_presenter.rb +11 -0
  109. data/app/presenters/renalware/mdm_presenter.rb +11 -0
  110. data/app/presenters/renalware/pathology/results_presenter.rb +1 -2
  111. data/app/presenters/renalware/renal/clinical_summary_presenter.rb +9 -6
  112. data/app/views/renalware/admin/playgrounds/show.html.slim +2 -6
  113. data/app/views/renalware/admin/users/edit.html.slim +9 -0
  114. data/app/views/renalware/admin/users/index.html.slim +6 -0
  115. data/app/views/renalware/admissions/admissions/_filters.html.slim +8 -16
  116. data/app/views/renalware/clinical/allergies/_list.html.slim +3 -1
  117. data/app/views/renalware/dashboard/dashboards/show.html.slim +1 -0
  118. data/app/views/renalware/hd/protocols/_virology.html.slim +4 -5
  119. data/app/views/renalware/letters/letters/_form.html.slim +1 -1
  120. data/app/views/renalware/letters/parts/_prescriptions.html.slim +4 -0
  121. data/app/views/renalware/mdm/_prescriptions.html.slim +4 -13
  122. data/app/views/renalware/mdm/prescriptions/_table.html.slim +3 -1
  123. data/app/views/renalware/medications/prescriptions/_current_hd.html.slim +13 -0
  124. data/app/views/renalware/medications/prescriptions/_filter_form.html.slim +26 -13
  125. data/app/views/renalware/medications/prescriptions/_form.html.slim +3 -2
  126. data/app/views/renalware/medications/prescriptions/_options.html.slim +3 -3
  127. data/app/views/renalware/medications/prescriptions/_table.html.slim +5 -4
  128. data/app/views/renalware/medications/prescriptions/_tables.html.slim +13 -16
  129. data/app/views/renalware/medications/prescriptions/index.html.slim +5 -4
  130. data/app/views/renalware/messaging/internal/messages/_form.html.slim +3 -0
  131. data/app/views/renalware/messaging/internal/messages/index.html.slim +36 -0
  132. data/app/views/renalware/navigation/_mdms.html.slim +5 -0
  133. data/app/views/renalware/navigation/_renal.html.slim +1 -0
  134. data/app/views/renalware/navigation/{_super_admin.html.slim → _super_admin.html.slim.dead} +0 -0
  135. data/app/views/renalware/pathology/code_groups/edit.html.slim +5 -5
  136. data/app/views/renalware/pathology/code_groups/index.html.slim +4 -5
  137. data/app/views/renalware/pathology/code_groups/show.html.slim +25 -26
  138. data/app/views/renalware/pathology/observation_descriptions/_filters.html.slim +14 -0
  139. data/app/views/renalware/pathology/observation_descriptions/edit.html.slim +21 -0
  140. data/app/views/renalware/pathology/observation_descriptions/index.html.slim +38 -0
  141. data/app/views/renalware/pathology/requests/requests/request_form/_crs_form.html.slim +1 -1
  142. data/app/views/renalware/patients/alerts/_list.html.slim +1 -0
  143. data/app/views/renalware/patients/mdms/_filters.html.slim +38 -0
  144. data/app/views/renalware/patients/mdms/_table.html.slim +72 -0
  145. data/app/views/renalware/patients/mdms/show.html.slim +18 -0
  146. data/app/views/renalware/patients/side_menu/_general.html.slim +4 -0
  147. data/app/views/renalware/patients/worryboard/_filters.html.slim +18 -13
  148. data/app/views/renalware/pd/_peritonitis_episodes.html.slim +13 -13
  149. data/app/views/renalware/pd/adequacy_results/_form_fields.html.slim +1 -1
  150. data/app/views/renalware/pd/adequacy_results/_table.html.slim +2 -2
  151. data/app/views/renalware/pd/peritonitis_episodes/show.html.slim +8 -6
  152. data/app/views/renalware/shared/_fieldset.html.slim +1 -2
  153. data/app/views/renalware/shared/_magellan_block.html.slim +1 -2
  154. data/app/views/renalware/system/view_metadata/_columns_table.html.slim +44 -0
  155. data/app/views/renalware/system/view_metadata/_filters_form.html.slim +19 -0
  156. data/app/views/renalware/system/view_metadata/_versions.html.slim +23 -0
  157. data/app/views/renalware/system/view_metadata/edit.html.slim +66 -0
  158. data/app/views/renalware/transplants/mdm/_prescriptions.html.slim +6 -22
  159. data/app/views/renalware/users/_filters.html.slim +11 -0
  160. data/app/views/renalware/users/index.html.slim +24 -0
  161. data/config/initializers/core_extensions.rb +2 -2
  162. data/config/initializers/delayed_job.rb +1 -1
  163. data/config/initializers/inflections.rb +1 -0
  164. data/config/initializers/pagy.rb +5 -0
  165. data/config/locales/renalware/clinical/allergies.en.yml +1 -0
  166. data/config/locales/renalware/medications/tabbed_prescriptions_list_component.yml +15 -0
  167. data/config/locales/renalware/navigation/renal.en.yml +1 -0
  168. data/config/locales/renalware/patients/side_menu.en.yml +1 -0
  169. data/config/permissions.yml +1 -0
  170. data/config/routes.rb +1 -0
  171. data/config/routes/messaging.rb +9 -1
  172. data/config/routes/pathology.rb +1 -0
  173. data/config/routes/patients.rb +1 -0
  174. data/config/routes/system.rb +3 -0
  175. data/config/routes/users.rb +3 -0
  176. data/db/functions/convert_to_float_with_explicit_return_v01.sql +18 -0
  177. data/db/functions/update_current_observation_set_from_trigger_v05.sql +92 -0
  178. data/db/functions/update_pathology_observations_nresult_from_trigger_v01.sql +13 -0
  179. data/db/migrate/20200122182018_update_patient_current_modalities.rb +7 -0
  180. data/db/migrate/20200122182036_create_transplant_mdm_patients.rb +7 -0
  181. data/db/migrate/20200122190909_create_view_metadata.rb +44 -0
  182. data/db/migrate/20200131133223_create_hd_mdm_patients.rb +7 -0
  183. data/db/migrate/20200205185151_add_columns_to_system_view_metadata.rb +13 -0
  184. data/db/migrate/20200219113324_create_supportive_care_mdm_patients_view.rb +7 -0
  185. data/db/migrate/20200622120232_add_limits_to_path_obs_descriptions.rb +18 -0
  186. data/db/migrate/20200626081248_overload_convert_to_float_function.rb +13 -0
  187. data/db/migrate/20200626090256_add_nresult_to_pathology_observations.rb +29 -0
  188. data/db/migrate/20200628094228_add_prescriber_to_users.rb +14 -0
  189. data/db/migrate/20200812074223_add_public_flag_to_messages.rb +18 -0
  190. data/db/migrate/20200815150303_create_system_versions.rb +16 -0
  191. data/db/migrate/20200817085618_create_pd_mdm_patients.rb +7 -0
  192. data/db/migrate/20200817103930_create_low_clearance_mdm_patients.rb +7 -0
  193. data/db/migrate/20201001144512_update_fn_update_current_obs_set_triggerv05.rb +13 -0
  194. data/db/migrate/20201001145452_add_position_to_letter_descriptions.rb +5 -0
  195. data/db/migrate/20201009090959_make_drug_types_unique.rb +8 -0
  196. data/db/migrate/20201012160414_add_suggested_measurement_unit_to_pathology_observation_descriptions.rb +18 -0
  197. data/db/migrate/20201012171428_create_ukrdc_measurement_units.rb +18 -0
  198. data/db/migrate/20201015160542_add_position_to_drug_types.rb +31 -0
  199. data/db/migrate/20201020155510_add_bmi_to_clinic_visits.rb +28 -0
  200. data/db/migrate/20201020164524_update_pd_mdm_patients_view.rb +7 -0
  201. data/db/migrate/20201020170921_update_hd_mdm_patients_view.rb +7 -0
  202. data/db/migrate/20201020171139_update_low_clearance_mdm_patients_view.rb +7 -0
  203. data/db/migrate/20201021153832_update_supportive_care_mdm_patients_view.rb +7 -0
  204. data/db/migrate/20201021154809_update_transplant_mdm_patients_view.rb +7 -0
  205. data/db/migrate/20201023092859_remove_unused_indexes.rb +20 -0
  206. data/db/seeds/default/system/seeds.rb +1 -0
  207. data/db/seeds/default/system/view_metadata.rb +91 -0
  208. data/db/seeds/default/ukrdc/measurement_units.csv +12 -0
  209. data/db/seeds/default/ukrdc/measurement_units.rb +15 -0
  210. data/db/seeds/default/ukrdc/seeds.rb +1 -0
  211. data/db/triggers/update_pathology_observations_nresult_trigger_v01.sql +11 -0
  212. data/db/views/hd_mdm_patients_v01.sql +69 -0
  213. data/db/views/hd_mdm_patients_v02.sql +70 -0
  214. data/db/views/low_clearance_mdm_patients_v01.sql +38 -0
  215. data/db/views/low_clearance_mdm_patients_v02.sql +39 -0
  216. data/db/views/patient_current_modalities_v02.sql +18 -0
  217. data/db/views/pd_mdm_patients_v01.sql +42 -0
  218. data/db/views/pd_mdm_patients_v02.sql +43 -0
  219. data/db/views/supportive_care_mdm_patients_v01.sql +28 -0
  220. data/db/views/supportive_care_mdm_patients_v02.sql +29 -0
  221. data/db/views/transplant_mdm_patients_v01.sql +46 -0
  222. data/db/views/transplant_mdm_patients_v02.sql +47 -0
  223. data/lib/renalware/configuration.rb +2 -0
  224. data/lib/renalware/engine.rb +2 -2
  225. data/lib/renalware/version_number.rb +1 -1
  226. data/lib/tasks/db.rake +9 -0
  227. data/lib/tasks/pd.rake +28 -0
  228. data/spec/factories/drugs/drug_types.rb +5 -1
  229. data/spec/factories/messaging/internal/messages.rb +1 -0
  230. data/spec/factories/patients/practices.rb +1 -1
  231. data/spec/factories/patients/primary_care_physicians.rb +1 -1
  232. data/spec/factories/system/users.rb +1 -0
  233. data/spec/factories/system/view_metadata.rb +20 -0
  234. data/spec/support/capybara_helper.rb +2 -4
  235. data/spec/support/letters_spec_helper.rb +1 -1
  236. data/spec/support/matchers/validate_timeliness_of.rb +1 -1
  237. data/spec/support/pathology_spec_helper.rb +1 -2
  238. data/spec/support/policy_spec_helper.rb +12 -0
  239. data/vendor/assets/javascripts/foundation/foundation.alert.js +43 -0
  240. data/vendor/assets/javascripts/foundation/foundation.dropdown.js +468 -0
  241. data/vendor/assets/javascripts/foundation/foundation.js +727 -0
  242. data/vendor/assets/javascripts/foundation/foundation.reveal.js +522 -0
  243. data/vendor/assets/javascripts/foundation/foundation.tab.js +247 -0
  244. data/vendor/assets/javascripts/foundation/foundation.tooltip.js +348 -0
  245. data/vendor/assets/javascripts/foundation/foundation.topbar.js +458 -0
  246. data/vendor/assets/stylesheets/foundation/_functions.scss +156 -0
  247. data/vendor/assets/stylesheets/foundation/components/_alert-boxes.scss +128 -0
  248. data/vendor/assets/stylesheets/foundation/components/_buttons.scss +261 -0
  249. data/vendor/assets/stylesheets/foundation/components/_dropdown-buttons.scss +130 -0
  250. data/vendor/assets/stylesheets/foundation/components/_dropdown.scss +269 -0
  251. data/vendor/assets/stylesheets/foundation/components/_forms.scss +601 -0
  252. data/vendor/assets/stylesheets/foundation/components/_global.scss +566 -0
  253. data/vendor/assets/stylesheets/foundation/components/_grid.scss +292 -0
  254. data/vendor/assets/stylesheets/foundation/components/_labels.scss +106 -0
  255. data/vendor/assets/stylesheets/foundation/components/_pagination.scss +163 -0
  256. data/vendor/assets/stylesheets/foundation/components/_panels.scss +107 -0
  257. data/vendor/assets/stylesheets/foundation/components/_reveal.scss +212 -0
  258. data/vendor/assets/stylesheets/foundation/components/_side-nav.scss +120 -0
  259. data/vendor/assets/stylesheets/foundation/components/_split-buttons.scss +203 -0
  260. data/vendor/assets/stylesheets/foundation/components/_sub-nav.scss +125 -0
  261. data/vendor/assets/stylesheets/foundation/components/_tables.scss +135 -0
  262. data/vendor/assets/stylesheets/foundation/components/_tabs.scss +142 -0
  263. data/vendor/assets/stylesheets/foundation/components/_tooltips.scss +142 -0
  264. data/vendor/assets/stylesheets/foundation/components/_top-bar.scss +745 -0
  265. data/vendor/assets/stylesheets/foundation/components/_type.scss +525 -0
  266. data/vendor/assets/stylesheets/foundation/components/_visibility.scss +425 -0
  267. metadata +162 -64
  268. data/app/views/renalware/pd/infection_organisms/_edit.html.slim.obsolete +0 -16
  269. data/app/views/renalware/transplants/donor_operations/_sections_nav.html.slim +0 -11
  270. data/app/views/renalware/transplants/donor_workups/_sections_nav.html.slim +0 -15
  271. data/app/views/renalware/transplants/recipient_operations/_sections_nav.html.slim +0 -14
  272. data/app/views/renalware/transplants/recipient_workups/_sections_nav.html.slim +0 -15
  273. data/lib/core_extensions/active_record/sort.rb +0 -52
  274. data/spec/support/pages/accesses/procedure_page.rb +0 -53
  275. data/spec/support/pages/accesses/profile_page.rb +0 -45
  276. data/spec/support/pages/admissions/consults_page.rb +0 -26
  277. data/spec/support/pages/clinical/allergy_page.rb +0 -74
  278. data/spec/support/pages/clinical/profile_page.rb +0 -28
  279. data/spec/support/pages/hd/prescription_administration_dialog.rb +0 -132
  280. data/spec/support/pages/letters/form.rb +0 -63
  281. data/spec/support/pages/letters/mailshots/form.rb +0 -58
  282. data/spec/support/pages/letters/patient_letters.rb +0 -20
  283. data/spec/support/pages/low_clearance/profile_page.rb +0 -70
  284. data/spec/support/pages/medications/home_delivery_dialog.rb +0 -77
  285. data/spec/support/pages/medications/prescription_fom.rb +0 -62
  286. data/spec/support/pages/page_object.rb +0 -10
@@ -0,0 +1,247 @@
1
+ ;(function ($, window, document, undefined) {
2
+ 'use strict';
3
+
4
+ Foundation.libs.tab = {
5
+ name : 'tab',
6
+
7
+ version : '5.5.3',
8
+
9
+ settings : {
10
+ active_class : 'active',
11
+ callback : function () {},
12
+ deep_linking : false,
13
+ scroll_to_content : true,
14
+ is_hover : false
15
+ },
16
+
17
+ default_tab_hashes : [],
18
+
19
+ init : function (scope, method, options) {
20
+ var self = this,
21
+ S = this.S;
22
+
23
+ // Store the default active tabs which will be referenced when the
24
+ // location hash is absent, as in the case of navigating the tabs and
25
+ // returning to the first viewing via the browser Back button.
26
+ S('[' + this.attr_name() + '] > .active > a', this.scope).each(function () {
27
+ self.default_tab_hashes.push(this.hash);
28
+ });
29
+
30
+ this.bindings(method, options);
31
+ this.handle_location_hash_change();
32
+ },
33
+
34
+ events : function () {
35
+ var self = this,
36
+ S = this.S;
37
+
38
+ var usual_tab_behavior = function (e, target) {
39
+ var settings = S(target).closest('[' + self.attr_name() + ']').data(self.attr_name(true) + '-init');
40
+ if (!settings.is_hover || Modernizr.touch) {
41
+ // if user did not pressed tab key, prevent default action
42
+ var keyCode = e.keyCode || e.which;
43
+ if (keyCode !== 9) {
44
+ e.preventDefault();
45
+ e.stopPropagation();
46
+ }
47
+ self.toggle_active_tab(S(target).parent());
48
+
49
+ }
50
+ };
51
+
52
+ S(this.scope)
53
+ .off('.tab')
54
+ // Key event: focus/tab key
55
+ .on('keydown.fndtn.tab', '[' + this.attr_name() + '] > * > a', function(e) {
56
+ var keyCode = e.keyCode || e.which;
57
+ // if user pressed tab key
58
+ if (keyCode === 13 || keyCode === 32) { // enter or space
59
+ var el = this;
60
+ usual_tab_behavior(e, el);
61
+ }
62
+ })
63
+ // Click event: tab title
64
+ .on('click.fndtn.tab', '[' + this.attr_name() + '] > * > a', function(e) {
65
+ var el = this;
66
+ usual_tab_behavior(e, el);
67
+ })
68
+ // Hover event: tab title
69
+ .on('mouseenter.fndtn.tab', '[' + this.attr_name() + '] > * > a', function (e) {
70
+ var settings = S(this).closest('[' + self.attr_name() + ']').data(self.attr_name(true) + '-init');
71
+ if (settings.is_hover) {
72
+ self.toggle_active_tab(S(this).parent());
73
+ }
74
+ });
75
+
76
+ // Location hash change event
77
+ S(window).on('hashchange.fndtn.tab', function (e) {
78
+ e.preventDefault();
79
+ self.handle_location_hash_change();
80
+ });
81
+ },
82
+
83
+ handle_location_hash_change : function () {
84
+
85
+ var self = this,
86
+ S = this.S;
87
+
88
+ S('[' + this.attr_name() + ']', this.scope).each(function () {
89
+ var settings = S(this).data(self.attr_name(true) + '-init');
90
+ if (settings.deep_linking) {
91
+ // Match the location hash to a label
92
+ var hash;
93
+ if (settings.scroll_to_content) {
94
+ hash = self.scope.location.hash;
95
+ } else {
96
+ // prefix the hash to prevent anchor scrolling
97
+ hash = self.scope.location.hash.replace('fndtn-', '');
98
+ }
99
+ if (hash != '') {
100
+ // Check whether the location hash references a tab content div or
101
+ // another element on the page (inside or outside the tab content div)
102
+ var hash_element = S(hash);
103
+ if (hash_element.hasClass('content') && hash_element.parent().hasClass('tabs-content')) {
104
+ // Tab content div
105
+ self.toggle_active_tab($('[' + self.attr_name() + '] > * > a[href=' + hash + ']').parent());
106
+ } else {
107
+ // Not the tab content div. If inside the tab content, find the
108
+ // containing tab and toggle it as active.
109
+ var hash_tab_container_id = hash_element.closest('.content').attr('id');
110
+ if (hash_tab_container_id != undefined) {
111
+ self.toggle_active_tab($('[' + self.attr_name() + '] > * > a[href=#' + hash_tab_container_id + ']').parent(), hash);
112
+ }
113
+ }
114
+ } else {
115
+ // Reference the default tab hashes which were initialized in the init function
116
+ for (var ind = 0; ind < self.default_tab_hashes.length; ind++) {
117
+ self.toggle_active_tab($('[' + self.attr_name() + '] > * > a[href=' + self.default_tab_hashes[ind] + ']').parent());
118
+ }
119
+ }
120
+ }
121
+ });
122
+ },
123
+
124
+ toggle_active_tab : function (tab, location_hash) {
125
+ var self = this,
126
+ S = self.S,
127
+ tabs = tab.closest('[' + this.attr_name() + ']'),
128
+ tab_link = tab.find('a'),
129
+ anchor = tab.children('a').first(),
130
+ target_hash = '#' + anchor.attr('href').split('#')[1],
131
+ target = S(target_hash),
132
+ siblings = tab.siblings(),
133
+ settings = tabs.data(this.attr_name(true) + '-init'),
134
+ interpret_keyup_action = function (e) {
135
+ // Light modification of Heydon Pickering's Practical ARIA Examples: http://heydonworks.com/practical_aria_examples/js/a11y.js
136
+
137
+ // define current, previous and next (possible) tabs
138
+
139
+ var $original = $(this);
140
+ var $prev = $(this).parents('li').prev().children('[role="tab"]');
141
+ var $next = $(this).parents('li').next().children('[role="tab"]');
142
+ var $target;
143
+
144
+ // find the direction (prev or next)
145
+
146
+ switch (e.keyCode) {
147
+ case 37:
148
+ $target = $prev;
149
+ break;
150
+ case 39:
151
+ $target = $next;
152
+ break;
153
+ default:
154
+ $target = false
155
+ break;
156
+ }
157
+
158
+ if ($target.length) {
159
+ $original.attr({
160
+ 'tabindex' : '-1',
161
+ 'aria-selected' : null
162
+ });
163
+ $target.attr({
164
+ 'tabindex' : '0',
165
+ 'aria-selected' : true
166
+ }).focus();
167
+ }
168
+
169
+ // Hide panels
170
+
171
+ $('[role="tabpanel"]')
172
+ .attr('aria-hidden', 'true');
173
+
174
+ // Show panel which corresponds to target
175
+
176
+ $('#' + $(document.activeElement).attr('href').substring(1))
177
+ .attr('aria-hidden', null);
178
+
179
+ },
180
+ go_to_hash = function(hash) {
181
+ // This function allows correct behaviour of the browser's back button when deep linking is enabled. Without it
182
+ // the user would get continually redirected to the default hash.
183
+ var default_hash = settings.scroll_to_content ? self.default_tab_hashes[0] : 'fndtn-' + self.default_tab_hashes[0].replace('#', '');
184
+
185
+ if (hash !== default_hash || window.location.hash) {
186
+ window.location.hash = hash;
187
+ }
188
+ };
189
+
190
+ // allow usage of data-tab-content attribute instead of href
191
+ if (anchor.data('tab-content')) {
192
+ target_hash = '#' + anchor.data('tab-content').split('#')[1];
193
+ target = S(target_hash);
194
+ }
195
+
196
+ if (settings.deep_linking) {
197
+
198
+ if (settings.scroll_to_content) {
199
+
200
+ // retain current hash to scroll to content
201
+ go_to_hash(location_hash || target_hash);
202
+
203
+ if (location_hash == undefined || location_hash == target_hash) {
204
+ tab.parent()[0].scrollIntoView();
205
+ } else {
206
+ S(target_hash)[0].scrollIntoView();
207
+ }
208
+ } else {
209
+ // prefix the hashes so that the browser doesn't scroll down
210
+ if (location_hash != undefined) {
211
+ go_to_hash('fndtn-' + location_hash.replace('#', ''));
212
+ } else {
213
+ go_to_hash('fndtn-' + target_hash.replace('#', ''));
214
+ }
215
+ }
216
+ }
217
+
218
+ // WARNING: The activation and deactivation of the tab content must
219
+ // occur after the deep linking in order to properly refresh the browser
220
+ // window (notably in Chrome).
221
+ // Clean up multiple attr instances to done once
222
+ tab.addClass(settings.active_class).triggerHandler('opened');
223
+ tab_link.attr({'aria-selected' : 'true', tabindex : 0});
224
+ siblings.removeClass(settings.active_class)
225
+ siblings.find('a').attr({'aria-selected' : 'false'/*, tabindex : -1*/});
226
+ target.siblings().removeClass(settings.active_class).attr({'aria-hidden' : 'true'/*, tabindex : -1*/});
227
+ target.addClass(settings.active_class).attr('aria-hidden', 'false').removeAttr('tabindex');
228
+ settings.callback(tab);
229
+ target.triggerHandler('toggled', [target]);
230
+ tabs.triggerHandler('toggled', [tab]);
231
+
232
+ tab_link.off('keydown').on('keydown', interpret_keyup_action );
233
+ },
234
+
235
+ data_attr : function (str) {
236
+ if (this.namespace.length > 0) {
237
+ return this.namespace + '-' + str;
238
+ }
239
+
240
+ return str;
241
+ },
242
+
243
+ off : function () {},
244
+
245
+ reflow : function () {}
246
+ };
247
+ }(jQuery, window, window.document));
@@ -0,0 +1,348 @@
1
+ ;(function ($, window, document, undefined) {
2
+ 'use strict';
3
+
4
+ Foundation.libs.tooltip = {
5
+ name : 'tooltip',
6
+
7
+ version : '5.5.3',
8
+
9
+ settings : {
10
+ additional_inheritable_classes : [],
11
+ tooltip_class : '.tooltip',
12
+ append_to : 'body',
13
+ touch_close_text : 'Tap To Close',
14
+ disable_for_touch : false,
15
+ hover_delay : 200,
16
+ fade_in_duration : 150,
17
+ fade_out_duration : 150,
18
+ show_on : 'all',
19
+ tip_template : function (selector, content) {
20
+ return '<span data-selector="' + selector + '" id="' + selector + '" class="'
21
+ + Foundation.libs.tooltip.settings.tooltip_class.substring(1)
22
+ + '" role="tooltip">' + content + '<span class="nub"></span></span>';
23
+ }
24
+ },
25
+
26
+ cache : {},
27
+
28
+ init : function (scope, method, options) {
29
+ Foundation.inherit(this, 'random_str');
30
+ this.bindings(method, options);
31
+ },
32
+
33
+ should_show : function (target, tip) {
34
+ var settings = $.extend({}, this.settings, this.data_options(target));
35
+
36
+ if (settings.show_on === 'all') {
37
+ return true;
38
+ } else if (this.small() && settings.show_on === 'small') {
39
+ return true;
40
+ } else if (this.medium() && settings.show_on === 'medium') {
41
+ return true;
42
+ } else if (this.large() && settings.show_on === 'large') {
43
+ return true;
44
+ }
45
+ return false;
46
+ },
47
+
48
+ medium : function () {
49
+ return matchMedia(Foundation.media_queries['medium']).matches;
50
+ },
51
+
52
+ large : function () {
53
+ return matchMedia(Foundation.media_queries['large']).matches;
54
+ },
55
+
56
+ events : function (instance) {
57
+ var self = this,
58
+ S = self.S;
59
+
60
+ self.create(this.S(instance));
61
+
62
+ function _startShow(elt, $this, immediate) {
63
+ if (elt.timer) {
64
+ return;
65
+ }
66
+
67
+ if (immediate) {
68
+ elt.timer = null;
69
+ self.showTip($this);
70
+ } else {
71
+ elt.timer = setTimeout(function () {
72
+ elt.timer = null;
73
+ self.showTip($this);
74
+ }.bind(elt), self.settings.hover_delay);
75
+ }
76
+ }
77
+
78
+ function _startHide(elt, $this) {
79
+ if (elt.timer) {
80
+ clearTimeout(elt.timer);
81
+ elt.timer = null;
82
+ }
83
+
84
+ self.hide($this);
85
+ }
86
+
87
+ $(this.scope)
88
+ .off('.tooltip')
89
+ .on('mouseenter.fndtn.tooltip mouseleave.fndtn.tooltip touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip',
90
+ '[' + this.attr_name() + ']', function (e) {
91
+ var $this = S(this),
92
+ settings = $.extend({}, self.settings, self.data_options($this)),
93
+ is_touch = false;
94
+
95
+ if (Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type) && S(e.target).is('a')) {
96
+ return false;
97
+ }
98
+
99
+ if (/mouse/i.test(e.type) && self.ie_touch(e)) {
100
+ return false;
101
+ }
102
+
103
+ if ($this.hasClass('open')) {
104
+ if (Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) {
105
+ e.preventDefault();
106
+ }
107
+ self.hide($this);
108
+ } else {
109
+ if (settings.disable_for_touch && Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) {
110
+ return;
111
+ } else if (!settings.disable_for_touch && Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) {
112
+ e.preventDefault();
113
+ S(settings.tooltip_class + '.open').hide();
114
+ is_touch = true;
115
+ // close other open tooltips on touch
116
+ if ($('.open[' + self.attr_name() + ']').length > 0) {
117
+ var prevOpen = S($('.open[' + self.attr_name() + ']')[0]);
118
+ self.hide(prevOpen);
119
+ }
120
+ }
121
+
122
+ if (/enter|over/i.test(e.type)) {
123
+ _startShow(this, $this);
124
+
125
+ } else if (e.type === 'mouseout' || e.type === 'mouseleave') {
126
+ _startHide(this, $this);
127
+ } else {
128
+ _startShow(this, $this, true);
129
+ }
130
+ }
131
+ })
132
+ .on('mouseleave.fndtn.tooltip touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip', '[' + this.attr_name() + '].open', function (e) {
133
+ if (/mouse/i.test(e.type) && self.ie_touch(e)) {
134
+ return false;
135
+ }
136
+
137
+ if ($(this).data('tooltip-open-event-type') == 'touch' && e.type == 'mouseleave') {
138
+ return;
139
+ } else if ($(this).data('tooltip-open-event-type') == 'mouse' && /MSPointerDown|touchstart/i.test(e.type)) {
140
+ self.convert_to_touch($(this));
141
+ } else {
142
+ _startHide(this, $(this));
143
+ }
144
+ })
145
+ .on('DOMNodeRemoved DOMAttrModified', '[' + this.attr_name() + ']:not(a)', function (e) {
146
+ _startHide(this, S(this));
147
+ });
148
+ },
149
+
150
+ ie_touch : function (e) {
151
+ // How do I distinguish between IE11 and Windows Phone 8?????
152
+ return false;
153
+ },
154
+
155
+ showTip : function ($target) {
156
+ var $tip = this.getTip($target);
157
+ if (this.should_show($target, $tip)) {
158
+ return this.show($target);
159
+ }
160
+ return;
161
+ },
162
+
163
+ getTip : function ($target) {
164
+ var selector = this.selector($target),
165
+ settings = $.extend({}, this.settings, this.data_options($target)),
166
+ tip = null;
167
+
168
+ if (selector) {
169
+ tip = this.S('span[data-selector="' + selector + '"]' + settings.tooltip_class);
170
+ }
171
+
172
+ return (typeof tip === 'object') ? tip : false;
173
+ },
174
+
175
+ selector : function ($target) {
176
+ var dataSelector = $target.attr(this.attr_name()) || $target.attr('data-selector');
177
+
178
+ if (typeof dataSelector != 'string') {
179
+ dataSelector = this.random_str(6);
180
+ $target
181
+ .attr('data-selector', dataSelector)
182
+ .attr('aria-describedby', dataSelector);
183
+ }
184
+
185
+ return dataSelector;
186
+ },
187
+
188
+ create : function ($target) {
189
+ var self = this,
190
+ settings = $.extend({}, this.settings, this.data_options($target)),
191
+ tip_template = this.settings.tip_template;
192
+
193
+ if (typeof settings.tip_template === 'string' && window.hasOwnProperty(settings.tip_template)) {
194
+ tip_template = window[settings.tip_template];
195
+ }
196
+
197
+ var $tip = $(tip_template(this.selector($target), $('<div></div>').html($target.attr('title')).html())),
198
+ classes = this.inheritable_classes($target);
199
+
200
+ $tip.addClass(classes).appendTo(settings.append_to);
201
+
202
+ if (Modernizr.touch) {
203
+ $tip.append('<span class="tap-to-close">' + settings.touch_close_text + '</span>');
204
+ $tip.on('touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip', function (e) {
205
+ self.hide($target);
206
+ });
207
+ }
208
+
209
+ $target.removeAttr('title').attr('title', '');
210
+ },
211
+
212
+ reposition : function (target, tip, classes) {
213
+ var width, nub, nubHeight, nubWidth, objPos;
214
+
215
+ tip.css('visibility', 'hidden').show();
216
+
217
+ width = target.data('width');
218
+ nub = tip.children('.nub');
219
+ nubHeight = nub.outerHeight();
220
+ nubWidth = nub.outerWidth();
221
+
222
+ if (this.small()) {
223
+ tip.css({'width' : '100%'});
224
+ } else {
225
+ tip.css({'width' : (width) ? width : 'auto'});
226
+ }
227
+
228
+ objPos = function (obj, top, right, bottom, left, width) {
229
+ return obj.css({
230
+ 'top' : (top) ? top : 'auto',
231
+ 'bottom' : (bottom) ? bottom : 'auto',
232
+ 'left' : (left) ? left : 'auto',
233
+ 'right' : (right) ? right : 'auto'
234
+ }).end();
235
+ };
236
+
237
+ var o_top = target.offset().top;
238
+ var o_left = target.offset().left;
239
+ var outerHeight = target.outerHeight();
240
+
241
+ objPos(tip, (o_top + outerHeight + 10), 'auto', 'auto', o_left);
242
+
243
+ if (this.small()) {
244
+ objPos(tip, (o_top + outerHeight + 10), 'auto', 'auto', 12.5, $(this.scope).width());
245
+ tip.addClass('tip-override');
246
+ objPos(nub, -nubHeight, 'auto', 'auto', o_left);
247
+ } else {
248
+
249
+ if (Foundation.rtl) {
250
+ nub.addClass('rtl');
251
+ o_left = o_left + target.outerWidth() - tip.outerWidth();
252
+ }
253
+
254
+ objPos(tip, (o_top + outerHeight + 10), 'auto', 'auto', o_left);
255
+ // reset nub from small styles, if they've been applied
256
+ if (nub.attr('style')) {
257
+ nub.removeAttr('style');
258
+ }
259
+
260
+ tip.removeClass('tip-override');
261
+
262
+ var tip_outerHeight = tip.outerHeight();
263
+
264
+ if (classes && classes.indexOf('tip-top') > -1) {
265
+ if (Foundation.rtl) {
266
+ nub.addClass('rtl');
267
+ }
268
+ objPos(tip, (o_top - tip_outerHeight), 'auto', 'auto', o_left)
269
+ .removeClass('tip-override');
270
+ } else if (classes && classes.indexOf('tip-left') > -1) {
271
+ objPos(tip, (o_top + (outerHeight / 2) - (tip_outerHeight / 2)), 'auto', 'auto', (o_left - tip.outerWidth() - nubHeight))
272
+ .removeClass('tip-override');
273
+ nub.removeClass('rtl');
274
+ } else if (classes && classes.indexOf('tip-right') > -1) {
275
+ objPos(tip, (o_top + (outerHeight / 2) - (tip_outerHeight / 2)), 'auto', 'auto', (o_left + target.outerWidth() + nubHeight))
276
+ .removeClass('tip-override');
277
+ nub.removeClass('rtl');
278
+ }
279
+ }
280
+
281
+ tip.css('visibility', 'visible').hide();
282
+ },
283
+
284
+ small : function () {
285
+ return matchMedia(Foundation.media_queries.small).matches &&
286
+ !matchMedia(Foundation.media_queries.medium).matches;
287
+ },
288
+
289
+ inheritable_classes : function ($target) {
290
+ var settings = $.extend({}, this.settings, this.data_options($target)),
291
+ inheritables = ['tip-top', 'tip-left', 'tip-bottom', 'tip-right', 'radius', 'round'].concat(settings.additional_inheritable_classes),
292
+ classes = $target.attr('class'),
293
+ filtered = classes ? $.map(classes.split(' '), function (el, i) {
294
+ if ($.inArray(el, inheritables) !== -1) {
295
+ return el;
296
+ }
297
+ }).join(' ') : '';
298
+
299
+ return $.trim(filtered);
300
+ },
301
+
302
+ convert_to_touch : function ($target) {
303
+ var self = this,
304
+ $tip = self.getTip($target),
305
+ settings = $.extend({}, self.settings, self.data_options($target));
306
+
307
+ if ($tip.find('.tap-to-close').length === 0) {
308
+ $tip.append('<span class="tap-to-close">' + settings.touch_close_text + '</span>');
309
+ $tip.on('click.fndtn.tooltip.tapclose touchstart.fndtn.tooltip.tapclose MSPointerDown.fndtn.tooltip.tapclose', function (e) {
310
+ self.hide($target);
311
+ });
312
+ }
313
+
314
+ $target.data('tooltip-open-event-type', 'touch');
315
+ },
316
+
317
+ show : function ($target) {
318
+ var $tip = this.getTip($target);
319
+ if ($target.data('tooltip-open-event-type') == 'touch') {
320
+ this.convert_to_touch($target);
321
+ }
322
+
323
+ this.reposition($target, $tip, $target.attr('class'));
324
+ $target.addClass('open');
325
+ $tip.fadeIn(this.settings.fade_in_duration);
326
+ },
327
+
328
+ hide : function ($target) {
329
+ var $tip = this.getTip($target);
330
+
331
+ $tip.fadeOut(this.settings.fade_out_duration, function () {
332
+ $tip.find('.tap-to-close').remove();
333
+ $tip.off('click.fndtn.tooltip.tapclose MSPointerDown.fndtn.tapclose');
334
+ $target.removeClass('open');
335
+ });
336
+ },
337
+
338
+ off : function () {
339
+ var self = this;
340
+ this.S(this.scope).off('.fndtn.tooltip');
341
+ this.S(this.settings.tooltip_class).each(function (i) {
342
+ $('[' + self.attr_name() + ']').eq(i).attr('title', $(this).text());
343
+ }).remove();
344
+ },
345
+
346
+ reflow : function () {}
347
+ };
348
+ }(jQuery, window, window.document));