kit_cms 2.3.9 → 2.3.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (261) hide show
  1. data/app/assets/images/mercury/dashboard.png +0 -0
  2. data/app/assets/images/mercury/info.png +0 -0
  3. data/app/assets/images/mercury/insertsPanel.png +0 -0
  4. data/app/assets/images/mercury/related.png +0 -0
  5. data/app/assets/images/mercury/view.png +0 -0
  6. data/app/assets/javascripts/{kit/best_in_place.js → best_in_place.js} +0 -0
  7. data/app/assets/javascripts/codemirror/editor.js +1 -1
  8. data/app/assets/javascripts/codemirror/sass.js +349 -0
  9. data/app/assets/javascripts/{kit/fancybox → fancybox}/ajax.txt +0 -0
  10. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/blank.gif +0 -0
  11. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_close.png +0 -0
  12. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_loading.png +0 -0
  13. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_nav_left.png +0 -0
  14. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_nav_right.png +0 -0
  15. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_shadow_e.png +0 -0
  16. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_shadow_n.png +0 -0
  17. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_shadow_ne.png +0 -0
  18. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_shadow_nw.png +0 -0
  19. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_shadow_s.png +0 -0
  20. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_shadow_se.png +0 -0
  21. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_shadow_sw.png +0 -0
  22. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_shadow_w.png +0 -0
  23. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_title_left.png +0 -0
  24. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_title_main.png +0 -0
  25. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_title_over.png +0 -0
  26. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancy_title_right.png +0 -0
  27. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancybox-x.png +0 -0
  28. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancybox-y.png +0 -0
  29. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancybox.css +0 -0
  30. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancybox.js +0 -0
  31. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/fancybox.png +0 -0
  32. data/app/assets/javascripts/{kit/fancybox → fancybox}/fancybox/jquery.mousewheel-3.0.4.pack.js +0 -0
  33. data/app/assets/javascripts/{kit/fancybox → fancybox}/index.html +0 -0
  34. data/app/assets/javascripts/{kit/fancybox → fancybox}/style.css +0 -0
  35. data/app/assets/javascripts/{kit/gadash-1.0.js → gadash-1.0.js} +0 -0
  36. data/app/assets/javascripts/{kit/jquery-ui.js → jquery-ui.js} +0 -0
  37. data/app/assets/javascripts/{kit/jquery.contextmenu.js → jquery.contextmenu.js} +0 -0
  38. data/app/assets/javascripts/{kit/jquery.fileupload-ui.js → jquery.fileupload-ui.js} +0 -0
  39. data/app/assets/javascripts/{kit/jquery.fileupload.js → jquery.fileupload.js} +0 -0
  40. data/app/assets/javascripts/{kit/jquery.js → jquery.js} +0 -0
  41. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/apple/bg.jpg +0 -0
  42. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/apple/d.png +0 -0
  43. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/apple/doc.png +0 -0
  44. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/apple/dot_for_ie.gif +0 -0
  45. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/apple/gear.png +0 -0
  46. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/apple/style.css +0 -0
  47. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/apple/throbber.gif +0 -0
  48. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/default/bg.jpg +0 -0
  49. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/default/d.png +0 -0
  50. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/default/doc.png +0 -0
  51. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/default/dot_for_ie.gif +0 -0
  52. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/default/gear.png +0 -0
  53. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/default/style.css +0 -0
  54. data/app/assets/javascripts/{kit/jquery.themes → jquery.themes}/default/throbber.gif +0 -0
  55. data/app/assets/javascripts/{kit/jquery.validate.js → jquery.validate.js} +0 -0
  56. data/app/assets/javascripts/jqueryui.js +4 -0
  57. data/app/assets/javascripts/{kit/jsplumb-min.js → jsplumb-min.js} +0 -0
  58. data/app/assets/javascripts/{kit_admin.js → kit/cms.js} +5 -4
  59. data/app/assets/javascripts/kit/{mercury-editor.js.erb → editor.js} +5 -4
  60. data/app/assets/javascripts/kit/kit.js +12 -0
  61. data/app/assets/javascripts/kit/utilities.js +0 -15
  62. data/app/assets/javascripts/{kit/underscore.js → underscore.js} +0 -0
  63. data/app/assets/javascripts/{kit/waypoint.js → waypoint.js} +0 -0
  64. data/app/assets/stylesheets/codemirror/editor.css +6 -0
  65. data/app/assets/stylesheets/codemirror/style.css +2 -2
  66. data/app/assets/stylesheets/codemirror/theme.css +26 -1
  67. data/app/assets/stylesheets/{kit_admin.css → kit/admin.css} +0 -0
  68. data/app/assets/stylesheets/kit/cms.css +35 -0
  69. data/app/assets/stylesheets/{mercury_editor.css → kit/editor.css} +9 -0
  70. data/app/assets/stylesheets/{kit.css → kit/kit.css} +4 -4
  71. data/app/controllers/admin/ad_units_controller.rb +1 -1
  72. data/app/controllers/admin/block_controller.rb +1 -1
  73. data/app/controllers/admin/block_instance_controller.rb +1 -1
  74. data/app/controllers/admin/blocks_controller.rb +1 -1
  75. data/app/controllers/admin/calendar_entries_controller.rb +1 -1
  76. data/app/controllers/admin/calendars_controller.rb +1 -1
  77. data/app/controllers/admin/content_controller.rb +1 -1
  78. data/app/controllers/admin/dashboard_controller.rb +15 -6
  79. data/app/controllers/admin/forum_controller.rb +1 -1
  80. data/app/controllers/admin/help_controller.rb +1 -1
  81. data/app/controllers/admin/mapping_controller.rb +1 -1
  82. data/app/controllers/admin/newsletter_controller.rb +1 -1
  83. data/app/controllers/admin/page_template_terms_controller.rb +1 -1
  84. data/app/controllers/admin/page_templates_controller.rb +1 -1
  85. data/app/controllers/admin/preference_controller.rb +1 -1
  86. data/app/controllers/admin/snippet_controller.rb +1 -1
  87. data/app/controllers/admin/todo_controller.rb +2 -2
  88. data/app/controllers/admin/user_controller.rb +1 -1
  89. data/app/controllers/admin/views_controller.rb +1 -1
  90. data/app/controllers/admin_controller.rb +1 -1
  91. data/app/controllers/asset_controller.rb +1 -1
  92. data/app/controllers/calendar_controller.rb +1 -1
  93. data/app/controllers/category_controller.rb +2 -2
  94. data/app/controllers/menu_controller.rb +1 -1
  95. data/app/controllers/pages_controller.rb +5 -5
  96. data/app/controllers/utility_controller.rb +1 -1
  97. data/app/helpers/kit_helper.rb +5 -17
  98. data/app/helpers/kit_modules_helper.rb +1 -1
  99. data/app/models/asset.rb +2 -0
  100. data/app/models/block.rb +1 -0
  101. data/app/models/block_instance.rb +8 -3
  102. data/app/models/html_asset.rb +1 -0
  103. data/app/models/layout.rb +1 -0
  104. data/app/models/page.rb +2 -3
  105. data/app/models/page_template.rb +2 -0
  106. data/app/views/admin/blocks/_form.html.haml +1 -1
  107. data/app/views/admin/dashboard/system.html.haml +1 -0
  108. data/app/views/admin/help/edit.html.haml +1 -1
  109. data/app/views/admin/html_asset/show.html.haml +1 -1
  110. data/app/views/admin/layouts/show.html.haml +2 -2
  111. data/app/views/admin/page_templates/_form.html.haml +1 -1
  112. data/app/views/admin/snippet/edit.html.erb +1 -1
  113. data/app/views/admin/snippet/new.html.erb +1 -1
  114. data/app/views/admin/stylesheet/show.html.haml +1 -1
  115. data/app/views/asset/index.html.haml +0 -3
  116. data/app/views/layouts/_cms-common.html.erb +1 -1
  117. data/app/views/layouts/_kit_header.html.haml +2 -2
  118. data/app/views/layouts/{cms-boxed.html.haml → cms.html.haml} +1 -1
  119. data/app/views/layouts/mercury-editor.html.erb +2 -8
  120. data/app/views/pages/content_edit.html.haml +1 -1
  121. data/app/views/utility/_cm_editor.html.erb +19 -0
  122. data/app/views/utility/mercury_html.html.haml +0 -3
  123. data/lib/kit_cms.rb +2 -0
  124. metadata +66 -196
  125. data/app/assets/javascripts/admin/advertisments.js +0 -2
  126. data/app/assets/javascripts/admin/kit_engagement.js +0 -2
  127. data/app/assets/javascripts/admin/order.js +0 -2
  128. data/app/assets/javascripts/kit.js +0 -14
  129. data/app/assets/javascripts/kit/ace/ace.js +0 -11
  130. data/app/assets/javascripts/kit/ace/ext-static_highlight.js +0 -1
  131. data/app/assets/javascripts/kit/ace/ext-textarea.js +0 -1
  132. data/app/assets/javascripts/kit/ace/keybinding-emacs.js +0 -1
  133. data/app/assets/javascripts/kit/ace/keybinding-vim.js +0 -1
  134. data/app/assets/javascripts/kit/ace/mode-abap.js +0 -1
  135. data/app/assets/javascripts/kit/ace/mode-asciidoc.js +0 -1
  136. data/app/assets/javascripts/kit/ace/mode-c9search.js +0 -1
  137. data/app/assets/javascripts/kit/ace/mode-c_cpp.js +0 -1
  138. data/app/assets/javascripts/kit/ace/mode-clojure.js +0 -1
  139. data/app/assets/javascripts/kit/ace/mode-coffee.js +0 -1
  140. data/app/assets/javascripts/kit/ace/mode-coldfusion.js +0 -1
  141. data/app/assets/javascripts/kit/ace/mode-csharp.js +0 -1
  142. data/app/assets/javascripts/kit/ace/mode-css.js +0 -1
  143. data/app/assets/javascripts/kit/ace/mode-dart.js +0 -1
  144. data/app/assets/javascripts/kit/ace/mode-diff.js +0 -1
  145. data/app/assets/javascripts/kit/ace/mode-dot.js +0 -1
  146. data/app/assets/javascripts/kit/ace/mode-glsl.js +0 -1
  147. data/app/assets/javascripts/kit/ace/mode-golang.js +0 -1
  148. data/app/assets/javascripts/kit/ace/mode-groovy.js +0 -1
  149. data/app/assets/javascripts/kit/ace/mode-haml.js +0 -1
  150. data/app/assets/javascripts/kit/ace/mode-haxe.js +0 -1
  151. data/app/assets/javascripts/kit/ace/mode-html.js +0 -1
  152. data/app/assets/javascripts/kit/ace/mode-jade.js +0 -1
  153. data/app/assets/javascripts/kit/ace/mode-java.js +0 -1
  154. data/app/assets/javascripts/kit/ace/mode-javascript.js +0 -1
  155. data/app/assets/javascripts/kit/ace/mode-json.js +0 -1
  156. data/app/assets/javascripts/kit/ace/mode-jsp.js +0 -1
  157. data/app/assets/javascripts/kit/ace/mode-jsx.js +0 -1
  158. data/app/assets/javascripts/kit/ace/mode-latex.js +0 -1
  159. data/app/assets/javascripts/kit/ace/mode-less.js +0 -1
  160. data/app/assets/javascripts/kit/ace/mode-liquid.js +0 -1
  161. data/app/assets/javascripts/kit/ace/mode-lisp.js +0 -1
  162. data/app/assets/javascripts/kit/ace/mode-lua.js +0 -1
  163. data/app/assets/javascripts/kit/ace/mode-luapage.js +0 -1
  164. data/app/assets/javascripts/kit/ace/mode-lucene.js +0 -1
  165. data/app/assets/javascripts/kit/ace/mode-makefile.js +0 -1
  166. data/app/assets/javascripts/kit/ace/mode-markdown.js +0 -1
  167. data/app/assets/javascripts/kit/ace/mode-objectivec.js +0 -1
  168. data/app/assets/javascripts/kit/ace/mode-ocaml.js +0 -1
  169. data/app/assets/javascripts/kit/ace/mode-perl.js +0 -1
  170. data/app/assets/javascripts/kit/ace/mode-pgsql.js +0 -1
  171. data/app/assets/javascripts/kit/ace/mode-php.js +0 -1
  172. data/app/assets/javascripts/kit/ace/mode-powershell.js +0 -1
  173. data/app/assets/javascripts/kit/ace/mode-python.js +0 -1
  174. data/app/assets/javascripts/kit/ace/mode-r.js +0 -1
  175. data/app/assets/javascripts/kit/ace/mode-rdoc.js +0 -1
  176. data/app/assets/javascripts/kit/ace/mode-rhtml.js +0 -1
  177. data/app/assets/javascripts/kit/ace/mode-ruby.js +0 -1
  178. data/app/assets/javascripts/kit/ace/mode-sass.js +0 -0
  179. data/app/assets/javascripts/kit/ace/mode-scad.js +0 -1
  180. data/app/assets/javascripts/kit/ace/mode-scala.js +0 -1
  181. data/app/assets/javascripts/kit/ace/mode-scss.js +0 -1
  182. data/app/assets/javascripts/kit/ace/mode-sh.js +0 -1
  183. data/app/assets/javascripts/kit/ace/mode-sql.js +0 -1
  184. data/app/assets/javascripts/kit/ace/mode-stylus.js +0 -1
  185. data/app/assets/javascripts/kit/ace/mode-svg.js +0 -1
  186. data/app/assets/javascripts/kit/ace/mode-tcl.js +0 -1
  187. data/app/assets/javascripts/kit/ace/mode-text.js +0 -0
  188. data/app/assets/javascripts/kit/ace/mode-textile.js +0 -1
  189. data/app/assets/javascripts/kit/ace/mode-typescript.js +0 -1
  190. data/app/assets/javascripts/kit/ace/mode-xml.js +0 -1
  191. data/app/assets/javascripts/kit/ace/mode-xquery.js +0 -1
  192. data/app/assets/javascripts/kit/ace/mode-yaml.js +0 -1
  193. data/app/assets/javascripts/kit/ace/theme-ambiance.js +0 -1
  194. data/app/assets/javascripts/kit/ace/theme-chaos.js +0 -1
  195. data/app/assets/javascripts/kit/ace/theme-chrome.js +0 -1
  196. data/app/assets/javascripts/kit/ace/theme-clouds.js +0 -1
  197. data/app/assets/javascripts/kit/ace/theme-clouds_midnight.js +0 -1
  198. data/app/assets/javascripts/kit/ace/theme-cobalt.js +0 -1
  199. data/app/assets/javascripts/kit/ace/theme-crimson_editor.js +0 -1
  200. data/app/assets/javascripts/kit/ace/theme-dawn.js +0 -1
  201. data/app/assets/javascripts/kit/ace/theme-dreamweaver.js +0 -1
  202. data/app/assets/javascripts/kit/ace/theme-eclipse.js +0 -1
  203. data/app/assets/javascripts/kit/ace/theme-github.js +0 -1
  204. data/app/assets/javascripts/kit/ace/theme-idle_fingers.js +0 -1
  205. data/app/assets/javascripts/kit/ace/theme-kr.js +0 -1
  206. data/app/assets/javascripts/kit/ace/theme-merbivore.js +0 -1
  207. data/app/assets/javascripts/kit/ace/theme-merbivore_soft.js +0 -1
  208. data/app/assets/javascripts/kit/ace/theme-mono_industrial.js +0 -1
  209. data/app/assets/javascripts/kit/ace/theme-monokai.js +0 -1
  210. data/app/assets/javascripts/kit/ace/theme-pastel_on_dark.js +0 -1
  211. data/app/assets/javascripts/kit/ace/theme-solarized_dark.js +0 -1
  212. data/app/assets/javascripts/kit/ace/theme-solarized_light.js +0 -1
  213. data/app/assets/javascripts/kit/ace/theme-textmate.js +0 -1
  214. data/app/assets/javascripts/kit/ace/theme-tomorrow.js +0 -1
  215. data/app/assets/javascripts/kit/ace/theme-tomorrow_night.js +0 -1
  216. data/app/assets/javascripts/kit/ace/theme-tomorrow_night_blue.js +0 -1
  217. data/app/assets/javascripts/kit/ace/theme-tomorrow_night_bright.js +0 -1
  218. data/app/assets/javascripts/kit/ace/theme-tomorrow_night_eighties.js +0 -1
  219. data/app/assets/javascripts/kit/ace/theme-twilight.js +0 -1
  220. data/app/assets/javascripts/kit/ace/theme-vibrant_ink.js +0 -1
  221. data/app/assets/javascripts/kit/ace/theme-xcode.js +0 -1
  222. data/app/assets/javascripts/kit/ace/worker-coffee.js +0 -1
  223. data/app/assets/javascripts/kit/ace/worker-css.js +0 -1
  224. data/app/assets/javascripts/kit/ace/worker-javascript.js +0 -1
  225. data/app/assets/javascripts/kit/ace/worker-json.js +0 -1
  226. data/app/assets/javascripts/kit/ace/worker-xquery.js +0 -1
  227. data/app/assets/javascripts/kit/jquery-ui.min.js +0 -126
  228. data/app/assets/javascripts/kit/jquery.markitup.js +0 -635
  229. data/app/assets/javascripts/kit/jquery.min.js +0 -3
  230. data/app/assets/javascripts/kit/rails_admin/application.js +0 -7
  231. data/app/assets/javascripts/kit/rails_admin/jquery-1.5.1.min.js +0 -16
  232. data/app/assets/javascripts/kit/rails_admin/jquery-ui-1.8.10.min.js +0 -405
  233. data/app/assets/javascripts/kit/rails_admin/jquery.colorpicker.js +0 -484
  234. data/app/assets/javascripts/kit/rails_admin/jquery.ui.timepicker.js +0 -915
  235. data/app/assets/javascripts/kit/rails_admin/ra.datetimepicker.js +0 -67
  236. data/app/assets/javascripts/kit/rails_admin/ra.filtering-multiselect.js +0 -274
  237. data/app/assets/javascripts/kit/rails_admin/ra.filtering-select.js +0 -179
  238. data/app/assets/javascripts/kit/rails_admin/ra.remote-form.js +0 -111
  239. data/app/assets/javascripts/kit/rails_admin/ra.timeline.js +0 -206
  240. data/app/assets/javascripts/kit/rails_admin/rails.js +0 -289
  241. data/app/assets/stylesheets/application.css +0 -5
  242. data/app/assets/stylesheets/kit/rails_admin/aristo/images/bg_fallback.png +0 -0
  243. data/app/assets/stylesheets/kit/rails_admin/aristo/images/icon_sprite.png +0 -0
  244. data/app/assets/stylesheets/kit/rails_admin/aristo/images/progress_bar.gif +0 -0
  245. data/app/assets/stylesheets/kit/rails_admin/aristo/images/slider_handles.png +0 -0
  246. data/app/assets/stylesheets/kit/rails_admin/aristo/images/ui-icons_222222_256x240.png +0 -0
  247. data/app/assets/stylesheets/kit/rails_admin/aristo/images/ui-icons_454545_256x240.png +0 -0
  248. data/app/assets/stylesheets/kit/rails_admin/aristo/jquery-ui-1.8.7.custom.css +0 -703
  249. data/app/assets/stylesheets/kit/rails_admin/base.css +0 -349
  250. data/app/assets/stylesheets/kit/rails_admin/dashboard.css +0 -88
  251. data/app/assets/stylesheets/kit/rails_admin/form.css +0 -147
  252. data/app/assets/stylesheets/kit/rails_admin/jquery.colorpicker.css +0 -179
  253. data/app/assets/stylesheets/kit/rails_admin/jquery.ui.timepicker.css +0 -39
  254. data/app/assets/stylesheets/kit/rails_admin/list.css +0 -127
  255. data/app/assets/stylesheets/kit/rails_admin/ra.filtering-multiselect.css +0 -113
  256. data/app/assets/stylesheets/kit/rails_admin/ra.filtering-select.css +0 -7
  257. data/app/assets/stylesheets/kit/rails_admin/ra.timeline.css +0 -77
  258. data/app/assets/stylesheets/kit/ui.tar.gz +0 -0
  259. data/app/assets/stylesheets/mercury_overrides.css +0 -23
  260. data/app/views/layouts/cms.html.erb +0 -66
  261. data/app/views/utility/_ace_editor.html.erb +0 -10
@@ -1,67 +0,0 @@
1
- /*
2
- * RailsAdmin date/time picker @VERSION
3
- *
4
- * License
5
- *
6
- * http://www.railsadmin.org
7
- *
8
- * Depends:
9
- * jquery.ui.core.js
10
- * jquery.ui.widget.js
11
- * jquery.ui.datepicker.js
12
- * jquery.ui.timepicker.js (http://plugins.jquery.com/project/timepicker-by-fgelinas)
13
- */
14
- (function($) {
15
-
16
- $.widget("ra.datetimepicker", {
17
- options: {
18
- showDate: true,
19
- showTime: true,
20
- datepicker: {},
21
- timepicker: {}
22
- },
23
-
24
- _create: function() {
25
- var widget = this;
26
- this.element.hide();
27
-
28
- if (this.options.showTime) {
29
- this.timepicker = $('<input type="text" value="' + this.options.timepicker.value + '" />');
30
-
31
- this.timepicker.css("width", "60px");
32
-
33
- this.timepicker.insertAfter(this.element);
34
-
35
- this.timepicker.bind("change", function() { widget._onChange(); });
36
-
37
- this.timepicker.timepicker(this.options.timepicker);
38
- }
39
-
40
- if (this.options.showDate) {
41
- this.datepicker = $('<input type="text" value="' + this.options.datepicker.value + '" />');
42
-
43
- this.datepicker.css("margin-right", "10px");
44
-
45
- this.datepicker.insertAfter(this.element);
46
-
47
- this.datepicker.bind("change", function() { widget._onChange(); });
48
-
49
- this.datepicker.datepicker(this.options.datepicker);
50
- }
51
- },
52
-
53
- _onChange: function() {
54
- var value = [];
55
-
56
- if (this.options.showDate) {
57
- value.push(this.datepicker.val());
58
- }
59
-
60
- if (this.options.showTime) {
61
- value.push(this.timepicker.val());
62
- }
63
-
64
- this.element.val(value.join(" "));
65
- }
66
- });
67
- })(jQuery);
@@ -1,274 +0,0 @@
1
- /*
2
- * RailsAdmin filtering multiselect @VERSION
3
- *
4
- * License
5
- *
6
- * http://www.railsadmin.org
7
- *
8
- * Depends:
9
- * jquery.ui.core.js
10
- * jquery.ui.widget.js
11
- */
12
- (function($) {
13
- $.widget("ra.filteringMultiselect", {
14
- _cache: {},
15
- options: {
16
- createQuery: function(query) {
17
- return { query: query };
18
- },
19
- sortable: false,
20
- regional: {
21
- up: "Up",
22
- down: "Down",
23
- add: "Add",
24
- chooseAll: "Choose all",
25
- chosen: "Chosen records",
26
- clearAll: "Clear all",
27
- remove: "Remove",
28
- selectChoice: "Select your choice(s) and click"
29
- },
30
- searchDelay: 400,
31
- source: null
32
- },
33
-
34
- _create: function() {
35
- this._cache = {};
36
- this._build();
37
- this._bindEvents();
38
- this._buildCache();
39
- },
40
-
41
- _build: function() {
42
- var i;
43
-
44
- this.wrapper = $('<div class="ra-multiselect">');
45
-
46
- this.wrapper.insertAfter(this.element);
47
-
48
- this.header = $('<div class="ra-multiselect-header ui-helper-clearfix">');
49
-
50
- this.filter = $('<input type="text" class="ra-multiselect-search"/>');
51
-
52
- this.header.append(this.filter)
53
- .append('<div class="help"><strong>' + this.options.regional.chosen + '</strong><br />' + this.options.regional.selectChoice + '</div><div class="ui-icon ui-icon-circle-triangle-e"></div>');
54
-
55
- this.wrapper.append(this.header);
56
-
57
- this.columns = {
58
- left: $('<div class="ra-multiselect-column ra-multiselect-left">'),
59
- center: $('<div class="ra-multiselect-column ra-multiselect-center">'),
60
- right: $('<div class="ra-multiselect-column ra-multiselect-right">')
61
- };
62
-
63
- for (i in this.columns) {
64
- if (this.columns.hasOwnProperty(i)) {
65
- this.wrapper.append(this.columns[i]);
66
- }
67
- }
68
-
69
- this.collection = $('<select multiple="multiple"></select>');
70
-
71
- this.collection.addClass("ra-multiselect-collection");
72
-
73
- this.addAll = $('<a class="ra-multiselect-item-add-all"><span class="ui-icon ui-icon-circle-triangle-e"></span>' + this.options.regional.chooseAll + '</a>');
74
-
75
- this.columns.left.append(this.collection)
76
- .append(this.addAll);
77
-
78
- this.add = $('<a class="ui-icon ui-icon-circle-triangle-e ra-multiselect-item-add">' + this.options.regional.add + '</a>');
79
-
80
- this.remove = $('<a class="ui-icon ui-icon-circle-triangle-w ra-multiselect-item-remove">' + this.options.regional.remove + '</a>');
81
-
82
- this.columns.center.append(this.add).append(this.remove)
83
- if (this.options.sortable) {
84
- this.up = $('<a class="ui-icon ui-icon-circle-triangle-n ra-multiselect-item-up">' + this.options.regional.up + '</a>');
85
- this.down = $('<a class="ui-icon ui-icon-circle-triangle-s ra-multiselect-item-down">' + this.options.regional.down + '</a>');
86
- this.columns.center.append(this.up).append(this.down);
87
- }
88
-
89
- this.selection = $('<select class="ra-multiselect-selection" multiple="multiple"></select>');
90
-
91
- this.removeAll = $('<a class="ra-multiselect-item-remove-all"><span class="ui-icon ui-icon-circle-triangle-w"></span>' + this.options.regional.clearAll + '</a>');
92
-
93
- this.columns.right.append(this.selection)
94
- .append(this.removeAll);
95
-
96
- this.element.css({display: "none"});
97
- },
98
-
99
- _bindEvents: function() {
100
- var widget = this;
101
-
102
- /* Add all to selection */
103
- this.addAll.click(function(e){
104
- widget._select($('option', widget.collection));
105
- });
106
-
107
- /* Add to selection */
108
- this.add.click(function(e){
109
- widget._select($(':selected', widget.collection));
110
- });
111
-
112
- /* Remove all from selection */
113
- this.removeAll.click(function(e){
114
- widget._deSelect($('option', widget.selection));
115
- });
116
-
117
- /* Remove from selection */
118
- this.remove.click(function(e){
119
- widget._deSelect($(':selected', widget.selection));
120
- });
121
-
122
- var timeout = null;
123
- if(this.options.sortable) {
124
- /* Move selection up */
125
- this.up.click(function(e){
126
- widget._move('up', $(':selected', widget.selection));
127
- });
128
-
129
- /* Move selection down */
130
- this.down.click(function(e){
131
- widget._move('down', $(':selected', widget.selection));
132
- });
133
- }
134
-
135
- /* Typing to the filter */
136
- this.filter.keyup(function(e){
137
-
138
- if (timeout) { clearTimeout(timeout); }
139
-
140
- var search = function() {
141
-
142
- widget._query(widget.filter.val(), function(matches) {
143
- var i, html = "";
144
- for (i in matches) {
145
- if (matches.hasOwnProperty(i) && !widget.selected(matches[i].id)) {
146
- html += '<option value="' + matches[i].id + '">' + matches[i].label + '</option>';
147
- }
148
- }
149
-
150
- widget.collection.html(html);
151
- });
152
- };
153
-
154
- timeout = setTimeout(search, widget.options.searchDelay);
155
- });
156
- },
157
-
158
- _buildCache: function(options) {
159
- var widget = this;
160
-
161
- this.element.find("option").each(function(i, option) {
162
- if (option.selected) {
163
- widget._cache[option.value] = option.innerHTML;
164
- $(option).clone().appendTo(widget.selection).attr("selected", false);
165
- } else {
166
- widget._cache[option.value] = option.innerHTML;
167
- $(option).clone().appendTo(widget.collection).attr("selected", false);
168
- }
169
- });
170
- },
171
-
172
- _deSelect: function(options) {
173
- var widget = this;
174
- options.each(function(i, option) {
175
- widget.element.find("option[value=" + option.value + "]").removeAttr("selected");
176
- });
177
- $(options).appendTo(this.collection).attr('selected', false);
178
- },
179
-
180
- _query: function(query, success) {
181
-
182
- var i, matches = [];
183
-
184
- if (query === "") {
185
-
186
- if (!this.options.source) {
187
-
188
- for (i in this._cache) {
189
- if (this._cache.hasOwnProperty(i)) {
190
- matches.push({id: i, label: this._cache[i]});
191
- }
192
- }
193
- }
194
-
195
- success.apply(this, [matches]);
196
-
197
- } else {
198
-
199
- if (this.options.source) {
200
-
201
- $.ajax({
202
- beforeSend: function(xhr) {
203
- xhr.setRequestHeader("Accept", "application/json");
204
- },
205
- url: this.options.source,
206
- data: this.options.createQuery(query),
207
- success: success
208
- });
209
-
210
- } else {
211
-
212
- query = new RegExp(query + '.*', 'i');
213
-
214
- for (i in this._cache) {
215
- if (this._cache.hasOwnProperty(i) && query.test(this._cache[i])) {
216
- matches.push({id: i, label: this._cache[i]});
217
- }
218
- }
219
-
220
- success.apply(this, [matches]);
221
- }
222
- }
223
- },
224
-
225
- _select: function(options) {
226
- var widget = this;
227
- options.each(function(i, option) {
228
- var el = widget.element.find("option[value=" + option.value + "]");
229
- if (el.length) {
230
- el.attr("selected", "selected");
231
- } else {
232
- widget.element.append($('<option value="' + option.value + '" selected="selected"></option>'));
233
- }
234
- });
235
- $(options).appendTo(this.selection).attr('selected', false);
236
- },
237
-
238
- _move: function(direction, options) {
239
- var widget = this;
240
- if(direction == 'up') {
241
- options.each(function(i, option) {
242
- var prev = $(option).prev();
243
- if (prev.length > 0) {
244
- var el = widget.element.find("option[value=" + option.value + "]");
245
- var el_prev = widget.element.find("option[value=" + prev[0].value + "]");
246
- el_prev.before(el);
247
- prev.before($(option));
248
- }
249
- });
250
- } else {
251
- $.fn.reverse = [].reverse; // needed to lower last items first
252
- options.reverse().each(function(i, option) {
253
- var next = $(option).next();
254
- if (next.length > 0) {
255
- var el = widget.element.find("option[value=" + option.value + "]");
256
- var el_next = widget.element.find("option[value=" + next[0].value + "]");
257
- el_next.after(el);
258
- next.after($(option));
259
- }
260
- });
261
- }
262
- },
263
-
264
- selected: function(value) {
265
- return this.element.find("option[value=" + value + "]").attr("selected");
266
- },
267
-
268
- destroy: function() {
269
- this.wrapper.remove();
270
- this.element.css({display: "inline"});
271
- $.Widget.prototype.destroy.apply(this, arguments);
272
- }
273
- });
274
- })(jQuery);
@@ -1,179 +0,0 @@
1
- /*
2
- * RailsAdmin filtering select @VERSION
3
- *
4
- * Based on the combobox example from jQuery UI documentation
5
- * http://jqueryui.com/demos/autocomplete/#combobox
6
- *
7
- * License
8
- *
9
- * http://www.railsadmin.org
10
- *
11
- * Depends:
12
- * jquery.ui.core.js
13
- * jquery.ui.widget.js
14
- * jquery.ui.autocomplete.js
15
- */
16
- (function($) {
17
- $.widget("ra.filteringSelect", {
18
- options: {
19
- createQuery: function(query) {
20
- return { query: query };
21
- },
22
- minLength: 0,
23
- searchDelay: 200,
24
- source: null
25
- },
26
-
27
- _create: function() {
28
- var self = this,
29
- select = this.element.hide(),
30
- selected = select.children(":selected"),
31
- value = selected.val() ? selected.text() : "";
32
-
33
- if (!this.options.source) {
34
- this.options.source = select.children("option").map(function() {
35
- return { label: $(this).text(), value: this.value };
36
- }).toArray();
37
- }
38
-
39
- var input = this.input = $("<input>")
40
- .insertAfter(select)
41
- .val(value)
42
- .addClass("ra-filtering-select-input")
43
- .autocomplete({
44
- delay: this.options.searchDelay,
45
- minLength: this.options.minLength,
46
- source: this._getSourceFunction(this.options.source),
47
- select: function(event, ui) {
48
- var option = $('<option value="' + ui.item.id + '" selected="selected">' + ui.item.value + '</option>');
49
- select.html(option);
50
- self._trigger("selected", event, {
51
- item: option
52
- });
53
- },
54
- change: function(event, ui) {
55
- if (!ui.item) {
56
- var matcher = new RegExp("^" + $.ui.autocomplete.escapeRegex($(this).val()) + "$", "i"),
57
- valid = false;
58
- select.children("option").each(function() {
59
- if ($(this).text().match(matcher)) {
60
- this.selected = valid = true;
61
- return false;
62
- }
63
- });
64
- if (!valid) {
65
- // remove invalid value, as it didn't match anything
66
- $(this).val("");
67
- select.val("");
68
- input.data("autocomplete").term = "";
69
- return false;
70
- }
71
- }
72
- }
73
- })
74
- .addClass("ui-widget ui-widget-content ui-corner-left");
75
-
76
- input.data("autocomplete")._renderItem = function(ul, item) {
77
- return $("<li></li>")
78
- .data("item.autocomplete", item)
79
- .append("<a>" + item.label + "</a>")
80
- .appendTo(ul);
81
- };
82
-
83
- this.button = $("<button type='button'>&nbsp;</button>")
84
- .attr("tabIndex", -1)
85
- .attr("title", "Show All Items")
86
- .insertAfter(input)
87
- .button({
88
- icons: {
89
- primary: "ui-icon-triangle-1-s"
90
- },
91
- text: false
92
- })
93
-
94
- .removeClass("ui-corner-all")
95
- .addClass("ra-filtering-select-button ui-corner-right")
96
- .click(function() {
97
- // close if already visible
98
- if (input.autocomplete("widget").is(":visible")) {
99
- input.autocomplete("close");
100
- return;
101
- }
102
-
103
- // pass empty string as value to search for, displaying all results
104
- input.autocomplete("search", "");
105
- input.focus();
106
- });
107
- },
108
-
109
- _getResultSet: function(request, data, xhr) {
110
- var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i");
111
-
112
- return $.map(data, function(el, i) {
113
- // match regexp only for local requests, remote ones are already filtered, and label may not contain filtered term.
114
- if ((el.id || el.value) && (xhr || matcher.test(el.label))) {
115
- return {
116
- label: el.label.replace(
117
- new RegExp(
118
- "(?![^&;]+;)(?!<[^<>]*)(" +
119
- $.ui.autocomplete.escapeRegex(request.term) +
120
- ")(?![^<>]*>)(?![^&;]+;)", "gi"
121
- ), "<strong>$1</strong>"),
122
- value: el.label,
123
- id: el.id || el.value
124
- };
125
- }
126
- });
127
- },
128
-
129
- _getSourceFunction: function(source) {
130
-
131
- var self = this,
132
- requestIndex = 0;
133
-
134
- if ($.isArray(source)) {
135
-
136
- return function(request, response) {
137
- response(self._getResultSet(request, source, false));
138
- };
139
-
140
- } else if (typeof source === "string") {
141
-
142
- return function(request, response) {
143
-
144
- if (this.xhr) {
145
- this.xhr.abort();
146
- }
147
-
148
- this.xhr = $.ajax({
149
- url: source,
150
- data: self.options.createQuery(request.term),
151
- dataType: "json",
152
- autocompleteRequest: ++requestIndex,
153
- success: function(data, status) {
154
- if (this.autocompleteRequest === requestIndex) {
155
- response(self._getResultSet(request, data, true));
156
- }
157
- },
158
- error: function() {
159
- if (this.autocompleteRequest === requestIndex) {
160
- response([]);
161
- }
162
- }
163
- });
164
- };
165
-
166
- } else {
167
-
168
- return source;
169
- }
170
- },
171
-
172
- destroy: function() {
173
- this.input.remove();
174
- this.button.remove();
175
- this.element.show();
176
- $.Widget.prototype.destroy.call(this);
177
- }
178
- });
179
- })(jQuery);