trusty-festivity-extension 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (261) hide show
  1. checksums.yaml +15 -0
  2. data/Gemfile +3 -0
  3. data/Gemfile.lock +33 -0
  4. data/README.md +2 -0
  5. data/Rakefile +110 -0
  6. data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.eot +0 -0
  7. data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.svg +288 -0
  8. data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.ttf +0 -0
  9. data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.woff +0 -0
  10. data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.woff2 +0 -0
  11. data/app/assets/images/pct-black.png +0 -0
  12. data/app/assets/images/skins/pghkids/footer.png +0 -0
  13. data/app/assets/images/skins/pghkids/footer_mobile.png +0 -0
  14. data/app/assets/images/skins/pghkids/frog.png +0 -0
  15. data/app/assets/images/skins/pghkids/frog_mobile.png +0 -0
  16. data/app/assets/images/skins/pghkids/header.png +0 -0
  17. data/app/assets/images/skins/pghkids/header_mobile.png +0 -0
  18. data/app/assets/images/skins/pghkids/seafoam.jpg +0 -0
  19. data/app/assets/javascripts/admin/festivity_admin.js +22 -0
  20. data/app/assets/javascripts/admin/pages/ajax_image_uploader.js +29 -0
  21. data/app/assets/javascripts/admin/pages/page_bindings.js +94 -0
  22. data/app/assets/javascripts/admin/pages/performances.js +59 -0
  23. data/app/assets/javascripts/admin/sites/categories.js +74 -0
  24. data/app/assets/javascripts/admin/sites/category_types.js +63 -0
  25. data/app/assets/javascripts/admin/sites/site_bindings.js +4 -0
  26. data/app/assets/javascripts/ajaxupload.js +1 -0
  27. data/app/assets/javascripts/bootstrap-sprockets.js +12 -0
  28. data/app/assets/javascripts/bootstrap.js +2306 -0
  29. data/app/assets/javascripts/bootstrap.min.js +7 -0
  30. data/app/assets/javascripts/bootstrap/affix.js +162 -0
  31. data/app/assets/javascripts/bootstrap/alert.js +94 -0
  32. data/app/assets/javascripts/bootstrap/button.js +116 -0
  33. data/app/assets/javascripts/bootstrap/carousel.js +237 -0
  34. data/app/assets/javascripts/bootstrap/collapse.js +211 -0
  35. data/app/assets/javascripts/bootstrap/dropdown.js +161 -0
  36. data/app/assets/javascripts/bootstrap/modal.js +324 -0
  37. data/app/assets/javascripts/bootstrap/popover.js +113 -0
  38. data/app/assets/javascripts/bootstrap/scrollspy.js +175 -0
  39. data/app/assets/javascripts/bootstrap/tab.js +153 -0
  40. data/app/assets/javascripts/bootstrap/tooltip.js +472 -0
  41. data/app/assets/javascripts/bootstrap/transition.js +59 -0
  42. data/app/assets/javascripts/events/event_list_bindings.js +3 -0
  43. data/app/assets/javascripts/events/filters.js +100 -0
  44. data/app/assets/javascripts/festivity.js +1 -0
  45. data/app/assets/javascripts/festivity_app.js +13 -0
  46. data/app/assets/javascripts/jasny-bootstrap.js +1024 -0
  47. data/app/assets/javascripts/jquery-migrate.js +521 -0
  48. data/app/assets/javascripts/jquery.collapse.js +176 -0
  49. data/app/assets/javascripts/jquery.collapse_cookie_storage.js +37 -0
  50. data/app/assets/javascripts/jquery.collapse_storage.js +56 -0
  51. data/app/assets/javascripts/jquery.inputmask.bundle.min.js +10 -0
  52. data/app/assets/javascripts/lodash.min.js +88 -0
  53. data/app/assets/javascripts/readmore.min.js +11 -0
  54. data/app/assets/javascripts/script.js +22 -0
  55. data/app/assets/javascripts/underscore.js +1545 -0
  56. data/app/assets/stylesheets/_bootstrap-compass.scss +9 -0
  57. data/app/assets/stylesheets/_bootstrap-mincer.scss +19 -0
  58. data/app/assets/stylesheets/_bootstrap-sprockets.scss +9 -0
  59. data/app/assets/stylesheets/_bootstrap.scss +50 -0
  60. data/app/assets/stylesheets/_defaults.scss +6 -0
  61. data/app/assets/stylesheets/_event_filter_bar.scss +78 -0
  62. data/app/assets/stylesheets/_faq.scss +48 -0
  63. data/app/assets/stylesheets/_filter-bar-mobile.scss +32 -0
  64. data/app/assets/stylesheets/_footer.scss +18 -0
  65. data/app/assets/stylesheets/_global.scss +30 -0
  66. data/app/assets/stylesheets/_header.scss +95 -0
  67. data/app/assets/stylesheets/_landing_page.scss +62 -0
  68. data/app/assets/stylesheets/_locations.scss +17 -0
  69. data/app/assets/stylesheets/_media-queries.scss +9 -0
  70. data/app/assets/stylesheets/_mixins.scss +17 -0
  71. data/app/assets/stylesheets/_nav.scss +128 -0
  72. data/app/assets/stylesheets/_normalize.scss +375 -0
  73. data/app/assets/stylesheets/_overrides.scss +11 -0
  74. data/app/assets/stylesheets/_page-template.scss +124 -0
  75. data/app/assets/stylesheets/_related_events.scss +20 -0
  76. data/app/assets/stylesheets/_search-results.scss +20 -0
  77. data/app/assets/stylesheets/_utils.scss +8 -0
  78. data/app/assets/stylesheets/admin/festivity_admin.scss +28 -0
  79. data/app/assets/stylesheets/admin/modules/_category_styles.scss +23 -0
  80. data/app/assets/stylesheets/admin/modules/_form_styles.scss +40 -0
  81. data/app/assets/stylesheets/admin/modules/_list_styles.scss +30 -0
  82. data/app/assets/stylesheets/admin/modules/_variables.scss +3 -0
  83. data/app/assets/stylesheets/bootstrap/_alerts.scss +73 -0
  84. data/app/assets/stylesheets/bootstrap/_badges.scss +67 -0
  85. data/app/assets/stylesheets/bootstrap/_breadcrumbs.scss +26 -0
  86. data/app/assets/stylesheets/bootstrap/_button-groups.scss +243 -0
  87. data/app/assets/stylesheets/bootstrap/_buttons.scss +160 -0
  88. data/app/assets/stylesheets/bootstrap/_carousel.scss +269 -0
  89. data/app/assets/stylesheets/bootstrap/_close.scss +36 -0
  90. data/app/assets/stylesheets/bootstrap/_code.scss +69 -0
  91. data/app/assets/stylesheets/bootstrap/_component-animations.scss +38 -0
  92. data/app/assets/stylesheets/bootstrap/_dropdowns.scss +214 -0
  93. data/app/assets/stylesheets/bootstrap/_forms.scss +570 -0
  94. data/app/assets/stylesheets/bootstrap/_glyphicons.scss +301 -0
  95. data/app/assets/stylesheets/bootstrap/_grid.scss +84 -0
  96. data/app/assets/stylesheets/bootstrap/_input-groups.scss +166 -0
  97. data/app/assets/stylesheets/bootstrap/_jumbotron.scss +50 -0
  98. data/app/assets/stylesheets/bootstrap/_labels.scss +66 -0
  99. data/app/assets/stylesheets/bootstrap/_list-group.scss +124 -0
  100. data/app/assets/stylesheets/bootstrap/_media.scss +61 -0
  101. data/app/assets/stylesheets/bootstrap/_mixins.scss +39 -0
  102. data/app/assets/stylesheets/bootstrap/_modals.scss +148 -0
  103. data/app/assets/stylesheets/bootstrap/_navbar.scss +663 -0
  104. data/app/assets/stylesheets/bootstrap/_navs.scss +244 -0
  105. data/app/assets/stylesheets/bootstrap/_normalize.scss +427 -0
  106. data/app/assets/stylesheets/bootstrap/_pager.scss +54 -0
  107. data/app/assets/stylesheets/bootstrap/_pagination.scss +88 -0
  108. data/app/assets/stylesheets/bootstrap/_panels.scss +265 -0
  109. data/app/assets/stylesheets/bootstrap/_popovers.scss +135 -0
  110. data/app/assets/stylesheets/bootstrap/_print.scss +107 -0
  111. data/app/assets/stylesheets/bootstrap/_progress-bars.scss +87 -0
  112. data/app/assets/stylesheets/bootstrap/_responsive-embed.scss +35 -0
  113. data/app/assets/stylesheets/bootstrap/_responsive-utilities.scss +177 -0
  114. data/app/assets/stylesheets/bootstrap/_scaffolding.scss +150 -0
  115. data/app/assets/stylesheets/bootstrap/_tables.scss +234 -0
  116. data/app/assets/stylesheets/bootstrap/_theme.scss +273 -0
  117. data/app/assets/stylesheets/bootstrap/_thumbnails.scss +38 -0
  118. data/app/assets/stylesheets/bootstrap/_tooltip.scss +103 -0
  119. data/app/assets/stylesheets/bootstrap/_type.scss +298 -0
  120. data/app/assets/stylesheets/bootstrap/_utilities.scss +56 -0
  121. data/app/assets/stylesheets/bootstrap/_variables.scss +862 -0
  122. data/app/assets/stylesheets/bootstrap/_wells.scss +29 -0
  123. data/app/assets/stylesheets/bootstrap/mixins/_alerts.scss +14 -0
  124. data/app/assets/stylesheets/bootstrap/mixins/_background-variant.scss +11 -0
  125. data/app/assets/stylesheets/bootstrap/mixins/_border-radius.scss +18 -0
  126. data/app/assets/stylesheets/bootstrap/mixins/_buttons.scss +52 -0
  127. data/app/assets/stylesheets/bootstrap/mixins/_center-block.scss +7 -0
  128. data/app/assets/stylesheets/bootstrap/mixins/_clearfix.scss +22 -0
  129. data/app/assets/stylesheets/bootstrap/mixins/_forms.scss +88 -0
  130. data/app/assets/stylesheets/bootstrap/mixins/_gradients.scss +58 -0
  131. data/app/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +81 -0
  132. data/app/assets/stylesheets/bootstrap/mixins/_grid.scss +122 -0
  133. data/app/assets/stylesheets/bootstrap/mixins/_hide-text.scss +21 -0
  134. data/app/assets/stylesheets/bootstrap/mixins/_image.scss +33 -0
  135. data/app/assets/stylesheets/bootstrap/mixins/_labels.scss +12 -0
  136. data/app/assets/stylesheets/bootstrap/mixins/_list-group.scss +31 -0
  137. data/app/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +10 -0
  138. data/app/assets/stylesheets/bootstrap/mixins/_nav-vertical-align.scss +9 -0
  139. data/app/assets/stylesheets/bootstrap/mixins/_opacity.scss +8 -0
  140. data/app/assets/stylesheets/bootstrap/mixins/_pagination.scss +23 -0
  141. data/app/assets/stylesheets/bootstrap/mixins/_panels.scss +24 -0
  142. data/app/assets/stylesheets/bootstrap/mixins/_progress-bar.scss +10 -0
  143. data/app/assets/stylesheets/bootstrap/mixins/_reset-filter.scss +8 -0
  144. data/app/assets/stylesheets/bootstrap/mixins/_resize.scss +6 -0
  145. data/app/assets/stylesheets/bootstrap/mixins/_responsive-visibility.scss +21 -0
  146. data/app/assets/stylesheets/bootstrap/mixins/_size.scss +10 -0
  147. data/app/assets/stylesheets/bootstrap/mixins/_tab-focus.scss +9 -0
  148. data/app/assets/stylesheets/bootstrap/mixins/_table-row.scss +28 -0
  149. data/app/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +11 -0
  150. data/app/assets/stylesheets/bootstrap/mixins/_text-overflow.scss +8 -0
  151. data/app/assets/stylesheets/bootstrap/mixins/_vendor-prefixes.scss +222 -0
  152. data/app/assets/stylesheets/events/_event-list-item.scss +85 -0
  153. data/app/assets/stylesheets/events/_event_template.scss +66 -0
  154. data/app/assets/stylesheets/events/_filter-bar.scss +5 -0
  155. data/app/assets/stylesheets/festivity.scss +35 -0
  156. data/app/assets/stylesheets/skins/pghkids/_events.scss +17 -0
  157. data/app/assets/stylesheets/skins/pghkids/_footer.scss +22 -0
  158. data/app/assets/stylesheets/skins/pghkids/_global.scss +42 -0
  159. data/app/assets/stylesheets/skins/pghkids/_header.scss +27 -0
  160. data/app/assets/stylesheets/skins/pghkids/_home.scss +113 -0
  161. data/app/assets/stylesheets/skins/pghkids/skin.scss +8 -0
  162. data/app/assets/stylesheets/vars/_vars_color.scss +6 -0
  163. data/app/assets/stylesheets/vars/_vars_media-queries.scss +5 -0
  164. data/app/assets/stylesheets/vars/_vars_type.scss +1 -0
  165. data/app/controllers/admin/festivity_categories_controller.rb +31 -0
  166. data/app/controllers/admin/festivity_category_types_controller.rb +31 -0
  167. data/app/controllers/admin/festivity_performances_controller.rb +21 -0
  168. data/app/controllers/festivity_events_controller.rb +71 -0
  169. data/app/controllers/festivity_location_areas_controller.rb +17 -0
  170. data/app/controllers/festivity_locations_controller.rb +19 -0
  171. data/app/controllers/search_controller.rb +17 -0
  172. data/app/helpers/admin/festivity_performances_helper.rb +3 -0
  173. data/app/helpers/admin/snippets_helper.rb +3 -0
  174. data/app/helpers/festivity_events_helper.rb +12 -0
  175. data/app/helpers/festivity_locations_helper.rb +4 -0
  176. data/app/models/festivity_base_page.rb +23 -0
  177. data/app/models/festivity_category.rb +17 -0
  178. data/app/models/festivity_category_type.rb +14 -0
  179. data/app/models/festivity_event_list.rb +90 -0
  180. data/app/models/festivity_event_list/festivity_event.rb +40 -0
  181. data/app/models/festivity_event_list/festivity_event_performance.rb +10 -0
  182. data/app/models/festivity_event_list/festivity_location.rb +15 -0
  183. data/app/models/festivity_event_page.rb +55 -0
  184. data/app/models/festivity_location_area_page.rb +5 -0
  185. data/app/models/festivity_location_page.rb +3 -0
  186. data/app/models/festivity_market_page.rb +3 -0
  187. data/app/models/festivity_page_category.rb +4 -0
  188. data/app/models/festivity_performance.rb +29 -0
  189. data/app/views/admin/pages/_festivity_base_fields.html.haml +75 -0
  190. data/app/views/admin/pages/_festivity_featured_image_fields.html.haml +3 -0
  191. data/app/views/admin/pages/_festivity_includes.html.haml +2 -0
  192. data/app/views/admin/pages/_festivity_location_fields.html.haml +26 -0
  193. data/app/views/admin/pages/partials/_categories.html.haml +18 -0
  194. data/app/views/admin/pages/partials/_category.html.haml +4 -0
  195. data/app/views/admin/pages/partials/_featured_image.html.haml +18 -0
  196. data/app/views/admin/pages/partials/_performance.html.haml +13 -0
  197. data/app/views/admin/pages/partials/_performances.html.haml +11 -0
  198. data/app/views/admin/pages/partials/_performances_table.html.haml +15 -0
  199. data/app/views/admin/sites/_festivity_site_fields.html.haml +26 -0
  200. data/app/views/admin/sites/partials/_category.html.haml +7 -0
  201. data/app/views/admin/sites/partials/_category_popup.html.haml +19 -0
  202. data/app/views/admin/sites/partials/_category_popups.haml +27 -0
  203. data/app/views/admin/sites/partials/_category_section.html.haml +7 -0
  204. data/app/views/admin/sites/partials/_category_types.html.haml +23 -0
  205. data/app/views/admin/sites/partials/_filters.html.haml +25 -0
  206. data/app/views/admin/sites/partials/_new_category.html.haml +3 -0
  207. data/app/views/admin/sites/partials/_new_category_type.html.haml +3 -0
  208. data/app/views/festivity_events/_event_filters.html.haml +39 -0
  209. data/app/views/festivity_events/_event_list.html.haml +62 -0
  210. data/app/views/festivity_events/_filter_bar_mobile.html.haml +22 -0
  211. data/app/views/festivity_events/index.html.haml +34 -0
  212. data/app/views/festivity_events/show.html.haml +152 -0
  213. data/app/views/festivity_location_areas/show.html.haml +29 -0
  214. data/app/views/festivity_locations/show.html.haml +66 -0
  215. data/app/views/header/_meta_tags.html.haml +8 -0
  216. data/app/views/navigation/_subnav_one_column.html.haml +15 -0
  217. data/app/views/navigation/_subnav_three_column.html.haml +7 -0
  218. data/app/views/navigation/_three_column_item.html.haml +11 -0
  219. data/app/views/search/_page.html.haml +1 -0
  220. data/app/views/search/_pagination_links.html.haml +7 -0
  221. data/app/views/search/_result_item.html.haml +6 -0
  222. data/app/views/search/show.html.haml +19 -0
  223. data/config/initializers/pluralizations.rb +0 -0
  224. data/config/initializers/radiant_config.rb +1 -0
  225. data/config/locales/en.yml +16 -0
  226. data/config/routes.rb +14 -0
  227. data/config/trustygems.yml +2 -0
  228. data/db/content/layouts/base.html +174 -0
  229. data/db/content/layouts/normal.html +5 -0
  230. data/db/fixtures/home_pages.yml +40 -0
  231. data/db/fixtures/layouts.yml +2 -0
  232. data/db/fixtures/pages.yml +23 -0
  233. data/db/fixtures/sites.yml +57 -0
  234. data/db/fixtures/users.yml +8 -0
  235. data/db/migrate/200150325136087799_add_event_performances_view.rb +27 -0
  236. data/db/migrate/200150425136087799_update_event_performances_view_with_site.rb +27 -0
  237. data/db/migrate/20150123175758_add_site_fields.rb +15 -0
  238. data/db/migrate/20150127090858995_add_base_event_fields.rb +24 -0
  239. data/db/migrate/20150127091005232_add_market_and_event_fields.rb +29 -0
  240. data/db/migrate/20150204113325731_add_category_types_table.rb +15 -0
  241. data/db/migrate/20150204113427832_add_categories_table.rb +15 -0
  242. data/db/migrate/20150204113510326_add_page_categories_table.rb +12 -0
  243. data/db/migrate/20150226131727777_add_location_page_fields.rb +19 -0
  244. data/db/migrate/20150302135485569_add_performances_table.rb +19 -0
  245. data/db/migrate/20150324135487799_add_indexes.rb +21 -0
  246. data/festivity_extension.rb +25 -0
  247. data/lib/festivity/admin/assets_helper.rb +17 -0
  248. data/lib/festivity/engine.rb +9 -0
  249. data/lib/festivity/extensions/page_extensions.rb +61 -0
  250. data/lib/festivity/extensions/pages_helper_extensions.rb +11 -0
  251. data/lib/festivity/extensions/paperclipped_extensions.rb +22 -0
  252. data/lib/festivity/extensions/site_extensions.rb +40 -0
  253. data/lib/festivity/mixins/not_found.rb +10 -0
  254. data/lib/tags/header_tags.rb +41 -0
  255. data/lib/tags/navigation_tags.rb +55 -0
  256. data/lib/tasks/active_record_utils.rb +35 -0
  257. data/lib/tasks/festivity_extension_tasks.rake +7 -0
  258. data/lib/tasks/setup.rake +101 -0
  259. data/lib/trusty-festivity-extension.rb +8 -0
  260. data/trusty-festivity-extension.gemspec +37 -0
  261. metadata +442 -0
@@ -0,0 +1,59 @@
1
+ /* ========================================================================
2
+ * Bootstrap: transition.js v3.3.2
3
+ * http://getbootstrap.com/javascript/#transitions
4
+ * ========================================================================
5
+ * Copyright 2011-2015 Twitter, Inc.
6
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7
+ * ======================================================================== */
8
+
9
+
10
+ +function ($) {
11
+ 'use strict';
12
+
13
+ // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
14
+ // ============================================================
15
+
16
+ function transitionEnd() {
17
+ var el = document.createElement('bootstrap')
18
+
19
+ var transEndEventNames = {
20
+ WebkitTransition : 'webkitTransitionEnd',
21
+ MozTransition : 'transitionend',
22
+ OTransition : 'oTransitionEnd otransitionend',
23
+ transition : 'transitionend'
24
+ }
25
+
26
+ for (var name in transEndEventNames) {
27
+ if (el.style[name] !== undefined) {
28
+ return { end: transEndEventNames[name] }
29
+ }
30
+ }
31
+
32
+ return false // explicit for ie8 ( ._.)
33
+ }
34
+
35
+ // http://blog.alexmaccaw.com/css-transitions
36
+ $.fn.emulateTransitionEnd = function (duration) {
37
+ var called = false
38
+ var $el = this
39
+ $(this).one('bsTransitionEnd', function () { called = true })
40
+ var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
41
+ setTimeout(callback, duration)
42
+ return this
43
+ }
44
+
45
+ $(function () {
46
+ $.support.transition = transitionEnd()
47
+
48
+ if (!$.support.transition) return
49
+
50
+ $.event.special.bsTransitionEnd = {
51
+ bindType: $.support.transition.end,
52
+ delegateType: $.support.transition.end,
53
+ handle: function (e) {
54
+ if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
55
+ }
56
+ }
57
+ })
58
+
59
+ }(jQuery);
@@ -0,0 +1,3 @@
1
+ $(document).ready(function() {
2
+ Festivity.Filters.bindEvents();
3
+ });
@@ -0,0 +1,100 @@
1
+ Festivity.Filters = {
2
+ bindEvents: function() {
3
+ $(".date-filters input[type='checkbox'], .category-filters input[type='checkbox']").click(function(e){
4
+ if (e.target.checked == false) {
5
+ $("input[data-sort='" + $(e.target).attr("data-sort") + "']").removeAttr('checked');
6
+ }
7
+ else {
8
+ $("input[data-sort='" + $(e.target).attr("data-sort") + "']").attr('checked', true);
9
+ }
10
+ Festivity.Filters.queryEvents();
11
+ });
12
+
13
+ $("#clear-filters").click(function(e){
14
+ e.preventDefault();
15
+ $("input[type='checkbox']").removeAttr("checked");
16
+ Festivity.Filters.queryEvents();
17
+ });
18
+
19
+ $(".sort-control").change(function(e){
20
+ $(".sort-control").val(e.currentTarget.value);
21
+ Festivity.Filters.queryEvents();
22
+ });
23
+
24
+ $( document ).ajaxStart(function() {
25
+ $("i#spinner").removeClass('hide');
26
+ $('input[type="checkbox"]').attr('disabled', true);
27
+ $('select').attr('disabled', true);
28
+ });
29
+
30
+ $( document ).ajaxStop(function() {
31
+ $('input[type="checkbox"]').removeAttr('disabled');
32
+ $('select').removeAttr('disabled');
33
+ $("i#spinner").addClass('hide');
34
+ });
35
+ Festivity.Filters.bindListEvents();
36
+ Festivity.Filters.toggleClearButton();
37
+ Festivity.Filters.updateActiveFilters();
38
+ },
39
+
40
+ bindListEvents: function() {
41
+ // init popovers
42
+ $("[data-toggle=popover]").popover();
43
+ },
44
+
45
+ toggleClearButton: function() {
46
+ if($("input[type='checkbox']:checked").length > 0) {
47
+ $("#current-filters").removeClass("hide");
48
+ }
49
+ else {
50
+ $("#current-filters").addClass("hide");
51
+ }
52
+ },
53
+
54
+ queryEvents: function() {
55
+ var url = Festivity.Filters.eventsUrl();
56
+ history.pushState(null, "A new title!", url);
57
+ $.ajax({
58
+ url: url,
59
+ cache: false,
60
+ type: "GET",
61
+ success: function(data, textStatus, jqXHR){
62
+ $("#event-list-items").html(data);
63
+ Festivity.Filters.bindListEvents();
64
+ Festivity.Filters.toggleClearButton();
65
+ Festivity.Filters.updateActiveFilters();
66
+ }
67
+ });
68
+ },
69
+
70
+ updateActiveFilters: function() {
71
+ var filter_types = _.uniq(_.map($("input[type='checkbox']:checked"), Festivity.Filters.checkboxFilterType));
72
+ $("#current-filters-list").html(filter_types.join(", "))
73
+ },
74
+
75
+ eventsUrl: function() {
76
+ var dates = _.map($(".date-filters input[type='checkbox']:checked"), Festivity.Filters.checkboxValues);
77
+ var categories = _.map($(".category-filters input[type='checkbox']:checked"), Festivity.Filters.checkboxValues);
78
+ var sort_string = "?sort=" + $("#sort").val();
79
+ var params_string = Festivity.Filters.arrayToParams("dates", _.uniq(dates)) + Festivity.Filters.arrayToParams("categories", _.uniq(categories));
80
+ return $("#events-url").val() + sort_string + params_string;
81
+ },
82
+
83
+ checkboxValues: function(checkbox) {
84
+ return $(checkbox).val();
85
+ },
86
+
87
+ checkboxFilterType: function(checkbox) {
88
+ return $(checkbox).attr('data-filter');
89
+ },
90
+
91
+ arrayToParams: function(param, array) {
92
+ if (array.length > 0) {
93
+ return "&" + param + "=" + array.join(",");
94
+ }
95
+ else {
96
+ return "";
97
+ }
98
+ }
99
+
100
+ };
@@ -0,0 +1 @@
1
+ Festivity = {};
@@ -0,0 +1,13 @@
1
+ // Base and external Javascript libraries
2
+ //= require lodash.min
3
+ //= require jquery
4
+ //= require jquery-migrate.js
5
+ //= require bootstrap.min
6
+ //= require readmore.min
7
+ //= require underscore.js
8
+ //= require jasny-bootstrap.js
9
+ //= require jquery.collapse.js
10
+ //= require script
11
+ //= require festivity
12
+ //= require events/filters
13
+ //= require events/event_list_bindings
@@ -0,0 +1,1024 @@
1
+ /*!
2
+ * Jasny Bootstrap v3.1.3 (http://jasny.github.io/bootstrap)
3
+ * Copyright 2012-2014 Arnold Daniels
4
+ * Licensed under Apache-2.0 (https://github.com/jasny/bootstrap/blob/master/LICENSE)
5
+ */
6
+
7
+ if (typeof jQuery === 'undefined') { throw new Error('Jasny Bootstrap\'s JavaScript requires jQuery') }
8
+
9
+ /* ========================================================================
10
+ * Bootstrap: transition.js v3.1.3
11
+ * http://getbootstrap.com/javascript/#transitions
12
+ * ========================================================================
13
+ * Copyright 2011-2014 Twitter, Inc.
14
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
15
+ * ======================================================================== */
16
+
17
+
18
+ +function ($) {
19
+ 'use strict';
20
+
21
+ // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
22
+ // ============================================================
23
+
24
+ function transitionEnd() {
25
+ var el = document.createElement('bootstrap')
26
+
27
+ var transEndEventNames = {
28
+ WebkitTransition : 'webkitTransitionEnd',
29
+ MozTransition : 'transitionend',
30
+ OTransition : 'oTransitionEnd otransitionend',
31
+ transition : 'transitionend'
32
+ }
33
+
34
+ for (var name in transEndEventNames) {
35
+ if (el.style[name] !== undefined) {
36
+ return { end: transEndEventNames[name] }
37
+ }
38
+ }
39
+
40
+ return false // explicit for ie8 ( ._.)
41
+ }
42
+
43
+ if ($.support.transition !== undefined) return // Prevent conflict with Twitter Bootstrap
44
+
45
+ // http://blog.alexmaccaw.com/css-transitions
46
+ $.fn.emulateTransitionEnd = function (duration) {
47
+ var called = false, $el = this
48
+ $(this).one($.support.transition.end, function () { called = true })
49
+ var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
50
+ setTimeout(callback, duration)
51
+ return this
52
+ }
53
+
54
+ $(function () {
55
+ $.support.transition = transitionEnd()
56
+ })
57
+
58
+ }(window.jQuery);
59
+
60
+ /* ========================================================================
61
+ * Bootstrap: offcanvas.js v3.1.3
62
+ * http://jasny.github.io/bootstrap/javascript/#offcanvas
63
+ * ========================================================================
64
+ * Copyright 2013-2014 Arnold Daniels
65
+ *
66
+ * Licensed under the Apache License, Version 2.0 (the "License")
67
+ * you may not use this file except in compliance with the License.
68
+ * You may obtain a copy of the License at
69
+ *
70
+ * http://www.apache.org/licenses/LICENSE-2.0
71
+ *
72
+ * Unless required by applicable law or agreed to in writing, software
73
+ * distributed under the License is distributed on an "AS IS" BASIS,
74
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
75
+ * See the License for the specific language governing permissions and
76
+ * limitations under the License.
77
+ * ======================================================================== */
78
+
79
+ +function ($) { "use strict";
80
+
81
+ // OFFCANVAS PUBLIC CLASS DEFINITION
82
+ // =================================
83
+
84
+ var OffCanvas = function (element, options) {
85
+ this.$element = $(element)
86
+ this.options = $.extend({}, OffCanvas.DEFAULTS, options)
87
+ this.state = null
88
+ this.placement = null
89
+
90
+ if (this.options.recalc) {
91
+ this.calcClone()
92
+ $(window).on('resize', $.proxy(this.recalc, this))
93
+ }
94
+
95
+ if (this.options.autohide)
96
+ $(document).on('click', $.proxy(this.autohide, this))
97
+
98
+ if (this.options.toggle) this.toggle()
99
+
100
+ if (this.options.disablescrolling) {
101
+ this.options.disableScrolling = this.options.disablescrolling
102
+ delete this.options.disablescrolling
103
+ }
104
+ }
105
+
106
+ OffCanvas.DEFAULTS = {
107
+ toggle: true,
108
+ placement: 'auto',
109
+ autohide: true,
110
+ recalc: true,
111
+ disableScrolling: true
112
+ }
113
+
114
+ OffCanvas.prototype.offset = function () {
115
+ switch (this.placement) {
116
+ case 'left':
117
+ case 'right': return this.$element.outerWidth()
118
+ case 'top':
119
+ case 'bottom': return this.$element.outerHeight()
120
+ }
121
+ }
122
+
123
+ OffCanvas.prototype.calcPlacement = function () {
124
+ if (this.options.placement !== 'auto') {
125
+ this.placement = this.options.placement
126
+ return
127
+ }
128
+
129
+ if (!this.$element.hasClass('in')) {
130
+ this.$element.css('visiblity', 'hidden !important').addClass('in')
131
+ }
132
+
133
+ var horizontal = $(window).width() / this.$element.width()
134
+ var vertical = $(window).height() / this.$element.height()
135
+
136
+ var element = this.$element
137
+ function ab(a, b) {
138
+ if (element.css(b) === 'auto') return a
139
+ if (element.css(a) === 'auto') return b
140
+
141
+ var size_a = parseInt(element.css(a), 10)
142
+ var size_b = parseInt(element.css(b), 10)
143
+
144
+ return size_a > size_b ? b : a
145
+ }
146
+
147
+ this.placement = horizontal >= vertical ? ab('left', 'right') : ab('top', 'bottom')
148
+
149
+ if (this.$element.css('visibility') === 'hidden !important') {
150
+ this.$element.removeClass('in').css('visiblity', '')
151
+ }
152
+ }
153
+
154
+ OffCanvas.prototype.opposite = function (placement) {
155
+ switch (placement) {
156
+ case 'top': return 'bottom'
157
+ case 'left': return 'right'
158
+ case 'bottom': return 'top'
159
+ case 'right': return 'left'
160
+ }
161
+ }
162
+
163
+ OffCanvas.prototype.getCanvasElements = function() {
164
+ // Return a set containing the canvas plus all fixed elements
165
+ var canvas = this.options.canvas ? $(this.options.canvas) : this.$element
166
+
167
+ var fixed_elements = canvas.find('*').filter(function() {
168
+ return $(this).css('position') === 'fixed'
169
+ }).not(this.options.exclude)
170
+
171
+ return canvas.add(fixed_elements)
172
+ }
173
+
174
+ OffCanvas.prototype.slide = function (elements, offset, callback) {
175
+ // Use jQuery animation if CSS transitions aren't supported
176
+ if (!$.support.transition) {
177
+ var anim = {}
178
+ anim[this.placement] = "+=" + offset
179
+ return elements.animate(anim, 350, callback)
180
+ }
181
+
182
+ var placement = this.placement
183
+ var opposite = this.opposite(placement)
184
+
185
+ elements.each(function() {
186
+ if ($(this).css(placement) !== 'auto')
187
+ $(this).css(placement, (parseInt($(this).css(placement), 10) || 0) + offset)
188
+
189
+ if ($(this).css(opposite) !== 'auto')
190
+ $(this).css(opposite, (parseInt($(this).css(opposite), 10) || 0) - offset)
191
+ })
192
+
193
+ this.$element
194
+ .one($.support.transition.end, callback)
195
+ .emulateTransitionEnd(350)
196
+ }
197
+
198
+ OffCanvas.prototype.disableScrolling = function() {
199
+ var bodyWidth = $('body').width()
200
+ var prop = 'padding-' + this.opposite(this.placement)
201
+
202
+ if ($('body').data('offcanvas-style') === undefined) {
203
+ $('body').data('offcanvas-style', $('body').attr('style') || '')
204
+ }
205
+
206
+ $('body').css('overflow', 'hidden')
207
+
208
+ if ($('body').width() > bodyWidth) {
209
+ var padding = parseInt($('body').css(prop), 10) + $('body').width() - bodyWidth
210
+
211
+ setTimeout(function() {
212
+ $('body').css(prop, padding)
213
+ }, 1)
214
+ }
215
+ }
216
+
217
+ OffCanvas.prototype.show = function () {
218
+ if (this.state) return
219
+
220
+ var startEvent = $.Event('show.bs.offcanvas')
221
+ this.$element.trigger(startEvent)
222
+ if (startEvent.isDefaultPrevented()) return
223
+
224
+ this.state = 'slide-in'
225
+ this.calcPlacement();
226
+
227
+ var elements = this.getCanvasElements()
228
+ var placement = this.placement
229
+ var opposite = this.opposite(placement)
230
+ var offset = this.offset()
231
+
232
+ if (elements.index(this.$element) !== -1) {
233
+ $(this.$element).data('offcanvas-style', $(this.$element).attr('style') || '')
234
+ this.$element.css(placement, -1 * offset)
235
+ this.$element.css(placement); // Workaround: Need to get the CSS property for it to be applied before the next line of code
236
+ }
237
+
238
+ elements.addClass('canvas-sliding').each(function() {
239
+ if ($(this).data('offcanvas-style') === undefined) $(this).data('offcanvas-style', $(this).attr('style') || '')
240
+ if ($(this).css('position') === 'static') $(this).css('position', 'relative')
241
+ if (($(this).css(placement) === 'auto' || $(this).css(placement) === '0px') &&
242
+ ($(this).css(opposite) === 'auto' || $(this).css(opposite) === '0px')) {
243
+ $(this).css(placement, 0)
244
+ }
245
+ })
246
+
247
+ if (this.options.disableScrolling) this.disableScrolling()
248
+
249
+ var complete = function () {
250
+ if (this.state != 'slide-in') return
251
+
252
+ this.state = 'slid'
253
+
254
+ elements.removeClass('canvas-sliding').addClass('canvas-slid')
255
+ this.$element.trigger('shown.bs.offcanvas')
256
+ }
257
+
258
+ setTimeout($.proxy(function() {
259
+ this.$element.addClass('in')
260
+ this.slide(elements, offset, $.proxy(complete, this))
261
+ }, this), 1)
262
+ }
263
+
264
+ OffCanvas.prototype.hide = function (fast) {
265
+ if (this.state !== 'slid') return
266
+
267
+ var startEvent = $.Event('hide.bs.offcanvas')
268
+ this.$element.trigger(startEvent)
269
+ if (startEvent.isDefaultPrevented()) return
270
+
271
+ this.state = 'slide-out'
272
+
273
+ var elements = $('.canvas-slid')
274
+ var placement = this.placement
275
+ var offset = -1 * this.offset()
276
+
277
+ var complete = function () {
278
+ if (this.state != 'slide-out') return
279
+
280
+ this.state = null
281
+ this.placement = null
282
+
283
+ this.$element.removeClass('in')
284
+
285
+ elements.removeClass('canvas-sliding')
286
+ elements.add(this.$element).add('body').each(function() {
287
+ $(this).attr('style', $(this).data('offcanvas-style')).removeData('offcanvas-style')
288
+ })
289
+
290
+ this.$element.trigger('hidden.bs.offcanvas')
291
+ }
292
+
293
+ elements.removeClass('canvas-slid').addClass('canvas-sliding')
294
+
295
+ setTimeout($.proxy(function() {
296
+ this.slide(elements, offset, $.proxy(complete, this))
297
+ }, this), 1)
298
+ }
299
+
300
+ OffCanvas.prototype.toggle = function () {
301
+ if (this.state === 'slide-in' || this.state === 'slide-out') return
302
+ this[this.state === 'slid' ? 'hide' : 'show']()
303
+ }
304
+
305
+ OffCanvas.prototype.calcClone = function() {
306
+ this.$calcClone = this.$element.clone()
307
+ .html('')
308
+ .addClass('offcanvas-clone').removeClass('in')
309
+ .appendTo($('body'))
310
+ }
311
+
312
+ OffCanvas.prototype.recalc = function () {
313
+ if (this.$calcClone.css('display') === 'none' || (this.state !== 'slid' && this.state !== 'slide-in')) return
314
+
315
+ this.state = null
316
+ this.placement = null
317
+ var elements = this.getCanvasElements()
318
+
319
+ this.$element.removeClass('in')
320
+
321
+ elements.removeClass('canvas-slid')
322
+ elements.add(this.$element).add('body').each(function() {
323
+ $(this).attr('style', $(this).data('offcanvas-style')).removeData('offcanvas-style')
324
+ })
325
+ }
326
+
327
+ OffCanvas.prototype.autohide = function (e) {
328
+ if ($(e.target).closest(this.$element).length === 0) this.hide()
329
+ }
330
+
331
+ // OFFCANVAS PLUGIN DEFINITION
332
+ // ==========================
333
+
334
+ var old = $.fn.offcanvas
335
+
336
+ $.fn.offcanvas = function (option) {
337
+ return this.each(function () {
338
+ var $this = $(this)
339
+ var data = $this.data('bs.offcanvas')
340
+ var options = $.extend({}, OffCanvas.DEFAULTS, $this.data(), typeof option === 'object' && option)
341
+
342
+ if (!data) $this.data('bs.offcanvas', (data = new OffCanvas(this, options)))
343
+ if (typeof option === 'string') data[option]()
344
+ })
345
+ }
346
+
347
+ $.fn.offcanvas.Constructor = OffCanvas
348
+
349
+
350
+ // OFFCANVAS NO CONFLICT
351
+ // ====================
352
+
353
+ $.fn.offcanvas.noConflict = function () {
354
+ $.fn.offcanvas = old
355
+ return this
356
+ }
357
+
358
+
359
+ // OFFCANVAS DATA-API
360
+ // =================
361
+
362
+ $(document).on('click.bs.offcanvas.data-api', '[data-toggle=offcanvas]', function (e) {
363
+ var $this = $(this), href
364
+ var target = $this.attr('data-target')
365
+ || e.preventDefault()
366
+ || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
367
+ var $canvas = $(target)
368
+ var data = $canvas.data('bs.offcanvas')
369
+ var option = data ? 'toggle' : $this.data()
370
+
371
+ e.stopPropagation()
372
+
373
+ if (data) data.toggle()
374
+ else $canvas.offcanvas(option)
375
+ })
376
+
377
+ }(window.jQuery);
378
+
379
+ /* ============================================================
380
+ * Bootstrap: rowlink.js v3.1.3
381
+ * http://jasny.github.io/bootstrap/javascript/#rowlink
382
+ * ============================================================
383
+ * Copyright 2012-2014 Arnold Daniels
384
+ *
385
+ * Licensed under the Apache License, Version 2.0 (the "License");
386
+ * you may not use this file except in compliance with the License.
387
+ * You may obtain a copy of the License at
388
+ *
389
+ * http://www.apache.org/licenses/LICENSE-2.0
390
+ *
391
+ * Unless required by applicable law or agreed to in writing, software
392
+ * distributed under the License is distributed on an "AS IS" BASIS,
393
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
394
+ * See the License for the specific language governing permissions and
395
+ * limitations under the License.
396
+ * ============================================================ */
397
+
398
+ +function ($) { "use strict";
399
+
400
+ var Rowlink = function (element, options) {
401
+ this.$element = $(element)
402
+ this.options = $.extend({}, Rowlink.DEFAULTS, options)
403
+
404
+ this.$element.on('click.bs.rowlink', 'td:not(.rowlink-skip)', $.proxy(this.click, this))
405
+ }
406
+
407
+ Rowlink.DEFAULTS = {
408
+ target: "a"
409
+ }
410
+
411
+ Rowlink.prototype.click = function(e) {
412
+ var target = $(e.currentTarget).closest('tr').find(this.options.target)[0]
413
+ if ($(e.target)[0] === target) return
414
+
415
+ e.preventDefault();
416
+
417
+ if (target.click) {
418
+ target.click()
419
+ } else if (document.createEvent) {
420
+ var evt = document.createEvent("MouseEvents");
421
+ evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
422
+ target.dispatchEvent(evt);
423
+ }
424
+ }
425
+
426
+
427
+ // ROWLINK PLUGIN DEFINITION
428
+ // ===========================
429
+
430
+ var old = $.fn.rowlink
431
+
432
+ $.fn.rowlink = function (options) {
433
+ return this.each(function () {
434
+ var $this = $(this)
435
+ var data = $this.data('bs.rowlink')
436
+ if (!data) $this.data('bs.rowlink', (data = new Rowlink(this, options)))
437
+ })
438
+ }
439
+
440
+ $.fn.rowlink.Constructor = Rowlink
441
+
442
+
443
+ // ROWLINK NO CONFLICT
444
+ // ====================
445
+
446
+ $.fn.rowlink.noConflict = function () {
447
+ $.fn.rowlink = old
448
+ return this
449
+ }
450
+
451
+
452
+ // ROWLINK DATA-API
453
+ // ==================
454
+
455
+ $(document).on('click.bs.rowlink.data-api', '[data-link="row"]', function (e) {
456
+ if ($(e.target).closest('.rowlink-skip').length !== 0) return
457
+
458
+ var $this = $(this)
459
+ if ($this.data('bs.rowlink')) return
460
+ $this.rowlink($this.data())
461
+ $(e.target).trigger('click.bs.rowlink')
462
+ })
463
+
464
+ }(window.jQuery);
465
+
466
+ /* ===========================================================
467
+ * Bootstrap: inputmask.js v3.1.0
468
+ * http://jasny.github.io/bootstrap/javascript/#inputmask
469
+ *
470
+ * Based on Masked Input plugin by Josh Bush (digitalbush.com)
471
+ * ===========================================================
472
+ * Copyright 2012-2014 Arnold Daniels
473
+ *
474
+ * Licensed under the Apache License, Version 2.0 (the "License")
475
+ * you may not use this file except in compliance with the License.
476
+ * You may obtain a copy of the License at
477
+ *
478
+ * http://www.apache.org/licenses/LICENSE-2.0
479
+ *
480
+ * Unless required by applicable law or agreed to in writing, software
481
+ * distributed under the License is distributed on an "AS IS" BASIS,
482
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
483
+ * See the License for the specific language governing permissions and
484
+ * limitations under the License.
485
+ * ========================================================== */
486
+
487
+ +function ($) { "use strict";
488
+
489
+ var isIphone = (window.orientation !== undefined)
490
+ var isAndroid = navigator.userAgent.toLowerCase().indexOf("android") > -1
491
+ var isIE = window.navigator.appName == 'Microsoft Internet Explorer'
492
+
493
+ // INPUTMASK PUBLIC CLASS DEFINITION
494
+ // =================================
495
+
496
+ var Inputmask = function (element, options) {
497
+ if (isAndroid) return // No support because caret positioning doesn't work on Android
498
+
499
+ this.$element = $(element)
500
+ this.options = $.extend({}, Inputmask.DEFAULTS, options)
501
+ this.mask = String(this.options.mask)
502
+
503
+ this.init()
504
+ this.listen()
505
+
506
+ this.checkVal() //Perform initial check for existing values
507
+ }
508
+
509
+ Inputmask.DEFAULTS = {
510
+ mask: "",
511
+ placeholder: "_",
512
+ definitions: {
513
+ '9': "[0-9]",
514
+ 'a': "[A-Za-z]",
515
+ 'w': "[A-Za-z0-9]",
516
+ '*': "."
517
+ }
518
+ }
519
+
520
+ Inputmask.prototype.init = function() {
521
+ var defs = this.options.definitions
522
+ var len = this.mask.length
523
+
524
+ this.tests = []
525
+ this.partialPosition = this.mask.length
526
+ this.firstNonMaskPos = null
527
+
528
+ $.each(this.mask.split(""), $.proxy(function(i, c) {
529
+ if (c == '?') {
530
+ len--
531
+ this.partialPosition = i
532
+ } else if (defs[c]) {
533
+ this.tests.push(new RegExp(defs[c]))
534
+ if (this.firstNonMaskPos === null)
535
+ this.firstNonMaskPos = this.tests.length - 1
536
+ } else {
537
+ this.tests.push(null)
538
+ }
539
+ }, this))
540
+
541
+ this.buffer = $.map(this.mask.split(""), $.proxy(function(c, i) {
542
+ if (c != '?') return defs[c] ? this.options.placeholder : c
543
+ }, this))
544
+
545
+ this.focusText = this.$element.val()
546
+
547
+ this.$element.data("rawMaskFn", $.proxy(function() {
548
+ return $.map(this.buffer, function(c, i) {
549
+ return this.tests[i] && c != this.options.placeholder ? c : null
550
+ }).join('')
551
+ }, this))
552
+ }
553
+
554
+ Inputmask.prototype.listen = function() {
555
+ if (this.$element.attr("readonly")) return
556
+
557
+ var pasteEventName = (isIE ? 'paste' : 'input') + ".mask"
558
+
559
+ this.$element
560
+ .on("unmask.bs.inputmask", $.proxy(this.unmask, this))
561
+
562
+ .on("focus.bs.inputmask", $.proxy(this.focusEvent, this))
563
+ .on("blur.bs.inputmask", $.proxy(this.blurEvent, this))
564
+
565
+ .on("keydown.bs.inputmask", $.proxy(this.keydownEvent, this))
566
+ .on("keypress.bs.inputmask", $.proxy(this.keypressEvent, this))
567
+
568
+ .on(pasteEventName, $.proxy(this.pasteEvent, this))
569
+ }
570
+
571
+ //Helper Function for Caret positioning
572
+ Inputmask.prototype.caret = function(begin, end) {
573
+ if (this.$element.length === 0) return
574
+ if (typeof begin == 'number') {
575
+ end = (typeof end == 'number') ? end : begin
576
+ return this.$element.each(function() {
577
+ if (this.setSelectionRange) {
578
+ this.setSelectionRange(begin, end)
579
+ } else if (this.createTextRange) {
580
+ var range = this.createTextRange()
581
+ range.collapse(true)
582
+ range.moveEnd('character', end)
583
+ range.moveStart('character', begin)
584
+ range.select()
585
+ }
586
+ })
587
+ } else {
588
+ if (this.$element[0].setSelectionRange) {
589
+ begin = this.$element[0].selectionStart
590
+ end = this.$element[0].selectionEnd
591
+ } else if (document.selection && document.selection.createRange) {
592
+ var range = document.selection.createRange()
593
+ begin = 0 - range.duplicate().moveStart('character', -100000)
594
+ end = begin + range.text.length
595
+ }
596
+ return {
597
+ begin: begin,
598
+ end: end
599
+ }
600
+ }
601
+ }
602
+
603
+ Inputmask.prototype.seekNext = function(pos) {
604
+ var len = this.mask.length
605
+ while (++pos <= len && !this.tests[pos]);
606
+
607
+ return pos
608
+ }
609
+
610
+ Inputmask.prototype.seekPrev = function(pos) {
611
+ while (--pos >= 0 && !this.tests[pos]);
612
+
613
+ return pos
614
+ }
615
+
616
+ Inputmask.prototype.shiftL = function(begin,end) {
617
+ var len = this.mask.length
618
+
619
+ if (begin < 0) return
620
+
621
+ for (var i = begin, j = this.seekNext(end); i < len; i++) {
622
+ if (this.tests[i]) {
623
+ if (j < len && this.tests[i].test(this.buffer[j])) {
624
+ this.buffer[i] = this.buffer[j]
625
+ this.buffer[j] = this.options.placeholder
626
+ } else
627
+ break
628
+ j = this.seekNext(j)
629
+ }
630
+ }
631
+ this.writeBuffer()
632
+ this.caret(Math.max(this.firstNonMaskPos, begin))
633
+ }
634
+
635
+ Inputmask.prototype.shiftR = function(pos) {
636
+ var len = this.mask.length
637
+
638
+ for (var i = pos, c = this.options.placeholder; i < len; i++) {
639
+ if (this.tests[i]) {
640
+ var j = this.seekNext(i)
641
+ var t = this.buffer[i]
642
+ this.buffer[i] = c
643
+ if (j < len && this.tests[j].test(t))
644
+ c = t
645
+ else
646
+ break
647
+ }
648
+ }
649
+ },
650
+
651
+ Inputmask.prototype.unmask = function() {
652
+ this.$element
653
+ .unbind(".mask")
654
+ .removeData("inputmask")
655
+ }
656
+
657
+ Inputmask.prototype.focusEvent = function() {
658
+ this.focusText = this.$element.val()
659
+ var len = this.mask.length
660
+ var pos = this.checkVal()
661
+ this.writeBuffer()
662
+
663
+ var that = this
664
+ var moveCaret = function() {
665
+ if (pos == len)
666
+ that.caret(0, pos)
667
+ else
668
+ that.caret(pos)
669
+ }
670
+
671
+ moveCaret()
672
+ setTimeout(moveCaret, 50)
673
+ }
674
+
675
+ Inputmask.prototype.blurEvent = function() {
676
+ this.checkVal()
677
+ if (this.$element.val() !== this.focusText)
678
+ this.$element.trigger('change')
679
+ }
680
+
681
+ Inputmask.prototype.keydownEvent = function(e) {
682
+ var k = e.which
683
+
684
+ //backspace, delete, and escape get special treatment
685
+ if (k == 8 || k == 46 || (isIphone && k == 127)) {
686
+ var pos = this.caret(),
687
+ begin = pos.begin,
688
+ end = pos.end
689
+
690
+ if (end - begin === 0) {
691
+ begin = k != 46 ? this.seekPrev(begin) : (end = this.seekNext(begin - 1))
692
+ end = k == 46 ? this.seekNext(end) : end
693
+ }
694
+ this.clearBuffer(begin, end)
695
+ this.shiftL(begin, end - 1)
696
+
697
+ return false
698
+ } else if (k == 27) {//escape
699
+ this.$element.val(this.focusText)
700
+ this.caret(0, this.checkVal())
701
+ return false
702
+ }
703
+ }
704
+
705
+ Inputmask.prototype.keypressEvent = function(e) {
706
+ var len = this.mask.length
707
+
708
+ var k = e.which,
709
+ pos = this.caret()
710
+
711
+ if (e.ctrlKey || e.altKey || e.metaKey || k < 32) {//Ignore
712
+ return true
713
+ } else if (k) {
714
+ if (pos.end - pos.begin !== 0) {
715
+ this.clearBuffer(pos.begin, pos.end)
716
+ this.shiftL(pos.begin, pos.end - 1)
717
+ }
718
+
719
+ var p = this.seekNext(pos.begin - 1)
720
+ if (p < len) {
721
+ var c = String.fromCharCode(k)
722
+ if (this.tests[p].test(c)) {
723
+ this.shiftR(p)
724
+ this.buffer[p] = c
725
+ this.writeBuffer()
726
+ var next = this.seekNext(p)
727
+ this.caret(next)
728
+ }
729
+ }
730
+ return false
731
+ }
732
+ }
733
+
734
+ Inputmask.prototype.pasteEvent = function() {
735
+ var that = this
736
+
737
+ setTimeout(function() {
738
+ that.caret(that.checkVal(true))
739
+ }, 0)
740
+ }
741
+
742
+ Inputmask.prototype.clearBuffer = function(start, end) {
743
+ var len = this.mask.length
744
+
745
+ for (var i = start; i < end && i < len; i++) {
746
+ if (this.tests[i])
747
+ this.buffer[i] = this.options.placeholder
748
+ }
749
+ }
750
+
751
+ Inputmask.prototype.writeBuffer = function() {
752
+ return this.$element.val(this.buffer.join('')).val()
753
+ }
754
+
755
+ Inputmask.prototype.checkVal = function(allow) {
756
+ var len = this.mask.length
757
+ //try to place characters where they belong
758
+ var test = this.$element.val()
759
+ var lastMatch = -1
760
+
761
+ for (var i = 0, pos = 0; i < len; i++) {
762
+ if (this.tests[i]) {
763
+ this.buffer[i] = this.options.placeholder
764
+ while (pos++ < test.length) {
765
+ var c = test.charAt(pos - 1)
766
+ if (this.tests[i].test(c)) {
767
+ this.buffer[i] = c
768
+ lastMatch = i
769
+ break
770
+ }
771
+ }
772
+ if (pos > test.length)
773
+ break
774
+ } else if (this.buffer[i] == test.charAt(pos) && i != this.partialPosition) {
775
+ pos++
776
+ lastMatch = i
777
+ }
778
+ }
779
+ if (!allow && lastMatch + 1 < this.partialPosition) {
780
+ this.$element.val("")
781
+ this.clearBuffer(0, len)
782
+ } else if (allow || lastMatch + 1 >= this.partialPosition) {
783
+ this.writeBuffer()
784
+ if (!allow) this.$element.val(this.$element.val().substring(0, lastMatch + 1))
785
+ }
786
+ return (this.partialPosition ? i : this.firstNonMaskPos)
787
+ }
788
+
789
+
790
+ // INPUTMASK PLUGIN DEFINITION
791
+ // ===========================
792
+
793
+ var old = $.fn.inputmask
794
+
795
+ $.fn.inputmask = function (options) {
796
+ return this.each(function () {
797
+ var $this = $(this)
798
+ var data = $this.data('bs.inputmask')
799
+
800
+ if (!data) $this.data('bs.inputmask', (data = new Inputmask(this, options)))
801
+ })
802
+ }
803
+
804
+ $.fn.inputmask.Constructor = Inputmask
805
+
806
+
807
+ // INPUTMASK NO CONFLICT
808
+ // ====================
809
+
810
+ $.fn.inputmask.noConflict = function () {
811
+ $.fn.inputmask = old
812
+ return this
813
+ }
814
+
815
+
816
+ // INPUTMASK DATA-API
817
+ // ==================
818
+
819
+ $(document).on('focus.bs.inputmask.data-api', '[data-mask]', function (e) {
820
+ var $this = $(this)
821
+ if ($this.data('bs.inputmask')) return
822
+ $this.inputmask($this.data())
823
+ })
824
+
825
+ }(window.jQuery);
826
+
827
+ /* ===========================================================
828
+ * Bootstrap: fileinput.js v3.1.3
829
+ * http://jasny.github.com/bootstrap/javascript/#fileinput
830
+ * ===========================================================
831
+ * Copyright 2012-2014 Arnold Daniels
832
+ *
833
+ * Licensed under the Apache License, Version 2.0 (the "License")
834
+ * you may not use this file except in compliance with the License.
835
+ * You may obtain a copy of the License at
836
+ *
837
+ * http://www.apache.org/licenses/LICENSE-2.0
838
+ *
839
+ * Unless required by applicable law or agreed to in writing, software
840
+ * distributed under the License is distributed on an "AS IS" BASIS,
841
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
842
+ * See the License for the specific language governing permissions and
843
+ * limitations under the License.
844
+ * ========================================================== */
845
+
846
+ +function ($) { "use strict";
847
+
848
+ var isIE = window.navigator.appName == 'Microsoft Internet Explorer'
849
+
850
+ // FILEUPLOAD PUBLIC CLASS DEFINITION
851
+ // =================================
852
+
853
+ var Fileinput = function (element, options) {
854
+ this.$element = $(element)
855
+
856
+ this.$input = this.$element.find(':file')
857
+ if (this.$input.length === 0) return
858
+
859
+ this.name = this.$input.attr('name') || options.name
860
+
861
+ this.$hidden = this.$element.find('input[type=hidden][name="' + this.name + '"]')
862
+ if (this.$hidden.length === 0) {
863
+ this.$hidden = $('<input type="hidden">').insertBefore(this.$input)
864
+ }
865
+
866
+ this.$preview = this.$element.find('.fileinput-preview')
867
+ var height = this.$preview.css('height')
868
+ if (this.$preview.css('display') !== 'inline' && height !== '0px' && height !== 'none') {
869
+ this.$preview.css('line-height', height)
870
+ }
871
+
872
+ this.original = {
873
+ exists: this.$element.hasClass('fileinput-exists'),
874
+ preview: this.$preview.html(),
875
+ hiddenVal: this.$hidden.val()
876
+ }
877
+
878
+ this.listen()
879
+ }
880
+
881
+ Fileinput.prototype.listen = function() {
882
+ this.$input.on('change.bs.fileinput', $.proxy(this.change, this))
883
+ $(this.$input[0].form).on('reset.bs.fileinput', $.proxy(this.reset, this))
884
+
885
+ this.$element.find('[data-trigger="fileinput"]').on('click.bs.fileinput', $.proxy(this.trigger, this))
886
+ this.$element.find('[data-dismiss="fileinput"]').on('click.bs.fileinput', $.proxy(this.clear, this))
887
+ },
888
+
889
+ Fileinput.prototype.change = function(e) {
890
+ var files = e.target.files === undefined ? (e.target && e.target.value ? [{ name: e.target.value.replace(/^.+\\/, '')}] : []) : e.target.files
891
+
892
+ e.stopPropagation()
893
+
894
+ if (files.length === 0) {
895
+ this.clear()
896
+ return
897
+ }
898
+
899
+ this.$hidden.val('')
900
+ this.$hidden.attr('name', '')
901
+ this.$input.attr('name', this.name)
902
+
903
+ var file = files[0]
904
+
905
+ if (this.$preview.length > 0 && (typeof file.type !== "undefined" ? file.type.match(/^image\/(gif|png|jpeg)$/) : file.name.match(/\.(gif|png|jpe?g)$/i)) && typeof FileReader !== "undefined") {
906
+ var reader = new FileReader()
907
+ var preview = this.$preview
908
+ var element = this.$element
909
+
910
+ reader.onload = function(re) {
911
+ var $img = $('<img>')
912
+ $img[0].src = re.target.result
913
+ files[0].result = re.target.result
914
+
915
+ element.find('.fileinput-filename').text(file.name)
916
+
917
+ // if parent has max-height, using `(max-)height: 100%` on child doesn't take padding and border into account
918
+ if (preview.css('max-height') != 'none') $img.css('max-height', parseInt(preview.css('max-height'), 10) - parseInt(preview.css('padding-top'), 10) - parseInt(preview.css('padding-bottom'), 10) - parseInt(preview.css('border-top'), 10) - parseInt(preview.css('border-bottom'), 10))
919
+
920
+ preview.html($img)
921
+ element.addClass('fileinput-exists').removeClass('fileinput-new')
922
+
923
+ element.trigger('change.bs.fileinput', files)
924
+ }
925
+
926
+ reader.readAsDataURL(file)
927
+ } else {
928
+ this.$element.find('.fileinput-filename').text(file.name)
929
+ this.$preview.text(file.name)
930
+
931
+ this.$element.addClass('fileinput-exists').removeClass('fileinput-new')
932
+
933
+ this.$element.trigger('change.bs.fileinput')
934
+ }
935
+ },
936
+
937
+ Fileinput.prototype.clear = function(e) {
938
+ if (e) e.preventDefault()
939
+
940
+ this.$hidden.val('')
941
+ this.$hidden.attr('name', this.name)
942
+ this.$input.attr('name', '')
943
+
944
+ //ie8+ doesn't support changing the value of input with type=file so clone instead
945
+ if (isIE) {
946
+ var inputClone = this.$input.clone(true);
947
+ this.$input.after(inputClone);
948
+ this.$input.remove();
949
+ this.$input = inputClone;
950
+ } else {
951
+ this.$input.val('')
952
+ }
953
+
954
+ this.$preview.html('')
955
+ this.$element.find('.fileinput-filename').text('')
956
+ this.$element.addClass('fileinput-new').removeClass('fileinput-exists')
957
+
958
+ if (e !== undefined) {
959
+ this.$input.trigger('change')
960
+ this.$element.trigger('clear.bs.fileinput')
961
+ }
962
+ },
963
+
964
+ Fileinput.prototype.reset = function() {
965
+ this.clear()
966
+
967
+ this.$hidden.val(this.original.hiddenVal)
968
+ this.$preview.html(this.original.preview)
969
+ this.$element.find('.fileinput-filename').text('')
970
+
971
+ if (this.original.exists) this.$element.addClass('fileinput-exists').removeClass('fileinput-new')
972
+ else this.$element.addClass('fileinput-new').removeClass('fileinput-exists')
973
+
974
+ this.$element.trigger('reset.bs.fileinput')
975
+ },
976
+
977
+ Fileinput.prototype.trigger = function(e) {
978
+ this.$input.trigger('click')
979
+ e.preventDefault()
980
+ }
981
+
982
+
983
+ // FILEUPLOAD PLUGIN DEFINITION
984
+ // ===========================
985
+
986
+ var old = $.fn.fileinput
987
+
988
+ $.fn.fileinput = function (options) {
989
+ return this.each(function () {
990
+ var $this = $(this),
991
+ data = $this.data('bs.fileinput')
992
+ if (!data) $this.data('bs.fileinput', (data = new Fileinput(this, options)))
993
+ if (typeof options == 'string') data[options]()
994
+ })
995
+ }
996
+
997
+ $.fn.fileinput.Constructor = Fileinput
998
+
999
+
1000
+ // FILEINPUT NO CONFLICT
1001
+ // ====================
1002
+
1003
+ $.fn.fileinput.noConflict = function () {
1004
+ $.fn.fileinput = old
1005
+ return this
1006
+ }
1007
+
1008
+
1009
+ // FILEUPLOAD DATA-API
1010
+ // ==================
1011
+
1012
+ $(document).on('click.fileinput.data-api', '[data-provides="fileinput"]', function (e) {
1013
+ var $this = $(this)
1014
+ if ($this.data('bs.fileinput')) return
1015
+ $this.fileinput($this.data())
1016
+
1017
+ var $target = $(e.target).closest('[data-dismiss="fileinput"],[data-trigger="fileinput"]');
1018
+ if ($target.length > 0) {
1019
+ e.preventDefault()
1020
+ $target.trigger('click.bs.fileinput')
1021
+ }
1022
+ })
1023
+
1024
+ }(window.jQuery);