georgia 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (366) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +27 -0
  4. data/Rakefile +27 -0
  5. data/app/assets/fonts/georgia/signika-bold-webfont.eot +0 -0
  6. data/app/assets/fonts/georgia/signika-bold-webfont.svg +1711 -0
  7. data/app/assets/fonts/georgia/signika-bold-webfont.ttf +0 -0
  8. data/app/assets/fonts/georgia/signika-bold-webfont.woff +0 -0
  9. data/app/assets/fonts/georgia/signika-light-webfont.eot +0 -0
  10. data/app/assets/fonts/georgia/signika-light-webfont.svg +1680 -0
  11. data/app/assets/fonts/georgia/signika-light-webfont.ttf +0 -0
  12. data/app/assets/fonts/georgia/signika-light-webfont.woff +0 -0
  13. data/app/assets/fonts/georgia/signika-regular-webfont.eot +0 -0
  14. data/app/assets/fonts/georgia/signika-regular-webfont.svg +1746 -0
  15. data/app/assets/fonts/georgia/signika-regular-webfont.ttf +0 -0
  16. data/app/assets/fonts/georgia/signika-regular-webfont.woff +0 -0
  17. data/app/assets/images/georgia/bg-body-bar.jpg +0 -0
  18. data/app/assets/images/georgia/checkmark.png +0 -0
  19. data/app/assets/images/georgia/content-types/avi.jpg +0 -0
  20. data/app/assets/images/georgia/content-types/css.jpg +0 -0
  21. data/app/assets/images/georgia/content-types/csv.jpg +0 -0
  22. data/app/assets/images/georgia/content-types/doc.jpg +0 -0
  23. data/app/assets/images/georgia/content-types/docx.jpg +0 -0
  24. data/app/assets/images/georgia/content-types/eps.jpg +0 -0
  25. data/app/assets/images/georgia/content-types/gif.jpg +0 -0
  26. data/app/assets/images/georgia/content-types/gz.jpg +0 -0
  27. data/app/assets/images/georgia/content-types/html.jpg +0 -0
  28. data/app/assets/images/georgia/content-types/jpg.jpg +0 -0
  29. data/app/assets/images/georgia/content-types/mp3.jpg +0 -0
  30. data/app/assets/images/georgia/content-types/ods.jpg +0 -0
  31. data/app/assets/images/georgia/content-types/odt.jpg +0 -0
  32. data/app/assets/images/georgia/content-types/pdf.jpg +0 -0
  33. data/app/assets/images/georgia/content-types/png.jpg +0 -0
  34. data/app/assets/images/georgia/content-types/ppt.jpg +0 -0
  35. data/app/assets/images/georgia/content-types/pptx.jpg +0 -0
  36. data/app/assets/images/georgia/content-types/rar.jpg +0 -0
  37. data/app/assets/images/georgia/content-types/tar.jpg +0 -0
  38. data/app/assets/images/georgia/content-types/txt.jpg +0 -0
  39. data/app/assets/images/georgia/content-types/wav.jpg +0 -0
  40. data/app/assets/images/georgia/content-types/xls.jpg +0 -0
  41. data/app/assets/images/georgia/content-types/zip.jpg +0 -0
  42. data/app/assets/images/georgia/down_arrow.gif +0 -0
  43. data/app/assets/images/georgia/grippy_large.png +0 -0
  44. data/app/assets/images/georgia/indeterminate.png +0 -0
  45. data/app/assets/images/georgia/logo.png +0 -0
  46. data/app/assets/images/georgia/select2-spinner.gif +0 -0
  47. data/app/assets/images/georgia/select2.png +0 -0
  48. data/app/assets/images/georgia/select2x2.png +0 -0
  49. data/app/assets/images/georgia/transparent.jpg +0 -0
  50. data/app/assets/images/georgia/up_arrow.gif +0 -0
  51. data/app/assets/images/ui-bg_glass_75_ffffff_1x400.png +0 -0
  52. data/app/assets/javascripts/georgia/application.js +20 -0
  53. data/app/assets/javascripts/georgia/bootstrap-vendor.js.coffee +13 -0
  54. data/app/assets/javascripts/georgia/ckeditor/config.js +22 -0
  55. data/app/assets/javascripts/georgia/components/asset-replacer.js.coffee +25 -0
  56. data/app/assets/javascripts/georgia/components/asset-uploader.js.coffee +44 -0
  57. data/app/assets/javascripts/georgia/components/flash.js.coffee +15 -0
  58. data/app/assets/javascripts/georgia/components/forms/menu.js.coffee +66 -0
  59. data/app/assets/javascripts/georgia/components/forms/revision.js.coffee +22 -0
  60. data/app/assets/javascripts/georgia/components/forms/spinning.js.coffee +51 -0
  61. data/app/assets/javascripts/georgia/components/media-library.js.coffee +57 -0
  62. data/app/assets/javascripts/georgia/components/portlets/link.js.coffee +14 -0
  63. data/app/assets/javascripts/georgia/components/portlets/slide.js.coffee +38 -0
  64. data/app/assets/javascripts/georgia/components/portlets/widget.js.coffee +47 -0
  65. data/app/assets/javascripts/georgia/components/position_sort.js.coffee +20 -0
  66. data/app/assets/javascripts/georgia/components/tables/checkbox.js.coffee +123 -0
  67. data/app/assets/javascripts/georgia/components/tables/media.js.coffee +59 -0
  68. data/app/assets/javascripts/georgia/components/tables/messages.js.coffee +59 -0
  69. data/app/assets/javascripts/georgia/components/tables/pages.js.coffee +93 -0
  70. data/app/assets/javascripts/georgia/components/tags.js.coffee +36 -0
  71. data/app/assets/javascripts/georgia/components/widget.js.coffee +32 -0
  72. data/app/assets/javascripts/georgia/featured-image.js.coffee +8 -0
  73. data/app/assets/javascripts/georgia/keybindings.js.coffee +42 -0
  74. data/app/assets/javascripts/georgia/toggle.js.coffee +4 -0
  75. data/app/assets/javascripts/georgia/vendor/bootstrap-datetimepicker.js +28 -0
  76. data/app/assets/javascripts/georgia/vendor/jquery.mjs.nestedSortable.js +608 -0
  77. data/app/assets/javascripts/georgia/vendor/jquery.ui.touch-punch.js +160 -0
  78. data/app/assets/javascripts/georgia/vendor/moment.js +6 -0
  79. data/app/assets/stylesheets/georgia/application.css.scss +16 -0
  80. data/app/assets/stylesheets/georgia/components/_box.scss +29 -0
  81. data/app/assets/stylesheets/georgia/components/_button.scss +60 -0
  82. data/app/assets/stylesheets/georgia/components/_checkbox.scss +48 -0
  83. data/app/assets/stylesheets/georgia/components/_form.scss +8 -0
  84. data/app/assets/stylesheets/georgia/components/_help.scss +4 -0
  85. data/app/assets/stylesheets/georgia/components/_icon.scss +7 -0
  86. data/app/assets/stylesheets/georgia/components/_input.scss +48 -0
  87. data/app/assets/stylesheets/georgia/components/_label.scss +4 -0
  88. data/app/assets/stylesheets/georgia/components/_modal.scss +14 -0
  89. data/app/assets/stylesheets/georgia/components/_nav-list.scss +13 -0
  90. data/app/assets/stylesheets/georgia/components/_note.scss +31 -0
  91. data/app/assets/stylesheets/georgia/components/_portlet.scss +57 -0
  92. data/app/assets/stylesheets/georgia/components/_progress.scss +4 -0
  93. data/app/assets/stylesheets/georgia/components/_state.scss +17 -0
  94. data/app/assets/stylesheets/georgia/components/_table.scss +8 -0
  95. data/app/assets/stylesheets/georgia/components/_transparent.scss +3 -0
  96. data/app/assets/stylesheets/georgia/layout/_base.scss +94 -0
  97. data/app/assets/stylesheets/georgia/layout/_devise.scss +5 -0
  98. data/app/assets/stylesheets/georgia/mixins/_clearfix.scss +12 -0
  99. data/app/assets/stylesheets/georgia/mixins/_ellipsis.scss +8 -0
  100. data/app/assets/stylesheets/georgia/mixins/_inflectors.scss +1 -0
  101. data/app/assets/stylesheets/georgia/mixins/_opacity.scss +6 -0
  102. data/app/assets/stylesheets/georgia/mixins/_utilities.scss +13 -0
  103. data/app/assets/stylesheets/georgia/modules/_facets.scss +4 -0
  104. data/app/assets/stylesheets/georgia/modules/_footer.scss +9 -0
  105. data/app/assets/stylesheets/georgia/modules/_form_with_helpers.scss +17 -0
  106. data/app/assets/stylesheets/georgia/modules/_header.scss +66 -0
  107. data/app/assets/stylesheets/georgia/modules/_link.scss +51 -0
  108. data/app/assets/stylesheets/georgia/modules/_login.scss +7 -0
  109. data/app/assets/stylesheets/georgia/modules/_media.scss +55 -0
  110. data/app/assets/stylesheets/georgia/modules/_menu.scss +7 -0
  111. data/app/assets/stylesheets/georgia/modules/_message.scss +53 -0
  112. data/app/assets/stylesheets/georgia/modules/_notifications.scss +26 -0
  113. data/app/assets/stylesheets/georgia/modules/_pages.scss +7 -0
  114. data/app/assets/stylesheets/georgia/modules/_pagination.scss +41 -0
  115. data/app/assets/stylesheets/georgia/modules/_results.scss +46 -0
  116. data/app/assets/stylesheets/georgia/modules/_revision.scss +18 -0
  117. data/app/assets/stylesheets/georgia/modules/_sidebar.scss +71 -0
  118. data/app/assets/stylesheets/georgia/modules/_slide.scss +11 -0
  119. data/app/assets/stylesheets/georgia/modules/_subpage.scss +25 -0
  120. data/app/assets/stylesheets/georgia/modules/_users.scss +3 -0
  121. data/app/assets/stylesheets/georgia/modules/_widget.scss +45 -0
  122. data/app/assets/stylesheets/georgia/overrides/_select2.scss +5 -0
  123. data/app/assets/stylesheets/georgia/settings/_base.scss +6 -0
  124. data/app/assets/stylesheets/georgia/settings/_colors.scss +41 -0
  125. data/app/assets/stylesheets/georgia/settings/_fonts.scss +3 -0
  126. data/app/assets/stylesheets/georgia/settings/_z-index.scss +7 -0
  127. data/app/assets/stylesheets/georgia/vendor/_autocomplete.scss +50 -0
  128. data/app/assets/stylesheets/georgia/vendor/_bootstrap-datetimepicker.scss +174 -0
  129. data/app/assets/stylesheets/georgia/vendor/_select2.scss +18 -0
  130. data/app/assets/stylesheets/georgia/vendor/_tooltip.scss +98 -0
  131. data/app/controllers/georgia/api/media_controller.rb +18 -0
  132. data/app/controllers/georgia/api/tags_controller.rb +22 -0
  133. data/app/controllers/georgia/application_controller.rb +25 -0
  134. data/app/controllers/georgia/concerns/frontendable.rb +45 -0
  135. data/app/controllers/georgia/concerns/helpers.rb +28 -0
  136. data/app/controllers/georgia/dashboard_controller.rb +14 -0
  137. data/app/controllers/georgia/links_controller.rb +13 -0
  138. data/app/controllers/georgia/media_controller.rb +101 -0
  139. data/app/controllers/georgia/menus_controller.rb +80 -0
  140. data/app/controllers/georgia/messages_controller.rb +74 -0
  141. data/app/controllers/georgia/pages_controller.rb +180 -0
  142. data/app/controllers/georgia/revisions_controller.rb +89 -0
  143. data/app/controllers/georgia/slides_controller.rb +13 -0
  144. data/app/controllers/georgia/ui_associations_controller.rb +12 -0
  145. data/app/controllers/georgia/users/sessions_controller.rb +7 -0
  146. data/app/controllers/georgia/users_controller.rb +51 -0
  147. data/app/controllers/georgia/widgets_controller.rb +67 -0
  148. data/app/controllers/messages_controller.rb +29 -0
  149. data/app/decorators/ckeditor/asset_decorator.rb +13 -0
  150. data/app/decorators/ckeditor/assets_decorator.rb +4 -0
  151. data/app/decorators/ckeditor/picture_decorator.rb +9 -0
  152. data/app/decorators/ckeditor/pictures_decorator.rb +4 -0
  153. data/app/decorators/georgia/application_decorator.rb +6 -0
  154. data/app/decorators/georgia/link_decorator.rb +9 -0
  155. data/app/decorators/georgia/links_decorator.rb +4 -0
  156. data/app/decorators/georgia/message_decorator.rb +21 -0
  157. data/app/decorators/georgia/messages_decorator.rb +4 -0
  158. data/app/decorators/georgia/page_decorator.rb +31 -0
  159. data/app/decorators/georgia/pages_decorator.rb +4 -0
  160. data/app/decorators/georgia/revision_decorator.rb +28 -0
  161. data/app/decorators/georgia/slide_decorator.rb +4 -0
  162. data/app/decorators/georgia/widget_decorator.rb +4 -0
  163. data/app/decorators/pagination_decorator.rb +3 -0
  164. data/app/decorators/sunspot/highlighted_hit_decorator.rb +29 -0
  165. data/app/helpers/georgia/checkboxes_helper.rb +13 -0
  166. data/app/helpers/georgia/devise_helper.rb +15 -0
  167. data/app/helpers/georgia/facets_helper.rb +35 -0
  168. data/app/helpers/georgia/forms_helper.rb +68 -0
  169. data/app/helpers/georgia/header_helper.rb +10 -0
  170. data/app/helpers/georgia/internationalization_helper.rb +32 -0
  171. data/app/helpers/georgia/menus_helper.rb +20 -0
  172. data/app/helpers/georgia/messages_helper.rb +9 -0
  173. data/app/helpers/georgia/meta_tags_helper.rb +22 -0
  174. data/app/helpers/georgia/modals_helper.rb +7 -0
  175. data/app/helpers/georgia/pages_helper.rb +22 -0
  176. data/app/helpers/georgia/pagination_helper.rb +10 -0
  177. data/app/helpers/georgia/routes_helper.rb +25 -0
  178. data/app/helpers/georgia/sidebar_helper.rb +13 -0
  179. data/app/helpers/georgia/states_helper.rb +17 -0
  180. data/app/helpers/georgia/twitter_helper.rb +24 -0
  181. data/app/helpers/georgia/ui_helper.rb +51 -0
  182. data/app/mailers/georgia/notifier.rb +33 -0
  183. data/app/models/ability.rb +19 -0
  184. data/app/models/ckeditor/asset.rb +61 -0
  185. data/app/models/ckeditor/attachment_file.rb +7 -0
  186. data/app/models/ckeditor/picture.rb +15 -0
  187. data/app/models/georgia/clone.rb +101 -0
  188. data/app/models/georgia/concerns/cacheable.rb +18 -0
  189. data/app/models/georgia/concerns/contentable.rb +22 -0
  190. data/app/models/georgia/concerns/indexable.rb +67 -0
  191. data/app/models/georgia/concerns/orderable.rb +21 -0
  192. data/app/models/georgia/concerns/publishable.rb +35 -0
  193. data/app/models/georgia/concerns/revisionable.rb +38 -0
  194. data/app/models/georgia/concerns/slugable.rb +46 -0
  195. data/app/models/georgia/concerns/statable.rb +64 -0
  196. data/app/models/georgia/concerns/taggable.rb +19 -0
  197. data/app/models/georgia/concerns/templatable.rb +20 -0
  198. data/app/models/georgia/concerns/treeable.rb +26 -0
  199. data/app/models/georgia/content.rb +15 -0
  200. data/app/models/georgia/link.rb +27 -0
  201. data/app/models/georgia/menu.rb +13 -0
  202. data/app/models/georgia/message.rb +47 -0
  203. data/app/models/georgia/page.rb +20 -0
  204. data/app/models/georgia/revision.rb +22 -0
  205. data/app/models/georgia/role.rb +10 -0
  206. data/app/models/georgia/slide.rb +13 -0
  207. data/app/models/georgia/status.rb +29 -0
  208. data/app/models/georgia/ui_association.rb +27 -0
  209. data/app/models/georgia/ui_section.rb +12 -0
  210. data/app/models/georgia/user.rb +27 -0
  211. data/app/models/georgia/widget.rb +32 -0
  212. data/app/parsers/georgia/menu_ancestry_parser.rb +41 -0
  213. data/app/policies/georgia/policy.rb +17 -0
  214. data/app/policies/georgia/revision_policy.rb +53 -0
  215. data/app/presenters/georgia/active_facet_presenter.rb +25 -0
  216. data/app/presenters/georgia/facet_presenter.rb +26 -0
  217. data/app/presenters/georgia/link_portlet.rb +101 -0
  218. data/app/presenters/georgia/list_facet_presenter.rb +32 -0
  219. data/app/presenters/georgia/media_library_presenter.rb +44 -0
  220. data/app/presenters/georgia/message_actions_presenter.rb +51 -0
  221. data/app/presenters/georgia/page_actions_presenter.rb +94 -0
  222. data/app/presenters/georgia/pagination_presenter.rb +58 -0
  223. data/app/presenters/georgia/portlet.rb +30 -0
  224. data/app/presenters/georgia/presenter.rb +17 -0
  225. data/app/presenters/georgia/sidebar_link_presenter.rb +55 -0
  226. data/app/presenters/georgia/single_active_facet_presenter.rb +10 -0
  227. data/app/presenters/georgia/slide_portlet.rb +79 -0
  228. data/app/presenters/georgia/subpage_portlet.rb +36 -0
  229. data/app/presenters/georgia/warning_message.rb +55 -0
  230. data/app/presenters/georgia/widget_portlet.rb +75 -0
  231. data/app/sweepers/navigation_sweeper.rb +12 -0
  232. data/app/uploaders/ckeditor_attachment_file_uploader.rb +16 -0
  233. data/app/uploaders/ckeditor_picture_uploader.rb +36 -0
  234. data/app/uploaders/georgia/attachment_uploader.rb +16 -0
  235. data/app/views/georgia/api/media/pictures.html.erb +17 -0
  236. data/app/views/georgia/ckeditor/assets/_asset.html.erb +23 -0
  237. data/app/views/georgia/ckeditor/attachment_files/_attachment_file.html.erb +1 -0
  238. data/app/views/georgia/ckeditor/pictures/_picture.html.erb +26 -0
  239. data/app/views/georgia/dashboard/panels/_messages.html.erb +30 -0
  240. data/app/views/georgia/dashboard/panels/_reviews.html.erb +24 -0
  241. data/app/views/georgia/dashboard/show.html.erb +18 -0
  242. data/app/views/georgia/header/_dashboard.html.erb +1 -0
  243. data/app/views/georgia/header/_media.html.erb +3 -0
  244. data/app/views/georgia/header/_messages.html.erb +3 -0
  245. data/app/views/georgia/header/_navigation.html.erb +3 -0
  246. data/app/views/georgia/header/_pages.html.erb +3 -0
  247. data/app/views/georgia/header/_users.html.erb +3 -0
  248. data/app/views/georgia/header/_widgets.html.erb +3 -0
  249. data/app/views/georgia/links/show.html.erb +1 -0
  250. data/app/views/georgia/media/_header.html.erb +27 -0
  251. data/app/views/georgia/media/create.js.erb +1 -0
  252. data/app/views/georgia/media/edit.html.erb +74 -0
  253. data/app/views/georgia/media/search.html.erb +36 -0
  254. data/app/views/georgia/media/sidebar/_facets.html.erb +12 -0
  255. data/app/views/georgia/menus/_menu.html.erb +7 -0
  256. data/app/views/georgia/menus/create.js.erb +5 -0
  257. data/app/views/georgia/menus/edit.html.erb +37 -0
  258. data/app/views/georgia/menus/index.html.erb +36 -0
  259. data/app/views/georgia/messages/_message.html.erb +26 -0
  260. data/app/views/georgia/messages/destroy.js.erb +3 -0
  261. data/app/views/georgia/messages/search.html.erb +58 -0
  262. data/app/views/georgia/messages/show.html.erb +46 -0
  263. data/app/views/georgia/notifier/notify_admins.html.erb +10 -0
  264. data/app/views/georgia/notifier/notify_editors.html.erb +10 -0
  265. data/app/views/georgia/notifier/notify_support.html.erb +9 -0
  266. data/app/views/georgia/pages/_header.html.erb +22 -0
  267. data/app/views/georgia/pages/_page.html.erb +19 -0
  268. data/app/views/georgia/pages/_subpage.html.erb +1 -0
  269. data/app/views/georgia/pages/create.js.erb +6 -0
  270. data/app/views/georgia/pages/search.html.erb +32 -0
  271. data/app/views/georgia/pages/settings.html.erb +79 -0
  272. data/app/views/georgia/pages/templates/_custom.html.erb +7 -0
  273. data/app/views/georgia/pages/templates/_default.html.erb +7 -0
  274. data/app/views/georgia/pages/templates/_one-column.html.erb +7 -0
  275. data/app/views/georgia/pages/templates/_sidebar-left.html.erb +10 -0
  276. data/app/views/georgia/pages/templates/_sidebar-right.html.erb +10 -0
  277. data/app/views/georgia/revisions/_revision.html.erb +11 -0
  278. data/app/views/georgia/revisions/edit.html.erb +36 -0
  279. data/app/views/georgia/revisions/fields/_content.html.erb +43 -0
  280. data/app/views/georgia/revisions/fields/_slides.html.erb +19 -0
  281. data/app/views/georgia/revisions/fields/_template.html.erb +8 -0
  282. data/app/views/georgia/revisions/fields/_ui_section.html.erb +14 -0
  283. data/app/views/georgia/revisions/fields/_widgets.html.erb +11 -0
  284. data/app/views/georgia/revisions/index.html.erb +25 -0
  285. data/app/views/georgia/shared/_messages.html.erb +11 -0
  286. data/app/views/georgia/shared/modals/_media_library.html.erb +35 -0
  287. data/app/views/georgia/shared/modals/_menu.html.erb +20 -0
  288. data/app/views/georgia/shared/modals/_page.html.erb +20 -0
  289. data/app/views/georgia/shared/modals/_progress.html.erb +15 -0
  290. data/app/views/georgia/shared/modals/_widget.html.erb +24 -0
  291. data/app/views/georgia/shared/search/_messages.html.erb +4 -0
  292. data/app/views/georgia/slides/new.html.erb +1 -0
  293. data/app/views/georgia/ui_associations/new.html.erb +1 -0
  294. data/app/views/georgia/users/_form.html.erb +27 -0
  295. data/app/views/georgia/users/_user.html.erb +9 -0
  296. data/app/views/georgia/users/edit.html.erb +22 -0
  297. data/app/views/georgia/users/index.html.erb +25 -0
  298. data/app/views/georgia/users/new.html.erb +19 -0
  299. data/app/views/georgia/users/registrations/new.html.erb +20 -0
  300. data/app/views/georgia/users/sessions/new.html.erb +17 -0
  301. data/app/views/georgia/widgets/_widget.html.erb +35 -0
  302. data/app/views/georgia/widgets/create.js.erb +5 -0
  303. data/app/views/georgia/widgets/index.html.erb +31 -0
  304. data/app/views/layouts/georgia/_footer.html.erb +7 -0
  305. data/app/views/layouts/georgia/_head.html.erb +15 -0
  306. data/app/views/layouts/georgia/_header.html.erb +40 -0
  307. data/app/views/layouts/georgia/_messages.html.erb +7 -0
  308. data/app/views/layouts/georgia/_sidebar.html.erb +9 -0
  309. data/app/views/layouts/georgia/application.html.erb +16 -0
  310. data/app/views/layouts/georgia/devise.html.erb +11 -0
  311. data/app/views/menus/_dropdown_group.html.erb +10 -0
  312. data/app/views/menus/_dropdown_link.html.erb +3 -0
  313. data/app/views/menus/_dropdown_menu.html.erb +11 -0
  314. data/app/views/menus/_link.html.erb +1 -0
  315. data/app/views/menus/_menu.html.erb +7 -0
  316. data/app/views/messages/create.js.erb +0 -0
  317. data/app/workers/spam_worker.rb +12 -0
  318. data/config/initializers/acts_as_taggable_on.rb +19 -0
  319. data/config/initializers/ckeditor.rb +18 -0
  320. data/config/initializers/devise.rb +254 -0
  321. data/config/initializers/inflections.rb +3 -0
  322. data/config/initializers/revisions.rb +5 -0
  323. data/config/initializers/simple_form.rb +79 -0
  324. data/config/locales/georgia.en.yml +4 -0
  325. data/config/routes.rb +79 -0
  326. data/db/migrate/001_create_ckeditor_assets.rb +25 -0
  327. data/db/migrate/002_create_georgia_contents.rb +18 -0
  328. data/db/migrate/003_create_georgia_links.rb +12 -0
  329. data/db/migrate/004_create_georgia_menus.rb +10 -0
  330. data/db/migrate/005_create_georgia_messages.rb +21 -0
  331. data/db/migrate/006_create_georgia_pages.rb +21 -0
  332. data/db/migrate/007_create_georgia_revisions.rb +12 -0
  333. data/db/migrate/008_create_georgia_roles.rb +10 -0
  334. data/db/migrate/009_create_georgia_slides.rb +11 -0
  335. data/db/migrate/010_create_georgia_ui_associations.rb +13 -0
  336. data/db/migrate/011_create_georgia_ui_sections.rb +9 -0
  337. data/db/migrate/012_create_georgia_users.rb +24 -0
  338. data/db/migrate/013_create_georgia_widgets.rb +9 -0
  339. data/db/migrate/014_create_roles_users.rb +11 -0
  340. data/db/migrate/015_create_tags.rb +20 -0
  341. data/lib/generators/georgia/install/install_generator.rb +60 -0
  342. data/lib/generators/georgia/install/templates/Procfile +1 -0
  343. data/lib/generators/georgia/install/templates/README +14 -0
  344. data/lib/generators/georgia/install/templates/app/controllers/pages_controller.rb +13 -0
  345. data/lib/generators/georgia/install/templates/config/initializers/georgia.rb +15 -0
  346. data/lib/generators/georgia/upgrade/templates/add_anti_spam_to_messages.rb +12 -0
  347. data/lib/generators/georgia/upgrade/templates/add_contents_counter_cache_to_images.rb +15 -0
  348. data/lib/generators/georgia/upgrade/templates/add_public_to_georgia_pages.rb +8 -0
  349. data/lib/generators/georgia/upgrade/templates/add_state_to_georgia_pages.rb +13 -0
  350. data/lib/generators/georgia/upgrade/templates/create_georgia_revisions.rb +12 -0
  351. data/lib/generators/georgia/upgrade/upgrade_generator.rb +34 -0
  352. data/lib/georgia.rb +23 -0
  353. data/lib/georgia/assets.rb +8 -0
  354. data/lib/georgia/assets/cloud_files_connection.rb +22 -0
  355. data/lib/georgia/assets/transferable_picture.rb +51 -0
  356. data/lib/georgia/engine.rb +58 -0
  357. data/lib/georgia/paths.rb +22 -0
  358. data/lib/georgia/version.rb +3 -0
  359. data/lib/tasks/assets.rake +106 -0
  360. data/lib/tasks/georgia.rake +61 -0
  361. data/lib/tasks/install.rake +19 -0
  362. data/lib/tasks/sidekiq.rake +8 -0
  363. data/lib/tasks/solr.rake +30 -0
  364. data/lib/tasks/upgrade.rake +39 -0
  365. data/lib/templates/erb/scaffold/_form.html.erb +13 -0
  366. metadata +857 -0
@@ -0,0 +1,36 @@
1
+ class @Tags
2
+
3
+ constructor: (element, options={}) ->
4
+ @el = $(element)
5
+ @tags = []
6
+
7
+ @options =
8
+ placeholder: 'Enter tags'
9
+ multiple: true
10
+ tokenSeparators: [","]
11
+ tags: () =>
12
+ query = @el.select2('container').find('input.select2-input').val()
13
+ @search(query)
14
+ @options = $.extend {}, @options, options
15
+
16
+ @el.select2(@options)
17
+
18
+ search: (query='') ->
19
+ if query?
20
+ $.ajax(
21
+ type: 'GET'
22
+ url: '/admin/api/tags/search'
23
+ data: {q: query}
24
+ async: false
25
+ success: (data) =>
26
+ @tags = $.map(data.results, (e) => e.text)
27
+ )
28
+ @tags
29
+
30
+
31
+ $.fn.taggable = ->
32
+ @each ->
33
+ new Tags(this)
34
+
35
+ jQuery ->
36
+ $('input.js-token-input').taggable()
@@ -0,0 +1,32 @@
1
+ class @Widget
2
+
3
+ constructor: (element) ->
4
+ @element = $(element)
5
+ @widget = @element.find('.widget-show')
6
+ @widgetForm = @element.find('.widget-form')
7
+ @editLink = @element.find('.js-edit')
8
+ @cancelLink = @element.find('.js-close')
9
+ @setBindings()
10
+
11
+ setBindings: () =>
12
+ @editLink.bind('click', @showForm)
13
+ @cancelLink.bind('click', @hideForm)
14
+
15
+ showForm: (event) =>
16
+ event.preventDefault()
17
+ @widget.addClass('hide')
18
+ @widgetForm.removeClass('hide')
19
+
20
+ hideForm: (event) =>
21
+ event.preventDefault()
22
+ @widgetForm.addClass('hide')
23
+ @widget.removeClass('hide')
24
+
25
+
26
+ $.fn.widget = () ->
27
+ @each ->
28
+ new Widget($(this))
29
+
30
+ jQuery ->
31
+ $(".js-widget").each () ->
32
+ $(this).widget()
@@ -0,0 +1,8 @@
1
+ jQuery ->
2
+
3
+ $("[data-featured-image='toggle']").click (e) ->
4
+ e.preventDefault()
5
+ pane = $(this).closest('.tab-pane')
6
+ pane.find("[data-featured-image='toggle']").removeClass('active')
7
+ $(this).addClass('active')
8
+ pane.find("[data-featured-image='input']").val($(this).data('featured-image-id'))
@@ -0,0 +1,42 @@
1
+ jQuery ->
2
+
3
+ Mousetrap.bind ['ctrl+s', 'command+s'], (e) ->
4
+ $('form').submit()
5
+ false
6
+
7
+ # Hotkey binding to links with 'data-keybinding' attribute
8
+ # Navigate link when hotkey pressed
9
+ $('a[data-keybinding]').each (i, el) ->
10
+ Mousetrap.bind $(el).data('keybinding'), (e) -> el.click()
11
+
12
+ # Hotkey binding to inputs with 'data-keybinding' attribute
13
+ # Focus input when hotkey pressed
14
+ $('input[data-keybinding]').each (i, el) ->
15
+ Mousetrap.bind $(el).data('keybinding'), (e) ->
16
+ el.focus()
17
+ if e.preventDefault
18
+ e.preventDefault()
19
+ else
20
+ e.returnValue = false
21
+
22
+ # Toggle show/hide hotkey hints
23
+ window.mouseTrapRails =
24
+ showOnLoad: false # Show/hide hotkey hints by default (on page load). Mostly for debugging purposes.
25
+ toggleKeys: 'alt+shift+h' # Key sequence to toggle hints visibility.
26
+ keysShown: false
27
+ toggleHints: ->
28
+ $('a[data-keybinding]').each (i, el) ->
29
+ $el = $(el)
30
+ if mouseTrapRails.keysShown
31
+ $el.removeClass('mt-hotkey-el').find('.mt-hotkey-hint').remove()
32
+ else
33
+ mtKey = $el.data('keybinding')
34
+ $hint = "<i class='mt-hotkey-hint' title='Press \<#{mtKey}\> to open link'>#{mtKey}</i>"
35
+ $el.addClass('mt-hotkey-el') unless $el.css('position') is 'absolute'
36
+ $el.append $hint
37
+ @keysShown ^= true
38
+
39
+ Mousetrap.bind mouseTrapRails.toggleKeys, -> mouseTrapRails.toggleHints()
40
+
41
+ mouseTrapRails.toggleHints() if mouseTrapRails.showOnLoad
42
+
@@ -0,0 +1,4 @@
1
+ jQuery ->
2
+
3
+ $('.js-toggle-icon').hover -> $(this).siblings('i').toggleClass('hide')
4
+ $('.js-toggle-children').click -> $(this).children().toggleClass('hide')
@@ -0,0 +1,28 @@
1
+ /**
2
+ * version 2.1.20
3
+ * @license
4
+ * =========================================================
5
+ * bootstrap-datetimepicker.js
6
+ * http://www.eyecon.ro/bootstrap-datepicker
7
+ * =========================================================
8
+ * Copyright 2012 Stefan Petre
9
+ *
10
+ * Contributions:
11
+ * - updated for Bootstrap v3 by Jonathan Peterson (@Eonasdan) and (almost)
12
+ * completely rewritten to use Momentjs
13
+ * - based on tarruda's bootstrap-datepicker
14
+ *
15
+ * Licensed under the Apache License, Version 2.0 (the "License");
16
+ * you may not use this file except in compliance with the License.
17
+ * You may obtain a copy of the License at
18
+ *
19
+ * http://www.apache.org/licenses/LICENSE-2.0
20
+ *
21
+ * Unless required by applicable law or agreed to in writing, software
22
+ * distributed under the License is distributed on an "AS IS" BASIS,
23
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
+ * See the License for the specific language governing permissions and
25
+ * limitations under the License.
26
+ * =========================================================
27
+ */
28
+ (function(a){if(typeof define==="function"&&define.amd){define(["jquery","moment"],a)}else{if(!jQuery){throw"bootstrap-datetimepicker requires jQuery to be loaded first"}else{if(!moment){throw"bootstrap-datetimepicker requires moment.js to be loaded first"}else{a(jQuery,moment)}}}}(function(d,e){if(typeof e==="undefined"){alert("momentjs is requried");throw new Error("momentjs is requried")}var c=0,a=e,b=function(o,q){var z={pickDate:true,pickTime:true,useMinutes:true,useSeconds:false,minuteStepping:1,startDate:new a({y:1970}),endDate:new a().add(50,"y"),collapse:true,language:"en",defaultDate:"",disabledDates:[],enabledDates:false,icons:{},useStrict:false},M={time:"glyphicon glyphicon-time",date:"glyphicon glyphicon-calendar",up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down"},l=this,I=function(){var S=false,R,T,Q;l.options=d.extend({},z,q);l.options.icons=d.extend({},M,l.options.icons);l.element=d(o);f();if(!(l.options.pickTime||l.options.pickDate)){throw new Error("Must choose at least one picker")}l.id=c++;a.lang(l.options.language);l.date=a();l.unset=false;l.isInput=l.element.is("input");l.component=false;if(l.element.hasClass("input-group")){if(l.element.find(".datepickerbutton").size()==0){l.component=l.element.find("[class^='input-group-']")}else{l.component=l.element.find(".datepickerbutton")}}l.format=l.options.format;Q=a()._lang._longDateFormat;if(!l.format){if(l.isInput){l.format=l.element.data("format")}else{l.format=l.element.find("input").data("format")}if(!l.format){l.format=(l.options.pickDate?Q.L:"");if(l.options.pickDate&&l.options.pickTime){l.format+=" "}l.format+=(l.options.pickTime?Q.LT:"");if(l.options.useSeconds){if(~Q.LT.indexOf(" A")){l.format=l.format.split(" A")[0]+":ss A"}else{l.format+=":ss"}}}}l.options.use24hours=l.format.toLowerCase().indexOf("a")<1;if(l.component){S=l.component.find("span")}if(l.options.pickTime){if(S){S.addClass(l.options.icons.time)}}if(l.options.pickDate){if(S){S.removeClass(l.options.icons.time);S.addClass(l.options.icons.date)}}l.widget=d(P(l.options.pickDate,l.options.pickTime,l.options.collapse)).appendTo("body");l.minViewMode=l.options.minViewMode||l.element.data("date-minviewmode")||0;if(typeof l.minViewMode==="string"){switch(l.minViewMode){case"months":l.minViewMode=1;break;case"years":l.minViewMode=2;break;default:l.minViewMode=0;break}}l.viewMode=l.options.viewMode||l.element.data("date-viewmode")||0;if(typeof l.viewMode==="string"){switch(l.viewMode){case"months":l.viewMode=1;break;case"years":l.viewMode=2;break;default:l.viewMode=0;break}}for(R=0;R<l.options.disabledDates.length;R++){T=l.options.disabledDates[R];T=a(T);if(!T.isValid()){T=a(l.options.startDate).subtract(1,"day")}l.options.disabledDates[R]=T.format("L")}for(R=0;R<l.options.enabledDates.length;R++){T=l.options.enabledDates[R];T=a(T);if(!T.isValid()){T=a(l.options.startDate).subtract(1,"day")}l.options.enabledDates[R]=T.format("L")}l.startViewMode=l.viewMode;l.setStartDate(l.options.startDate||l.element.data("date-startdate"));l.setEndDate(l.options.endDate||l.element.data("date-enddate"));H();u();v();t();h();y();g();J();if(l.options.defaultDate!==""){l.setValue(l.options.defaultDate)}},f=function(){var Q=l.element.data();if(Q.pickdate!==undefined){l.options.pickDate=Q.pickdate}if(Q.picktime!==undefined){l.options.pickTime=Q.picktime}if(Q.useminutes!==undefined){l.options.useMinutes=Q.useminutes}if(Q.useseconds!==undefined){l.options.useSeconds=Q.useseconds}if(Q.minutestepping!==undefined){l.options.minuteStepping=Q.minutestepping}if(Q.startdate!==undefined){l.options.startDate=Q.startdate}if(Q.enddate!==undefined){l.options.endDate=Q.enddate}if(Q.collapse!==undefined){l.options.collapse=Q.collapse}if(Q.language!==undefined){l.options.language=Q.language}if(Q.defaultdate!==undefined){l.options.defaultDate=Q.defaultdate}if(Q.disableddates!==undefined){l.options.disabledDates=Q.disableddates}if(Q.enableddates!==undefined){l.options.enabledDates=Q.enableddates}if(Q.icons!==undefined){l.options.icons=Q.icons}if(Q.usestrict!==undefined){l.options.useStrict=Q.usestrict}},j=function(){var Q="absolute",S=l.component?l.component.offset():l.element.offset(),R=d(window);l.width=l.component?l.component.outerWidth():l.element.outerWidth();S.top=S.top+l.element.outerHeight();if(l.options.width!==undefined){l.widget.width(l.options.width)}if(l.options.orientation==="left"){l.widget.addClass("left-oriented");S.left=S.left-l.widget.width()+20}if(B()){Q="fixed";S.top-=R.scrollTop();S.left-=R.scrollLeft()}if(R.width()<S.left+l.widget.outerWidth()){S.right=R.width()-S.left-l.width;S.left="auto";l.widget.addClass("pull-right")}else{S.right="auto";l.widget.removeClass("pull-right")}l.widget.css({position:Q,top:S.top,left:S.left,right:S.right})},p=function(R,Q){l.element.trigger({type:"change.dp",date:a(l.date),oldDate:a(R)})},C=function(Q){l.element.trigger({type:"error.dp",date:a(Q)})},y=function(Q){a.lang(l.options.language);var R=Q;if(!R){if(l.isInput){R=l.element.val()}else{R=l.element.find("input").val()}if(R){l.date=a(R,l.format,l.options.useStrict)}if(!l.date){l.date=a()}}l.viewDate=a(l.date).startOf("month");n();k()},H=function(){a.lang(l.options.language);var S=d("<tr>"),Q=a.weekdaysMin(),R;if(a()._lang._week.dow==0){for(R=0;R<7;R++){S.append('<th class="dow">'+Q[R]+"</th>")}}else{for(R=1;R<8;R++){if(R==7){S.append('<th class="dow">'+Q[0]+"</th>")}else{S.append('<th class="dow">'+Q[R]+"</th>")}}}l.widget.find(".datepicker-days thead").append(S)},u=function(){a.lang(l.options.language);var R="",Q=0,S=a.monthsShort();while(Q<12){R+='<span class="month">'+S[Q++]+"</span>"}l.widget.find(".datepicker-months td").append(R)},n=function(){a.lang(l.options.language);var ab=l.viewDate.year(),Z=l.viewDate.month(),aa=l.options.startDate.year(),ad=l.options.startDate.month(),ae=l.options.endDate.year(),X=l.options.endDate.month(),T,W,V=[],af,S,U,ac,R,Y,Q=a.months();l.widget.find(".datepicker-days").find(".disabled").removeClass("disabled");l.widget.find(".datepicker-months").find(".disabled").removeClass("disabled");l.widget.find(".datepicker-years").find(".disabled").removeClass("disabled");l.widget.find(".datepicker-days th:eq(1)").text(Q[Z]+" "+ab);T=a(l.viewDate).subtract("months",1);ac=T.daysInMonth();T.date(ac).startOf("week");if((ab==aa&&Z<=ad)||ab<aa){l.widget.find(".datepicker-days th:eq(0)").addClass("disabled")}if((ab==ae&&Z>=X)||ab>ae){l.widget.find(".datepicker-days th:eq(2)").addClass("disabled")}W=a(T).add(42,"d");while(T.isBefore(W)){if(T.weekday()===a().startOf("week").weekday()){af=d("<tr>");V.push(af)}S="";if(T.year()<ab||(T.year()==ab&&T.month()<Z)){S+=" old"}else{if(T.year()>ab||(T.year()==ab&&T.month()>Z)){S+=" new"}}if(T.isSame(a({y:l.date.year(),M:l.date.month(),d:l.date.date()}))){S+=" active"}if((a(T).add(1,"d")<=l.options.startDate)||(T>l.options.endDate)||O(T)||!s(T)){S+=" disabled"}af.append('<td class="day'+S+'">'+T.date()+"</td>");T.add(1,"d")}l.widget.find(".datepicker-days tbody").empty().append(V);Y=a().year(),Q=l.widget.find(".datepicker-months").find("th:eq(1)").text(ab).end().find("span").removeClass("active");if(Y===ab){Q.eq(a().month()).addClass("active")}if(Y-1<aa){l.widget.find(".datepicker-months th:eq(0)").addClass("disabled")}if(Y+1>ae){l.widget.find(".datepicker-months th:eq(2)").addClass("disabled")}for(U=0;U<12;U++){if((ab==aa&&ad>U)||(ab<aa)){d(Q[U]).addClass("disabled")}else{if((ab==ae&&X<U)||(ab>ae)){d(Q[U]).addClass("disabled")}}}V="";ab=parseInt(ab/10,10)*10;R=l.widget.find(".datepicker-years").find("th:eq(1)").text(ab+"-"+(ab+9)).end().find("td");l.widget.find(".datepicker-years").find("th").removeClass("disabled");if(aa>ab){l.widget.find(".datepicker-years").find("th:eq(0)").addClass("disabled")}if(ae<ab+9){l.widget.find(".datepicker-years").find("th:eq(2)").addClass("disabled")}ab-=1;for(U=-1;U<11;U++){V+='<span class="year'+(U===-1||U===10?" old":"")+(Y===ab?" active":"")+((ab<aa||ab>ae)?" disabled":"")+'">'+ab+"</span>";ab+=1}R.html(V)},v=function(){a.lang(l.options.language);var T=l.widget.find(".timepicker .timepicker-hours table"),S="",U,R,Q;T.parent().hide();if(l.options.use24hours){U=0;for(R=0;R<6;R+=1){S+="<tr>";for(Q=0;Q<4;Q+=1){S+='<td class="hour">'+N(U.toString())+"</td>";U++}S+="</tr>"}}else{U=1;for(R=0;R<3;R+=1){S+="<tr>";for(Q=0;Q<4;Q+=1){S+='<td class="hour">'+N(U.toString())+"</td>";U++}S+="</tr>"}}T.html(S)},t=function(){var T=l.widget.find(".timepicker .timepicker-minutes table"),S="",U=0,R,Q;T.parent().hide();for(R=0;R<5;R++){S+="<tr>";for(Q=0;Q<4;Q+=1){S+='<td class="minute">'+N(U.toString())+"</td>";U+=3}S+="</tr>"}T.html(S)},h=function(){var T=l.widget.find(".timepicker .timepicker-seconds table"),S="",U=0,R,Q;T.parent().hide();for(R=0;R<5;R++){S+="<tr>";for(Q=0;Q<4;Q+=1){S+='<td class="second">'+N(U.toString())+"</td>";U+=3}S+="</tr>"}T.html(S)},k=function(){if(!l.date){return}var S=l.widget.find(".timepicker span[data-time-component]"),Q=l.date.hours(),R="AM";if(!l.options.use24hours){if(Q>=12){R="PM"}if(Q===0){Q=12}else{if(Q!=12){Q=Q%12}}l.widget.find(".timepicker [data-action=togglePeriod]").text(R)}S.filter("[data-time-component=hours]").text(N(Q));S.filter("[data-time-component=minutes]").text(N(l.date.minutes()));S.filter("[data-time-component=seconds]").text(N(l.date.second()))},A=function(W){W.stopPropagation();W.preventDefault();l.unset=false;var V=d(W.target).closest("span, td, th"),U,S,T,Q,R=a(l.date);if(V.length===1){if(!V.is(".disabled")){switch(V[0].nodeName.toLowerCase()){case"th":switch(V[0].className){case"switch":g(1);break;case"prev":case"next":T=w.modes[l.viewMode].navStep;if(V[0].className==="prev"){T=T*-1}l.viewDate.add(T,w.modes[l.viewMode].navFnc);n();break}break;case"span":if(V.is(".month")){U=V.parent().find("span").index(V);l.viewDate.month(U)}else{S=parseInt(V.text(),10)||0;l.viewDate.year(S)}if(l.viewMode!==0){l.date=a({y:l.viewDate.year(),M:l.viewDate.month(),d:l.viewDate.date(),h:l.date.hours(),m:l.date.minutes()});p(R,W.type)}g(-1);n();break;case"td":if(V.is(".day")){Q=parseInt(V.text(),10)||1;U=l.viewDate.month();S=l.viewDate.year();if(V.is(".old")){if(U===0){U=11;S-=1}else{U-=1}}else{if(V.is(".new")){if(U==11){U=0;S+=1}else{U+=1}}}l.date=a({y:S,M:U,d:Q,h:l.date.hours(),m:l.date.minutes()});l.viewDate=a({y:S,M:U,d:Math.min(28,Q)});n();r();p(R,W.type)}break}}}},D={incrementHours:function(){m("add","hours",1)},incrementMinutes:function(){m("add","minutes",l.options.minuteStepping)},incrementSeconds:function(){m("add","seconds",1)},decrementHours:function(){m("subtract","hours",1)},decrementMinutes:function(){m("subtract","minutes",l.options.minuteStepping)},decrementSeconds:function(){m("subtract","seconds",1)},togglePeriod:function(){var Q=l.date.hours();if(Q>=12){Q-=12}else{Q+=12}l.date.hours(Q)},showPicker:function(){l.widget.find(".timepicker > div:not(.timepicker-picker)").hide();l.widget.find(".timepicker .timepicker-picker").show()},showHours:function(){l.widget.find(".timepicker .timepicker-picker").hide();l.widget.find(".timepicker .timepicker-hours").show()},showMinutes:function(){l.widget.find(".timepicker .timepicker-picker").hide();l.widget.find(".timepicker .timepicker-minutes").show()},showSeconds:function(){l.widget.find(".timepicker .timepicker-picker").hide();l.widget.find(".timepicker .timepicker-seconds").show()},selectHour:function(Q){l.date.hours(parseInt(d(Q.target).text(),10));D.showPicker.call(l)},selectMinute:function(Q){l.date.minutes(parseInt(d(Q.target).text(),10));D.showPicker.call(l)},selectSecond:function(Q){l.date.seconds(parseInt(d(Q.target).text(),10));D.showPicker.call(l)}},x=function(S){var Q=a(l.date),R=d(S.currentTarget).data("action"),T=D[R].apply(l,arguments);K(S);if(!l.date){l.date=a({y:1970})}r();k();p(Q);return T},K=function(Q){Q.stopPropagation();Q.preventDefault()},i=function(S){a.lang(l.options.language);var Q=d(S.target),R=a(l.date),T=a(Q.val(),l.format,l.options.useStrict);if(T.isValid()){y();l.setValue(T);p(R);r()}else{l.viewDate=R;p(R);C(T);l.unset=true;Q.val("")}},g=function(Q){if(Q){l.viewMode=Math.max(l.minViewMode,Math.min(2,l.viewMode+Q))}l.widget.find(".datepicker > div").hide().filter(".datepicker-"+w.modes[l.viewMode].clsName).show()},J=function(){var U,T,R,Q,S;l.widget.on("click",".datepicker *",d.proxy(A,this));l.widget.on("click","[data-action]",d.proxy(x,this));l.widget.on("mousedown",d.proxy(K,this));if(l.options.pickDate&&l.options.pickTime){l.widget.on("click.togglePicker",".accordion-toggle",function(V){V.stopPropagation();U=d(this);T=U.closest("ul");R=T.find(".in");Q=T.find(".collapse:not(.in)");if(R&&R.length){S=R.data("collapse");if(S&&S.transitioning){return}R.collapse("hide");Q.collapse("show");U.find("span").toggleClass(l.options.icons.time+" "+l.options.icons.date);l.element.find(".input-group-addon span").toggleClass(l.options.icons.time+" "+l.options.icons.date)}})}if(l.isInput){l.element.on({focus:d.proxy(l.show,this),change:d.proxy(i,this),blur:d.proxy(l.hide,this)})}else{l.element.on({change:d.proxy(i,this)},"input");if(l.component){l.component.on("click",d.proxy(l.show,this))}else{l.element.on("click",d.proxy(l.show,this))}}},L=function(){d(window).on("resize.datetimepicker"+l.id,d.proxy(j,this));if(!l.isInput){d(document).on("mousedown.datetimepicker"+l.id,d.proxy(l.hide,this))}},F=function(){l.widget.off("click",".datepicker *",l.click);l.widget.off("click","[data-action]");l.widget.off("mousedown",l.stopEvent);if(l.options.pickDate&&l.options.pickTime){l.widget.off("click.togglePicker")}if(l.isInput){l.element.off({focus:l.show,change:l.change})}else{l.element.off({change:l.change},"input");if(l.component){l.component.off("click",l.show)}else{l.element.off("click",l.show)}}},E=function(){d(window).off("resize.datetimepicker"+l.id);if(!l.isInput){d(document).off("mousedown.datetimepicker"+l.id)}},B=function(){if(l.element){var R=l.element.parents(),Q=false,S;for(S=0;S<R.length;S++){if(d(R[S]).css("position")=="fixed"){Q=true;break}}return Q}else{return false}},r=function(){a.lang(l.options.language);var R="",Q;if(!l.unset){R=a(l.date).format(l.format)}if(!l.isInput){if(l.component){Q=l.element.find("input");Q.val(R)}l.element.data("date",R)}else{l.element.val(R)}if(!l.options.pickTime){l.hide()}},m=function(T,S,R){a.lang(l.options.language);var Q;if(T=="add"){Q=a(l.date);if(Q.hours()==23){Q.add(R,S)}Q.add(R,S)}else{Q=a(l.date).subtract(R,S)}if(Q.isAfter(l.options.endDate)||a(Q.subtract(R,S)).isBefore(l.options.startDate)||O(Q)){C(Q.format(l.format));return}if(T=="add"){l.date.add(R,S)}else{l.date.subtract(R,S)}},O=function(Q){a.lang(l.options.language);var S=l.options.disabledDates,R;for(R in S){if(S[R]==a(Q).format("L")){return true}}return false},s=function(R){a.lang(l.options.language);var Q=l.options.enabledDates,S;if(Q.length){for(S in Q){if(Q[S]==a(R).format("L")){return true}}return false}return Q===false?true:false},N=function(Q){Q=Q.toString();if(Q.length>=2){return Q}else{return"0"+Q}},P=function(R,Q,S){if(R&&Q){return('<div class="bootstrap-datetimepicker-widget dropdown-menu" style="z-index:9999 !important;"><ul class="list-unstyled"><li'+(S?' class="collapse in"':"")+'><div class="datepicker">'+w.template+'</div></li><li class="picker-switch accordion-toggle"><a class="btn" style="width:100%"><span class="'+l.options.icons.time+'"></span></a></li><li'+(S?' class="collapse"':"")+'><div class="timepicker">'+G.getTemplate()+"</div></li></ul></div>")}else{if(Q){return('<div class="bootstrap-datetimepicker-widget dropdown-menu"><div class="timepicker">'+G.getTemplate()+"</div></div>")}else{return('<div class="bootstrap-datetimepicker-widget dropdown-menu"><div class="datepicker">'+w.template+"</div></div>")}}},w={modes:[{clsName:"days",navFnc:"month",navStep:1},{clsName:"months",navFnc:"year",navStep:1},{clsName:"years",navFnc:"year",navStep:10}],headTemplate:'<thead><tr><th class="prev">&lsaquo;</th><th colspan="5" class="switch"></th><th class="next">&rsaquo;</th></tr></thead>',contTemplate:'<tbody><tr><td colspan="7"></td></tr></tbody>'},G={hourTemplate:'<span data-action="showHours" data-time-component="hours" class="timepicker-hour"></span>',minuteTemplate:'<span data-action="showMinutes" data-time-component="minutes" class="timepicker-minute"></span>',secondTemplate:'<span data-action="showSeconds" data-time-component="seconds" class="timepicker-second"></span>'};w.template='<div class="datepicker-days"><table class="table-condensed">'+w.headTemplate+'<tbody></tbody></table></div><div class="datepicker-months"><table class="table-condensed">'+w.headTemplate+w.contTemplate+'</table></div><div class="datepicker-years"><table class="table-condensed">'+w.headTemplate+w.contTemplate+"</table></div>";G.getTemplate=function(){return('<div class="timepicker-picker"><table class="table-condensed"><tr><td><a href="#" class="btn" data-action="incrementHours"><span class="'+l.options.icons.up+'"></span></a></td><td class="separator"></td><td>'+(l.options.useMinutes?'<a href="#" class="btn" data-action="incrementMinutes"><span class="'+l.options.icons.up+'"></span></a>':"")+"</td>"+(l.options.useSeconds?'<td class="separator"></td><td><a href="#" class="btn" data-action="incrementSeconds"><span class="'+l.options.icons.up+'"></span></a></td>':"")+(l.options.use24hours?"":'<td class="separator"></td>')+"</tr><tr><td>"+G.hourTemplate+'</td> <td class="separator">:</td><td>'+(l.options.useMinutes?G.minuteTemplate:'<span class="timepicker-minute">00</span>')+"</td> "+(l.options.useSeconds?'<td class="separator">:</td><td>'+G.secondTemplate+"</td>":"")+(l.options.use24hours?"":'<td class="separator"></td><td><button type="button" class="btn btn-primary" data-action="togglePeriod"></button></td>')+'</tr><tr><td><a href="#" class="btn" data-action="decrementHours"><span class="'+l.options.icons.down+'"></span></a></td><td class="separator"></td><td>'+(l.options.useMinutes?'<a href="#" class="btn" data-action="decrementMinutes"><span class="'+l.options.icons.down+'"></span></a>':"")+"</td>"+(l.options.useSeconds?'<td class="separator"></td><td><a href="#" class="btn" data-action="decrementSeconds"><span class="'+l.options.icons.down+'"></span></a></td>':"")+(l.options.use24hours?"":'<td class="separator"></td>')+'</tr></table></div><div class="timepicker-hours" data-action="selectHour"><table class="table-condensed"></table></div><div class="timepicker-minutes" data-action="selectMinute"><table class="table-condensed"></table></div>'+(l.options.useSeconds?'<div class="timepicker-seconds" data-action="selectSecond"><table class="table-condensed"></table></div>':""))};l.destroy=function(){F();E();l.widget.remove();l.element.removeData("DateTimePicker");if(l.component){l.component.removeData("DateTimePicker")}};l.show=function(Q){l.widget.show();l.height=l.component?l.component.outerHeight():l.element.outerHeight();j();l.element.trigger({type:"show.dp",date:a(l.date)});L();if(Q){K(Q)}},l.disable=function(){var Q=l.element.find("input");if(!Q.prop("disabled")){return}Q.prop("disabled",true);F()},l.enable=function(){var Q=l.element.find("input");if(!Q.prop("disabled")){return}Q.prop("disabled",true);J()},l.hide=function(S){if(S&&d(S.target).is(l.element.attr("id"))){return}var T=l.widget.find(".collapse"),Q,R;for(Q=0;Q<T.length;Q++){R=T.eq(Q).data("collapse");if(R&&R.transitioning){return}}l.widget.hide();l.viewMode=l.startViewMode;g();l.element.trigger({type:"hide.dp",date:a(l.date)});E()},l.setValue=function(Q){a.lang(l.options.language);if(!Q){l.unset=true}else{l.unset=false}if(!a.isMoment(Q)){Q=a(Q)}if(Q.isValid()){l.date=Q;r();l.viewDate=a({y:l.date.year(),M:l.date.month()});n();k()}else{C(Q)}},l.getDate=function(){if(l.unset){return null}return l.date},l.setDate=function(Q){Q=a(Q);if(!Q){l.setValue(null)}else{l.setValue(Q)}},l.setEnabledDates=function(Q){if(!Q){l.options.enabledDates=false}else{l.options.enabledDates=Q}if(l.viewDate){y()}},l.setEndDate=function(Q){l.options.endDate=a(Q);if(!l.options.endDate.isValid()){l.options.endDate=a().add(50,"y")}if(l.viewDate){y()}},l.setStartDate=function(Q){l.options.startDate=a(Q);if(!l.options.startDate.isValid()){l.options.startDate=a({y:1970})}if(l.viewDate){y()}};I()};d.fn.datetimepicker=function(f){return this.each(function(){var h=d(this),g=h.data("DateTimePicker");if(!g){h.data("DateTimePicker",new b(this,f))}})}}));
@@ -0,0 +1,608 @@
1
+ /*
2
+ * jQuery UI Nested Sortable
3
+ * v 2.0 / 29 oct 2012
4
+ * http://mjsarfatti.com/sandbox/nestedSortable
5
+ *
6
+ * Depends on:
7
+ * jquery.ui.sortable.js 1.10+
8
+ *
9
+ * Copyright (c) 2010-2013 Manuele J Sarfatti
10
+ * Licensed under the MIT License
11
+ * http://www.opensource.org/licenses/mit-license.php
12
+ */
13
+
14
+ (function($) {
15
+
16
+ function isOverAxis( x, reference, size ) {
17
+ return ( x > reference ) && ( x < ( reference + size ) );
18
+ }
19
+
20
+ $.widget("mjs.nestedSortable", $.extend({}, $.ui.sortable.prototype, {
21
+
22
+ options: {
23
+ doNotClear: false,
24
+ expandOnHover: 700,
25
+ isAllowed: function(placeholder, placeholderParent, originalItem) { return true; },
26
+ isTree: false,
27
+ listType: 'ol',
28
+ maxLevels: 0,
29
+ protectRoot: false,
30
+ rootID: null,
31
+ rtl: false,
32
+ startCollapsed: false,
33
+ tabSize: 20,
34
+
35
+ branchClass: 'mjs-nestedSortable-branch',
36
+ collapsedClass: 'mjs-nestedSortable-collapsed',
37
+ disableNestingClass: 'mjs-nestedSortable-no-nesting',
38
+ errorClass: 'mjs-nestedSortable-error',
39
+ expandedClass: 'mjs-nestedSortable-expanded',
40
+ hoveringClass: 'mjs-nestedSortable-hovering',
41
+ leafClass: 'mjs-nestedSortable-leaf'
42
+ },
43
+
44
+ _create: function() {
45
+ this.element.data('ui-sortable', this.element.data('mjs-nestedSortable'));
46
+
47
+ // mjs - prevent browser from freezing if the HTML is not correct
48
+ if (!this.element.is(this.options.listType))
49
+ throw new Error('nestedSortable: Please check that the listType option is set to your actual list type');
50
+
51
+ // mjs - force 'intersect' tolerance method if we have a tree with expanding/collapsing functionality
52
+ if (this.options.isTree) this.options.tolerance = 'intersect';
53
+
54
+ $.ui.sortable.prototype._create.apply(this, arguments);
55
+
56
+ // mjs - prepare the tree by applying the right classes (the CSS is responsible for actual hide/show functionality)
57
+ if (this.options.isTree) {
58
+ var self = this;
59
+ $(this.items).each(function() {
60
+ var $li = this.item;
61
+ if ($li.children(self.options.listType).length) {
62
+ $li.addClass(self.options.branchClass);
63
+ // expand/collapse class only if they have children
64
+ if (self.options.startCollapsed) $li.addClass(self.options.collapsedClass);
65
+ else $li.addClass(self.options.expandedClass);
66
+ } else {
67
+ $li.addClass(self.options.leafClass);
68
+ }
69
+ })
70
+ }
71
+ },
72
+
73
+ _destroy: function() {
74
+ this.element
75
+ .removeData("mjs-nestedSortable")
76
+ .removeData("ui-sortable");
77
+ return $.ui.sortable.prototype._destroy.apply(this, arguments);
78
+ },
79
+
80
+ _mouseDrag: function(event) {
81
+ var i, item, itemElement, intersection,
82
+ o = this.options,
83
+ scrolled = false;
84
+
85
+ //Compute the helpers position
86
+ this.position = this._generatePosition(event);
87
+ this.positionAbs = this._convertPositionTo("absolute");
88
+
89
+ if (!this.lastPositionAbs) {
90
+ this.lastPositionAbs = this.positionAbs;
91
+ }
92
+
93
+ //Do scrolling
94
+ if(this.options.scroll) {
95
+ if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') {
96
+
97
+ if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
98
+ this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
99
+ } else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) {
100
+ this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
101
+ }
102
+
103
+ if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {
104
+ this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
105
+ } else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) {
106
+ this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
107
+ }
108
+
109
+ } else {
110
+
111
+ if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
112
+ scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
113
+ } else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) {
114
+ scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
115
+ }
116
+
117
+ if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
118
+ scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
119
+ } else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) {
120
+ scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
121
+ }
122
+
123
+ }
124
+
125
+ if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
126
+ $.ui.ddmanager.prepareOffsets(this, event);
127
+ }
128
+
129
+ //Regenerate the absolute position used for position checks
130
+ this.positionAbs = this._convertPositionTo("absolute");
131
+
132
+ // mjs - find the top offset before rearrangement,
133
+ var previousTopOffset = this.placeholder.offset().top;
134
+
135
+ //Set the helper position
136
+ if(!this.options.axis || this.options.axis !== "y") {
137
+ this.helper[0].style.left = this.position.left+"px";
138
+ }
139
+ if(!this.options.axis || this.options.axis !== "x") {
140
+ this.helper[0].style.top = this.position.top+"px";
141
+ }
142
+
143
+ // mjs - check and reset hovering state at each cycle
144
+ this.hovering = this.hovering ? this.hovering : null;
145
+ this.mouseentered = this.mouseentered ? this.mouseentered : false;
146
+
147
+ // mjs - let's start caching some variables
148
+ var parentItem = (this.placeholder[0].parentNode.parentNode &&
149
+ $(this.placeholder[0].parentNode.parentNode).closest('.ui-sortable').length)
150
+ ? $(this.placeholder[0].parentNode.parentNode)
151
+ : null,
152
+ level = this._getLevel(this.placeholder),
153
+ childLevels = this._getChildLevels(this.helper);
154
+
155
+ var newList = document.createElement(o.listType);
156
+
157
+ //Rearrange
158
+ for (i = this.items.length - 1; i >= 0; i--) {
159
+
160
+ //Cache variables and intersection, continue if no intersection
161
+ item = this.items[i];
162
+ itemElement = item.item[0];
163
+ intersection = this._intersectsWithPointer(item);
164
+ if (!intersection) {
165
+ continue;
166
+ }
167
+
168
+ // Only put the placeholder inside the current Container, skip all
169
+ // items form other containers. This works because when moving
170
+ // an item from one container to another the
171
+ // currentContainer is switched before the placeholder is moved.
172
+ //
173
+ // Without this moving items in "sub-sortables" can cause the placeholder to jitter
174
+ // beetween the outer and inner container.
175
+ if (item.instance !== this.currentContainer) {
176
+ continue;
177
+ }
178
+
179
+ // cannot intersect with itself
180
+ // no useless actions that have been done before
181
+ // no action if the item moved is the parent of the item checked
182
+ if (itemElement !== this.currentItem[0] &&
183
+ this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement &&
184
+ !$.contains(this.placeholder[0], itemElement) &&
185
+ (this.options.type === "semi-dynamic" ? !$.contains(this.element[0], itemElement) : true)
186
+ ) {
187
+
188
+ // mjs - we are intersecting an element: trigger the mouseenter event and store this state
189
+ if (!this.mouseentered) {
190
+ $(itemElement).mouseenter();
191
+ this.mouseentered = true;
192
+ }
193
+
194
+ // mjs - if the element has children and they are hidden, show them after a delay (CSS responsible)
195
+ if (o.isTree && $(itemElement).hasClass(o.collapsedClass) && o.expandOnHover) {
196
+ if (!this.hovering) {
197
+ $(itemElement).addClass(o.hoveringClass);
198
+ var self = this;
199
+ this.hovering = window.setTimeout(function() {
200
+ $(itemElement).removeClass(o.collapsedClass).addClass(o.expandedClass);
201
+ self.refreshPositions();
202
+ self._trigger("expand", event, self._uiHash());
203
+ }, o.expandOnHover);
204
+ }
205
+ }
206
+
207
+ this.direction = intersection == 1 ? "down" : "up";
208
+
209
+ // mjs - rearrange the elements and reset timeouts and hovering state
210
+ if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) {
211
+ $(itemElement).mouseleave();
212
+ this.mouseentered = false;
213
+ $(itemElement).removeClass(o.hoveringClass);
214
+ this.hovering && window.clearTimeout(this.hovering);
215
+ this.hovering = null;
216
+
217
+ // mjs - do not switch container if it's a root item and 'protectRoot' is true
218
+ // or if it's not a root item but we are trying to make it root
219
+ if (o.protectRoot
220
+ && ! (this.currentItem[0].parentNode == this.element[0] // it's a root item
221
+ && itemElement.parentNode != this.element[0]) // it's intersecting a non-root item
222
+ ) {
223
+ if (this.currentItem[0].parentNode != this.element[0]
224
+ && itemElement.parentNode == this.element[0]
225
+ ) {
226
+
227
+ if ( ! $(itemElement).children(o.listType).length) {
228
+ itemElement.appendChild(newList);
229
+ o.isTree && $(itemElement).removeClass(o.leafClass).addClass(o.branchClass + ' ' + o.expandedClass);
230
+ }
231
+
232
+ var a = this.direction === "down" ? $(itemElement).prev().children(o.listType) : $(itemElement).children(o.listType);
233
+ if (a[0] !== undefined) {
234
+ this._rearrange(event, null, a);
235
+ }
236
+
237
+ } else {
238
+ this._rearrange(event, item);
239
+ }
240
+ } else if ( ! o.protectRoot) {
241
+ this._rearrange(event, item);
242
+ }
243
+ } else {
244
+ break;
245
+ }
246
+
247
+ // Clear emtpy ul's/ol's
248
+ this._clearEmpty(itemElement);
249
+
250
+ this._trigger("change", event, this._uiHash());
251
+ break;
252
+ }
253
+ }
254
+
255
+ // mjs - to find the previous sibling in the list, keep backtracking until we hit a valid list item.
256
+ var previousItem = this.placeholder[0].previousSibling ? $(this.placeholder[0].previousSibling) : null;
257
+ if (previousItem != null) {
258
+ while (previousItem[0].nodeName.toLowerCase() != 'li' || previousItem[0] == this.currentItem[0] || previousItem[0] == this.helper[0]) {
259
+ if (previousItem[0].previousSibling) {
260
+ previousItem = $(previousItem[0].previousSibling);
261
+ } else {
262
+ previousItem = null;
263
+ break;
264
+ }
265
+ }
266
+ }
267
+
268
+ // mjs - to find the next sibling in the list, keep stepping forward until we hit a valid list item.
269
+ var nextItem = this.placeholder[0].nextSibling ? $(this.placeholder[0].nextSibling) : null;
270
+ if (nextItem != null) {
271
+ while (nextItem[0].nodeName.toLowerCase() != 'li' || nextItem[0] == this.currentItem[0] || nextItem[0] == this.helper[0]) {
272
+ if (nextItem[0].nextSibling) {
273
+ nextItem = $(nextItem[0].nextSibling);
274
+ } else {
275
+ nextItem = null;
276
+ break;
277
+ }
278
+ }
279
+ }
280
+
281
+ this.beyondMaxLevels = 0;
282
+
283
+ // mjs - if the item is moved to the left, send it one level up but only if it's at the bottom of the list
284
+ if (parentItem != null
285
+ && nextItem == null
286
+ && ! (o.protectRoot && parentItem[0].parentNode == this.element[0])
287
+ &&
288
+ (o.rtl && (this.positionAbs.left + this.helper.outerWidth() > parentItem.offset().left + parentItem.outerWidth())
289
+ || ! o.rtl && (this.positionAbs.left < parentItem.offset().left))
290
+ ) {
291
+
292
+ parentItem.after(this.placeholder[0]);
293
+ if (o.isTree && parentItem.children(o.listItem).children('li:visible:not(.ui-sortable-helper)').length < 1) {
294
+ parentItem.removeClass(this.options.branchClass + ' ' + this.options.expandedClass)
295
+ .addClass(this.options.leafClass);
296
+ }
297
+ this._clearEmpty(parentItem[0]);
298
+ this._trigger("change", event, this._uiHash());
299
+ }
300
+ // mjs - if the item is below a sibling and is moved to the right, make it a child of that sibling
301
+ else if (previousItem != null
302
+ && ! previousItem.hasClass(o.disableNestingClass)
303
+ &&
304
+ (previousItem.children(o.listType).length && previousItem.children(o.listType).is(':visible')
305
+ || ! previousItem.children(o.listType).length)
306
+ && ! (o.protectRoot && this.currentItem[0].parentNode == this.element[0])
307
+ &&
308
+ (o.rtl && (this.positionAbs.left + this.helper.outerWidth() < previousItem.offset().left + previousItem.outerWidth() - o.tabSize)
309
+ || ! o.rtl && (this.positionAbs.left > previousItem.offset().left + o.tabSize))
310
+ ) {
311
+
312
+ this._isAllowed(previousItem, level, level+childLevels+1);
313
+
314
+ if (!previousItem.children(o.listType).length) {
315
+ previousItem[0].appendChild(newList);
316
+ o.isTree && previousItem.removeClass(o.leafClass).addClass(o.branchClass + ' ' + o.expandedClass);
317
+ }
318
+
319
+ // mjs - if this item is being moved from the top, add it to the top of the list.
320
+ if (previousTopOffset && (previousTopOffset <= previousItem.offset().top)) {
321
+ previousItem.children(o.listType).prepend(this.placeholder);
322
+ }
323
+ // mjs - otherwise, add it to the bottom of the list.
324
+ else {
325
+ previousItem.children(o.listType)[0].appendChild(this.placeholder[0]);
326
+ }
327
+
328
+ this._trigger("change", event, this._uiHash());
329
+ }
330
+ else {
331
+ this._isAllowed(parentItem, level, level+childLevels);
332
+ }
333
+
334
+ //Post events to containers
335
+ this._contactContainers(event);
336
+
337
+ //Interconnect with droppables
338
+ if($.ui.ddmanager) {
339
+ $.ui.ddmanager.drag(this, event);
340
+ }
341
+
342
+ //Call callbacks
343
+ this._trigger('sort', event, this._uiHash());
344
+
345
+ this.lastPositionAbs = this.positionAbs;
346
+ return false;
347
+
348
+ },
349
+
350
+ _mouseStop: function(event, noPropagation) {
351
+
352
+ // mjs - if the item is in a position not allowed, send it back
353
+ if (this.beyondMaxLevels) {
354
+
355
+ this.placeholder.removeClass(this.options.errorClass);
356
+
357
+ if (this.domPosition.prev) {
358
+ $(this.domPosition.prev).after(this.placeholder);
359
+ } else {
360
+ $(this.domPosition.parent).prepend(this.placeholder);
361
+ }
362
+
363
+ this._trigger("revert", event, this._uiHash());
364
+
365
+ }
366
+
367
+
368
+ // mjs - clear the hovering timeout, just to be sure
369
+ $('.'+this.options.hoveringClass).mouseleave().removeClass(this.options.hoveringClass);
370
+ this.mouseentered = false;
371
+ this.hovering && window.clearTimeout(this.hovering);
372
+ this.hovering = null;
373
+
374
+ $.ui.sortable.prototype._mouseStop.apply(this, arguments);
375
+
376
+ },
377
+
378
+ // mjs - this function is slightly modified to make it easier to hover over a collapsed element and have it expand
379
+ _intersectsWithSides: function(item) {
380
+
381
+ var half = this.options.isTree ? .8 : .5;
382
+
383
+ var isOverBottomHalf = isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height*half), item.height),
384
+ isOverTopHalf = isOverAxis(this.positionAbs.top + this.offset.click.top, item.top - (item.height*half), item.height),
385
+ isOverRightHalf = isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
386
+ verticalDirection = this._getDragVerticalDirection(),
387
+ horizontalDirection = this._getDragHorizontalDirection();
388
+
389
+ if (this.floating && horizontalDirection) {
390
+ return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf));
391
+ } else {
392
+ return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && isOverTopHalf));
393
+ }
394
+
395
+ },
396
+
397
+ _contactContainers: function(event) {
398
+
399
+ if (this.options.protectRoot && this.currentItem[0].parentNode == this.element[0] ) {
400
+ return;
401
+ }
402
+
403
+ $.ui.sortable.prototype._contactContainers.apply(this, arguments);
404
+
405
+ },
406
+
407
+ _clear: function(event, noPropagation) {
408
+
409
+ $.ui.sortable.prototype._clear.apply(this, arguments);
410
+
411
+ // mjs - clean last empty ul/ol
412
+ for (var i = this.items.length - 1; i >= 0; i--) {
413
+ var item = this.items[i].item[0];
414
+ this._clearEmpty(item);
415
+ }
416
+
417
+ },
418
+
419
+ serialize: function(options) {
420
+
421
+ var o = $.extend({}, this.options, options),
422
+ items = this._getItemsAsjQuery(o && o.connected),
423
+ str = [];
424
+
425
+ $(items).each(function() {
426
+ var res = ($(o.item || this).attr(o.attribute || 'id') || '')
427
+ .match(o.expression || (/(.+)[-=_](.+)/)),
428
+ pid = ($(o.item || this).parent(o.listType)
429
+ .parent(o.items)
430
+ .attr(o.attribute || 'id') || '')
431
+ .match(o.expression || (/(.+)[-=_](.+)/));
432
+
433
+ if (res) {
434
+ str.push(((o.key || res[1]) + '[' + (o.key && o.expression ? res[1] : res[2]) + ']')
435
+ + '='
436
+ + (pid ? (o.key && o.expression ? pid[1] : pid[2]) : o.rootID));
437
+ }
438
+ });
439
+
440
+ if(!str.length && o.key) {
441
+ str.push(o.key + '=');
442
+ }
443
+
444
+ return str.join('&');
445
+
446
+ },
447
+
448
+ toHierarchy: function(options) {
449
+
450
+ var o = $.extend({}, this.options, options),
451
+ sDepth = o.startDepthCount || 0,
452
+ ret = [];
453
+
454
+ $(this.element).children(o.items).each(function () {
455
+ var level = _recursiveItems(this);
456
+ ret.push(level);
457
+ });
458
+
459
+ return ret;
460
+
461
+ function _recursiveItems(item) {
462
+ var id = ($(item).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
463
+ if (id) {
464
+ var currentItem = {"id" : id[2]};
465
+ if ($(item).children(o.listType).children(o.items).length > 0) {
466
+ currentItem.children = [];
467
+ $(item).children(o.listType).children(o.items).each(function() {
468
+ var level = _recursiveItems(this);
469
+ currentItem.children.push(level);
470
+ });
471
+ }
472
+ return currentItem;
473
+ }
474
+ }
475
+ },
476
+
477
+ toArray: function(options) {
478
+
479
+ var o = $.extend({}, this.options, options),
480
+ sDepth = o.startDepthCount || 0,
481
+ ret = [],
482
+ left = 2;
483
+
484
+ ret.push({
485
+ "item_id": o.rootID,
486
+ "parent_id": 'none',
487
+ "depth": sDepth,
488
+ "left": '1',
489
+ "right": ($(o.items, this.element).length + 1) * 2
490
+ });
491
+
492
+ $(this.element).children(o.items).each(function () {
493
+ left = _recursiveArray(this, sDepth + 1, left);
494
+ });
495
+
496
+ ret = ret.sort(function(a,b){ return (a.left - b.left); });
497
+
498
+ return ret;
499
+
500
+ function _recursiveArray(item, depth, left) {
501
+
502
+ var right = left + 1,
503
+ id,
504
+ pid;
505
+
506
+ if ($(item).children(o.listType).children(o.items).length > 0) {
507
+ depth ++;
508
+ $(item).children(o.listType).children(o.items).each(function () {
509
+ right = _recursiveArray($(this), depth, right);
510
+ });
511
+ depth --;
512
+ }
513
+
514
+ id = ($(item).attr(o.attribute || 'id')).match(o.expression || (/(.+)[-=_](.+)/));
515
+
516
+ if (depth === sDepth + 1) {
517
+ pid = o.rootID;
518
+ } else {
519
+ var parentItem = ($(item).parent(o.listType)
520
+ .parent(o.items)
521
+ .attr(o.attribute || 'id'))
522
+ .match(o.expression || (/(.+)[-=_](.+)/));
523
+ pid = parentItem[2];
524
+ }
525
+
526
+ if (id) {
527
+ ret.push({"item_id": id[2], "parent_id": pid, "depth": depth, "left": left, "right": right});
528
+ }
529
+
530
+ left = right + 1;
531
+ return left;
532
+ }
533
+
534
+ },
535
+
536
+ _clearEmpty: function(item) {
537
+ var o = this.options;
538
+
539
+ var emptyList = $(item).children(o.listType);
540
+
541
+ if (emptyList.length && !emptyList.children().length && !o.doNotClear) {
542
+ o.isTree && $(item).removeClass(o.branchClass + ' ' + o.expandedClass).addClass(o.leafClass);
543
+ emptyList.remove();
544
+ } else if (o.isTree && emptyList.length && emptyList.children().length && emptyList.is(':visible')) {
545
+ $(item).removeClass(o.leafClass).addClass(o.branchClass + ' ' + o.expandedClass);
546
+ } else if (o.isTree && emptyList.length && emptyList.children().length && !emptyList.is(':visible')) {
547
+ $(item).removeClass(o.leafClass).addClass(o.branchClass + ' ' + o.collapsedClass);
548
+ }
549
+
550
+ },
551
+
552
+ _getLevel: function(item) {
553
+
554
+ var level = 1;
555
+
556
+ if (this.options.listType) {
557
+ var list = item.closest(this.options.listType);
558
+ while (list && list.length > 0 &&
559
+ !list.is('.ui-sortable')) {
560
+ level++;
561
+ list = list.parent().closest(this.options.listType);
562
+ }
563
+ }
564
+
565
+ return level;
566
+ },
567
+
568
+ _getChildLevels: function(parent, depth) {
569
+ var self = this,
570
+ o = this.options,
571
+ result = 0;
572
+ depth = depth || 0;
573
+
574
+ $(parent).children(o.listType).children(o.items).each(function (index, child) {
575
+ result = Math.max(self._getChildLevels(child, depth + 1), result);
576
+ });
577
+
578
+ return depth ? result + 1 : result;
579
+ },
580
+
581
+ _isAllowed: function(parentItem, level, levels) {
582
+ var o = this.options,
583
+ maxLevels = this.placeholder.closest('.ui-sortable').nestedSortable('option', 'maxLevels'); // this takes into account the maxLevels set to the recipient list
584
+
585
+ // mjs - is the root protected?
586
+ // mjs - are we nesting too deep?
587
+ if ( ! o.isAllowed(this.placeholder, parentItem, this.currentItem)) {
588
+ this.placeholder.addClass(o.errorClass);
589
+ if (maxLevels < levels && maxLevels != 0) {
590
+ this.beyondMaxLevels = levels - maxLevels;
591
+ } else {
592
+ this.beyondMaxLevels = 1;
593
+ }
594
+ } else {
595
+ if (maxLevels < levels && maxLevels != 0) {
596
+ this.placeholder.addClass(o.errorClass);
597
+ this.beyondMaxLevels = levels - maxLevels;
598
+ } else {
599
+ this.placeholder.removeClass(o.errorClass);
600
+ this.beyondMaxLevels = 0;
601
+ }
602
+ }
603
+ }
604
+
605
+ }));
606
+
607
+ $.mjs.nestedSortable.prototype.options = $.extend({}, $.ui.sortable.prototype.options, $.mjs.nestedSortable.prototype.options);
608
+ })(jQuery);