rails_admin 0.4.9 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rails_admin might be problematic. Click here for more details.

Files changed (281) hide show
  1. data.tar.gz.sig +0 -0
  2. data/Gemfile +10 -9
  3. data/README.md +9 -0
  4. data/app/assets/javascripts/rails_admin/ra.filtering-select.js +3 -3
  5. data/app/assets/javascripts/rails_admin/ra.nested-form-hooks.coffee +1 -1
  6. data/app/assets/javascripts/rails_admin/ra.remote-form.js +1 -1
  7. data/app/assets/javascripts/rails_admin/ra.widgets.coffee +28 -26
  8. data/app/helpers/rails_admin/application_helper.rb +2 -2
  9. data/app/views/rails_admin/main/_form_ck_editor.html.haml +10 -0
  10. data/app/views/rails_admin/main/_form_code_mirror.html.haml +9 -0
  11. data/app/views/rails_admin/main/_form_text.html.haml +1 -31
  12. data/app/views/rails_admin/main/_form_wysihtml5.html.haml +8 -0
  13. data/lib/generators/rails_admin/install_generator.rb +40 -31
  14. data/lib/generators/rails_admin/templates/initializer.erb +2 -2
  15. data/lib/rails_admin/abstract_model.rb +1 -1
  16. data/lib/rails_admin/adapters/active_record.rb +21 -17
  17. data/lib/rails_admin/adapters/active_record/abstract_object.rb +1 -1
  18. data/lib/rails_admin/adapters/mongoid.rb +1 -0
  19. data/lib/rails_admin/config.rb +2 -2
  20. data/lib/rails_admin/config/configurable.rb +13 -5
  21. data/lib/rails_admin/config/fields/base.rb +1 -25
  22. data/lib/rails_admin/config/fields/factories/enum.rb +8 -1
  23. data/lib/rails_admin/config/fields/types/all.rb +4 -1
  24. data/lib/rails_admin/config/fields/types/ck_editor.rb +45 -0
  25. data/lib/rails_admin/config/fields/types/code_mirror.rb +55 -0
  26. data/lib/rails_admin/config/fields/types/serialized.rb +1 -1
  27. data/lib/rails_admin/config/fields/types/text.rb +12 -66
  28. data/lib/rails_admin/config/fields/types/wysihtml5.rb +44 -0
  29. data/lib/rails_admin/config/model.rb +1 -1
  30. data/lib/rails_admin/extensions/history/history.rb +4 -2
  31. data/lib/rails_admin/version.rb +2 -2
  32. data/spec/controllers/rails_admin/main_controller_spec.rb +21 -0
  33. data/spec/dummy_app/Gemfile +11 -10
  34. data/spec/dummy_app/app/active_record/another_field_test.rb +0 -1
  35. data/spec/dummy_app/app/active_record/ball.rb +0 -2
  36. data/spec/dummy_app/app/active_record/category.rb +0 -2
  37. data/spec/dummy_app/app/active_record/cms/basic_page.rb +0 -2
  38. data/spec/dummy_app/app/active_record/comment.rb +0 -2
  39. data/spec/dummy_app/app/active_record/comment/confirmed.rb +1 -1
  40. data/spec/dummy_app/app/active_record/division.rb +0 -2
  41. data/spec/dummy_app/app/active_record/draft.rb +0 -2
  42. data/spec/dummy_app/app/active_record/fan.rb +0 -2
  43. data/spec/dummy_app/app/active_record/field_test.rb +0 -5
  44. data/spec/dummy_app/app/active_record/image.rb +0 -2
  45. data/spec/dummy_app/app/active_record/league.rb +1 -3
  46. data/spec/dummy_app/app/active_record/nested_field_test.rb +0 -2
  47. data/spec/dummy_app/app/active_record/player.rb +0 -3
  48. data/spec/dummy_app/app/active_record/team.rb +1 -4
  49. data/spec/dummy_app/app/active_record/user.rb +0 -4
  50. data/spec/dummy_app/app/mongoid/another_field_test.rb +0 -1
  51. data/spec/dummy_app/app/mongoid/ball.rb +0 -2
  52. data/spec/dummy_app/app/mongoid/category.rb +0 -2
  53. data/spec/dummy_app/app/mongoid/cms/basic_page.rb +0 -2
  54. data/spec/dummy_app/app/mongoid/comment.rb +0 -2
  55. data/spec/dummy_app/app/mongoid/division.rb +0 -2
  56. data/spec/dummy_app/app/mongoid/draft.rb +0 -2
  57. data/spec/dummy_app/app/mongoid/fan.rb +0 -2
  58. data/spec/dummy_app/app/mongoid/field_test.rb +1 -5
  59. data/spec/dummy_app/app/mongoid/image.rb +0 -2
  60. data/spec/dummy_app/app/mongoid/league.rb +0 -2
  61. data/spec/dummy_app/app/mongoid/nested_field_test.rb +0 -2
  62. data/spec/dummy_app/app/mongoid/player.rb +1 -3
  63. data/spec/dummy_app/app/mongoid/team.rb +0 -2
  64. data/spec/dummy_app/app/mongoid/user.rb +1 -2
  65. data/spec/dummy_app/config/application.rb +0 -7
  66. data/spec/dummy_app/config/environments/development.rb +1 -7
  67. data/spec/dummy_app/config/environments/test.rb +2 -4
  68. data/spec/dummy_app/config/initializers/secret_token.rb +1 -0
  69. data/spec/dummy_app/config/routes.rb +2 -2
  70. data/spec/dummy_app/db/test.sqlite3 +0 -0
  71. data/spec/dummy_app/db/test.sqlite3-journal +0 -0
  72. data/spec/dummy_app/log/test.log +1423 -0
  73. data/spec/dummy_app/tmp/cache/assets/test/sass/0759f2828afb668a39de3ede4887b369780cdb28/jquery-ui-1.8.7.custom.scssc +0 -0
  74. data/spec/dummy_app/tmp/cache/assets/test/sass/1de49575831c79805eaa5ca759c4aae181c38254/mixins.scssc +0 -0
  75. data/spec/dummy_app/tmp/cache/assets/test/sass/1de49575831c79805eaa5ca759c4aae181c38254/theming.scssc +0 -0
  76. data/spec/dummy_app/tmp/cache/assets/test/sass/1de49575831c79805eaa5ca759c4aae181c38254/variables.scssc +0 -0
  77. data/spec/dummy_app/tmp/cache/assets/test/sass/50e4466efc3255401f37f709f5f338668408ef71/mixins.scssc +0 -0
  78. data/spec/dummy_app/tmp/cache/assets/test/sass/50e4466efc3255401f37f709f5f338668408ef71/theming.scssc +0 -0
  79. data/spec/dummy_app/tmp/cache/assets/test/sass/50e4466efc3255401f37f709f5f338668408ef71/variables.scssc +0 -0
  80. data/spec/dummy_app/tmp/cache/assets/test/sass/60ddb7b14935cbd11f83ec188b4bb1d618ec996f/jquery.colorpicker.scssc +0 -0
  81. data/spec/dummy_app/tmp/cache/assets/test/sass/60ddb7b14935cbd11f83ec188b4bb1d618ec996f/jquery.ui.timepicker.scssc +0 -0
  82. data/spec/dummy_app/tmp/cache/assets/test/sass/60ddb7b14935cbd11f83ec188b4bb1d618ec996f/ra.calendar-additions.scssc +0 -0
  83. data/spec/dummy_app/tmp/cache/assets/test/sass/60ddb7b14935cbd11f83ec188b4bb1d618ec996f/ra.filtering-multiselect.scssc +0 -0
  84. data/spec/dummy_app/tmp/cache/assets/test/sass/60ddb7b14935cbd11f83ec188b4bb1d618ec996f/ra.widgets.scssc +0 -0
  85. data/spec/dummy_app/tmp/cache/assets/test/sass/60ddb7b14935cbd11f83ec188b4bb1d618ec996f/rails_admin.scss.erbc +0 -0
  86. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_accordion.scssc +0 -0
  87. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_alerts.scssc +0 -0
  88. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_breadcrumbs.scssc +0 -0
  89. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_button-groups.scssc +0 -0
  90. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_buttons.scssc +0 -0
  91. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_carousel.scssc +0 -0
  92. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_close.scssc +0 -0
  93. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_component-animations.scssc +0 -0
  94. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_dropdowns.scssc +0 -0
  95. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_forms.scssc +0 -0
  96. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_grid.scssc +0 -0
  97. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_hero-unit.scssc +0 -0
  98. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_labels-badges.scssc +0 -0
  99. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_layouts.scssc +0 -0
  100. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_mixins.scssc +0 -0
  101. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_modals.scssc +0 -0
  102. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_navbar.scssc +0 -0
  103. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_navs.scssc +0 -0
  104. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_pager.scssc +0 -0
  105. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_pagination.scssc +0 -0
  106. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_popovers.scssc +0 -0
  107. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_progress-bars.scssc +0 -0
  108. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_reset.scssc +0 -0
  109. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_scaffolding.scssc +0 -0
  110. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_tables.scssc +0 -0
  111. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_thumbnails.scssc +0 -0
  112. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_tooltip.scssc +0 -0
  113. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_type.scssc +0 -0
  114. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_utilities.scssc +0 -0
  115. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_variables.scssc +0 -0
  116. data/spec/dummy_app/tmp/cache/assets/test/sass/6f29b1fe98624195dbac940d9b40236b6dc877d3/_wells.scssc +0 -0
  117. data/spec/dummy_app/tmp/cache/assets/test/sass/7e38bdfe3aa21a76da53ed64003686502baf8110/font-awesome.css.erbc +0 -0
  118. data/spec/dummy_app/tmp/cache/assets/test/sass/e307626ae1f1da10c3b3073e0db008ce0a7bb251/mixins.scssc +0 -0
  119. data/spec/dummy_app/tmp/cache/assets/test/sass/e307626ae1f1da10c3b3073e0db008ce0a7bb251/theming.scssc +0 -0
  120. data/spec/dummy_app/tmp/cache/assets/test/sass/e307626ae1f1da10c3b3073e0db008ce0a7bb251/variables.scssc +0 -0
  121. data/spec/dummy_app/tmp/cache/assets/test/sprockets/039a5bf66d220fc450725c31951c0003 +0 -0
  122. data/spec/dummy_app/tmp/cache/assets/test/sprockets/04fc3904edb99236187355cbb911f89e +0 -0
  123. data/spec/dummy_app/tmp/cache/assets/test/sprockets/0602c18d49d9162a4115f24689044530 +0 -0
  124. data/spec/dummy_app/tmp/cache/assets/test/sprockets/07a77b4186e7385aa93ee9817d30976d +0 -0
  125. data/spec/dummy_app/tmp/cache/assets/test/sprockets/09b197beb54130b951fd00df7b3e2ebb +0 -0
  126. data/spec/dummy_app/tmp/cache/assets/test/sprockets/0c53bdcb904e01bc3006dea06a984620 +0 -0
  127. data/spec/dummy_app/tmp/cache/assets/test/sprockets/0cf66ef0545ef4a25158b64a8a63acc0 +0 -0
  128. data/spec/dummy_app/tmp/cache/assets/test/sprockets/0dcf1b67fc7a00043acda5614e28621a +0 -0
  129. data/spec/dummy_app/tmp/cache/assets/test/sprockets/0ed5cf232eb4a060d90fa60242ec82eb +0 -0
  130. data/spec/dummy_app/tmp/cache/assets/test/sprockets/104cf49747acce2cd760bde221916757 +0 -0
  131. data/spec/dummy_app/tmp/cache/assets/test/sprockets/11336ccd98408f1d60bc4f137dd6d513 +0 -0
  132. data/spec/dummy_app/tmp/cache/assets/test/sprockets/129ab684736012c224b424a9202c4077 +0 -0
  133. data/spec/dummy_app/tmp/cache/assets/test/sprockets/13c5851787eee7ea1dbb6771daf38754 +0 -0
  134. data/spec/dummy_app/tmp/cache/assets/test/sprockets/148bf2b1fa2b1c501e534d8019e35550 +0 -0
  135. data/spec/dummy_app/tmp/cache/assets/test/sprockets/17805e3468eb563f81855f6ac93ac7de +0 -0
  136. data/spec/dummy_app/tmp/cache/assets/test/sprockets/196f8e4aff622708f7a2060b98fa730a +0 -0
  137. data/spec/dummy_app/tmp/cache/assets/test/sprockets/1a1d73dd5f0ac320b3a8952b0e6669f5 +0 -0
  138. data/spec/dummy_app/tmp/cache/assets/test/sprockets/1a5c2589d7a73ca326745770ec8c3a68 +0 -0
  139. data/spec/dummy_app/tmp/cache/assets/test/sprockets/1b1d3f4fa8e1243fb66271b20233d01b +0 -0
  140. data/spec/dummy_app/tmp/cache/assets/test/sprockets/1ca1a15643004e8daee77e762149bfe6 +0 -0
  141. data/spec/dummy_app/tmp/cache/assets/test/sprockets/1cb0bbe35ef01a226fef698f0a9277d2 +0 -0
  142. data/spec/dummy_app/tmp/cache/assets/test/sprockets/1d635e9b0475899eec5bce058b6d48b4 +0 -0
  143. data/spec/dummy_app/tmp/cache/assets/test/sprockets/1e097efcd1115a58473612106f20aad2 +0 -0
  144. data/spec/dummy_app/tmp/cache/assets/test/sprockets/2047e1449cbcbd8331c15e05c33f006a +0 -0
  145. data/spec/dummy_app/tmp/cache/assets/test/sprockets/2740e776eb74b1103220f4a3bf76e55d +0 -0
  146. data/spec/dummy_app/tmp/cache/assets/test/sprockets/281a64929dab11d3635bdd9ff39fe31c +0 -0
  147. data/spec/dummy_app/tmp/cache/assets/test/sprockets/28549a2080576826cd4de9ce7ed8d69f +0 -0
  148. data/spec/dummy_app/tmp/cache/assets/test/sprockets/2e1c59996da5739b76e5ed290e16e4b8 +0 -0
  149. data/spec/dummy_app/tmp/cache/assets/test/sprockets/308e53bfc20ae7fe1c148e8cd4795184 +0 -0
  150. data/spec/dummy_app/tmp/cache/assets/test/sprockets/30d3cccc8e819bfc42faebbae2132106 +0 -0
  151. data/spec/dummy_app/tmp/cache/assets/test/sprockets/349b83b5f7fc156a7865362b50c8a747 +0 -0
  152. data/spec/dummy_app/tmp/cache/assets/test/sprockets/352b668d5a833880cd46e68e87b61f83 +0 -0
  153. data/spec/dummy_app/tmp/cache/assets/test/sprockets/3a44eeaaf1973955ec1385900f16e9b0 +0 -0
  154. data/spec/dummy_app/tmp/cache/assets/test/sprockets/3b9145cad8e6cc05febf5b7ebfdc09b5 +0 -0
  155. data/spec/dummy_app/tmp/cache/assets/test/sprockets/3ba0f5b2e3e94b6513f5136fa20e5a24 +0 -0
  156. data/spec/dummy_app/tmp/cache/assets/test/sprockets/3bb982191028c492bec814ca36dda349 +0 -0
  157. data/spec/dummy_app/tmp/cache/assets/test/sprockets/3e529508d6168a92db8f1706328dbd6b +0 -0
  158. data/spec/dummy_app/tmp/cache/assets/test/sprockets/3fea6c96d559fd56c796222c89bf4a55 +0 -0
  159. data/spec/dummy_app/tmp/cache/assets/test/sprockets/410492703e63dffa68a29af838226cc6 +0 -0
  160. data/spec/dummy_app/tmp/cache/assets/test/sprockets/433362a2fd8b9b7a80331d20cdfd84b6 +0 -0
  161. data/spec/dummy_app/tmp/cache/assets/test/sprockets/445343e680a88785242a2aa99d907216 +0 -0
  162. data/spec/dummy_app/tmp/cache/assets/test/sprockets/4499a6f31ad672fb69537267becff285 +0 -0
  163. data/spec/dummy_app/tmp/cache/assets/test/sprockets/455dc61be5289cb0a50fc650c4a27b01 +0 -0
  164. data/spec/dummy_app/tmp/cache/assets/test/sprockets/4563ab77d6c769264c70b904c4ca2b37 +0 -0
  165. data/spec/dummy_app/tmp/cache/assets/test/sprockets/4c501e79458ca87b9b7964a3656cad68 +0 -0
  166. data/spec/dummy_app/tmp/cache/assets/test/sprockets/4f49294c06a799e1c063a1ccf100860c +0 -0
  167. data/spec/dummy_app/tmp/cache/assets/test/sprockets/4fd99da81590fb27074904dd2d4b0afe +0 -0
  168. data/spec/dummy_app/tmp/cache/assets/test/sprockets/54a5de7c79d8407342c31af3d5eb31f6 +0 -0
  169. data/spec/dummy_app/tmp/cache/assets/test/sprockets/5507d3ba3736f304240090662413733a +0 -0
  170. data/spec/dummy_app/tmp/cache/assets/test/sprockets/585bed8595e5e9d8e5e1a680ac20f005 +0 -0
  171. data/spec/dummy_app/tmp/cache/assets/test/sprockets/5c0be9a39a450f2b191275d281ff50d8 +0 -0
  172. data/spec/dummy_app/tmp/cache/assets/test/sprockets/5eab397d2a4b6ca7b0084107e4acc0d9 +0 -0
  173. data/spec/dummy_app/tmp/cache/assets/test/sprockets/5eae694e8713be9376531ee73716b107 +0 -0
  174. data/spec/dummy_app/tmp/cache/assets/test/sprockets/6012dbf768041ff3d9566cd00e6ad0e6 +0 -0
  175. data/spec/dummy_app/tmp/cache/assets/test/sprockets/61077cb42651197ce0d00d267f8cb157 +0 -0
  176. data/spec/dummy_app/tmp/cache/assets/test/sprockets/627a45561b3d1ecbd1a1f4850208503a +0 -0
  177. data/spec/dummy_app/tmp/cache/assets/test/sprockets/642ea63365a0f33fb982cde355dbd952 +0 -0
  178. data/spec/dummy_app/tmp/cache/assets/test/sprockets/67c296751ce247c30402dd43b035c05b +0 -0
  179. data/spec/dummy_app/tmp/cache/assets/test/sprockets/689332efdfbf2cfa06d02d26a47d4332 +0 -0
  180. data/spec/dummy_app/tmp/cache/assets/test/sprockets/694afe79cc6e42a3e5436d282997ea79 +0 -0
  181. data/spec/dummy_app/tmp/cache/assets/test/sprockets/6c5729b427f229cad24067bfec82441d +0 -0
  182. data/spec/dummy_app/tmp/cache/assets/test/sprockets/6f0a4a833a1ce47d77ebbd71ae021a4d +0 -0
  183. data/spec/dummy_app/tmp/cache/assets/test/sprockets/702016a19f9bf693eec6930878077e4e +0 -0
  184. data/spec/dummy_app/tmp/cache/assets/test/sprockets/724ce3ff0aeb1174d3a8fddfe1335a79 +0 -0
  185. data/spec/dummy_app/tmp/cache/assets/test/sprockets/726abc48daa7878021ee1c34360918af +0 -0
  186. data/spec/dummy_app/tmp/cache/assets/test/sprockets/749c6e08a7826fd22d279405af87aaf1 +0 -0
  187. data/spec/dummy_app/tmp/cache/assets/test/sprockets/77ad5664cd45382abab39f19d032133d +0 -0
  188. data/spec/dummy_app/tmp/cache/assets/test/sprockets/785692dac9a319d2706bd96d7fb5999c +0 -0
  189. data/spec/dummy_app/tmp/cache/assets/test/sprockets/7cfceeccc9c61c03ad54298ce2472f45 +0 -0
  190. data/spec/dummy_app/tmp/cache/assets/test/sprockets/7e73c94fd43e4f8b82acfa085d8d5476 +0 -0
  191. data/spec/dummy_app/tmp/cache/assets/test/sprockets/801e4f782d10f5498b68113e6b2ac139 +0 -0
  192. data/spec/dummy_app/tmp/cache/assets/test/sprockets/822dbfd89b2b1243844e7c3a0ba001a7 +0 -0
  193. data/spec/dummy_app/tmp/cache/assets/test/sprockets/842ea8c5f8b0fdb4ef7472b189a76174 +0 -0
  194. data/spec/dummy_app/tmp/cache/assets/test/sprockets/84a6a7978131f4f8c46fe9c480634aab +0 -0
  195. data/spec/dummy_app/tmp/cache/assets/test/sprockets/84cb05237234ff279ad6c78ef3e8e823 +0 -0
  196. data/spec/dummy_app/tmp/cache/assets/test/sprockets/84f51912f02a7a1ff255ae491b3cc711 +0 -0
  197. data/spec/dummy_app/tmp/cache/assets/test/sprockets/8605a56363a1d23fad98fbc6d9b3b047 +0 -0
  198. data/spec/dummy_app/tmp/cache/assets/test/sprockets/86120a9bdcdfa970f8dadae131a2e95e +0 -0
  199. data/spec/dummy_app/tmp/cache/assets/test/sprockets/88c829469780275b9c1714e2166e1ba4 +0 -0
  200. data/spec/dummy_app/tmp/cache/assets/test/sprockets/89ffe73975976a0200a923aa2e1e42fb +0 -0
  201. data/spec/dummy_app/tmp/cache/assets/test/sprockets/8b0a8bf59842e1d4aaa787eff38e207f +0 -0
  202. data/spec/dummy_app/tmp/cache/assets/test/sprockets/8b78cef60b108a16787f32ea26a792d0 +0 -0
  203. data/spec/dummy_app/tmp/cache/assets/test/sprockets/8ddbd7ab77689f8ebb25c59de8152b5e +0 -0
  204. data/spec/dummy_app/tmp/cache/assets/test/sprockets/8f9bc2d4514893616bed6d6bf75dded1 +0 -0
  205. data/spec/dummy_app/tmp/cache/assets/test/sprockets/91cb85d19bf8e4ebba27ccf6ea318d9f +0 -0
  206. data/spec/dummy_app/tmp/cache/assets/test/sprockets/922df3fedca77782061a6d4a6029e7f1 +0 -0
  207. data/spec/dummy_app/tmp/cache/assets/test/sprockets/9509bd192a75365a34a00b01e04b5ab4 +0 -0
  208. data/spec/dummy_app/tmp/cache/assets/test/sprockets/97cd44fc8e2b4f6acb0d912be738c90f +0 -0
  209. data/spec/dummy_app/tmp/cache/assets/test/sprockets/98a7dfb33d5879f166f1bf20c031e836 +0 -0
  210. data/spec/dummy_app/tmp/cache/assets/test/sprockets/98d49f7e1c1d73b97ac2937069e8f312 +0 -0
  211. data/spec/dummy_app/tmp/cache/assets/test/sprockets/99c1629b9f2827a9840fe8d230e2c5df +0 -0
  212. data/spec/dummy_app/tmp/cache/assets/test/sprockets/9a451dac641c38ce41d5c1b73fb8de2a +0 -0
  213. data/spec/dummy_app/tmp/cache/assets/test/sprockets/9ba5e11e725ed4a76f73bc3c43070fc9 +0 -0
  214. data/spec/dummy_app/tmp/cache/assets/test/sprockets/9c332bf94ad0e3614abadfaf3aaf60b2 +0 -0
  215. data/spec/dummy_app/tmp/cache/assets/test/sprockets/9cf969e4845d5a4d718d2e8bfd77101d +0 -0
  216. data/spec/dummy_app/tmp/cache/assets/test/sprockets/9f9d40e0ca625e92215807c7d36eeb45 +0 -0
  217. data/spec/dummy_app/tmp/cache/assets/test/sprockets/a0d2eb8c9feccca7df34d40b8614a939 +0 -0
  218. data/spec/dummy_app/tmp/cache/assets/test/sprockets/a1657b7bdf73ec95be9f0514ee2254a2 +0 -0
  219. data/spec/dummy_app/tmp/cache/assets/test/sprockets/a1c38b062b4789cba43cfce569d89a4e +0 -0
  220. data/spec/dummy_app/tmp/cache/assets/test/sprockets/a2346449005dbaa9093d8ba7ed2a5d47 +0 -0
  221. data/spec/dummy_app/tmp/cache/assets/test/sprockets/a86a829dee3d408be1e17d970ee388fa +0 -0
  222. data/spec/dummy_app/tmp/cache/assets/test/sprockets/ab554675ca375fa03f104b42bd948fe5 +0 -0
  223. data/spec/dummy_app/tmp/cache/assets/test/sprockets/aded07271baf96cd6d24924ad93ec73d +0 -0
  224. data/spec/dummy_app/tmp/cache/assets/test/sprockets/ae325bc4588e222725187e5daf205589 +0 -0
  225. data/spec/dummy_app/tmp/cache/assets/test/sprockets/af529b87b946c6e64306fcce7453083e +0 -0
  226. data/spec/dummy_app/tmp/cache/assets/test/sprockets/b4760047e80466e8355e67301426c1d1 +0 -0
  227. data/spec/dummy_app/tmp/cache/assets/test/sprockets/b845c9c605c0ac49de3fbbb504e230f7 +0 -0
  228. data/spec/dummy_app/tmp/cache/assets/test/sprockets/b85362aec4168f3dc8d2a98060ee48eb +0 -0
  229. data/spec/dummy_app/tmp/cache/assets/test/sprockets/bab7336757583f60e7daf1487188ed18 +0 -0
  230. data/spec/dummy_app/tmp/cache/assets/test/sprockets/bd0a6ea6e12c15771e7f2523a3aadc63 +0 -0
  231. data/spec/dummy_app/tmp/cache/assets/test/sprockets/be49600855e45c34cba5d2d6746e2358 +0 -0
  232. data/spec/dummy_app/tmp/cache/assets/test/sprockets/be9c7f67a4c4bccb12ebfde75deadf78 +0 -0
  233. data/spec/dummy_app/tmp/cache/assets/test/sprockets/bff19a6530ebd8793f533e767a24e36e +0 -0
  234. data/spec/dummy_app/tmp/cache/assets/test/sprockets/c3be8bc6957ae7e95fb42e95b69a28c4 +0 -0
  235. data/spec/dummy_app/tmp/cache/assets/test/sprockets/c5787e2ae92280dbccc527e55b11635e +0 -0
  236. data/spec/dummy_app/tmp/cache/assets/test/sprockets/c5d9cd7fa2cb7bfe369963b0196f7ff4 +0 -0
  237. data/spec/dummy_app/tmp/cache/assets/test/sprockets/cfbcfcb1da5d394fb109e81d39e78159 +0 -0
  238. data/spec/dummy_app/tmp/cache/assets/test/sprockets/d07f5793bd18b01f933ddca0fe37250e +0 -0
  239. data/spec/dummy_app/tmp/cache/assets/test/sprockets/d0a719959de8c62c5bd015cce560bc8a +0 -0
  240. data/spec/dummy_app/tmp/cache/assets/test/sprockets/d4c23978dcf23280699067752b4d380d +0 -0
  241. data/spec/dummy_app/tmp/cache/assets/test/sprockets/d4e3f96df2204b35a7e8350ecc41cdc7 +0 -0
  242. data/spec/dummy_app/tmp/cache/assets/test/sprockets/d5d70fe44f0d681894cd75826cdaea12 +0 -0
  243. data/spec/dummy_app/tmp/cache/assets/test/sprockets/d6a6297cee0fca1e5e0838f582d80ab2 +0 -0
  244. data/spec/dummy_app/tmp/cache/assets/test/sprockets/d9266b8e42d3f777dc223da809274b31 +0 -0
  245. data/spec/dummy_app/tmp/cache/assets/test/sprockets/db583f90e8ee3ef1d2f254872519e9c6 +0 -0
  246. data/spec/dummy_app/tmp/cache/assets/test/sprockets/e4cc8214b21af79b430cd379aafeb4ce +0 -0
  247. data/spec/dummy_app/tmp/cache/assets/test/sprockets/e4e7c80687aa50a6e2e4b7c79a145a0c +0 -0
  248. data/spec/dummy_app/tmp/cache/assets/test/sprockets/e53e14c5fb50eb16744db14274a7eda8 +0 -0
  249. data/spec/dummy_app/tmp/cache/assets/test/sprockets/e600b47ff99e3ad76cb108e6c312c5b5 +0 -0
  250. data/spec/dummy_app/tmp/cache/assets/test/sprockets/e8f7215dd1531e59847951a7383271c5 +0 -0
  251. data/spec/dummy_app/tmp/cache/assets/test/sprockets/eb6ed96d57beb3fd8059dc280a7c2cd7 +0 -0
  252. data/spec/dummy_app/tmp/cache/assets/test/sprockets/ed5e8a35a505b86b4bf715b78391a870 +0 -0
  253. data/spec/dummy_app/tmp/cache/assets/test/sprockets/ee5e4d214ffc908f50e0a637eed3b7b1 +0 -0
  254. data/spec/dummy_app/tmp/cache/assets/test/sprockets/ef0431217a4bac4852ecc9987fd2629e +0 -0
  255. data/spec/dummy_app/tmp/cache/assets/test/sprockets/f28c745f4469bda7feb0e7b30c6a49ae +0 -0
  256. data/spec/dummy_app/tmp/cache/assets/test/sprockets/f43162a23f1a30e5baf49f543f72487d +0 -0
  257. data/spec/dummy_app/tmp/cache/assets/test/sprockets/f62c80206996d477a114b40987636c55 +0 -0
  258. data/spec/dummy_app/tmp/cache/assets/test/sprockets/f72d29b2f2b71e9f9f690a806f572e21 +0 -0
  259. data/spec/dummy_app/tmp/cache/assets/test/sprockets/fa8aef4c90e0b7f97618ed51c78eb38a +0 -0
  260. data/spec/dummy_app/tmp/cache/assets/test/sprockets/fb7856209a606e83084889ae67f02673 +0 -0
  261. data/spec/dummy_app/tmp/cache/assets/test/sprockets/fb7a84e10813b0033c09263a0abf0fa3 +0 -0
  262. data/spec/dummy_app/tmp/cache/assets/test/sprockets/fb94af8a31614a8efe49c2714a8f894e +0 -0
  263. data/spec/dummy_app/tmp/cache/assets/test/sprockets/fea0b3135fde8d44c3aaf052a21d28f8 +0 -0
  264. data/spec/dummy_app/tmp/cache/assets/test/sprockets/ff4c93f7f26410e737809fc8772ddc5c +0 -0
  265. data/spec/integration/authorization/cancan_spec.rb +8 -16
  266. data/spec/integration/basic/export/rails_admin_basic_export_spec.rb +1 -1
  267. data/spec/integration/config/edit/rails_admin_config_edit_spec.rb +9 -34
  268. data/spec/integration/config/show/rails_admin_config_show_spec.rb +1 -1
  269. data/spec/integration/rails_admin_spec.rb +2 -2
  270. data/spec/rails_admin/abstract_model_spec.rb +1 -1
  271. data/spec/rails_admin/adapters/active_record/abstract_object_spec.rb +5 -5
  272. data/spec/rails_admin/adapters/active_record_spec.rb +11 -9
  273. data/spec/rails_admin/adapters/mongoid_spec.rb +1 -1
  274. data/spec/rails_admin/config/fields/base_spec.rb +1 -48
  275. data/spec/rails_admin/config/fields/types/{text_spec.rb → ck_editor_spec.rb} +6 -3
  276. metadata +418 -46
  277. metadata.gz.sig +3 -2
  278. data/spec/dummy_app/app/active_record/cms/unscoped_page.rb +0 -3
  279. data/spec/dummy_app/app/mongoid/cms/unscoped_page.rb +0 -5
  280. data/spec/dummy_app/config/initializers/strong_parameters.rb +0 -2
  281. data/spec/dummy_app/db/migrate/20111103174459_create_unscoped_pages.rb +0 -9
@@ -12,7 +12,7 @@ RailsAdmin.config do |config|
12
12
  # config.main_app_name = Proc.new { |controller| [Rails.application.engine_name.titleize, controller.params['action'].titleize] }
13
13
 
14
14
  # RailsAdmin may need a way to know who the current user is]
15
- config.current_user_method { current_<%= @model_name.underscore %> } # auto-generated
15
+ config.current_user_method { <%= @current_user_method %> } # auto-generated
16
16
 
17
17
  # If you want to track changes on your models:
18
18
  # config.audit_with :history, '<%= @model_name.classify %>'
@@ -57,7 +57,7 @@ RailsAdmin.config do |config|
57
57
 
58
58
  # config.model '<%= abstract_model.model.model_name %>' do
59
59
 
60
- # # You can copy this to a 'rails_admin do ... end' block inside your <%= abstract_model.model.model_name.underscore %>.rb model definition
60
+ # # You can copy this to a 'rails_admin do ... end' block inside your <%= abstract_model.model.model_name.to_s.underscore %>.rb model definition
61
61
 
62
62
  # # Found associations:
63
63
 
@@ -32,7 +32,7 @@ module RailsAdmin
32
32
  end
33
33
  end
34
34
  end
35
- @@polymorphic_parents[adapter.to_sym][[model_name.underscore, name].join('_').to_sym]
35
+ @@polymorphic_parents[adapter.to_sym][[model_name.to_s.underscore, name].join('_').to_sym]
36
36
  end
37
37
 
38
38
  # For testing
@@ -28,7 +28,7 @@ module RailsAdmin
28
28
  end
29
29
 
30
30
  def scoped
31
- model.scoped
31
+ model.all
32
32
  end
33
33
 
34
34
  def first(options = {}, scope = nil)
@@ -40,8 +40,8 @@ module RailsAdmin
40
40
  scope = scope.includes(options[:include]) if options[:include]
41
41
  scope = scope.limit(options[:limit]) if options[:limit]
42
42
  scope = scope.where(model.primary_key => options[:bulk_ids]) if options[:bulk_ids]
43
- scope = scope.where(query_conditions(options[:query])) if options[:query]
44
- scope = scope.where(filter_conditions(options[:filters])) if options[:filters]
43
+ scope = query_scope(scope, options[:query]) if options[:query]
44
+ scope = filter_scope(scope, options[:filters]) if options[:filters]
45
45
  if options[:page] && options[:per]
46
46
  scope = scope.send(Kaminari.config.page_method_name, options[:page]).per(options[:per])
47
47
  end
@@ -117,9 +117,10 @@ module RailsAdmin
117
117
 
118
118
  private
119
119
 
120
- def query_conditions(query, fields = config.list.fields.select(&:queryable?))
120
+ def query_scope(scope, query, fields = config.list.fields.select(&:queryable?))
121
121
  statements = []
122
122
  values = []
123
+ tables = []
123
124
 
124
125
  fields.each do |field|
125
126
  field.searchable_columns.flatten.each do |column_infos|
@@ -127,32 +128,33 @@ module RailsAdmin
127
128
  statements << statement if statement
128
129
  values << value1 unless value1.nil?
129
130
  values << value2 unless value2.nil?
131
+ table, column = column_infos[:column].split('.')
132
+ tables.push(table) if column
130
133
  end
131
134
  end
132
-
133
- [statements.join(' OR '), *values]
135
+ scope.where(statements.join(' OR '), *values).references(*(tables.uniq))
134
136
  end
135
137
 
136
138
  # filters example => {"string_field"=>{"0055"=>{"o"=>"like", "v"=>"test_value"}}, ...}
137
139
  # "0055" is the filter index, no use here. o is the operator, v the value
138
- def filter_conditions(filters, fields = config.list.fields.select(&:filterable?))
139
- statements = []
140
- values = []
141
-
140
+ def filter_scope(scope, filters, fields = config.list.fields.select(&:filterable?))
142
141
  filters.each_pair do |field_name, filters_dump|
143
142
  filters_dump.each do |filter_index, filter_dump|
144
- field_statements = []
143
+ statements = []
144
+ values = []
145
+ tables = []
145
146
  fields.find{|f| f.name.to_s == field_name}.searchable_columns.each do |column_infos|
146
147
  statement, value1, value2 = build_statement(column_infos[:column], column_infos[:type], filter_dump[:v], (filter_dump[:o] || 'default'))
147
- field_statements << statement if statement.present?
148
+ statements << statement if statement.present?
148
149
  values << value1 unless value1.nil?
149
150
  values << value2 unless value2.nil?
151
+ table, column = column_infos[:column].split('.')
152
+ tables.push(table) if column
150
153
  end
151
- statements << "(#{field_statements.join(' OR ')})" unless field_statements.empty?
154
+ scope = scope.where(statements.join(' OR '), *values).references(*(tables.uniq))
152
155
  end
153
156
  end
154
-
155
- [statements.join(' AND '), *values]
157
+ scope
156
158
  end
157
159
 
158
160
  def build_statement(column, type, value, operator)
@@ -262,7 +264,7 @@ module RailsAdmin
262
264
 
263
265
  def association_model_lookup(association)
264
266
  if association.options[:polymorphic]
265
- RailsAdmin::AbstractModel.polymorphic_parents(:active_record, self.model.model_name, association.name) || []
267
+ RailsAdmin::AbstractModel.polymorphic_parents(:active_record, self.model.model_name.to_s, association.name) || []
266
268
  else
267
269
  association.klass
268
270
  end
@@ -295,7 +297,9 @@ module RailsAdmin
295
297
  end
296
298
 
297
299
  def association_read_only_lookup(association)
298
- association.options[:readonly]
300
+ if association.scope.is_a? Proc
301
+ association.klass.all.instance_eval(&association.scope).readonly_value
302
+ end
299
303
  end
300
304
 
301
305
  def association_foreign_key_lookup(association)
@@ -16,7 +16,7 @@ module RailsAdmin
16
16
  end
17
17
 
18
18
  def set_attributes(attributes, role = nil)
19
- object.assign_attributes(attributes, :as => role)
19
+ object.assign_attributes(attributes)
20
20
  end
21
21
 
22
22
  def save(options = { :validate => true })
@@ -278,6 +278,7 @@ module RailsAdmin
278
278
  {
279
279
  "Array" => { :type => :serialized },
280
280
  "BigDecimal" => { :type => :decimal },
281
+ "Mongoid::Boolean" => { :type => :boolean },
281
282
  "Boolean" => { :type => :boolean },
282
283
  "BSON::ObjectId" => { :type => :bson_object_id, :serial? => (name == primary_key) },
283
284
  "Moped::BSON::ObjectId" => { :type => :bson_object_id, :serial? => (name == primary_key) },
@@ -203,8 +203,8 @@ module RailsAdmin
203
203
  possible =
204
204
  included_models.map(&:to_s).presence || (
205
205
  @@system_models ||= # memoization for tests
206
- ([Rails.application] + Rails::Application::Railties.engines).map do |app|
207
- (app.paths['app/models'] + app.config.autoload_paths).map do |load_path|
206
+ ([Rails.application] + Rails::Engine::Railties.engines).map do |app|
207
+ (app.paths['app/models'].to_a + app.config.autoload_paths).map do |load_path|
208
208
  Dir.glob(app.root.join(load_path)).map do |load_dir|
209
209
  Dir.glob(load_dir + "/**/*.rb").map do |filename|
210
210
  # app/models/module/class.rb => module/class.rb => module/class => Module::Class
@@ -18,9 +18,9 @@ module RailsAdmin
18
18
  self.class.register_instance_option(option_name, scope, &default)
19
19
  end
20
20
 
21
- def register_deprecated_instance_option(option_name, replacement_option_name)
21
+ def register_deprecated_instance_option(option_name, replacement_option_name=nil, &custom_error)
22
22
  scope = class << self; self; end;
23
- self.class.register_deprecated_instance_option(option_name, replacement_option_name, scope)
23
+ self.class.register_deprecated_instance_option(option_name, replacement_option_name, scope, &custom_error)
24
24
  end
25
25
 
26
26
  module ClassMethods
@@ -72,10 +72,18 @@ module RailsAdmin
72
72
  end
73
73
  end
74
74
 
75
- def register_deprecated_instance_option(option_name, replacement_option_name, scope = self)
75
+ def register_deprecated_instance_option(option_name, replacement_option_name=nil, scope = self)
76
76
  scope.send(:define_method, option_name) do |*args, &block|
77
- ActiveSupport::Deprecation.warn("The #{option_name} configuration option is deprecated, please use #{replacement_option_name}.")
78
- send(replacement_option_name, *args, &block)
77
+ if replacement_option_name
78
+ ActiveSupport::Deprecation.warn("The #{option_name} configuration option is deprecated, please use #{replacement_option_name}.")
79
+ send(replacement_option_name, *args, &block)
80
+ else
81
+ if block_given?
82
+ yield
83
+ else
84
+ raise "The #{option_name} configuration option is removed without replacement."
85
+ end
86
+ end
79
87
  end
80
88
  end
81
89
 
@@ -214,31 +214,7 @@ module RailsAdmin
214
214
  end
215
215
 
216
216
  def editable?
217
- return false if @properties && @properties[:read_only]
218
- role = bindings[:view].controller.send(:_attr_accessible_role)
219
- active_model_attr_accessible = !bindings[:object].class.active_authorizer[role].deny?(self.method_name)
220
-
221
- return true if active_model_attr_accessible
222
- if RailsAdmin::Config.yell_for_non_accessible_fields
223
- accessible = "attr_accessible :#{self.method_name}#{role == :default ? '' : ", :as => :#{role}"}"
224
-
225
- Rails.logger.debug <<-MESSAGE.strip_heredoc
226
-
227
-
228
- [RailsAdmin] Please add '#{accessible}' in your '#{bindings[:object].class}' model definition if you want to make it editable.
229
- You can also explicitely mark this field as read-only:
230
-
231
- config.model #{bindings[:object].class} do
232
- field :#{self.name} do
233
- read_only true
234
- end
235
- end
236
-
237
- Add 'config.yell_for_non_accessible_fields = false' in your 'rails_admin.rb' initializer if you do not want to see these warnings
238
-
239
- MESSAGE
240
- end
241
- false
217
+ !(@properties && @properties[:read_only])
242
218
  end
243
219
 
244
220
  # Is this an association
@@ -2,7 +2,14 @@ require 'rails_admin/config/fields'
2
2
  require 'rails_admin/config/fields/types/enum'
3
3
 
4
4
  RailsAdmin::Config::Fields.register_factory do |parent, properties, fields|
5
- if parent.abstract_model.model.respond_to?("#{properties[:name]}_enum") || parent.abstract_model.model.method_defined?("#{properties[:name]}_enum")
5
+
6
+ _model = parent.abstract_model.model
7
+ _method_name = "#{properties[:name]}_enum"
8
+
9
+ #NOTICE: _method_name could be `to_enum` and this method defined in Object.
10
+ if !Object.respond_to?(_method_name) && \
11
+ (_model.respond_to?(_method_name) || \
12
+ _model.method_defined?(_method_name))
6
13
  fields << RailsAdmin::Config::Fields::Types::Enum.new(parent, properties[:name], properties)
7
14
  true
8
15
  else
@@ -4,10 +4,10 @@ require 'rails_admin/config/fields/types/bson_object_id'
4
4
  require 'rails_admin/config/fields/types/date'
5
5
  require 'rails_admin/config/fields/types/datetime'
6
6
  require 'rails_admin/config/fields/types/decimal'
7
+ require 'rails_admin/config/fields/types/dragonfly'
7
8
  require 'rails_admin/config/fields/types/enum'
8
9
  require 'rails_admin/config/fields/types/file_upload'
9
10
  require 'rails_admin/config/fields/types/paperclip'
10
- require 'rails_admin/config/fields/types/dragonfly'
11
11
  require 'rails_admin/config/fields/types/carrierwave'
12
12
  require 'rails_admin/config/fields/types/float'
13
13
  require 'rails_admin/config/fields/types/has_and_belongs_to_many_association'
@@ -23,3 +23,6 @@ require 'rails_admin/config/fields/types/serialized'
23
23
  require 'rails_admin/config/fields/types/time'
24
24
  require 'rails_admin/config/fields/types/timestamp'
25
25
  require 'rails_admin/config/fields/types/color'
26
+ require 'rails_admin/config/fields/types/ck_editor'
27
+ require 'rails_admin/config/fields/types/code_mirror'
28
+ require 'rails_admin/config/fields/types/wysihtml5'
@@ -0,0 +1,45 @@
1
+ require 'rails_admin/config/fields/base'
2
+
3
+ module RailsAdmin
4
+ module Config
5
+ module Fields
6
+ module Types
7
+ class CKEditor < RailsAdmin::Config::Fields::Types::Text
8
+ # Register field type for the type loader
9
+ RailsAdmin::Config::Fields::Types::register(self)
10
+
11
+ # If you want to have a different toolbar configuration for CKEditor
12
+ # create your own custom config.js and override this configuration
13
+ register_instance_option :config_js do
14
+ nil
15
+ end
16
+
17
+ #Use this if you want to point to a cloud instances of CKeditor
18
+ register_instance_option :location do
19
+ nil
20
+ end
21
+
22
+ #Use this if you want to point to a cloud instances of the base CKeditor
23
+ register_instance_option :base_location do
24
+ "#{Rails.application.config.assets.prefix}/ckeditor/"
25
+ end
26
+
27
+ register_instance_option :html_attributes do
28
+ {
29
+ :cols => '48',
30
+ :rows => '3'
31
+ }
32
+ end
33
+
34
+ register_instance_option :partial do
35
+ :form_ck_editor
36
+ end
37
+
38
+ [:base_location, :config_js, :location].each do |key|
39
+ register_deprecated_instance_option :"ckeditor_#{key}", key
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,55 @@
1
+ require 'rails_admin/config/fields/base'
2
+
3
+ module RailsAdmin
4
+ module Config
5
+ module Fields
6
+ module Types
7
+ class CodeMirror < RailsAdmin::Config::Fields::Types::Text
8
+ # Register field type for the type loader
9
+ RailsAdmin::Config::Fields::Types::register(self)
10
+
11
+ #Pass the theme and mode for Codemirror
12
+ register_instance_option :config do
13
+ {
14
+ :mode => 'css',
15
+ :theme => 'night'
16
+ }
17
+ end
18
+
19
+ #Pass the location of the theme and mode for Codemirror
20
+ register_instance_option :assets do
21
+ {
22
+ :mode => '/assets/codemirror/modes/css.js',
23
+ :theme => '/assets/codemirror/themes/night.css'
24
+ }
25
+ end
26
+
27
+ #Use this if you want to point to a cloud instances of CodeMirror
28
+ register_instance_option :js_location do
29
+ '/assets/codemirror.js'
30
+ end
31
+
32
+ #Use this if you want to point to a cloud instances of CodeMirror
33
+ register_instance_option :css_location do
34
+ '/assets/codemirror.css'
35
+ end
36
+
37
+ register_instance_option :html_attributes do
38
+ {
39
+ :cols => '48',
40
+ :rows => '3'
41
+ }
42
+ end
43
+
44
+ register_instance_option :partial do
45
+ :form_code_mirror
46
+ end
47
+
48
+ [:assets, :config, :css_location, :js_location].each do |key|
49
+ register_deprecated_instance_option :"codemirror_#{key}", key
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -9,7 +9,7 @@ module RailsAdmin
9
9
  RailsAdmin::Config::Fields::Types::register(self)
10
10
 
11
11
  register_instance_option :formatted_value do
12
- YAML.dump(value)
12
+ YAML.dump(value) unless value.nil?
13
13
  end
14
14
 
15
15
  def parse_input(params)
@@ -8,76 +8,22 @@ module RailsAdmin
8
8
  # Register field type for the type loader
9
9
  RailsAdmin::Config::Fields::Types::register(self)
10
10
 
11
- # CKEditor is disabled by default
12
- register_instance_option :ckeditor do
13
- false
11
+ [:ckeditor, :ckeditor_base_location, :ckeditor_config_js, :ckeditor_location].each do |key|
12
+ register_deprecated_instance_option key do
13
+ raise "The 'field(:foo){ ckeditor true }' style DSL is deprecated. Please use 'field :foo, :ck_editor' instead."
14
+ end
14
15
  end
15
16
 
16
- # If you want to have a different toolbar configuration for CKEditor
17
- # create your own custom config.js and override this configuration
18
- register_instance_option :ckeditor_config_js do
19
- nil
17
+ [:codemirror, :codemirror_assets, :codemirror_config, :codemirror_css_location, :codemirror_js_location].each do |key|
18
+ register_deprecated_instance_option key do
19
+ raise "The 'field(:foo){ codemirror true }' style DSL is deprecated. Please use 'field :foo, :code_mirror' instead."
20
+ end
20
21
  end
21
22
 
22
- #Use this if you want to point to a cloud instances of CKeditor
23
- register_instance_option :ckeditor_location do
24
- nil
25
- end
26
-
27
- #Use this if you want to point to a cloud instances of the base CKeditor
28
- register_instance_option :ckeditor_base_location do
29
- "#{Rails.application.config.assets.prefix}/ckeditor/"
30
- end
31
-
32
- # Codemirror is disabled by default and CKEditor takes precedence
33
- register_instance_option :codemirror do
34
- false
35
- end
36
-
37
- #Pass the theme and mode for Codemirror
38
- register_instance_option :codemirror_config do
39
- {
40
- :mode => 'css',
41
- :theme => 'night'
42
- }
43
- end
44
-
45
- #Pass the location of the theme and mode for Codemirror
46
- register_instance_option :codemirror_assets do
47
- {
48
- :mode => '/assets/codemirror/modes/css.js',
49
- :theme => '/assets/codemirror/themes/night.css'
50
- }
51
- end
52
-
53
- #Use this if you want to point to a cloud instances of CodeMirror
54
- register_instance_option :codemirror_js_location do
55
- '/assets/codemirror.js'
56
- end
57
-
58
- #Use this if you want to point to a cloud instances of CodeMirror
59
- register_instance_option :codemirror_css_location do
60
- '/assets/codemirror.css'
61
- end
62
-
63
- # bootstrap_wysihtml5
64
- register_instance_option :bootstrap_wysihtml5 do
65
- false
66
- end
67
-
68
- # If you want to have a different toolbar configuration for wysihtml5
69
- # you can use a Ruby hash to configure these options:
70
- # https://github.com/jhollingworth/bootstrap-wysihtml5/#advanced
71
- register_instance_option :bootstrap_wysihtml5_config_options do
72
- nil
73
- end
74
-
75
- register_instance_option :bootstrap_wysihtml5_css_location do
76
- '/assets/bootstrap-wysihtml5.css'
77
- end
78
-
79
- register_instance_option :bootstrap_wysihtml5_js_location do
80
- '/assets/bootstrap-wysihtml5.js'
23
+ [:bootstrap_wysihtml5, :bootstrap_wysihtml5_config_options, :bootstrap_wysihtml5_css_location, :bootstrap_wysihtml5_js_location].each do |key|
24
+ register_deprecated_instance_option key do
25
+ raise "The 'field(:foo){ bootstrap_wysihtml5 true }' style DSL is deprecated. Please use 'field :foo, :wysihtml5' instead."
26
+ end
81
27
  end
82
28
 
83
29
  register_instance_option :html_attributes do