cd2_catton_cms 1.1.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (306) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +37 -0
  3. data/app/assets/config/c_manifest.js +2 -0
  4. data/app/assets/images/c/drag_handle.gif +0 -0
  5. data/app/assets/images/c/login_background.jpg +0 -0
  6. data/app/assets/images/c/main_application/hero.jpg +0 -0
  7. data/app/assets/images/c/main_application/search.png +0 -0
  8. data/app/assets/images/c/placeholder_product_image.png +0 -0
  9. data/app/assets/images/c/select_arrow_down_blk.png +0 -0
  10. data/app/assets/images/c/small_icon.png +0 -0
  11. data/app/assets/images/c/vendor/chosen-sprite.png +0 -0
  12. data/app/assets/javascripts/c/application.js +59 -0
  13. data/app/assets/javascripts/c/change_tag.js +49 -0
  14. data/app/assets/javascripts/c/chosen.js +2 -0
  15. data/app/assets/javascripts/c/confirm_delete.js +55 -0
  16. data/app/assets/javascripts/c/draggable_tree.js +223 -0
  17. data/app/assets/javascripts/c/dropzone_init.js +98 -0
  18. data/app/assets/javascripts/c/fake_table.js +87 -0
  19. data/app/assets/javascripts/c/master_form2/collection.js +180 -0
  20. data/app/assets/javascripts/c/master_form2/eu_cookie.js +1 -0
  21. data/app/assets/javascripts/c/master_form2/jrecord.js +116 -0
  22. data/app/assets/javascripts/c/master_form2/master_form.coffee +4 -0
  23. data/app/assets/javascripts/c/split_buttons.js.erb +15 -0
  24. data/app/assets/javascripts/c/things_to_be_done.js +138 -0
  25. data/app/assets/javascripts/c/unloadevent.js +35 -0
  26. data/app/assets/stylesheets/c/_core.sass +237 -0
  27. data/app/assets/stylesheets/c/_engine.sass +4 -0
  28. data/app/assets/stylesheets/c/_variables.sass +32 -0
  29. data/app/assets/stylesheets/c/_vendor.sass +6 -0
  30. data/app/assets/stylesheets/c/application/checkout/_cart.sass +85 -0
  31. data/app/assets/stylesheets/c/application/checkout/_checkout.sass +87 -0
  32. data/app/assets/stylesheets/c/application/elements/buttons.sass +34 -0
  33. data/app/assets/stylesheets/c/application/elements/forms.sass +135 -0
  34. data/app/assets/stylesheets/c/application/elements/shadows.sass +23 -0
  35. data/app/assets/stylesheets/c/application/partials/_breadcrumbs.sass +10 -0
  36. data/app/assets/stylesheets/c/application/partials/_categories_sidebars/_1.sass +53 -0
  37. data/app/assets/stylesheets/c/application/partials/_categories_sidebars/_2.sass +77 -0
  38. data/app/assets/stylesheets/c/application/partials/_footer.sass +43 -0
  39. data/app/assets/stylesheets/c/application/partials/_header.sass +317 -0
  40. data/app/assets/stylesheets/c/engine/_draggable_trees.sass +68 -0
  41. data/app/assets/stylesheets/c/engine/_form_pages.sass +153 -0
  42. data/app/assets/stylesheets/c/engine/_header_bar.sass +29 -0
  43. data/app/assets/stylesheets/c/engine/_index_header.sass +17 -0
  44. data/app/assets/stylesheets/c/engine/_layout.sass +15 -0
  45. data/app/assets/stylesheets/c/engine/_login.sass +38 -0
  46. data/app/assets/stylesheets/c/engine/_navbar.sass +19 -0
  47. data/app/assets/stylesheets/c/engine/_pagination.sass +16 -0
  48. data/app/assets/stylesheets/c/engine/_settings.sass +5 -0
  49. data/app/assets/stylesheets/c/engine/_sidebar.sass +20 -0
  50. data/app/assets/stylesheets/c/engine/_tables.sass +76 -0
  51. data/app/assets/stylesheets/c/engine/flash_messages.sass +2 -0
  52. data/app/assets/stylesheets/c/print_application.sass +167 -0
  53. data/app/assets/stylesheets/c/vendor/_flex_mixins.scss +394 -0
  54. data/app/assets/stylesheets/c/vendor/_normalize.sass +340 -0
  55. data/app/controllers/c/admin/blogs_controller.rb +57 -0
  56. data/app/controllers/c/admin/devise/passwords_controller.rb +5 -0
  57. data/app/controllers/c/admin/devise/sessions_controller.rb +5 -0
  58. data/app/controllers/c/admin/documents_controller.rb +50 -0
  59. data/app/controllers/c/admin/enquiries_controller.rb +22 -0
  60. data/app/controllers/c/admin/images_controller.rb +21 -0
  61. data/app/controllers/c/admin/locations_controller.rb +63 -0
  62. data/app/controllers/c/admin/menu_items_controller.rb +49 -0
  63. data/app/controllers/c/admin/pages_controller.rb +94 -0
  64. data/app/controllers/c/admin/projects_controller.rb +55 -0
  65. data/app/controllers/c/admin/redirects_controller.rb +55 -0
  66. data/app/controllers/c/admin/roles_controller.rb +49 -0
  67. data/app/controllers/c/admin/slides_controller.rb +50 -0
  68. data/app/controllers/c/admin/slideshows_controller.rb +34 -0
  69. data/app/controllers/c/admin/team_members_controller.rb +61 -0
  70. data/app/controllers/c/admin/testimonials_controller.rb +43 -0
  71. data/app/controllers/c/admin/users_controller.rb +51 -0
  72. data/app/controllers/c/admin_controller.rb +43 -0
  73. data/app/controllers/c/application_controller.rb +15 -0
  74. data/app/controllers/c/errors_controller.rb +12 -0
  75. data/app/controllers/c/front/devise/passwords_controller.rb +6 -0
  76. data/app/controllers/c/front/devise/registrations_controller.rb +32 -0
  77. data/app/controllers/c/front/devise/sessions_controller.rb +27 -0
  78. data/app/controllers/c/front/mailchimp_controller.rb +32 -0
  79. data/app/controllers/c/front_controller.rb +7 -0
  80. data/app/controllers/c/front_end/blogs_controller.rb +21 -0
  81. data/app/controllers/c/front_end/enquiries_controller.rb +32 -0
  82. data/app/controllers/c/front_end/pages_controller.rb +19 -0
  83. data/app/controllers/c/main_application_controller.rb +22 -0
  84. data/app/helpers/c/application_helper.rb +51 -0
  85. data/app/helpers/c/blogs_helper.rb +113 -0
  86. data/app/helpers/c/c_form_builder.rb +43 -0
  87. data/app/helpers/c/link_to_helper.rb +25 -0
  88. data/app/helpers/c/navigation_helper.rb +28 -0
  89. data/app/helpers/c/pages_helper.rb +27 -0
  90. data/app/helpers/c/storefront_helper.rb +63 -0
  91. data/app/mailers/c/application_mailer.rb +7 -0
  92. data/app/mailers/c/enquiries_mailer.rb +10 -0
  93. data/app/models/c/ability.rb +21 -0
  94. data/app/models/c/application_record.rb +6 -0
  95. data/app/models/c/author_record.rb +13 -0
  96. data/app/models/c/blog.rb +43 -0
  97. data/app/models/c/document.rb +17 -0
  98. data/app/models/c/enquiry.rb +95 -0
  99. data/app/models/c/image.rb +11 -0
  100. data/app/models/c/location.rb +18 -0
  101. data/app/models/c/menu_item.rb +35 -0
  102. data/app/models/c/non_delete.rb +10 -0
  103. data/app/models/c/page.rb +48 -0
  104. data/app/models/c/page_info.rb +16 -0
  105. data/app/models/c/permission.rb +9 -0
  106. data/app/models/c/permission_subject.rb +12 -0
  107. data/app/models/c/project.rb +20 -0
  108. data/app/models/c/redirect.rb +33 -0
  109. data/app/models/c/role.rb +18 -0
  110. data/app/models/c/slide.rb +16 -0
  111. data/app/models/c/slideshow.rb +23 -0
  112. data/app/models/c/team_member.rb +33 -0
  113. data/app/models/c/testimonial.rb +42 -0
  114. data/app/models/c/user.rb +42 -0
  115. data/app/models/c/user_role.rb +7 -0
  116. data/app/models/c/weight.rb +10 -0
  117. data/app/models/concerns/c/authorable.rb +18 -0
  118. data/app/models/concerns/c/documentable.rb +18 -0
  119. data/app/models/concerns/c/imageable.rb +49 -0
  120. data/app/models/concerns/c/non_deletable.rb +30 -0
  121. data/app/models/concerns/c/orderable.rb +30 -0
  122. data/app/models/concerns/c/previewable.rb +20 -0
  123. data/app/models/concerns/c/site_page.rb +89 -0
  124. data/app/uploaders/c/file_uploader.rb +9 -0
  125. data/app/uploaders/c/image_uploader.rb +39 -0
  126. data/app/views/c/admin/_background_jobs_dropdown.html.haml +18 -0
  127. data/app/views/c/admin/_bread_crumbs.html.haml +7 -0
  128. data/app/views/c/admin/_ebay_categories.html.haml +20 -0
  129. data/app/views/c/admin/_flash_messages.html.haml +5 -0
  130. data/app/views/c/admin/_header_bar.html.haml +18 -0
  131. data/app/views/c/admin/_index_table.html.haml +113 -0
  132. data/app/views/c/admin/_index_table_data.html.haml +17 -0
  133. data/app/views/c/admin/_navigation_bar.html.haml +1 -0
  134. data/app/views/c/admin/_preview_image.html.haml +2 -0
  135. data/app/views/c/admin/_preview_upload.html.haml +18 -0
  136. data/app/views/c/admin/_seo.html.haml +11 -0
  137. data/app/views/c/admin/_side_menu.html.haml +26 -0
  138. data/app/views/c/admin/_uploaded_images_new.html.haml +13 -0
  139. data/app/views/c/admin/blogs/_form.html.haml +58 -0
  140. data/app/views/c/admin/blogs/index.html.haml +9 -0
  141. data/app/views/c/admin/confirm_destroy.html.haml +6 -0
  142. data/app/views/c/admin/confirm_mass_destroy.html.haml +10 -0
  143. data/app/views/c/admin/documents/_form.html.haml +8 -0
  144. data/app/views/c/admin/documents/index.html.haml +9 -0
  145. data/app/views/c/admin/edit.html.haml +15 -0
  146. data/app/views/c/admin/enquiries/index.html.haml +14 -0
  147. data/app/views/c/admin/locations/_form.html.haml +58 -0
  148. data/app/views/c/admin/locations/index.html.haml +9 -0
  149. data/app/views/c/admin/menu_items/_form.html.haml +44 -0
  150. data/app/views/c/admin/menu_items/_menu_item_list_item.html.haml +10 -0
  151. data/app/views/c/admin/menu_items/index.html.haml +10 -0
  152. data/app/views/c/admin/new.html.haml +8 -0
  153. data/app/views/c/admin/pages/_form.html.haml +93 -0
  154. data/app/views/c/admin/pages/_page_list_item.html.haml +10 -0
  155. data/app/views/c/admin/pages/dashboard.html.erb +0 -0
  156. data/app/views/c/admin/pages/index.html.haml +11 -0
  157. data/app/views/c/admin/projects/_form.html.haml +46 -0
  158. data/app/views/c/admin/projects/index.html.haml +9 -0
  159. data/app/views/c/admin/quick_edit.js.erb +6 -0
  160. data/app/views/c/admin/redirects/_form.html.haml +14 -0
  161. data/app/views/c/admin/redirects/index.html.haml +9 -0
  162. data/app/views/c/admin/reload_images.js.erb +2 -0
  163. data/app/views/c/admin/roles/_form.html.haml +42 -0
  164. data/app/views/c/admin/roles/index.html.haml +17 -0
  165. data/app/views/c/admin/set_preview_image.js.erb +1 -0
  166. data/app/views/c/admin/show.html.haml +1 -0
  167. data/app/views/c/admin/slides/_form.html.haml +19 -0
  168. data/app/views/c/admin/slideshows/_form.html.haml +25 -0
  169. data/app/views/c/admin/slideshows/index.html.haml +8 -0
  170. data/app/views/c/admin/team_members/_form.html.haml +20 -0
  171. data/app/views/c/admin/team_members/index.html.haml +10 -0
  172. data/app/views/c/admin/testimonials/_form.html.haml +13 -0
  173. data/app/views/c/admin/testimonials/index.html.haml +8 -0
  174. data/app/views/c/admin/users/_form.html.haml +17 -0
  175. data/app/views/c/admin/users/index.html.haml +12 -0
  176. data/app/views/c/enquiries_mailer/new_enquiry.html.haml +14 -0
  177. data/app/views/c/enquiries_mailer/new_enquiry.text.haml +9 -0
  178. data/app/views/c/errors/404.html.haml +5 -0
  179. data/app/views/c/errors/500.html.haml +5 -0
  180. data/app/views/c/front/application/_category_item.html.haml +2 -0
  181. data/app/views/c/front/application/_menu_item.html.haml +4 -0
  182. data/app/views/c/front/application/_sales_highlight.html.haml +1 -0
  183. data/app/views/c/front/application/_slide.html.haml +6 -0
  184. data/app/views/c/front/blogs/_archive_filter_month.html.haml +2 -0
  185. data/app/views/c/front/blogs/_archive_filter_year.html.haml +1 -0
  186. data/app/views/c/front/blogs/_menu_item.html.haml +2 -0
  187. data/app/views/c/front_end/enquiries/new.html.haml +23 -0
  188. data/app/views/c/front_end/enquiries/thanks.html.haml +5 -0
  189. data/app/views/c/front_end/pages/_sales_highlight.html.haml +7 -0
  190. data/app/views/c/front_end/pages/about.html.haml +8 -0
  191. data/app/views/c/front_end/pages/home.html.haml +19 -0
  192. data/app/views/c/front_end/pages/search.html.haml +16 -0
  193. data/app/views/c/front_end/pages/show.html.haml +7 -0
  194. data/app/views/c/front_end/pages/sitemap.xml.builder +25 -0
  195. data/app/views/c/mailchimp/_signup_newsletter.html.haml +4 -0
  196. data/app/views/c/main_application/_application_bar.html.haml +22 -0
  197. data/app/views/c/main_application/_breadcrumbs.html.haml +7 -0
  198. data/app/views/c/main_application/_contact_info.html.haml +5 -0
  199. data/app/views/c/main_application/_footer.html.haml +49 -0
  200. data/app/views/c/main_application/_front_head_tags.html.haml +3 -0
  201. data/app/views/c/main_application/_header.html.haml +55 -0
  202. data/app/views/c/main_application/_site_search.html.haml +3 -0
  203. data/app/views/c/main_application/_yield.html.haml +5 -0
  204. data/app/views/devise/confirmations/new.html.erb +16 -0
  205. data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  206. data/app/views/devise/mailer/password_change.html.erb +3 -0
  207. data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  208. data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  209. data/app/views/devise/passwords/edit.html.haml +26 -0
  210. data/app/views/devise/passwords/new.html.haml +14 -0
  211. data/app/views/devise/registrations/edit.html.haml +40 -0
  212. data/app/views/devise/registrations/new.html.haml +24 -0
  213. data/app/views/devise/sessions/new.html.haml +20 -0
  214. data/app/views/devise/shared/_links.html.erb +25 -0
  215. data/app/views/devise/unlocks/new.html.erb +16 -0
  216. data/app/views/layouts/c/application.html.haml +18 -0
  217. data/app/views/layouts/c/cms_login_layout.html.haml +18 -0
  218. data/app/views/layouts/c/mailer.html.erb +245 -0
  219. data/app/views/layouts/c/mailer.text.erb +3 -0
  220. data/app/views/layouts/c/main_application.html.haml +13 -0
  221. data/config/environment.rb +0 -0
  222. data/config/initializers/carrierwave.rb +18 -0
  223. data/config/initializers/devise.rb +283 -0
  224. data/config/initializers/rack_profiler.rb +8 -0
  225. data/config/locales/devise.en.yml +62 -0
  226. data/config/locales/en.yml +17 -0
  227. data/config/routes.rb +150 -0
  228. data/db/migrate/20160819000000_migrate_schema.rb +273 -0
  229. data/db/seed_data/countries.txt +227 -0
  230. data/lib/c/engine.rb +38 -0
  231. data/lib/c/version.rb +4 -0
  232. data/lib/cd2_catton_cms.rb +51 -0
  233. data/lib/tasks/c_tasks.rake +28 -0
  234. data/spec/dummy/Gemfile +4 -0
  235. data/spec/dummy/Gemfile.lock +20 -0
  236. data/spec/dummy/Rakefile +6 -0
  237. data/spec/dummy/app/assets/config/manifest.js +5 -0
  238. data/spec/dummy/app/assets/images/placeholder.png +0 -0
  239. data/spec/dummy/app/assets/javascripts/application.js +26 -0
  240. data/spec/dummy/app/assets/javascripts/cable.js +13 -0
  241. data/spec/dummy/app/assets/javascripts/pages.coffee +3 -0
  242. data/spec/dummy/app/assets/stylesheets/application.sass +13 -0
  243. data/spec/dummy/app/assets/stylesheets/c/application.sass +2 -0
  244. data/spec/dummy/app/controllers/application_controller.rb +10 -0
  245. data/spec/dummy/app/controllers/blogs_controller.rb +11 -0
  246. data/spec/dummy/app/controllers/pages_controller.rb +13 -0
  247. data/spec/dummy/app/models/application_record.rb +4 -0
  248. data/spec/dummy/app/models/page.rb +3 -0
  249. data/spec/dummy/bin/bundle +4 -0
  250. data/spec/dummy/bin/rails +5 -0
  251. data/spec/dummy/bin/rake +5 -0
  252. data/spec/dummy/bin/setup +35 -0
  253. data/spec/dummy/bin/update +30 -0
  254. data/spec/dummy/config/application.rb +17 -0
  255. data/spec/dummy/config/boot.rb +6 -0
  256. data/spec/dummy/config/cable.yml +9 -0
  257. data/spec/dummy/config/database.travis.yml +3 -0
  258. data/spec/dummy/config/database.yml +85 -0
  259. data/spec/dummy/config/environment.rb +6 -0
  260. data/spec/dummy/config/environments/development.rb +61 -0
  261. data/spec/dummy/config/environments/production.rb +87 -0
  262. data/spec/dummy/config/environments/test.rb +43 -0
  263. data/spec/dummy/config/initializers/application_controller_renderer.rb +7 -0
  264. data/spec/dummy/config/initializers/assets.rb +21 -0
  265. data/spec/dummy/config/initializers/backtrace_silencers.rb +8 -0
  266. data/spec/dummy/config/initializers/carrierwave.rb +15 -0
  267. data/spec/dummy/config/initializers/commercity.rb +4 -0
  268. data/spec/dummy/config/initializers/cookies_serializer.rb +6 -0
  269. data/spec/dummy/config/initializers/filter_parameter_logging.rb +5 -0
  270. data/spec/dummy/config/initializers/inflections.rb +17 -0
  271. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  272. data/spec/dummy/config/initializers/new_framework_defaults.rb +25 -0
  273. data/spec/dummy/config/initializers/session_store.rb +4 -0
  274. data/spec/dummy/config/initializers/wrap_parameters.rb +15 -0
  275. data/spec/dummy/config/locales/en.yml +23 -0
  276. data/spec/dummy/config/puma.rb +48 -0
  277. data/spec/dummy/config/routes.rb +4 -0
  278. data/spec/dummy/config/secrets.yml +22 -0
  279. data/spec/dummy/config/sidekiq.yml +6 -0
  280. data/spec/dummy/config/spring.rb +7 -0
  281. data/spec/dummy/config.ru +5 -0
  282. data/spec/dummy/db/schema.rb +1110 -0
  283. data/spec/dummy/lib/tasks/reprocess_images.rake +12 -0
  284. data/spec/dummy/lib/tasks/reset_all.rake +44 -0
  285. data/spec/dummy/lib/tasks/seeds/seed_blogs.rake +8 -0
  286. data/spec/dummy/lib/tasks/seeds/seed_pages.rake +24 -0
  287. data/spec/dummy/public/404.html +67 -0
  288. data/spec/dummy/public/422.html +67 -0
  289. data/spec/dummy/public/500.html +66 -0
  290. data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
  291. data/spec/dummy/public/apple-touch-icon.png +0 -0
  292. data/spec/dummy/public/favicon.ico +0 -0
  293. data/spec/dummy/seed/highlight1.png +0 -0
  294. data/spec/dummy/seed/highlight2.png +0 -0
  295. data/spec/dummy/seed/images/1/main.jpg +0 -0
  296. data/spec/dummy/seed/images/1/thumb.JPG +0 -0
  297. data/spec/dummy/seed/images/1/thumb2.jpg +0 -0
  298. data/spec/dummy/seed/images/2/main.jpeg +0 -0
  299. data/spec/dummy/seed/images/2/thumb.JPG +0 -0
  300. data/spec/dummy/seed/images/2/thumb2.JPG +0 -0
  301. data/spec/dummy/spec/models/redirect_spec.rb +57 -0
  302. data/spec/dummy/spec/support/factory_girl.rb +8 -0
  303. data/spec/dummy/spec/support/seed/images/product_image.png +0 -0
  304. data/spec/rails_helper.rb +49 -0
  305. data/spec/spec_helper.rb +52 -0
  306. metadata +734 -0
@@ -0,0 +1,87 @@
1
+ (function(){
2
+
3
+ $.fakeTable = {
4
+ prefix: 'f_',
5
+ errors: true,
6
+ table_parts: 'thead, tbody, tr, th, td',
7
+ include_sub_tables: false,
8
+ element: 'div'
9
+ }
10
+
11
+ $.fn.fakeTable = function(opts){
12
+ var opts = opts || {}
13
+ opts = $.extend({}, $.fakeTable, opts);
14
+
15
+ if (opts['include_sub_tables']) {
16
+ opts['table_parts'] += ', table'
17
+ }
18
+
19
+ return this.each(function() {
20
+
21
+ if (!$(this).is('table')) {
22
+ if (opts['errors']) console.error('Not a table');
23
+ return;
24
+ };
25
+
26
+ $(this).find('[data-f-dropdown]').addClass('f_dropdown_closed').changeTag('div', function(elem){
27
+
28
+ $(this).addClass('f_dropdown_container');
29
+
30
+ $(this).children('td').changeTag('div', function(){
31
+ $(this).addClass(opts['prefix'] + 'dropdown_column');
32
+ });
33
+
34
+
35
+ $(this).wrapInner('<div class="f_dropdown_container_inner">')
36
+ });
37
+
38
+
39
+
40
+ $(this).find(opts['table_parts']).changeTag(opts['element'], function(oldElem){
41
+ var oldTagName = oldElem.tagName.toLowerCase();
42
+ $(this).addClass(opts['prefix'] + oldTagName);
43
+ });
44
+
45
+ $('[data-f-dropdown-trigger]').on('click', function(){
46
+ var dropdownName = $(this).data('f-dropdown-trigger');
47
+ $('[data-f-dropdown=' + dropdownName + ']').toggleClass('f_dropdown_closed')
48
+ });
49
+
50
+
51
+ x = $(this).changeTag(opts['element'], function(oldElem){
52
+ var oldTagName = oldElem.tagName.toLowerCase();
53
+ $(this).addClass(opts['prefix'] + oldTagName);
54
+
55
+ $(this).on('fake_table_update', tableUpdate)
56
+
57
+ }).trigger('fake_table_update');
58
+
59
+ $(window).on('resize', function(){
60
+ $(x).trigger('fake_table_update');
61
+ });
62
+
63
+ });
64
+
65
+
66
+ function tableUpdate() {
67
+ console.log("HI")
68
+ $(this).find('.f_dropdown_container_inner').width($(this).width())
69
+
70
+ //set dropdown container height to match the tallest child
71
+ var tallestChild = 0;
72
+ $(this).find('.f_dropdown_column').each(function(){
73
+ console.log(this, $(this).height());
74
+ tallestChild = (tallestChild > $(this).height())? tallestChild : $(this).height();
75
+ });
76
+
77
+ //set dropdown widths to match the table
78
+ $(this).find('.f_dropdown_container, .f_dropdown_container_inner').height(tallestChild);
79
+
80
+ }
81
+
82
+
83
+
84
+ }
85
+
86
+
87
+ })(jQuery);
@@ -0,0 +1,180 @@
1
+ var Collection,
2
+ indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
3
+ slice = [].slice;
4
+
5
+ Collection = (function() {
6
+ Collection.has_many = function(owner, record, ids) {
7
+ var collection;
8
+ collection = new Collection(record);
9
+ collection._set_owner(owner);
10
+ collection.assign_attrs_or_ids(ids);
11
+ return collection;
12
+ };
13
+
14
+ function Collection(record, attrs_or_ids) {
15
+ this._record = record;
16
+ this._ids = [];
17
+ if (attrs_or_ids) {
18
+ this.assign_attrs_or_ids(attrs_or_ids);
19
+ }
20
+ }
21
+
22
+ Collection.prototype.assign_attrs_or_ids = function(attrs_or_ids) {
23
+ var attr, i, len, results;
24
+ if (attrs_or_ids == null) {
25
+ attrs_or_ids = [];
26
+ }
27
+ if (!Array.isArray(attrs_or_ids)) {
28
+ attrs_or_ids = [attrs_or_ids];
29
+ }
30
+ if (attrs_or_ids.length > 0) {
31
+ if (typeof attrs_or_ids[0] === 'object') {
32
+ results = [];
33
+ for (i = 0, len = attrs_or_ids.length; i < len; i++) {
34
+ attr = attrs_or_ids[i];
35
+ results.push(this.create(attr));
36
+ }
37
+ return results;
38
+ } else {
39
+ return this._ids = attrs_or_ids;
40
+ }
41
+ }
42
+ };
43
+
44
+ Collection.prototype.create = function(args) {
45
+ var record;
46
+ if (args == null) {
47
+ args = {};
48
+ }
49
+ if (this._owner != null) {
50
+ args[this._owner_name + "_index"] = this._owner.index;
51
+ args["" + this._owner_name] = this._owner;
52
+ }
53
+ record = this._record["new"](args);
54
+ this._ids.push(record.index);
55
+ return record;
56
+ };
57
+
58
+ Collection.prototype.all = function() {
59
+ return this;
60
+ };
61
+
62
+ Collection.prototype.any = function() {
63
+ return this._ids.length > 0;
64
+ };
65
+
66
+ Collection.prototype.find = function(id) {
67
+ if (indexOf.call(this._ids, id) >= 0) {
68
+ return this._record.find(id);
69
+ }
70
+ };
71
+
72
+ Collection.prototype.first = function() {
73
+ return this.find(this._ids[0]);
74
+ };
75
+
76
+ Collection.prototype.last = function() {
77
+ return this.find(this._ids[this._ids.length - 1]);
78
+ };
79
+
80
+ Collection.prototype.each = function(callback) {
81
+ var i, id, len, ref, results;
82
+ ref = this._ids;
83
+ results = [];
84
+ for (i = 0, len = ref.length; i < len; i++) {
85
+ id = ref[i];
86
+ results.push(typeof callback === "function" ? callback(this.find(id)) : void 0);
87
+ }
88
+ return results;
89
+ };
90
+
91
+ Collection.prototype.select = function() {
92
+ var attr, attrs, data, i, id, j, len, len1, record, ref, results;
93
+ attrs = 1 <= arguments.length ? slice.call(arguments, 0) : [];
94
+ ref = this._ids;
95
+ results = [];
96
+ for (i = 0, len = ref.length; i < len; i++) {
97
+ id = ref[i];
98
+ record = this.find(id);
99
+ data = {};
100
+ for (j = 0, len1 = attrs.length; j < len1; j++) {
101
+ attr = attrs[j];
102
+ data[attr] = record[attr];
103
+ }
104
+ results.push(data);
105
+ }
106
+ return results;
107
+ };
108
+
109
+ Collection.prototype.pluck = function() {
110
+ var attr, attrs, data, id;
111
+ attrs = 1 <= arguments.length ? slice.call(arguments, 0) : [];
112
+ data = (function() {
113
+ var i, len, ref, results;
114
+ ref = this._ids;
115
+ results = [];
116
+ for (i = 0, len = ref.length; i < len; i++) {
117
+ id = ref[i];
118
+ results.push((function() {
119
+ var j, len1, results1;
120
+ results1 = [];
121
+ for (j = 0, len1 = attrs.length; j < len1; j++) {
122
+ attr = attrs[j];
123
+ results1.push(this.find(id)[attr]);
124
+ }
125
+ return results1;
126
+ }).call(this));
127
+ }
128
+ return results;
129
+ }).call(this);
130
+ if (attrs.length === 1) {
131
+ return [].concat.apply([], data);
132
+ } else {
133
+ return data;
134
+ }
135
+ };
136
+
137
+ Collection.prototype.where = function(cond) {
138
+ var id, ids;
139
+ ids = (function() {
140
+ var i, len, ref, results;
141
+ ref = this._ids;
142
+ results = [];
143
+ for (i = 0, len = ref.length; i < len; i++) {
144
+ id = ref[i];
145
+ if (this.find(id).is(cond)) {
146
+ results.push(id);
147
+ }
148
+ }
149
+ return results;
150
+ }).call(this);
151
+ return new Collection(this._record, ids);
152
+ };
153
+
154
+ Collection.prototype.update_all = function(attrs) {
155
+ return this.each(function(record) {
156
+ return record.assign_attributes(attrs);
157
+ });
158
+ };
159
+
160
+ Collection.prototype.to_a = function() {
161
+ var i, id, len, ref, results;
162
+ ref = this._ids;
163
+ results = [];
164
+ for (i = 0, len = ref.length; i < len; i++) {
165
+ id = ref[i];
166
+ results.push(this.find(id));
167
+ }
168
+ return results;
169
+ };
170
+
171
+ Collection.prototype._set_owner = function(owner) {
172
+ this._owner = owner;
173
+ return this._owner_name = owner.constructor.name.toLowerCase();
174
+ };
175
+
176
+ return Collection;
177
+
178
+ })();
179
+
180
+ window.Collection = Collection;
@@ -0,0 +1 @@
1
+ !function(){if(!window.hasCookieConsent){window.hasCookieConsent=!0;var e="cookieconsent_options",t="update_cookieconsent_options",n="cookieconsent_dismissed",i="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/1.0.10/";if(!(document.cookie.indexOf(n)>-1||window.navigator&&window.navigator.CookiesOK)){"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});var o,s={isArray:function(e){var t=Object.prototype.toString.call(e);return"[object Array]"==t},isObject:function(e){return"[object Object]"==Object.prototype.toString.call(e)},each:function(e,t,n,i){if(s.isObject(e)&&!i)for(var o in e)e.hasOwnProperty(o)&&t.call(n,e[o],o,e);else for(var r=0,a=e.length;a>r;r++)t.call(n,e[r],r,e)},merge:function(e,t){e&&s.each(t,function(t,n){s.isObject(t)&&s.isObject(e[n])?s.merge(e[n],t):e[n]=t})},bind:function(e,t){return function(){return e.apply(t,arguments)}},queryObject:function(e,t){var n,i=0,o=e;for(t=t.split(".");(n=t[i++])&&o.hasOwnProperty(n)&&(o=o[n]);)if(i===t.length)return o;return null},setCookie:function(e,t,n,i,o){n=n||365;var s=new Date;s.setDate(s.getDate()+n);var r=[e+"="+t,"expires="+s.toUTCString(),"path="+o||"/"];i&&r.push("domain="+i),document.cookie=r.join(";")},addEventListener:function(e,t,n){e.addEventListener?e.addEventListener(t,n):e.attachEvent("on"+t,n)}},r=function(){var e="data-cc-event",t="data-cc-if",n=function(e,t,i){return s.isArray(t)?s.each(t,function(t){n(e,t,i)}):void(e.addEventListener?e.addEventListener(t,i):e.attachEvent("on"+t,i))},i=function(e,t){return e.replace(/\{\{(.*?)\}\}/g,function(e,n){for(var i,o,r=n.split("||");o=r.shift();){if(o=o.trim(),'"'===o[0])return o.slice(1,o.length-1);if(i=s.queryObject(t,o))return i}return""})},o=function(e){var t=document.createElement("div");return t.innerHTML=e,t.children[0]},r=function(e,t,n){var i=e.parentNode.querySelectorAll("["+t+"]");s.each(i,function(e){var i=e.getAttribute(t);n(e,i)},window,!0)},a=function(t,i){r(t,e,function(e,t){var o=t.split(":"),r=s.queryObject(i,o[1]);n(e,o[0],s.bind(r,i))})},c=function(e,n){r(e,t,function(e,t){var i=s.queryObject(n,t);i||e.parentNode.removeChild(e)})};return{build:function(e,t){s.isArray(e)&&(e=e.join("")),e=i(e,t);var n=o(e);return a(n,t),c(n,t),n}}}(),a={options:{message:"This website uses cookies to ensure you get the best experience on our website. ",dismiss:"Got it!",learnMore:"More info",link:null,target:"_self",container:null,theme:"light-floating",domain:null,path:"/",expiryDays:365,markup:['<div class="cc_banner-wrapper {{containerClasses}}">','<div class="cc_banner cc_container cc_container--open">','<a href="#null" data-cc-event="click:dismiss" target="_blank" class="cc_btn cc_btn_accept_all">{{options.dismiss}}</a>','<p class="cc_message">{{options.message}} <a data-cc-if="options.link" target="{{ options.target }}" class="cc_more_info" href="{{options.link || "#null"}}">{{options.learnMore}}</a></p>','<a class="cc_logo" target="_blank" href="http://silktide.com/cookieconsent">Cookie Consent plugin for the EU cookie law</a>',"</div>","</div>"]},init:function(){var t=window[e];t&&this.setOptions(t),this.setContainer(),this.options.theme?this.loadTheme(this.render):this.render()},setOptionsOnTheFly:function(e){this.setOptions(e),this.render()},setOptions:function(e){s.merge(this.options,e)},setContainer:function(){this.options.container?this.container=document.querySelector(this.options.container):this.container=document.body,this.containerClasses="",navigator.appVersion.indexOf("MSIE 8")>-1&&(this.containerClasses+=" cc_ie8")},loadTheme:function(e){var t=this.options.theme;-1===t.indexOf(".css")&&(t=i+t+".css");var n=document.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=t;var o=!1;n.onload=s.bind(function(){!o&&e&&(e.call(this),o=!0)},this),document.getElementsByTagName("head")[0].appendChild(n)},render:function(){this.element&&this.element.parentNode&&(this.element.parentNode.removeChild(this.element),delete this.element),this.element=r.build(this.options.markup,this),this.container.firstChild?this.container.insertBefore(this.element,this.container.firstChild):this.container.appendChild(this.element)},dismiss:function(e){e.preventDefault&&e.preventDefault(),e.returnValue=!1,this.setDismissedCookie(),this.container.removeChild(this.element)},setDismissedCookie:function(){s.setCookie(n,"yes",this.options.expiryDays,this.options.domain,this.options.path)}},c=!1;(o=function(){c||"complete"!=document.readyState||(a.init(),c=!0,window[t]=s.bind(a.setOptionsOnTheFly,a))})(),s.addEventListener(document,"readystatechange",o)}}}();
@@ -0,0 +1,116 @@
1
+ var JRecord,
2
+ slice = [].slice;
3
+
4
+ JRecord = (function() {
5
+ JRecord._index = 1;
6
+
7
+ JRecord.attributes = function() {
8
+ var attr, attrs, i, len, results;
9
+ attrs = 1 <= arguments.length ? slice.call(arguments, 0) : [];
10
+ results = [];
11
+ for (i = 0, len = attrs.length; i < len; i++) {
12
+ attr = attrs[i];
13
+ this.prototype["set_" + attr] = (function(attr) {
14
+ return function(val) {
15
+ return this[attr] = val;
16
+ };
17
+ })(attr);
18
+ results.push(this.prototype["get_" + attr] = (function(attr) {
19
+ return function() {
20
+ return this[attr];
21
+ };
22
+ })(attr));
23
+ }
24
+ return results;
25
+ };
26
+
27
+ JRecord.all = function() {
28
+ return new Collection(this, Object.keys(this._objects));
29
+ };
30
+
31
+ JRecord.find = function(ids) {
32
+ if (Array.isArray(ids)) {
33
+ return new Collection(this, ids);
34
+ } else {
35
+ if (ids in this._objects) {
36
+ return this._objects[ids];
37
+ } else {
38
+ console.error('Record not found');
39
+ return null;
40
+ }
41
+ }
42
+ };
43
+
44
+ JRecord["new"] = function(args) {
45
+ var record;
46
+ if (args == null) {
47
+ args = {};
48
+ }
49
+ if (this._objects == null) {
50
+ this._objects = [];
51
+ }
52
+ if (args['index'] != null) {
53
+ throw new Error('Index is a reserved key');
54
+ }
55
+ args['index'] = this._index++;
56
+ record = new this(args);
57
+ this._objects[record.index] = record;
58
+ return record;
59
+ };
60
+
61
+ JRecord.first = function() {
62
+ return this.all().first();
63
+ };
64
+
65
+ JRecord.last = function() {
66
+ return this.all().last();
67
+ };
68
+
69
+ JRecord.where = function(cond) {
70
+ return this.all().where(cond);
71
+ };
72
+
73
+ function JRecord(args) {
74
+ if (args == null) {
75
+ args = {};
76
+ }
77
+ if (args['index'] == null) {
78
+ throw new Error('Do not call constructor directly. User `class.new` instead.');
79
+ }
80
+ this.index = args['index'];
81
+ this.assign_attributes(args);
82
+ }
83
+
84
+ JRecord.prototype.assign_attributes = function(args) {
85
+ var key, name, results, val;
86
+ if (args == null) {
87
+ args = [];
88
+ }
89
+ results = [];
90
+ for (key in args) {
91
+ val = args[key];
92
+ results.push(typeof this[name = "set_" + key] === "function" ? this[name](val) : void 0);
93
+ }
94
+ return results;
95
+ };
96
+
97
+ JRecord.prototype.is = function(conds) {
98
+ var key, value;
99
+ return ((function() {
100
+ var results;
101
+ results = [];
102
+ for (key in conds) {
103
+ value = conds[key];
104
+ if (('' + this["get_" + key]()) !== ("" + value)) {
105
+ results.push(true);
106
+ }
107
+ }
108
+ return results;
109
+ }).call(this)).length === 0;
110
+ };
111
+
112
+ return JRecord;
113
+
114
+ })();
115
+
116
+ window.JRecord = JRecord;
@@ -0,0 +1,4 @@
1
+ $(function() {
2
+ Variant.initialize($('[data-properties-table-body]'));
3
+ return Property.initialize($('.properties_list'));
4
+ });
@@ -0,0 +1,15 @@
1
+ var splitButtons = function(){
2
+ if ($('.quick_actions_toggle').length){
3
+ var link = $('.split_selector > a').attr('href')
4
+ $('.quick_actions_toggle').on('click', function(){
5
+ $('.quick_actions').toggleClass('hidden')
6
+ })
7
+
8
+ $('.quick_actions li').on('click', function(){
9
+ $('.split_selector > a').text($(this).text())
10
+ $('.split_selector > ul').toggleClass('hidden')
11
+ $('.split_selector > a').attr('href', link+'?f='+$('.split_selector > a').text().replace(/ /g, "_"))
12
+ $('.split_selector > a').click()
13
+ })
14
+ }
15
+ }
@@ -0,0 +1,138 @@
1
+ var arrayProto = function(){
2
+ if (!Array.isArray) {
3
+ Array.isArray = function(arg) {
4
+ return Object.prototype.toString.call(arg) === '[object Array]';
5
+ };
6
+ }
7
+ Array.prototype.uniq = function() {
8
+ return this.filter(function(value, index, self) {
9
+ return self.indexOf(value) === index;
10
+ });
11
+ }
12
+ Array.prototype.flatten = function() {
13
+ return [].concat.apply([], this);
14
+ }
15
+ }
16
+
17
+ var fieldsHelper = function(){
18
+ $('form').on('keypress', '[data-no-submit]', function(e){
19
+ return e.keyCode != 13
20
+ });
21
+
22
+ $('[data-fields]').on('click', function(e){
23
+ var time = new Date().getTime()
24
+ var regexp = new RegExp($(this).data('fields-id'), 'g')
25
+ $(this).before($(this).data('fields').replace(regexp, time))
26
+ e.preventDefault();
27
+ });
28
+
29
+ }
30
+
31
+ var reorderableElements = function(){
32
+ $('.reorderable').sortable({
33
+ axis:'y',
34
+ handle: '.sort_handle',
35
+ tolerance: 'pointer',
36
+ containment: 'parent',
37
+ revert: 50,
38
+ update: function(){
39
+ $('.order_field', this).each(function(i){
40
+ $(this).val(i)
41
+ })
42
+ }
43
+ });
44
+
45
+ $('.sortable_table tbody').sortable({
46
+ axis:'y',
47
+ handle: '.sort_handle',
48
+ tolerance: 'pointer',
49
+ containment: 'parent',
50
+ revert: 50,
51
+ update: function(){
52
+ $.ajax({
53
+ url: $(this).attr('index_data-sort'),
54
+ method: 'POST',
55
+ dataType: 'script',
56
+ data: $(this).sortable('serialize')});
57
+ }
58
+ });
59
+
60
+ }
61
+
62
+ var searchableSelectFields = function(){
63
+ $('select[data-searchable-select]').select2();
64
+ $('.select2').select2();
65
+ $('select[multiple]').each(function (i, e) {
66
+ $e = $(e);
67
+ console.log($e.data('pagination'))
68
+ if (!!$e.data('max-choices')) {
69
+ $e.select2({
70
+ maximumSelectionLength: $e.data('max-choices')
71
+ });
72
+ }
73
+ else {
74
+ $e.select2();
75
+ }
76
+ });
77
+ }
78
+
79
+ function formatRepo (repo) {
80
+ if (repo.loading) return repo.text;
81
+ console.log(repo)
82
+ markup = "<li class='select2-results__option' role='treeitem'>" + repo.name + "</li>";
83
+ return markup;
84
+ }
85
+
86
+ function formatRepoSelection (repo) {
87
+ console.log(repo)
88
+ return repo.text;
89
+ }
90
+
91
+ var sortThisOut = function(){
92
+ $('[data-add-key]').on('click', function(e){
93
+ e.preventDefault();
94
+
95
+ $new = $(this).prev().clone()
96
+
97
+ $new.find('.fields--stacked input:not(:first)').remove()
98
+ $new.find('input').val('')
99
+ $new.insertBefore($(this))
100
+ })
101
+
102
+
103
+ $('[data-add-value]').on('click', function(e){
104
+ e.preventDefault();
105
+ $new = $(this).prev().clone()
106
+
107
+ $new.find('input').val('')
108
+ $new.insertBefore($(this))
109
+ })
110
+
111
+ $('#select_all').change(function(){ //'select all' change
112
+ var status = this.checked; // 'select all' checked status
113
+ $('.check_box_column input').each(function(){ //iterate all listed checkbox items
114
+ this.checked = status; //change '.checkbox' checked status
115
+ });
116
+ });
117
+
118
+ $('.check_box_column input').change(function(){ //'.checkbox' change
119
+ //uncheck 'select all', if one of the listed checkbox item is unchecked
120
+ if(this.checked == false){ //if this item is unchecked
121
+ $('#select_all')[0].checked = false; //change 'select all' checked status to false
122
+ }
123
+
124
+ //check 'select all' if all checkbox items are checked
125
+ if ($('.check_box_column input:checked').length == $('.check_box_column input').length ){
126
+ $('#select_all')[0].checked = true; //change 'select all' checked status to true
127
+ }
128
+ });
129
+
130
+ $('input:checkbox').change(function(){
131
+ if($('input:checkbox').is(':checked')) {
132
+ $('html').addClass('bulk_actions_show');
133
+ } else {
134
+ $('html').removeClass('bulk_actions_show');
135
+ }
136
+ });
137
+
138
+ }
@@ -0,0 +1,35 @@
1
+ function unloadEvents(){
2
+
3
+ var dispatchUnloadEvent = function(e) {
4
+
5
+ var event = document.createEvent("Events")
6
+ event.initEvent("turbolinks:unload", true, false)
7
+ document.dispatchEvent(event)
8
+
9
+ if ( ($('.changed').length > 0) && !( $('.unload').length > 0 ) ) {
10
+
11
+ msg = 'You have unsaved changes.';
12
+ (e || window.event).returnValue = msg;
13
+ return msg;
14
+ }
15
+ }
16
+
17
+ $(':submit').on('click', function(){
18
+ $('html').addClass('unload');
19
+ })
20
+
21
+ $("form input, form textarea").on('change', function (event) {
22
+ if (!event.target.classList.contains("tab_controller")) {
23
+ $('.change_waiter').addClass('changed');
24
+ }
25
+ })
26
+
27
+ $('form').on('submit', function(){
28
+ console.log("JH")
29
+ window.removeEventListener('beforeunload', dispatchUnloadEvent)
30
+ })
31
+
32
+ addEventListener("beforeunload", dispatchUnloadEvent)
33
+ addEventListener("turbolinks:before-render", dispatchUnloadEvent)
34
+
35
+ }