kit_cms 2.3.9 → 2.3.10

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 (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,111 +0,0 @@
1
- /*
2
- * RailsAdmin remote form @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.dialog.js
12
- */
13
- (function($) {
14
- $.widget("ra.remoteForm", {
15
- dialog: null,
16
- options: {
17
- dialogClass: "",
18
- width: 720
19
- },
20
-
21
- _create: function() {
22
- var widget = this;
23
- $(widget.element).bind("click", function(e){
24
- e.preventDefault();
25
- var dialog = widget._getDialog();
26
- $.ajax({
27
- url: $(this).attr("href"),
28
- beforeSend: function(xhr) {
29
- xhr.setRequestHeader("Accept", "text/javascript");
30
- },
31
- success: function(data, status, xhr) {
32
- dialog.html(data);
33
- widget._bindFormEvents();
34
- },
35
- error: function(xhr, status, error) {
36
- dialog.html(xhr.responseText);
37
- }
38
- });
39
- });
40
- },
41
-
42
- _bindFormEvents: function() {
43
- var dialog = this._getDialog(),
44
- form = dialog.find("form"),
45
- widget = this,
46
- saveButtonText = dialog.find("input[name=_save]").val(),
47
- cancelButtonText = dialog.find("input[name=_continue]").val();
48
-
49
- dialog.dialog("option", "title", $(".ui-widget-header", dialog).remove().text());
50
-
51
- form.attr("data-remote", true);
52
- dialog.find(".submit").remove();
53
- dialog.find(".ra-block-content").removeClass("ra-block-content");
54
-
55
- var buttons = {};
56
-
57
- buttons[saveButtonText] = function() {
58
- // We need to manually update CKeditor mapped textarea before ajax submit
59
- if(typeof CKEDITOR != 'undefined') {
60
- for ( instance in CKEDITOR.instances )
61
- CKEDITOR.instances[instance].updateElement();
62
- }
63
- dialog.find("form").submit();
64
- };
65
-
66
- buttons[cancelButtonText] = function() {
67
- dialog.dialog("close");
68
- };
69
-
70
- dialog.dialog("option", "buttons", buttons);
71
-
72
- form.bind("ajax:success", function(e, data, status, xhr) {
73
- var json = $.parseJSON(data);
74
- var select = widget.element.siblings('select');
75
- var input = widget.element.siblings('.ra-filtering-select-input');
76
-
77
- if(input.length > 0) {
78
- input[0].value = json.label;
79
- }
80
-
81
- if(select.length > 0) {
82
- select.html('<option value="' + json.id + '">' + json.label + '</option>' );
83
- select[0].value = json.id;
84
- }
85
- dialog.dialog("close");
86
- });
87
-
88
- form.bind("ajax:error", function(e, xhr, status, error) {
89
- dialog.html(xhr.responseText);
90
- widget._bindFormEvents();
91
- });
92
- },
93
-
94
- _getDialog: function() {
95
- if (!this.dialog) {
96
- var widget = this;
97
- this.dialog = $('<div class="' + this.options.dialogClass + '"></div>').dialog({
98
- autoShow: false,
99
- close: function(e, ui) {
100
- $(this).dialog("destroy");
101
- $(this).remove();
102
- widget.dialog = null;
103
- },
104
- modal: true,
105
- width: this.options.width
106
- });
107
- }
108
- return this.dialog;
109
- }
110
- });
111
- })(jQuery);
@@ -1,206 +0,0 @@
1
- /*
2
- * RailsAdmin Timeline @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.draggable.js
12
- */
13
- (function($) {
14
- $.widget("ra.timeline", {
15
- options: {
16
- date: new Date(),
17
- monthChanged: function(month, year) {},
18
- months: ['January','February','March','April','May','June','July','August','September','October','November','December'],
19
- range: 4,
20
- url: null
21
- },
22
-
23
- _create: function() {
24
- if (!this.options.url) {
25
- alert("Timeline widget needs to be initialized with url option");
26
- }
27
-
28
- this._build();
29
- this._bindEvents();
30
- this.refresh();
31
- },
32
-
33
- _build: function() {
34
- this.element.addClass("ra-timeline");
35
-
36
- this.next = $('<a class="range next" href="javascript:void();">Next</a>').appendTo(this.element);
37
- this.previous = $('<a class="range previous" href="javascript:void();">Previous</a>').appendTo(this.element);
38
-
39
- this.months = $('<ul></ul>').appendTo(this.element);
40
-
41
- this.handle = $('<div class="handle"></div>').appendTo(this.element);
42
-
43
- this.handleOffset = parseInt(this.element.css("padding-left"), 10);
44
-
45
- this._moveHandleToRight();
46
- },
47
-
48
- _bindEvents: function() {
49
- var currentMonthIndex = 0,
50
- widget = this;
51
-
52
- this.handle.draggable({
53
- axis: "x",
54
- containment: this.element,
55
- drag: function(event, ui) {
56
- var i = Math.floor((ui.position.left - widget.handleOffset) / widget.monthWidth);
57
-
58
- if (i !== currentMonthIndex) {
59
- currentMonthIndex = i;
60
-
61
- var el = $(widget.months.children().get(i)),
62
- month = el.attr("data-month"),
63
- year = el.attr("data-year");
64
-
65
- widget.options.monthChanged(month, year);
66
- }
67
- }
68
- });
69
-
70
- this.previous.bind("click.timeline", function(e){
71
- e.preventDefault();
72
- widget.options.date.setMonth(widget.options.date.getMonth() - widget.options.range);
73
- widget._moveHandleToRight();
74
- widget.options.monthChanged(
75
- widget.options.date.getMonth() + 1,
76
- widget.options.date.getFullYear()
77
- );
78
- widget.refresh();
79
- });
80
-
81
- this.next.bind("click.timeline", function(e){
82
- e.preventDefault();
83
- var date = widget._getNextMonthDate();
84
- widget.options.monthChanged(
85
- date.getMonth() + 1,
86
- date.getFullYear()
87
- );
88
- widget.options.date.setMonth(widget.options.date.getMonth() + widget.options.range);
89
- widget._moveHandleToLeft();
90
- widget.refresh();
91
- });
92
- },
93
-
94
- _getCurrentDate: function() {
95
- return new Date(this.options.date.getFullYear(), this.options.date.getMonth(), 1);
96
- },
97
-
98
- _getNextMonthDate: function() {
99
- var date = this._getCurrentDate();
100
- date.setMonth(this.options.date.getMonth() + 1);
101
- return date;
102
- },
103
-
104
- _getPreviousMonthDate: function() {
105
- var date = this._getCurrentDate();
106
- date.setMonth(this.options.date.getMonth() - 1);
107
- return date;
108
- },
109
-
110
- _moveHandleToLeft: function() {
111
- this.handle.css("left", this.handleOffset);
112
- },
113
-
114
- _moveHandleToRight: function() {
115
- this.handle.css("left", this.months.width() - this.handle.width() + this.handleOffset);
116
- },
117
-
118
- refresh: function() {
119
- this.months.find("li").remove();
120
-
121
- var i = this.options.range,
122
- date = this._getCurrentDate();
123
-
124
- this.monthWidth = Math.floor(this.months.width() / this.options.range) - 1;
125
-
126
- while (i--) {
127
-
128
- this.months.prepend(
129
- '<li style="width:' + this.monthWidth + 'px" data-year="' + date.getFullYear() + '" data-month="' + (parseInt(date.getMonth(), 10) + 1) + '">' +
130
- '<span class="month">' + this.getMonthName(date) + '</span>' +
131
- '<span class="bar"><span></span</span>' +
132
- '</li>'
133
- );
134
-
135
- date.setMonth(date.getMonth() - 1);
136
- }
137
-
138
- var widget = this;
139
-
140
- $.ajax({
141
- url: this.options.url,
142
- data: {
143
- from: {
144
- month: date.getMonth() + 1,
145
- year: date.getFullYear()
146
- },
147
- to: {
148
- month: this.options.date.getMonth() + 1,
149
- year: this.options.date.getFullYear()
150
- }
151
- },
152
- beforeSend: function(xhr) {
153
- xhr.setRequestHeader("Accept", "application/json");
154
- },
155
- success: function(data, status, xhr) {
156
- var maxHeight = widget.months.find(".bar").first().height(), max = 0;
157
-
158
- var getHistoryIndicator = function(history) {
159
- return widget.months.find("li[data-year=" + history.year + "][data-month=" + history.month + "] .bar span").first();
160
- };
161
-
162
- $(data).each(function(i, e) {
163
- if (getHistoryIndicator(e.history).length && e.history.record_count > max) {
164
- max = e.history.record_count;
165
- }
166
- });
167
-
168
- $(data).each(function(i, e) {
169
- var className = "",
170
- el = getHistoryIndicator(e.history),
171
- height = 0,
172
- percent = 0;
173
-
174
- if (el.length) {
175
- if (e.history.record_count > 0) {
176
- percent = parseFloat(e.history.record_count / max);
177
- className = widget.getBarClass(percent);
178
- height = Math.floor(maxHeight * percent);
179
- }
180
-
181
- el.toggleClass(className, 300)
182
- .effect("size", { to: { height: height } }, 500);
183
- }
184
- });
185
- },
186
- error: function(xhr, status, error) {
187
- dialog.html(xhr.responseText);
188
- }
189
- });
190
- },
191
-
192
- getBarClass: function(percent) {
193
- if (percent < 0.33) {
194
- return "low";
195
- } else if (percent < 0.67) {
196
- return "medium";
197
- } else {
198
- return "high";
199
- }
200
- },
201
-
202
- getMonthName: function(date) {
203
- return this.options.months[date.getMonth()];
204
- }
205
- });
206
- })(jQuery);
@@ -1,289 +0,0 @@
1
- /**
2
- * Unobtrusive scripting adapter for jQuery
3
- *
4
- * Requires jQuery 1.4.4 or later.
5
- * https://github.com/rails/jquery-ujs
6
-
7
- * Uploading file using rails.js
8
- * =============================
9
- *
10
- * By default, browsers do not allow files to be uploaded via AJAX. As a result, if there are any non-blank file fields
11
- * in the remote form, this adapter aborts the AJAX submission and allows the form to submit through standard means.
12
- *
13
- * The `ajax:aborted:file` event allows you to bind your own handler to process the form submission however you wish.
14
- *
15
- * Ex:
16
- * $('form').live('ajax:aborted:file', function(event, elements){
17
- * // Implement own remote file-transfer handler here for non-blank file inputs passed in `elements`.
18
- * // Returning false in this handler tells rails.js to disallow standard form submission
19
- * return false;
20
- * });
21
- *
22
- * The `ajax:aborted:file` event is fired when a file-type input is detected with a non-blank value.
23
- *
24
- * Third-party tools can use this hook to detect when an AJAX file upload is attempted, and then use
25
- * techniques like the iframe method to upload the file instead.
26
- *
27
- * Required fields in rails.js
28
- * ===========================
29
- *
30
- * If any blank required inputs (required="required") are detected in the remote form, the whole form submission
31
- * is canceled. Note that this is unlike file inputs, which still allow standard (non-AJAX) form submission.
32
- *
33
- * The `ajax:aborted:required` event allows you to bind your own handler to inform the user of blank required inputs.
34
- *
35
- * !! Note that Opera does not fire the form's submit event if there are blank required inputs, so this event may never
36
- * get fired in Opera. This event is what causes other browsers to exhibit the same submit-aborting behavior.
37
- *
38
- * Ex:
39
- * $('form').live('ajax:aborted:required', function(event, elements){
40
- * // Returning false in this handler tells rails.js to submit the form anyway.
41
- * // The blank required inputs are passed to this function in `elements`.
42
- * return ! confirm("Would you like to submit the form with missing info?");
43
- * });
44
- */
45
-
46
- (function($) {
47
- // Shorthand to make it a little easier to call public rails functions from within rails.js
48
- var rails;
49
-
50
- $.rails = rails = {
51
- // Link elements bound by jquery-ujs
52
- linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]',
53
-
54
- // Form elements bound by jquery-ujs
55
- formSubmitSelector: 'form',
56
-
57
- // Form input elements bound by jquery-ujs
58
- formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not([type])',
59
-
60
- // Form input elements disabled during form submission
61
- disableSelector: 'input[data-disable-with], button[data-disable-with], textarea[data-disable-with]',
62
-
63
- // Form input elements re-enabled after form submission
64
- enableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled',
65
-
66
- // Form required input elements
67
- requiredInputSelector: 'input[name][required],textarea[name][required]',
68
-
69
- // Form file input elements
70
- fileInputSelector: 'input:file',
71
-
72
- // Make sure that every Ajax request sends the CSRF token
73
- CSRFProtection: function(xhr) {
74
- var token = $('meta[name="csrf-token"]').attr('content');
75
- if (token) xhr.setRequestHeader('X-CSRF-Token', token);
76
- },
77
-
78
- // Triggers an event on an element and returns false if the event result is false
79
- fire: function(obj, name, data) {
80
- var event = $.Event(name);
81
- obj.trigger(event, data);
82
- return event.result !== false;
83
- },
84
-
85
- // Submits "remote" forms and links with ajax
86
- handleRemote: function(element) {
87
- var method, url, data,
88
- dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType);
89
-
90
- if (rails.fire(element, 'ajax:before')) {
91
-
92
- if (element.is('form')) {
93
- method = element.attr('method');
94
- url = element.attr('action');
95
- data = element.serializeArray();
96
- // memoized value from clicked submit button
97
- var button = element.data('ujs:submit-button');
98
- if (button) {
99
- data.push(button);
100
- element.data('ujs:submit-button', null);
101
- }
102
- } else {
103
- method = element.data('method');
104
- url = element.attr('href');
105
- data = null;
106
- }
107
-
108
- $.ajax({
109
- url: url, type: method || 'GET', data: data, dataType: dataType,
110
- // stopping the "ajax:beforeSend" event will cancel the ajax request
111
- beforeSend: function(xhr, settings) {
112
- if (settings.dataType === undefined) {
113
- xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script);
114
- }
115
- return rails.fire(element, 'ajax:beforeSend', [xhr, settings]);
116
- },
117
- success: function(data, status, xhr) {
118
- element.trigger('ajax:success', [data, status, xhr]);
119
- },
120
- complete: function(xhr, status) {
121
- element.trigger('ajax:complete', [xhr, status]);
122
- },
123
- error: function(xhr, status, error) {
124
- element.trigger('ajax:error', [xhr, status, error]);
125
- }
126
- });
127
- }
128
- },
129
-
130
- // Handles "data-method" on links such as:
131
- // <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a>
132
- handleMethod: function(link) {
133
- var href = link.attr('href'),
134
- method = link.data('method'),
135
- csrf_token = $('meta[name=csrf-token]').attr('content'),
136
- csrf_param = $('meta[name=csrf-param]').attr('content'),
137
- form = $('<form method="post" action="' + href + '"></form>'),
138
- metadata_input = '<input name="_method" value="' + method + '" type="hidden" />';
139
-
140
- if (csrf_param !== undefined && csrf_token !== undefined) {
141
- metadata_input += '<input name="' + csrf_param + '" value="' + csrf_token + '" type="hidden" />';
142
- }
143
-
144
- form.hide().append(metadata_input).appendTo('body');
145
- form.submit();
146
- },
147
-
148
- /* Disables form elements:
149
- - Caches element value in 'ujs:enable-with' data store
150
- - Replaces element text with value of 'data-disable-with' attribute
151
- - Adds disabled=disabled attribute
152
- */
153
- disableFormElements: function(form) {
154
- form.find(rails.disableSelector).each(function() {
155
- var element = $(this), method = element.is('button') ? 'html' : 'val';
156
- element.data('ujs:enable-with', element[method]());
157
- element[method](element.data('disable-with'));
158
- element.attr('disabled', 'disabled');
159
- });
160
- },
161
-
162
- /* Re-enables disabled form elements:
163
- - Replaces element text with cached value from 'ujs:enable-with' data store (created in `disableFormElements`)
164
- - Removes disabled attribute
165
- */
166
- enableFormElements: function(form) {
167
- form.find(rails.enableSelector).each(function() {
168
- var element = $(this), method = element.is('button') ? 'html' : 'val';
169
- if (element.data('ujs:enable-with')) element[method](element.data('ujs:enable-with'));
170
- element.removeAttr('disabled');
171
- });
172
- },
173
-
174
- // If message provided in 'data-confirm' attribute, fires `confirm` event and returns result of confirm dialog.
175
- // Attaching a handler to the element's `confirm` event that returns false cancels the confirm dialog.
176
- allowAction: function(element) {
177
- var message = element.data('confirm');
178
- return !message || (rails.fire(element, 'confirm') && confirm(message));
179
- },
180
-
181
- // Helper function which checks for blank inputs in a form that match the specified CSS selector
182
- blankInputs: function(form, specifiedSelector, nonBlank) {
183
- var inputs = $(), input,
184
- selector = specifiedSelector || 'input,textarea';
185
- form.find(selector).each(function() {
186
- input = $(this);
187
- // Collect non-blank inputs if nonBlank option is true, otherwise, collect blank inputs
188
- if (nonBlank ? input.val() : !input.val()) {
189
- inputs = inputs.add(input);
190
- }
191
- });
192
- return inputs.length ? inputs : false;
193
- },
194
-
195
- // Helper function which checks for non-blank inputs in a form that match the specified CSS selector
196
- nonBlankInputs: function(form, specifiedSelector) {
197
- return rails.blankInputs(form, specifiedSelector, true); // true specifies nonBlank
198
- },
199
-
200
- // Helper function, needed to provide consistent behavior in IE
201
- stopEverything: function(e) {
202
- e.stopImmediatePropagation();
203
- return false;
204
- },
205
-
206
- // find all the submit events directly bound to the form and
207
- // manually invoke them. If anyone returns false then stop the loop
208
- callFormSubmitBindings: function(form) {
209
- var events = form.data('events'), continuePropagation = true;
210
- if (events !== undefined && events['submit'] !== undefined) {
211
- $.each(events['submit'], function(i, obj){
212
- if (typeof obj.handler === 'function') return continuePropagation = obj.handler(obj.data);
213
- });
214
- }
215
- return continuePropagation;
216
- }
217
- };
218
-
219
- // ajaxPrefilter is a jQuery 1.5 feature
220
- if ('ajaxPrefilter' in $) {
221
- $.ajaxPrefilter(function(options, originalOptions, xhr){ rails.CSRFProtection(xhr); });
222
- } else {
223
- $(document).ajaxSend(function(e, xhr){ rails.CSRFProtection(xhr); });
224
- }
225
-
226
- $(rails.linkClickSelector).live('click.rails', function(e) {
227
- var link = $(this);
228
- if (!rails.allowAction(link)) return rails.stopEverything(e);
229
-
230
- if (link.data('remote') !== undefined) {
231
- rails.handleRemote(link);
232
- return false;
233
- } else if (link.data('method')) {
234
- rails.handleMethod(link);
235
- return false;
236
- }
237
- });
238
-
239
- $(rails.formSubmitSelector).live('submit.rails', function(e) {
240
- var form = $(this),
241
- remote = form.data('remote') !== undefined,
242
- blankRequiredInputs = rails.blankInputs(form, rails.requiredInputSelector),
243
- nonBlankFileInputs = rails.nonBlankInputs(form, rails.fileInputSelector);
244
-
245
- if (!rails.allowAction(form)) return rails.stopEverything(e);
246
-
247
- // skip other logic when required values are missing or file upload is present
248
- if (blankRequiredInputs && rails.fire(form, 'ajax:aborted:required', [blankRequiredInputs])) {
249
- return !remote;
250
- }
251
-
252
- if (remote) {
253
- if (nonBlankFileInputs) {
254
- return rails.fire(form, 'ajax:aborted:file', [nonBlankFileInputs]);
255
- }
256
-
257
- // If browser does not support submit bubbling, then this live-binding will be called before direct
258
- // bindings. Therefore, we should directly call any direct bindings before remotely submitting form.
259
- if (!$.support.submitBubbles && rails.callFormSubmitBindings(form) === false) return rails.stopEverything(e);
260
-
261
- rails.handleRemote(form);
262
- return false;
263
- } else {
264
- // slight timeout so that the submit button gets properly serialized
265
- setTimeout(function(){ rails.disableFormElements(form); }, 13);
266
- }
267
- });
268
-
269
- $(rails.formInputClickSelector).live('click.rails', function(event) {
270
- var button = $(this);
271
-
272
- if (!rails.allowAction(button)) return rails.stopEverything(event);
273
-
274
- // register the pressed submit button
275
- var name = button.attr('name'),
276
- data = name ? {name:name, value:button.val()} : null;
277
-
278
- button.closest('form').data('ujs:submit-button', data);
279
- });
280
-
281
- $(rails.formSubmitSelector).live('ajax:beforeSend.rails', function(event) {
282
- if (this == event.target) rails.disableFormElements($(this));
283
- });
284
-
285
- $(rails.formSubmitSelector).live('ajax:complete.rails', function(event) {
286
- if (this == event.target) rails.enableFormElements($(this));
287
- });
288
-
289
- })( jQuery );