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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 49fa751153745d0e04a74b61e8316736f0f9c1f7
4
+ data.tar.gz: d973468185aa39a9b5be0ef3bb16d01180d75c74
5
+ SHA512:
6
+ metadata.gz: a46a2171ff8c005db4b5f9574ee061f0bc0a8d4bf3560ba040f1d4852a3041c8b1a343fe4e507b177706443fc1ff7fe1e4368d897af27f1eecff3621165885e6
7
+ data.tar.gz: df36acc3b7efafb2353843f9e01c84e2e77a525dcc9955bab115647747ae0de9f1785a3d9d8ad03bd61b5329fdd1253a1642d1149707b6e828ccaa3f01414285
data/Rakefile ADDED
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+
8
+ require 'rdoc/task'
9
+
10
+ RDoc::Task.new(:rdoc) do |rdoc|
11
+ rdoc.rdoc_dir = 'rdoc'
12
+ rdoc.title = 'C'
13
+ rdoc.options << '--line-numbers'
14
+ rdoc.rdoc_files.include('README.md')
15
+ rdoc.rdoc_files.include('lib/**/*.rb')
16
+ end
17
+
18
+ APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
19
+ load 'rails/tasks/engine.rake'
20
+ load 'rails/tasks/statistics.rake'
21
+ require 'bundler/gem_tasks'
22
+ require 'rake/testtask'
23
+
24
+ Rake::TestTask.new(:test) do |t|
25
+ t.libs << 'lib'
26
+ t.libs << 'spec'
27
+ t.pattern = 'spec/**/*.rb'
28
+ t.verbose = true
29
+ end
30
+
31
+ require 'rspec/core'
32
+ require 'rspec/core/rake_task'
33
+
34
+ desc 'Run all specs in spec directory (excluding plugin specs)'
35
+ RSpec::Core::RakeTask.new(spec: 'app:db:test:prepare')
36
+
37
+ task default: :spec
@@ -0,0 +1,2 @@
1
+ //= link_directory ../javascripts/c .js
2
+ //= link_directory ../stylesheets/c .css
Binary file
Binary file
@@ -0,0 +1,59 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file. JavaScript code in this file should be added after the last require_* statement.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require jquery
14
+ //= require jquery-ui
15
+ //= require jquery_ujs
16
+
17
+ //= require dropzone
18
+
19
+ //= require ./change_tag
20
+ //= require ./draggable_tree
21
+
22
+ //require ./master_form2/jrecord
23
+ //require ./master_form2/collection
24
+ //require ./master_form2/master_form
25
+
26
+ //= require sweetalert
27
+ //= require select2
28
+ //= require nested_form_fields
29
+
30
+ //= require ./confirm_delete
31
+
32
+ //= require ./split_buttons
33
+ //= require ./unloadevent
34
+
35
+ //=require ./dropzone_init
36
+
37
+ //= require ./things_to_be_done
38
+
39
+ //= require cd2_tabs_cookies
40
+
41
+ //= require 'tinymce-jquery'
42
+
43
+
44
+ function readyFunctions() {
45
+ $('.select2').select2();
46
+ arrayProto();
47
+ defaultDropzone();
48
+ }
49
+
50
+ $(function() {
51
+
52
+
53
+ $('.filter_toggle').on('click', function () {
54
+
55
+ $('.' + $(this).data("filter")).toggleClass('hidden')
56
+ $('.filter_panel').toggleClass('hidden')
57
+ })
58
+ readyFunctions()
59
+ });
@@ -0,0 +1,49 @@
1
+ (function($){
2
+ "use strict";
3
+
4
+ $.fn.changeTag = function(tagName, callback){
5
+
6
+ return $(this.map(function(){
7
+ var $newTag = $('<' + tagName + '/>');
8
+
9
+ //copy all attributes
10
+ $.each(this.attributes, function(_, attribute) {
11
+ $newTag.attr(attribute.name, attribute.value);
12
+ });
13
+
14
+ //copy contents
15
+ $newTag.append($(this).contents());
16
+
17
+ //call callback passing the old element
18
+ if (callback) {
19
+ var newTag = callback.call($newTag, this);
20
+ if (newTag instanceof jQuery) {
21
+ $newTag = newTag;
22
+ }
23
+ }
24
+
25
+ //clone events
26
+ var events = $._data(this, "events");
27
+ $.each(events, function(_, events) {
28
+ $.each(events, function(_, event) {
29
+ //Name spaces
30
+ var eventType = event.type;
31
+ if (event.namespace.length > 0) {
32
+ eventType += '.' + event.namespace
33
+ }
34
+ $newTag.bind(eventType, event.data, event.handler);
35
+ });
36
+ });
37
+
38
+ //replace old tag
39
+ $(this).replaceWith($newTag);
40
+
41
+ //return element to can create a jQuery object from new elements
42
+ return $newTag[0];
43
+
44
+ }));
45
+
46
+
47
+ };
48
+
49
+ })(jQuery);
@@ -0,0 +1,2 @@
1
+ /* Chosen v1.6.2 | (c) 2011-2016 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
2
+ (function(){var a,AbstractChosen,Chosen,SelectParser,b,c={}.hasOwnProperty,d=function(a,b){function d(){this.constructor=a}for(var e in b)c.call(b,e)&&(a[e]=b[e]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};SelectParser=function(){function SelectParser(){this.options_index=0,this.parsed=[]}return SelectParser.prototype.add_node=function(a){return"OPTGROUP"===a.nodeName.toUpperCase()?this.add_group(a):this.add_option(a)},SelectParser.prototype.add_group=function(a){var b,c,d,e,f,g;for(b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:this.escapeExpression(a.label),title:a.title?a.title:void 0,children:0,disabled:a.disabled,classes:a.className}),f=a.childNodes,g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},SelectParser.prototype.add_option=function(a,b,c){return"OPTION"===a.nodeName.toUpperCase()?(""!==a.text?(null!=b&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,title:a.title?a.title:void 0,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,group_label:null!=b?this.parsed[b].label:null,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1):void 0},SelectParser.prototype.escapeExpression=function(a){var b,c;return null==a||a===!1?"":/[\&\<\>\"\'\`]/.test(a)?(b={"<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},c=/&(?!\w+;)|[\<\>\"\'\`]/g,a.replace(c,function(a){return b[a]||"&amp;"})):a},SelectParser}(),SelectParser.select_to_array=function(a){var b,c,d,e,f;for(c=new SelectParser,f=a.childNodes,d=0,e=f.length;e>d;d++)b=f[d],c.add_node(b);return c.parsed},AbstractChosen=function(){function AbstractChosen(a,b){this.form_field=a,this.options=null!=b?b:{},AbstractChosen.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return AbstractChosen.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null!=this.options.enable_split_word_search?this.options.enable_split_word_search:!0,this.group_search=null!=this.options.group_search?this.options.group_search:!0,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null!=this.options.single_backstroke_delete?this.options.single_backstroke_delete:!0,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null!=this.options.display_selected_options?this.options.display_selected_options:!0,this.display_disabled_options=null!=this.options.display_disabled_options?this.options.display_disabled_options:!0,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1,this.max_shown_results=this.options.max_shown_results||Number.POSITIVE_INFINITY,this.case_sensitive_search=this.options.case_sensitive_search||!1},AbstractChosen.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||AbstractChosen.default_multiple_text:this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||AbstractChosen.default_single_text,this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||AbstractChosen.default_no_result_text},AbstractChosen.prototype.choice_label=function(a){return this.include_group_label_in_selected&&null!=a.group_label?"<b class='group-name'>"+a.group_label+"</b>"+a.html:a.html},AbstractChosen.prototype.mouse_enter=function(){return this.mouse_on_container=!0},AbstractChosen.prototype.mouse_leave=function(){return this.mouse_on_container=!1},AbstractChosen.prototype.input_focus=function(a){var b=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return b.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},AbstractChosen.prototype.input_blur=function(a){var b=this;return this.mouse_on_container?void 0:(this.active_field=!1,setTimeout(function(){return b.blur_test()},100))},AbstractChosen.prototype.results_option_build=function(a){var b,c,d,e,f,g,h;for(b="",e=0,h=this.results_data,f=0,g=h.length;g>f&&(c=h[f],d="",d=c.group?this.result_add_group(c):this.result_add_option(c),""!==d&&(e++,b+=d),(null!=a?a.first:void 0)&&(c.selected&&this.is_multiple?this.choice_build(c):c.selected&&!this.is_multiple&&this.single_set_selected_text(this.choice_label(c))),!(e>=this.max_shown_results));f++);return b},AbstractChosen.prototype.result_add_option=function(a){var b,c;return a.search_match&&this.include_option_in_results(a)?(b=[],a.disabled||a.selected&&this.is_multiple||b.push("active-result"),!a.disabled||a.selected&&this.is_multiple||b.push("disabled-result"),a.selected&&b.push("result-selected"),null!=a.group_array_index&&b.push("group-option"),""!==a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.style.cssText=a.style,c.setAttribute("data-option-array-index",a.array_index),c.innerHTML=a.search_text,a.title&&(c.title=a.title),this.outerHTML(c)):""},AbstractChosen.prototype.result_add_group=function(a){var b,c;return(a.search_match||a.group_match)&&a.active_options>0?(b=[],b.push("group-result"),a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.innerHTML=a.search_text,a.title&&(c.title=a.title),this.outerHTML(c)):""},AbstractChosen.prototype.results_update_field=function(){return this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing?this.winnow_results():void 0},AbstractChosen.prototype.reset_single_select_options=function(){var a,b,c,d,e;for(d=this.results_data,e=[],b=0,c=d.length;c>b;b++)a=d[b],a.selected?e.push(a.selected=!1):e.push(void 0);return e},AbstractChosen.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},AbstractChosen.prototype.results_search=function(a){return this.results_showing?this.winnow_results():this.results_show()},AbstractChosen.prototype.winnow_results=function(){var a,b,c,d,e,f,g,h,i,j,k,l;for(this.no_results_clear(),d=0,f=this.get_search_text(),a=f.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),i=new RegExp(a,"i"),c=this.get_search_regex(a),l=this.results_data,j=0,k=l.length;k>j;j++)b=l[j],b.search_match=!1,e=null,this.include_option_in_results(b)&&(b.group&&(b.group_match=!1,b.active_options=0),null!=b.group_array_index&&this.results_data[b.group_array_index]&&(e=this.results_data[b.group_array_index],0===e.active_options&&e.search_match&&(d+=1),e.active_options+=1),b.search_text=b.group?b.label:b.html,(!b.group||this.group_search)&&(b.search_match=this.search_string_match(b.search_text,c),b.search_match&&!b.group&&(d+=1),b.search_match?(f.length&&(g=b.search_text.search(i),h=b.search_text.substr(0,g+f.length)+"</em>"+b.search_text.substr(g+f.length),b.search_text=h.substr(0,g)+"<em>"+h.substr(g)),null!=e&&(e.group_match=!0)):null!=b.group_array_index&&this.results_data[b.group_array_index].search_match&&(b.search_match=!0)));return this.result_clear_highlight(),1>d&&f.length?(this.update_results_content(""),this.no_results(f)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},AbstractChosen.prototype.get_search_regex=function(a){var b,c;return b=this.search_contains?"":"^",c=this.case_sensitive_search?"":"i",new RegExp(b+a,c)},AbstractChosen.prototype.search_string_match=function(a,b){var c,d,e,f;if(b.test(a))return!0;if(this.enable_split_word_search&&(a.indexOf(" ")>=0||0===a.indexOf("["))&&(d=a.replace(/\[|\]/g,"").split(" "),d.length))for(e=0,f=d.length;f>e;e++)if(c=d[e],b.test(c))return!0},AbstractChosen.prototype.choices_count=function(){var a,b,c,d;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,d=this.form_field.options,b=0,c=d.length;c>b;b++)a=d[b],a.selected&&(this.selected_option_count+=1);return this.selected_option_count},AbstractChosen.prototype.choices_click=function(a){return a.preventDefault(),this.results_showing||this.is_disabled?void 0:this.results_show()},AbstractChosen.prototype.keyup_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:if(a.preventDefault(),this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:case 18:break;default:return this.results_search()}},AbstractChosen.prototype.clipboard_event_checker=function(a){var b=this;return setTimeout(function(){return b.results_search()},50)},AbstractChosen.prototype.container_width=function(){return null!=this.options.width?this.options.width:""+this.form_field.offsetWidth+"px"},AbstractChosen.prototype.include_option_in_results=function(a){return this.is_multiple&&!this.display_selected_options&&a.selected?!1:!this.display_disabled_options&&a.disabled?!1:a.empty?!1:!0},AbstractChosen.prototype.search_results_touchstart=function(a){return this.touch_started=!0,this.search_results_mouseover(a)},AbstractChosen.prototype.search_results_touchmove=function(a){return this.touch_started=!1,this.search_results_mouseout(a)},AbstractChosen.prototype.search_results_touchend=function(a){return this.touch_started?this.search_results_mouseup(a):void 0},AbstractChosen.prototype.outerHTML=function(a){var b;return a.outerHTML?a.outerHTML:(b=document.createElement("div"),b.appendChild(a),b.innerHTML)},AbstractChosen.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:/iP(od|hone)/i.test(window.navigator.userAgent)||/IEMobile/i.test(window.navigator.userAgent)||/Windows Phone/i.test(window.navigator.userAgent)||/BlackBerry/i.test(window.navigator.userAgent)||/BB10/i.test(window.navigator.userAgent)||/Android.*Mobile/i.test(window.navigator.userAgent)?!1:!0},AbstractChosen.default_multiple_text="Select Some Options",AbstractChosen.default_single_text="Select an Option",AbstractChosen.default_no_result_text="No results match",AbstractChosen}(),a=jQuery,a.fn.extend({chosen:function(b){return AbstractChosen.browser_is_supported()?this.each(function(c){var d,e;return d=a(this),e=d.data("chosen"),"destroy"===b?void(e instanceof Chosen&&e.destroy()):void(e instanceof Chosen||d.data("chosen",new Chosen(this,b)))}):this}}),Chosen=function(c){function Chosen(){return b=Chosen.__super__.constructor.apply(this,arguments)}return d(Chosen,c),Chosen.prototype.setup=function(){return this.form_field_jq=a(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex,this.is_rtl=this.form_field_jq.hasClass("chosen-rtl")},Chosen.prototype.set_up_html=function(){var b,c;return b=["chosen-container"],b.push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&b.push(this.form_field.className),this.is_rtl&&b.push("chosen-rtl"),c={"class":b.join(" "),style:"width: "+this.container_width()+";",title:this.form_field.title},this.form_field.id.length&&(c.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=a("<div />",c),this.is_multiple?this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>'):this.container.html('<a class="chosen-single chosen-default"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>'),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior()},Chosen.prototype.on_ready=function(){return this.form_field_jq.trigger("chosen:ready",{chosen:this})},Chosen.prototype.register_observers=function(){var a=this;return this.container.bind("touchstart.chosen",function(b){return a.container_mousedown(b),b.preventDefault()}),this.container.bind("touchend.chosen",function(b){return a.container_mouseup(b),b.preventDefault()}),this.container.bind("mousedown.chosen",function(b){a.container_mousedown(b)}),this.container.bind("mouseup.chosen",function(b){a.container_mouseup(b)}),this.container.bind("mouseenter.chosen",function(b){a.mouse_enter(b)}),this.container.bind("mouseleave.chosen",function(b){a.mouse_leave(b)}),this.search_results.bind("mouseup.chosen",function(b){a.search_results_mouseup(b)}),this.search_results.bind("mouseover.chosen",function(b){a.search_results_mouseover(b)}),this.search_results.bind("mouseout.chosen",function(b){a.search_results_mouseout(b)}),this.search_results.bind("mousewheel.chosen DOMMouseScroll.chosen",function(b){a.search_results_mousewheel(b)}),this.search_results.bind("touchstart.chosen",function(b){a.search_results_touchstart(b)}),this.search_results.bind("touchmove.chosen",function(b){a.search_results_touchmove(b)}),this.search_results.bind("touchend.chosen",function(b){a.search_results_touchend(b)}),this.form_field_jq.bind("chosen:updated.chosen",function(b){a.results_update_field(b)}),this.form_field_jq.bind("chosen:activate.chosen",function(b){a.activate_field(b)}),this.form_field_jq.bind("chosen:open.chosen",function(b){a.container_mousedown(b)}),this.form_field_jq.bind("chosen:close.chosen",function(b){a.input_blur(b)}),this.search_field.bind("blur.chosen",function(b){a.input_blur(b)}),this.search_field.bind("keyup.chosen",function(b){a.keyup_checker(b)}),this.search_field.bind("keydown.chosen",function(b){a.keydown_checker(b)}),this.search_field.bind("focus.chosen",function(b){a.input_focus(b)}),this.search_field.bind("cut.chosen",function(b){a.clipboard_event_checker(b)}),this.search_field.bind("paste.chosen",function(b){a.clipboard_event_checker(b)}),this.is_multiple?this.search_choices.bind("click.chosen",function(b){a.choices_click(b)}):this.container.bind("click.chosen",function(a){a.preventDefault()})},Chosen.prototype.destroy=function(){return a(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},Chosen.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field_jq[0].disabled,this.is_disabled?(this.container.addClass("chosen-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus.chosen",this.activate_action),this.close_field()):(this.container.removeClass("chosen-disabled"),this.search_field[0].disabled=!1,this.is_multiple?void 0:this.selected_item.bind("focus.chosen",this.activate_action))},Chosen.prototype.container_mousedown=function(b){return this.is_disabled||(b&&"mousedown"===b.type&&!this.results_showing&&b.preventDefault(),null!=b&&a(b.target).hasClass("search-choice-close"))?void 0:(this.active_field?this.is_multiple||!b||a(b.target)[0]!==this.selected_item[0]&&!a(b.target).parents("a.chosen-single").length||(b.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),a(this.container[0].ownerDocument).bind("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},Chosen.prototype.container_mouseup=function(a){return"ABBR"!==a.target.nodeName||this.is_disabled?void 0:this.results_reset(a)},Chosen.prototype.search_results_mousewheel=function(a){var b;return a.originalEvent&&(b=a.originalEvent.deltaY||-a.originalEvent.wheelDelta||a.originalEvent.detail),null!=b?(a.preventDefault(),"DOMMouseScroll"===a.type&&(b=40*b),this.search_results.scrollTop(b+this.search_results.scrollTop())):void 0},Chosen.prototype.blur_test=function(a){return!this.active_field&&this.container.hasClass("chosen-container-active")?this.close_field():void 0},Chosen.prototype.close_field=function(){return a(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},Chosen.prototype.activate_field=function(){return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},Chosen.prototype.test_active_click=function(b){var c;return c=a(b.target).closest(".chosen-container"),c.length&&this.container[0]===c[0]?this.active_field=!0:this.close_field()},Chosen.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=SelectParser.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},Chosen.prototype.result_do_highlight=function(a){var b,c,d,e,f;if(a.length){if(this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClass("highlighted"),d=parseInt(this.search_results.css("maxHeight"),10),f=this.search_results.scrollTop(),e=d+f,c=this.result_highlight.position().top+this.search_results.scrollTop(),b=c+this.result_highlight.outerHeight(),b>=e)return this.search_results.scrollTop(b-d>0?b-d:0);if(f>c)return this.search_results.scrollTop(c)}},Chosen.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},Chosen.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.container.addClass("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results(),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}))},Chosen.prototype.update_results_content=function(a){return this.search_results.html(a)},Chosen.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},Chosen.prototype.set_tab_index=function(a){var b;return this.form_field.tabIndex?(b=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=b):void 0},Chosen.prototype.set_label_behavior=function(){var b=this;return this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=a("label[for='"+this.form_field.id+"']")),this.form_field_label.length>0?this.form_field_label.bind("click.chosen",function(a){return b.is_multiple?b.container_mousedown(a):b.activate_field()}):void 0},Chosen.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},Chosen.prototype.search_results_mouseup=function(b){var c;return c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c.length?(this.result_highlight=c,this.result_select(b),this.search_field.focus()):void 0},Chosen.prototype.search_results_mouseover=function(b){var c;return c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c?this.result_do_highlight(c):void 0},Chosen.prototype.search_results_mouseout=function(b){return a(b.target).hasClass("active-result")?this.result_clear_highlight():void 0},Chosen.prototype.choice_build=function(b){var c,d,e=this;return c=a("<li />",{"class":"search-choice"}).html("<span>"+this.choice_label(b)+"</span>"),b.disabled?c.addClass("search-choice-disabled"):(d=a("<a />",{"class":"search-choice-close","data-option-array-index":b.array_index}),d.bind("click.chosen",function(a){return e.choice_destroy_link_click(a)}),c.append(d)),this.search_container.before(c)},Chosen.prototype.choice_destroy_link_click=function(b){return b.preventDefault(),b.stopPropagation(),this.is_disabled?void 0:this.choice_destroy(a(b.target))},Chosen.prototype.choice_destroy=function(a){return this.result_deselect(a[0].getAttribute("data-option-array-index"))?(this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.search_field.val().length<1&&this.results_hide(),a.parents("li").first().remove(),this.search_field_scale()):void 0},Chosen.prototype.results_reset=function(){return this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.form_field_jq.trigger("change"),this.active_field?this.results_hide():void 0},Chosen.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},Chosen.prototype.result_select=function(a){var b,c;return this.result_highlight?(b=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?b.removeClass("active-result"):this.reset_single_select_options(),b.addClass("result-selected"),c=this.results_data[b[0].getAttribute("data-option-array-index")],c.selected=!0,this.form_field.options[c.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(c):this.single_set_selected_text(this.choice_label(c)),(a.metaKey||a.ctrlKey)&&this.is_multiple||this.results_hide(),this.show_search_field_default(),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[c.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,a.preventDefault(),this.search_field_scale())):void 0},Chosen.prototype.single_set_selected_text=function(a){return null==a&&(a=this.default_text),a===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").html(a)},Chosen.prototype.result_deselect=function(a){var b;return b=this.results_data[a],this.form_field.options[b.options_index].disabled?!1:(b.selected=!1,this.form_field.options[b.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.form_field_jq.trigger("change",{deselected:this.form_field.options[b.options_index].value}),this.search_field_scale(),!0)},Chosen.prototype.single_deselect_control_build=function(){return this.allow_single_deselect?(this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'),this.selected_item.addClass("chosen-single-with-deselect")):void 0},Chosen.prototype.get_search_text=function(){return a("<div/>").text(a.trim(this.search_field.val())).html()},Chosen.prototype.winnow_results_set_highlight=function(){var a,b;return b=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),a=b.length?b.first():this.search_results.find(".active-result").first(),null!=a?this.result_do_highlight(a):void 0},Chosen.prototype.no_results=function(b){var c;return c=a('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),c.find("span").first().html(b),this.search_results.append(c),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},Chosen.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},Chosen.prototype.keydown_arrow=function(){var a;return this.results_showing&&this.result_highlight?(a=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(a):void 0:this.results_show()},Chosen.prototype.keyup_arrow=function(){var a;return this.results_showing||this.is_multiple?this.result_highlight?(a=this.result_highlight.prevAll("li.active-result"),a.length?this.result_do_highlight(a.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight())):void 0:this.results_show()},Chosen.prototype.keydown_backstroke=function(){var a;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(a=this.search_container.siblings("li.search-choice").last(),a.length&&!a.hasClass("search-choice-disabled")?(this.pending_backstroke=a,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0)},Chosen.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},Chosen.prototype.keydown_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),8!==b&&this.pending_backstroke&&this.clear_backstroke(),b){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:this.results_showing&&a.preventDefault();break;case 32:this.disable_search&&a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:a.preventDefault(),this.keydown_arrow()}},Chosen.prototype.search_field_scale=function(){var b,c,d,e,f,g,h,i,j;if(this.is_multiple){for(d=0,h=0,f="position:absolute; left: -1000px; top: -1000px; display:none;",g=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"],i=0,j=g.length;j>i;i++)e=g[i],f+=e+":"+this.search_field.css(e)+";";return b=a("<div />",{style:f}),b.text(this.search_field.val()),a("body").append(b),h=b.width()+25,b.remove(),c=this.container.outerWidth(),h>c-10&&(h=c-10),this.search_field.css({width:h+"px"})}},Chosen}(AbstractChosen)}).call(this);
@@ -0,0 +1,55 @@
1
+ var slice = [].slice;
2
+
3
+ $(window).on('page:load load ajax:success', function() {
4
+ return $('a[data-delete-link]').on('click', function(e) {
5
+ var redirect, url;
6
+ url = $(this).data('delete-link');
7
+ redirect = (function(_this) {
8
+ return function() {
9
+ if (url = $(_this).data('after-delete-redirection')) {
10
+ return window.location.href = url;
11
+ } else {
12
+ return location.reload();
13
+ }
14
+ };
15
+ })(this);
16
+ swal({
17
+ title: 'Are you sure?',
18
+ text: 'This action cannot be undone!',
19
+ type: 'warning',
20
+ showCancelButton: true,
21
+ confirmButtonColor: '#DD6B55',
22
+ confirmButtonText: 'Yes, delete it!',
23
+ closeOnConfirm: false,
24
+ showLoaderOnConfirm: true
25
+ }, function() {
26
+ return $.ajax({
27
+ url: url,
28
+ method: 'POST',
29
+ data: {
30
+ _method: 'DELETE'
31
+ },
32
+ success: function() {
33
+ var x;
34
+ x = 1 <= arguments.length ? slice.call(arguments, 0) : [];
35
+ return swal({
36
+ title: 'Deleted!',
37
+ text: 'Its been deleted.',
38
+ type: 'success'
39
+ }, redirect);
40
+ },
41
+ error: function() {
42
+ return swal({
43
+ title: 'Error!',
44
+ text: 'Sorry a problem has occurred',
45
+ type: 'error'
46
+ });
47
+ }
48
+ });
49
+ });
50
+ return e.preventDefault();
51
+ });
52
+ });
53
+
54
+ // ---
55
+ // generated by coffee-script 1.9.2
@@ -0,0 +1,223 @@
1
+ var $current_container, $ghost, $ghostBottom, $ghostMid, $ghostTop, $sibling_container, beginDrag, checkLessNesting, checkMoreNesting, checkNeedToMove, checkSiblings, collapse, convertYtoElem, endDrag, getGenericTree, moveDrag, newYPos, requestedYPos, uncollapse, updateGenericTree;
2
+ var $current_moving = null;
3
+ var $_ghost = null;
4
+ var $container = null;
5
+
6
+ $(window).on('load page:load', function() {
7
+ $container = $('.draggable_tree_list_container');
8
+ return $('[data-draggable]').each(function() {
9
+ return $(this).on('mousedown', $(this).data('draggable'), beginDrag);
10
+ });
11
+ });
12
+
13
+ beginDrag = function(e) {
14
+ var cur_height;
15
+ $(window).on('mouseup', endDrag);
16
+ $(window).on('mousemove', moveDrag);
17
+ $current_moving = $(e.delegateTarget);
18
+ collapse();
19
+ console.log($current_moving.find('input[type=check_box].hide_children'));
20
+ cur_height = $current_moving.height();
21
+ $current_moving.addClass('floating');
22
+ return $ghost().css({
23
+ height: cur_height
24
+ }).insertAfter($current_moving);
25
+ };
26
+
27
+ moveDrag = function(e) {
28
+ checkNeedToMove(e);
29
+ return $current_moving.css({
30
+ top: newYPos(e)
31
+ });
32
+ };
33
+
34
+ endDrag = function() {
35
+ $(window).off('mouseup', endDrag);
36
+ $(window).off('mousemove', moveDrag);
37
+ $current_moving.insertAfter($ghost());
38
+ $current_moving.removeClass('floating');
39
+ $current_moving.removeAttr('style');
40
+ uncollapse();
41
+ $ghost().detach();
42
+ return updateGenericTree();
43
+ };
44
+
45
+ collapse = function() {
46
+ var $check;
47
+ $check = $current_moving.find('input[type=checkbox].hide_children:first');
48
+ $check.data('before_drag_collapse_state', $check.prop('checked'));
49
+ return $check.prop('checked', true);
50
+ };
51
+
52
+ uncollapse = function() {
53
+ var $check, before_state;
54
+ $check = $current_moving.find('input[type=checkbox].hide_children').first();
55
+ before_state = $check.data('before_drag_collapse_state');
56
+ $check.prop('checked', before_state);
57
+ return $check.data('before_drag_collapse_state', null);
58
+ };
59
+
60
+ convertYtoElem = function(y, elem) {
61
+ return y - $(elem).offset().top;
62
+ };
63
+
64
+ requestedYPos = function(e) {
65
+ return convertYtoElem(e.pageY, $sibling_container()) - $current_moving.height() / 2;
66
+ };
67
+
68
+ newYPos = function(e) {
69
+ var high_y, low_y, y;
70
+ low_y = 0;
71
+ y = requestedYPos(e);
72
+ high_y = $sibling_container().height() - $current_moving.height();
73
+ if (y < low_y) {
74
+ return low_y;
75
+ }
76
+ if (y > high_y) {
77
+ return high_y;
78
+ }
79
+ return y;
80
+ };
81
+
82
+ checkNeedToMove = function(e) {
83
+ var moved;
84
+ moved = checkMoreNesting(e);
85
+ if (!moved){
86
+ moved = checkLessNesting(e)
87
+ }
88
+ if (moved) {
89
+ return checkNeedToMove(e);
90
+ }
91
+ };
92
+
93
+ checkMoreNesting = function(e) {
94
+ var $next, $nextChildren, $prev, $prevChildren, next_y, prev_y, y;
95
+ $prev = $ghost().prevAll('.draggable_tree_container:not(.floating):first');
96
+ $next = $ghost().nextAll('.draggable_tree_container:first');
97
+ $nextChildren = $next.find('.draggable_tree_children:first');
98
+ $prevChildren = $prev.find('.draggable_tree_children:first');
99
+ y = convertYtoElem(e.pageY, $sibling_container());
100
+ if ($nextChildren.length > 0) {
101
+ next_y = convertYtoElem($nextChildren.offset().top, $sibling_container());
102
+ next_y -= $current_moving.height() / 4;
103
+ if (y > next_y) {
104
+ $nextChildren.prepend($ghost());
105
+ return true;
106
+ }
107
+ }
108
+ if ($prevChildren.length > 0) {
109
+ prev_y = convertYtoElem($prevChildren.offset().top + $prevChildren.height(), $sibling_container());
110
+ prev_y += 20;
111
+ if (y < prev_y) {
112
+ $prevChildren.prepend($ghost());
113
+ return true;
114
+ }
115
+ }
116
+ return false;
117
+ };
118
+
119
+ checkLessNesting = function(e) {
120
+ var containerBottom, containerTop, y;
121
+ if ($current_container().length === 0) {
122
+ return;
123
+ }
124
+ y = convertYtoElem(e.pageY, $current_container());
125
+ containerTop = 0;
126
+ containerBottom = $current_container().height();
127
+ if (y < containerTop + $current_moving.height()) {
128
+ $ghost().insertBefore($current_container());
129
+ $current_moving.insertBefore($ghost());
130
+ return true;
131
+ }
132
+ if (y > containerBottom) {
133
+ $ghost().insertAfter($current_container());
134
+ $current_moving.insertBefore($ghost());
135
+ return true;
136
+ }
137
+ return false;
138
+ };
139
+
140
+ checkSiblings = function(e) {
141
+ var $next, $prev;
142
+ $prev = $ghost().prevAll('.draggable_tree_container:not(.floating):first');
143
+ $next = $ghost().nextAll('.draggable_tree_container:first');
144
+ if ($ghostBottom() + ($next.height() / 2) < requestedYPos(e) + $current_moving.height() / 2) {
145
+ return $ghost().insertAfter($next);
146
+ } else if ($ghostTop() - ($prev.height() / 2) > requestedYPos(e) + $current_moving.height() / 2) {
147
+ return $ghost().insertBefore($prev);
148
+ }
149
+ };
150
+
151
+ $ghost = function() {
152
+ if ($_ghost === null) {
153
+ $_ghost = $('<div data-ghost></div>');
154
+ console.log("CRETING");
155
+ }
156
+ window.x = $_ghost;
157
+ return $_ghost;
158
+ };
159
+
160
+ $ghostTop = function() {
161
+ return $ghost().position().top;
162
+ };
163
+
164
+ $ghostMid = function() {
165
+ return $ghost().position().top + $ghost().height() / 2;
166
+ };
167
+
168
+ $ghostBottom = function() {
169
+ return $ghost().position().top + $ghost().height();
170
+ };
171
+
172
+ $sibling_container = function() {
173
+ return $current_moving.parent().closest('.draggable_tree_children');
174
+ };
175
+
176
+ $current_container = function() {
177
+ return $ghost().parent().closest('.draggable_tree_container');
178
+ };
179
+
180
+ updateGenericTree = function($elem, ret) {
181
+ var genericTree;
182
+ if (ret === null) {
183
+ ret = false;
184
+ }
185
+ genericTree = getGenericTree($container);
186
+ console.log(window.xxx = genericTree);
187
+ return $.ajax({
188
+ url: $container.data('reorder-url'),
189
+ method: 'patch',
190
+ data: {
191
+ order: xxx
192
+ },
193
+ complete: function(resp) {
194
+ return console.log(resp);
195
+ }
196
+ });
197
+ };
198
+
199
+ getGenericTree = function() {
200
+ var draggable_tree_descendants;
201
+ draggable_tree_descendants = {};
202
+ $container.find('.draggable_tree_container').each(function(i, elem) {
203
+ var $elem, child_ids, e, id, id_field;
204
+ $elem = $(elem);
205
+ id_field = $elem.data('draggable-tree-id-field');
206
+ id = $elem.data(id_field);
207
+ child_ids = (function() {
208
+ var j, len, ref, results;
209
+ ref = $elem.children('.draggable_tree_children').children('.draggable_tree_container');
210
+ results = [];
211
+ for (j = 0, len = ref.length; j < len; j++) {
212
+ e = ref[j];
213
+ results.push($(e).data(id_field));
214
+ }
215
+ return results;
216
+ })();
217
+ draggable_tree_descendants[id] = {
218
+ child_ids: child_ids,
219
+ weight: $elem.index() + 1
220
+ };
221
+ });
222
+ return draggable_tree_descendants;
223
+ };
@@ -0,0 +1,98 @@
1
+ // TODO Update product image code to use the cool new function
2
+ function productDropzone() {
3
+
4
+ if ($('.dropzone.product').length) {
5
+
6
+ var $dropzone = $('.dropzone.product');
7
+ var myDropzone = new Dropzone('.dropzone.product', {
8
+ url: '/admin/products/' + $dropzone.attr('data-product-id') + '/product_image',
9
+ dictDefaultMessage: ''
10
+ });
11
+
12
+ myDropzone.on('complete', function(file) {
13
+ $.post('/admin/products/' + $dropzone.attr('data-product-id') + '/reload_images')
14
+ });
15
+
16
+ myDropzone.on('addedfile', function(file) {
17
+ $dropzone.addClass('uploading')
18
+ });
19
+
20
+ }
21
+ }
22
+
23
+ // This function below is for setting up dropzone dynamically based upon the data
24
+ // attributes that the image_upload partial contains. The data attributes should
25
+ // always be controller, object id and image id.
26
+ // Drag and drop setting a preview image also included in this function
27
+ function defaultDropzone() {
28
+
29
+
30
+ var dropzoneType = '';
31
+ var dropzoneName = '';
32
+ var $dropzone = '';
33
+ var dropzoneData = '';
34
+
35
+ if ($('.dropzone.pages').length) {
36
+
37
+ dropzoneType = "pages";
38
+ dropzoneName = ".dropzone." + dropzoneType;
39
+ $dropzone = $(dropzoneName);
40
+ dropzoneData = $dropzone.attr("data-" + dropzoneType + "-id");
41
+
42
+ }
43
+
44
+ if (dropzoneType.length > 0) {
45
+
46
+ var myDropzone = new Dropzone(dropzoneName, {
47
+ url: '/admin/' + dropzoneType + '/' + dropzoneData + '/dropzone_image',
48
+ dictDefaultMessage: ''
49
+ });
50
+
51
+ myDropzone.on('complete', function(file) {
52
+ $.post('/admin/' + dropzoneType + '/' + dropzoneData + '/reload_images')
53
+ });
54
+
55
+ myDropzone.on('addedfile', function(file) {
56
+ $dropzone.addClass('uploading')
57
+ });
58
+
59
+ }
60
+
61
+ if ($('#preview_drag__target').length && dropzoneData.length > 0) {
62
+
63
+ $('.image_container.draggable img').draggable({
64
+ revert: true,
65
+ drag: function(event, ui) {}
66
+ });
67
+
68
+ $('#preview_drag__target').droppable({
69
+ hoverClass: 'hovering',
70
+ drop: function(event, ui) {
71
+
72
+ setPreviewImage(dropzoneData, $(ui.draggable).attr('data-image-id'), dropzoneType);
73
+ }
74
+ });
75
+
76
+ $('.image_container.draggable img').on('drag', function(event, ui) {});
77
+
78
+ }
79
+
80
+ }
81
+
82
+ function setPreviewImage(objId, imageId, type) {
83
+
84
+ $.post('/admin/' + type + '/' + objId + '/set_preview_image?image_id=' + imageId)
85
+ setPreviewHeights();
86
+ }
87
+
88
+ function setPreviewHeights() {
89
+
90
+ if ($('#preview_image__wrapper').length > 0){
91
+ var w = $('#preview_image').width();
92
+ var h = $('#preview_image').height();
93
+
94
+ $('#preview_image__overlay').width(w);
95
+ $('#preview_image__overlay').height(h);
96
+ }
97
+
98
+ }