sunrise-cms 0.7.0.rc2 → 1.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (239) hide show
  1. data/README.md +18 -17
  2. data/app/assets/stylesheets/sunrise/main.css +1 -1
  3. data/app/controllers/sunrise/manager_controller.rb +4 -7
  4. data/app/controllers/sunrise/settings_controller.rb +1 -1
  5. data/app/views/layouts/sunrise/application.html.erb +1 -1
  6. data/app/views/sunrise/manager/_form.html.erb +1 -1
  7. data/app/views/sunrise/shared/_filter.html.erb +3 -3
  8. data/app/views/sunrise/shared/_panel.html.erb +2 -2
  9. data/app/views/sunrise/shared/_toolbar.html.erb +1 -1
  10. data/config/routes.rb +14 -15
  11. data/lib/generators/sunrise/templates/config/active_record/sunrise.rb +11 -8
  12. data/lib/generators/sunrise/templates/config/mongoid/sunrise.rb +9 -6
  13. data/lib/generators/sunrise/templates/models/sunrise/sunrise_navigation.rb +8 -9
  14. data/lib/generators/sunrise/templates/models/sunrise/sunrise_page.rb +4 -4
  15. data/lib/generators/sunrise/templates/models/sunrise/sunrise_structure.rb +8 -8
  16. data/lib/generators/sunrise/templates/models/sunrise/sunrise_user.rb +14 -14
  17. data/lib/generators/sunrise/templates/uploaders/avatar_uploader.rb +1 -1
  18. data/lib/sunrise/abstract_model.rb +29 -27
  19. data/lib/sunrise/config/export.rb +26 -0
  20. data/lib/sunrise/config/{edit.rb → form.rb} +1 -1
  21. data/lib/sunrise/config/{list.rb → index.rb} +1 -1
  22. data/lib/sunrise/config/model.rb +23 -12
  23. data/lib/sunrise/config/navigation.rb +33 -11
  24. data/lib/sunrise/config/page_presenter.rb +31 -0
  25. data/lib/sunrise/config.rb +15 -10
  26. data/lib/sunrise/engine.rb +0 -1
  27. data/lib/sunrise/models/structure.rb +7 -7
  28. data/lib/sunrise/utils.rb +0 -1
  29. data/lib/sunrise/version.rb +1 -1
  30. data/spec/controllers/sunrise/settings_controller_spec.rb +2 -2
  31. data/spec/dummy/app/{models/sunrise → sunrise}/sunrise_post.rb +3 -3
  32. data/spec/dummy/config/application.rb +2 -10
  33. data/spec/dummy/config/environments/development.rb +3 -0
  34. data/spec/dummy/config/environments/production.rb +6 -0
  35. data/spec/dummy/config/environments/test.rb +5 -3
  36. data/spec/dummy/db/schema.rb +90 -0
  37. data/spec/models/avatar_spec.rb +1 -1
  38. data/spec/models/sunrise/abstract_model_spec.rb +5 -8
  39. data/spec/requests/manager/default/edit_spec.rb +1 -1
  40. data/spec/requests/manager/default/new_spec.rb +1 -1
  41. data/spec/requests/manager/default/update_spec.rb +3 -3
  42. data/spec/requests/manager/many/index_spec.rb +2 -1
  43. data/spec/requests/manager/many/new_spec.rb +1 -1
  44. data/spec/spec_helper.rb +18 -0
  45. data/spec/sunrise_spec.rb +2 -2
  46. metadata +10 -405
  47. data/app/controllers/sunrise/shared_controller.rb +0 -13
  48. data/app/views/sunrise/shared/services.json.jbuilder +0 -6
  49. data/lib/sunrise/utils/mysql.rb +0 -35
  50. data/spec/controllers/sunrise/shared_controller_spec.rb +0 -32
  51. data/spec/dummy/log/test.log +0 -22584
  52. data/spec/dummy/public/uploads/avatar/content_rails.png +0 -0
  53. data/spec/dummy/public/uploads/avatar/rails.png +0 -0
  54. data/spec/dummy/public/uploads/avatar/thumb_rails.png +0 -0
  55. data/spec/dummy/public/uploads/tmp/1397814500-44499-6278/rails.png +0 -0
  56. data/spec/dummy/public/uploads/tmp/1397814500-44499-6278/small_rails.png +0 -0
  57. data/spec/dummy/public/uploads/tmp/1397814500-44499-6278/thumb_rails.png +0 -0
  58. data/spec/dummy/public/uploads/tmp/1397814501-44499-0716/rails.png +0 -0
  59. data/spec/dummy/public/uploads/tmp/1397814501-44499-0716/small_rails.png +0 -0
  60. data/spec/dummy/public/uploads/tmp/1397814501-44499-0716/thumb_rails.png +0 -0
  61. data/spec/dummy/public/uploads/tmp/1397814501-44499-6498/rails.png +0 -0
  62. data/spec/dummy/public/uploads/tmp/1397814501-44499-6498/small_rails.png +0 -0
  63. data/spec/dummy/public/uploads/tmp/1397814501-44499-6498/thumb_rails.png +0 -0
  64. data/spec/dummy/public/uploads/tmp/1397814502-44499-9048/silicon_valley.jpg +0 -0
  65. data/spec/dummy/public/uploads/tmp/1397814502-44499-9048/small_silicon_valley.jpg +0 -0
  66. data/spec/dummy/public/uploads/tmp/1397814502-44499-9048/thumb_silicon_valley.jpg +0 -0
  67. data/spec/dummy/public/uploads/tmp/1397814509-44499-4712/rails.png +0 -0
  68. data/spec/dummy/public/uploads/tmp/1397814511-44499-6511/rails.png +0 -0
  69. data/spec/dummy/public/uploads/tmp/1397814514-44499-0946/rails.png +0 -0
  70. data/spec/dummy/public/uploads/tmp/1397814515-44499-4275/rails.png +0 -0
  71. data/spec/dummy/public/uploads/tmp/1397814516-44499-7258/rails.png +0 -0
  72. data/spec/dummy/public/uploads/tmp/1397814743-45062-5613/rails.png +0 -0
  73. data/spec/dummy/public/uploads/tmp/1397814743-45062-5613/small_rails.png +0 -0
  74. data/spec/dummy/public/uploads/tmp/1397814743-45062-5613/thumb_rails.png +0 -0
  75. data/spec/dummy/public/uploads/tmp/1397814744-45062-2352/rails.png +0 -0
  76. data/spec/dummy/public/uploads/tmp/1397814744-45062-2352/small_rails.png +0 -0
  77. data/spec/dummy/public/uploads/tmp/1397814744-45062-2352/thumb_rails.png +0 -0
  78. data/spec/dummy/public/uploads/tmp/1397814744-45062-7990/rails.png +0 -0
  79. data/spec/dummy/public/uploads/tmp/1397814744-45062-7990/small_rails.png +0 -0
  80. data/spec/dummy/public/uploads/tmp/1397814744-45062-7990/thumb_rails.png +0 -0
  81. data/spec/dummy/public/uploads/tmp/1397814745-45062-4632/silicon_valley.jpg +0 -0
  82. data/spec/dummy/public/uploads/tmp/1397814745-45062-4632/small_silicon_valley.jpg +0 -0
  83. data/spec/dummy/public/uploads/tmp/1397814745-45062-4632/thumb_silicon_valley.jpg +0 -0
  84. data/spec/dummy/public/uploads/tmp/1397814752-45062-3620/rails.png +0 -0
  85. data/spec/dummy/public/uploads/tmp/1397814754-45062-7554/rails.png +0 -0
  86. data/spec/dummy/public/uploads/tmp/1397814757-45062-6575/rails.png +0 -0
  87. data/spec/dummy/public/uploads/tmp/1397814758-45062-2473/rails.png +0 -0
  88. data/spec/dummy/public/uploads/tmp/1397814758-45062-7698/rails.png +0 -0
  89. data/spec/dummy/public/uploads/tmp/1397815061-45673-4098/rails.png +0 -0
  90. data/spec/dummy/public/uploads/tmp/1397815061-45673-4098/small_rails.png +0 -0
  91. data/spec/dummy/public/uploads/tmp/1397815061-45673-4098/thumb_rails.png +0 -0
  92. data/spec/dummy/public/uploads/tmp/1397815062-45673-5873/rails.png +0 -0
  93. data/spec/dummy/public/uploads/tmp/1397815062-45673-5873/small_rails.png +0 -0
  94. data/spec/dummy/public/uploads/tmp/1397815062-45673-5873/thumb_rails.png +0 -0
  95. data/spec/dummy/public/uploads/tmp/1397815062-45673-9908/rails.png +0 -0
  96. data/spec/dummy/public/uploads/tmp/1397815062-45673-9908/small_rails.png +0 -0
  97. data/spec/dummy/public/uploads/tmp/1397815062-45673-9908/thumb_rails.png +0 -0
  98. data/spec/dummy/public/uploads/tmp/1397815063-45673-6362/silicon_valley.jpg +0 -0
  99. data/spec/dummy/public/uploads/tmp/1397815063-45673-6362/small_silicon_valley.jpg +0 -0
  100. data/spec/dummy/public/uploads/tmp/1397815063-45673-6362/thumb_silicon_valley.jpg +0 -0
  101. data/spec/dummy/public/uploads/tmp/1397815070-45673-9261/rails.png +0 -0
  102. data/spec/dummy/public/uploads/tmp/1397815072-45673-2350/rails.png +0 -0
  103. data/spec/dummy/public/uploads/tmp/1397815075-45673-3163/rails.png +0 -0
  104. data/spec/dummy/public/uploads/tmp/1397815076-45673-3745/rails.png +0 -0
  105. data/spec/dummy/public/uploads/tmp/1397815077-45673-2689/rails.png +0 -0
  106. data/spec/dummy/tmp/cache/assets/test/sprockets/025a845bfc99eb99aa9690545d024974 +0 -0
  107. data/spec/dummy/tmp/cache/assets/test/sprockets/02ca6949ca99936393e2992467409faf +0 -0
  108. data/spec/dummy/tmp/cache/assets/test/sprockets/03bae0b322a9c8706915fdb4f8d50961 +0 -0
  109. data/spec/dummy/tmp/cache/assets/test/sprockets/06632caa2dd14ba28b138446bd3d807a +0 -0
  110. data/spec/dummy/tmp/cache/assets/test/sprockets/06a86d61c2e57fad1cee30584df6f969 +0 -0
  111. data/spec/dummy/tmp/cache/assets/test/sprockets/07d036bf808a7ace22ce3b32701a2867 +0 -0
  112. data/spec/dummy/tmp/cache/assets/test/sprockets/0cc8e44f8b692c44ef509fd2d7f38941 +0 -0
  113. data/spec/dummy/tmp/cache/assets/test/sprockets/0d7fd69f7cbd03f1617b280bfb33677e +0 -0
  114. data/spec/dummy/tmp/cache/assets/test/sprockets/0e7270936d642e566d747ab335c44ec2 +0 -0
  115. data/spec/dummy/tmp/cache/assets/test/sprockets/0f382880a507fbcedb3a83727f118f84 +0 -0
  116. data/spec/dummy/tmp/cache/assets/test/sprockets/0fab3bb8b5212da52c8b7e0ae428b22a +0 -0
  117. data/spec/dummy/tmp/cache/assets/test/sprockets/12bbe81ebeeacdf11820f57a821789ff +0 -0
  118. data/spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  119. data/spec/dummy/tmp/cache/assets/test/sprockets/146ce2f3522fd98d4a8a1501f16c7092 +0 -0
  120. data/spec/dummy/tmp/cache/assets/test/sprockets/172c139e25cc08516d5a8c72c777dd4d +0 -0
  121. data/spec/dummy/tmp/cache/assets/test/sprockets/18b64b11b8b00cc21a396da25a5ff156 +0 -0
  122. data/spec/dummy/tmp/cache/assets/test/sprockets/197d8d604ec08a638b656e053944b734 +0 -0
  123. data/spec/dummy/tmp/cache/assets/test/sprockets/1bdb903463fe67323dbadb0f78337c70 +0 -0
  124. data/spec/dummy/tmp/cache/assets/test/sprockets/1beea1617441e02d76649f4b799aedac +0 -0
  125. data/spec/dummy/tmp/cache/assets/test/sprockets/20f8ac265bd1f0c57067c7a4b5c8f119 +0 -0
  126. data/spec/dummy/tmp/cache/assets/test/sprockets/212fc15df4fd708ebdef5bd3be2191c1 +0 -0
  127. data/spec/dummy/tmp/cache/assets/test/sprockets/256dcb01e7f35659d770584fd71a85d2 +0 -0
  128. data/spec/dummy/tmp/cache/assets/test/sprockets/25a167c7563d6fe8ec6b13ec1ac09274 +0 -0
  129. data/spec/dummy/tmp/cache/assets/test/sprockets/2a6ef2448bbff5c2c3c70c141f744cf5 +0 -0
  130. data/spec/dummy/tmp/cache/assets/test/sprockets/2dedb8177c20286c4259c1d58c5646cc +0 -0
  131. data/spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  132. data/spec/dummy/tmp/cache/assets/test/sprockets/33b9cc34fd627b9c81e63eb0faf06efb +0 -0
  133. data/spec/dummy/tmp/cache/assets/test/sprockets/33bd898bccf5b0821d1d3ffa02e9d1b6 +0 -0
  134. data/spec/dummy/tmp/cache/assets/test/sprockets/350390c7e44df7d038254cff29468e2d +0 -0
  135. data/spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  136. data/spec/dummy/tmp/cache/assets/test/sprockets/3633276e08728ac0cfea5659b4f8b516 +0 -0
  137. data/spec/dummy/tmp/cache/assets/test/sprockets/37b103f4623089af1456b90830fe941c +0 -0
  138. data/spec/dummy/tmp/cache/assets/test/sprockets/392239d689265304b5fe68912a8f2383 +0 -0
  139. data/spec/dummy/tmp/cache/assets/test/sprockets/3c396fbac68d9fb827a0f4c9d8cae3b6 +0 -0
  140. data/spec/dummy/tmp/cache/assets/test/sprockets/43ad0cf2497efae7114ac03a314706c5 +0 -0
  141. data/spec/dummy/tmp/cache/assets/test/sprockets/46e447bca92498433b2a3114106389a9 +0 -0
  142. data/spec/dummy/tmp/cache/assets/test/sprockets/47395ef44102932b2b9fe17a46c16601 +0 -0
  143. data/spec/dummy/tmp/cache/assets/test/sprockets/4c1c0c6c54ed879c4a5489eadd3a772c +0 -0
  144. data/spec/dummy/tmp/cache/assets/test/sprockets/4ca01587005a9b895bca383881bec87d +0 -0
  145. data/spec/dummy/tmp/cache/assets/test/sprockets/4cffdba2a7aac80c1765e060b152b382 +0 -0
  146. data/spec/dummy/tmp/cache/assets/test/sprockets/54d68ac9b230a01a37ef415779a748da +0 -0
  147. data/spec/dummy/tmp/cache/assets/test/sprockets/55b923cfea92fd264597042a44303f0c +0 -0
  148. data/spec/dummy/tmp/cache/assets/test/sprockets/56d4d696f46e9a63d0a42e11556bce11 +0 -0
  149. data/spec/dummy/tmp/cache/assets/test/sprockets/56e5bd2f3c94d7a9d0da7c4e05c7ad78 +0 -0
  150. data/spec/dummy/tmp/cache/assets/test/sprockets/5807e61754ed8b16702f6ad7ba34d439 +0 -0
  151. data/spec/dummy/tmp/cache/assets/test/sprockets/5a44970074ecbfeae2cc9798ed7da7aa +0 -0
  152. data/spec/dummy/tmp/cache/assets/test/sprockets/5ab8f53cba6a8bdf2c6d671491c397ce +0 -0
  153. data/spec/dummy/tmp/cache/assets/test/sprockets/5e27babe25470126fbc4635dc9fe9a6a +0 -0
  154. data/spec/dummy/tmp/cache/assets/test/sprockets/6056bd921f3a4b6e437dab030d7fef90 +0 -0
  155. data/spec/dummy/tmp/cache/assets/test/sprockets/61533733f5f9ec09571d2d5c45d5ab47 +0 -0
  156. data/spec/dummy/tmp/cache/assets/test/sprockets/68c52f388e9c2401252c0bedf6247c8c +0 -0
  157. data/spec/dummy/tmp/cache/assets/test/sprockets/6a1e72555b75237fffccb5de8937b4d4 +0 -0
  158. data/spec/dummy/tmp/cache/assets/test/sprockets/6a8187f5c6f2e115d1a1c21ca2ec81a0 +0 -0
  159. data/spec/dummy/tmp/cache/assets/test/sprockets/7041d544b28bff5f26dde49d77a2e87d +0 -0
  160. data/spec/dummy/tmp/cache/assets/test/sprockets/747d1d7298f227da4193f23f3932ac8e +0 -0
  161. data/spec/dummy/tmp/cache/assets/test/sprockets/749bd767d6654c80265f5ca0959dc8e1 +0 -0
  162. data/spec/dummy/tmp/cache/assets/test/sprockets/75870e6b6fe8335a7912ca4ea859a76a +0 -0
  163. data/spec/dummy/tmp/cache/assets/test/sprockets/759bbbe7d51d98664d8072e51b24744b +0 -0
  164. data/spec/dummy/tmp/cache/assets/test/sprockets/7a1f4a9bcb1d7d1e515330c4f5c391ad +0 -0
  165. data/spec/dummy/tmp/cache/assets/test/sprockets/7ad564910e515e335bb008989a97efb7 +0 -0
  166. data/spec/dummy/tmp/cache/assets/test/sprockets/7b55037b89f2debe558b43fe7542e409 +0 -0
  167. data/spec/dummy/tmp/cache/assets/test/sprockets/7ff7dd624cb7a6db5ec99af129138020 +0 -0
  168. data/spec/dummy/tmp/cache/assets/test/sprockets/80870efa2a2ddb1de325c224daff5712 +0 -0
  169. data/spec/dummy/tmp/cache/assets/test/sprockets/856b05d9307e97e681bc5c7f3649f714 +0 -0
  170. data/spec/dummy/tmp/cache/assets/test/sprockets/8766064af197b444eb1f06a6650ca9c3 +0 -0
  171. data/spec/dummy/tmp/cache/assets/test/sprockets/894aeaae9cc8483fa9f7a5146ff6ff6f +0 -0
  172. data/spec/dummy/tmp/cache/assets/test/sprockets/8a559f967fac90d4ae5a84af92c111e1 +0 -0
  173. data/spec/dummy/tmp/cache/assets/test/sprockets/8c5ee15b5860dcf2941abd00daf001eb +0 -0
  174. data/spec/dummy/tmp/cache/assets/test/sprockets/8c9393d7c6a1a2b6bb1fc9a9ccaba111 +0 -0
  175. data/spec/dummy/tmp/cache/assets/test/sprockets/8d476275ed52a5aa897cb7eef648dbc4 +0 -0
  176. data/spec/dummy/tmp/cache/assets/test/sprockets/906da6ff8c06db3e472a0a10985b668c +0 -0
  177. data/spec/dummy/tmp/cache/assets/test/sprockets/94826bb92d888d50a265392a81ce1286 +0 -0
  178. data/spec/dummy/tmp/cache/assets/test/sprockets/956d7ea9ee52ec12759995ab47f1e780 +0 -0
  179. data/spec/dummy/tmp/cache/assets/test/sprockets/974812817397ff6032b286a281d9a163 +0 -0
  180. data/spec/dummy/tmp/cache/assets/test/sprockets/9ba0cab624f25b68f79447e62fbc6112 +0 -0
  181. data/spec/dummy/tmp/cache/assets/test/sprockets/a1c0fa5689dff4e7edcc4f175f9d54bf +0 -0
  182. data/spec/dummy/tmp/cache/assets/test/sprockets/a43280845b1d41babd3f6714cd2d1337 +0 -0
  183. data/spec/dummy/tmp/cache/assets/test/sprockets/a50e247ceb9e9af32260a73eadbb65cb +0 -0
  184. data/spec/dummy/tmp/cache/assets/test/sprockets/a668bf13b4df6854c8c1085b26daa63a +0 -0
  185. data/spec/dummy/tmp/cache/assets/test/sprockets/a78a33e8cea959257da93b3e67786300 +0 -0
  186. data/spec/dummy/tmp/cache/assets/test/sprockets/aa4822def20c419f0e50e2a38e73a1df +0 -0
  187. data/spec/dummy/tmp/cache/assets/test/sprockets/aa94554c7d6f15d3f88e9710b043c2cc +0 -0
  188. data/spec/dummy/tmp/cache/assets/test/sprockets/abde9800d767ab39abc91703e5a83d70 +0 -0
  189. data/spec/dummy/tmp/cache/assets/test/sprockets/b25e1f0b850e73d0e1ef154249ce8135 +0 -0
  190. data/spec/dummy/tmp/cache/assets/test/sprockets/b4e0977feb24777fe3df7dd188b2b123 +0 -0
  191. data/spec/dummy/tmp/cache/assets/test/sprockets/b4e12b8782fac2f3caaa4aea2f89087c +0 -0
  192. data/spec/dummy/tmp/cache/assets/test/sprockets/b8c47badf85ceedb2268ef3b0f074257 +0 -0
  193. data/spec/dummy/tmp/cache/assets/test/sprockets/bafd6678f36ffd5fb29e4d9055df1f97 +0 -0
  194. data/spec/dummy/tmp/cache/assets/test/sprockets/bc4b7beed5a786619d6c3855909cb077 +0 -0
  195. data/spec/dummy/tmp/cache/assets/test/sprockets/bfc0fef30976427a03ddccb1ce78d6e7 +0 -0
  196. data/spec/dummy/tmp/cache/assets/test/sprockets/c104157fd9dbe5edc61a1889af968e19 +0 -0
  197. data/spec/dummy/tmp/cache/assets/test/sprockets/c37e2e0969ee5b3590335141a08ed884 +0 -0
  198. data/spec/dummy/tmp/cache/assets/test/sprockets/c3dc3ada4560805584739bfe7c2b24d9 +0 -0
  199. data/spec/dummy/tmp/cache/assets/test/sprockets/c4d36397803a4adf8ea86a8936b2d5f5 +0 -0
  200. data/spec/dummy/tmp/cache/assets/test/sprockets/c8f8b0ae15c86cf8aae9e3601758435e +0 -0
  201. data/spec/dummy/tmp/cache/assets/test/sprockets/cbbe8f22213647e8549911f486aee9b3 +0 -0
  202. data/spec/dummy/tmp/cache/assets/test/sprockets/cc04ce51d1e3d02a64f2781ea0876af3 +0 -0
  203. data/spec/dummy/tmp/cache/assets/test/sprockets/cebb517859b2ed48276bf54e0ba6dcec +0 -0
  204. data/spec/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  205. data/spec/dummy/tmp/cache/assets/test/sprockets/d311318a280b46ab076da5c419b210ab +0 -0
  206. data/spec/dummy/tmp/cache/assets/test/sprockets/d48c8e1ff1b6fcdbacf6ab08f8bde111 +0 -0
  207. data/spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  208. data/spec/dummy/tmp/cache/assets/test/sprockets/d7c40ebee2fb9471bab352337570ba40 +0 -0
  209. data/spec/dummy/tmp/cache/assets/test/sprockets/d9390b9983c2dcadf2533a63d0f7a84c +0 -0
  210. data/spec/dummy/tmp/cache/assets/test/sprockets/da055188ac218679c8fe62932c379340 +0 -0
  211. data/spec/dummy/tmp/cache/assets/test/sprockets/da4488b32bd6fb75c655a077956c9034 +0 -0
  212. data/spec/dummy/tmp/cache/assets/test/sprockets/e0f1660d21c6375d8a36eac87ae8ccbc +0 -0
  213. data/spec/dummy/tmp/cache/assets/test/sprockets/e1639f86099d91eb2fede327d443906f +0 -0
  214. data/spec/dummy/tmp/cache/assets/test/sprockets/e25f607f69c16bc5ffb481f9606b457e +0 -0
  215. data/spec/dummy/tmp/cache/assets/test/sprockets/e2c4f946939f2d7d0b42d86383755cae +0 -0
  216. data/spec/dummy/tmp/cache/assets/test/sprockets/e4a2ab1f3bf2d0726dff720ae88e8abc +0 -0
  217. data/spec/dummy/tmp/cache/assets/test/sprockets/e4f46080338c0c52e3933999a7f8106d +0 -0
  218. data/spec/dummy/tmp/cache/assets/test/sprockets/e59a3c2ff941e0fdc7987168580bf4cc +0 -0
  219. data/spec/dummy/tmp/cache/assets/test/sprockets/e5ab921ab9e413144898d780049a5c88 +0 -0
  220. data/spec/dummy/tmp/cache/assets/test/sprockets/e6cfe2e09e34ec2b24494a74eed5243a +0 -0
  221. data/spec/dummy/tmp/cache/assets/test/sprockets/e994cc6f07f643c4c230a9b740fd03f5 +0 -0
  222. data/spec/dummy/tmp/cache/assets/test/sprockets/ec87c33887ff6c0258bd8469a77bdcb4 +0 -0
  223. data/spec/dummy/tmp/cache/assets/test/sprockets/eccb73ad1563f9b070c4ffdf07ffff38 +0 -0
  224. data/spec/dummy/tmp/cache/assets/test/sprockets/ee5a41236d43159aac87f9224a0bcfb8 +0 -0
  225. data/spec/dummy/tmp/cache/assets/test/sprockets/f00fb03eca205b5e302d9ae7ed652817 +0 -0
  226. data/spec/dummy/tmp/cache/assets/test/sprockets/f24a0e7771eab5bd17ee05c73c56649e +0 -0
  227. data/spec/dummy/tmp/cache/assets/test/sprockets/f2de4855fd4840abb2f6e80afee5f4ed +0 -0
  228. data/spec/dummy/tmp/cache/assets/test/sprockets/f475ab32c44efa173bf8ba75435d2570 +0 -0
  229. data/spec/dummy/tmp/cache/assets/test/sprockets/f5165c4d7cee0e7cb99bc069fd4c09b9 +0 -0
  230. data/spec/dummy/tmp/cache/assets/test/sprockets/f53b02f1d2cbab753c7931e700469bed +0 -0
  231. data/spec/dummy/tmp/cache/assets/test/sprockets/f5cf5c65e6bf2039363f3b1e09bcdc9c +0 -0
  232. data/spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  233. data/spec/dummy/tmp/cache/assets/test/sprockets/f975cba8c490022ddfc45bab0b512879 +0 -0
  234. data/spec/dummy/tmp/cache/assets/test/sprockets/fba4eeb0b33c40737a907a18ee0770a4 +0 -0
  235. data/spec/dummy/tmp/cache/assets/test/sprockets/fbe8d6803f3e5a9ccb6eb7a285b95ee0 +0 -0
  236. data/spec/dummy/tmp/cache/assets/test/sprockets/fd7e46e0b42a510b40f17d1f1bacf80e +0 -0
  237. data/spec/dummy/tmp/cache/assets/test/sprockets/fd9e24b6acf76f9d44cc8e26d3148e39 +0 -0
  238. data/spec/dummy/tmp/cache/assets/test/sprockets/fe03e8232ec516da863efecd7bb2678b +0 -0
  239. data/spec/requests/shared_spec.rb +0 -36
@@ -1,9 +1,10 @@
1
1
  require 'active_support/core_ext/string/inflections'
2
2
  require 'sunrise/config/base'
3
- require 'sunrise/config/list'
4
- require 'sunrise/config/edit'
5
- require 'sunrise/config/association'
3
+ require 'sunrise/config/index'
4
+ require 'sunrise/config/export'
5
+ require 'sunrise/config/form'
6
6
  require 'sunrise/config/show'
7
+ require 'sunrise/config/association'
7
8
 
8
9
  module Sunrise
9
10
  module Config
@@ -27,12 +28,12 @@ module Sunrise
27
28
  @object_label_method ||= Config.label_methods.find { |method| (@dummy_object ||= abstract_model.model.new).respond_to? method } || :sunrise_default_object_label_method
28
29
  end
29
30
 
30
- register_instance_option(:default_list_view) do
31
- Config.default_list_view
31
+ register_instance_option(:default_index_view) do
32
+ Config.default_index_view
32
33
  end
33
34
 
34
- register_instance_option(:available_list_view) do
35
- Config.available_list_view
35
+ register_instance_option(:available_index_views) do
36
+ Config.available_index_views
36
37
  end
37
38
 
38
39
  register_instance_option(:sort_column) do
@@ -44,19 +45,29 @@ module Sunrise
44
45
  end
45
46
 
46
47
  # Register accessors for all the sections in this namespace
47
- [:list, :show, :edit, :association].each do |section|
48
+ [:index, :show, :export, :form, :association].each do |section|
48
49
  klass = "Sunrise::Config::#{section.to_s.classify}".constantize
49
- send(:define_method, section) do |*args, &block|
50
+
51
+ define_method(section) do |*args, &block|
50
52
  options = args.extract_options!
51
53
  name = args.first
52
- key = name ? [section, name].compact.join('_').to_sym : section
54
+ key = name ? [section, name].compact.map(&:to_s).join('_').to_sym : section
55
+
56
+ options[:name] ||= name
53
57
 
54
58
  if name === false || @sections[key] === false
55
59
  @sections[key] = false
60
+ elsif block
61
+ @sections[key] = PagePresenter.new(options, &block)
62
+ elsif @sections[key].is_a?(PagePresenter)
63
+ presenter = @sections[key]
64
+
65
+ instance = klass.new(abstract_model, self, presenter.options)
66
+ instance.instance_exec &presenter.block
67
+
68
+ @sections[key] = instance
56
69
  else
57
- options[:name] ||= name
58
70
  @sections[key] ||= klass.new(abstract_model, self, options)
59
- @sections[key].instance_eval &block if block
60
71
  end
61
72
 
62
73
  @sections[key]
@@ -7,19 +7,18 @@ module Sunrise
7
7
  include Singleton
8
8
  include Sunrise::Engine.routes.url_helpers
9
9
 
10
- attr_accessor :current_name
11
- attr_reader :navigations
10
+ attr_accessor :presenters
12
11
 
13
12
  class << self
14
13
  # Configure menu items
15
- def navigation(name, options = nil)
16
- instance.current_name = name
17
- yield instance if block_given?
14
+ def navigation(name, options = {}, &block)
15
+ instance.presenters ||= {}
16
+ instance.presenters[name] = PagePresenter.new(options, &block)
18
17
  end
19
18
 
20
- def method_missing(m, *args, &block)
21
- if instance.respond_to?(m)
22
- instance.send(m, *args, &block)
19
+ def method_missing(method_name, *args, &block)
20
+ if instance.respond_to?(method_name)
21
+ instance.send(method_name, *args, &block)
23
22
  else
24
23
  super
25
24
  end
@@ -27,16 +26,39 @@ module Sunrise
27
26
  end
28
27
 
29
28
  def initialize
30
- @navigations ||= {}
29
+ @navigations = nil
30
+ @presenters = {}
31
31
  @current_name = :main
32
32
  end
33
+
34
+ def navigations
35
+ @navigations ||= build_navigation
36
+ end
33
37
 
34
38
  def item(item_name, url = nil, options = {})
35
39
  url ||= index_path(:model_name => item_name)
36
40
 
37
- @navigations[current_name] ||= []
38
- @navigations[current_name] << NavigationItem.new(item_name, url, current_name, options)
41
+ @navigations[@current_name] ||= []
42
+ @navigations[@current_name] << NavigationItem.new(item_name, url, @current_name, options)
39
43
  end
44
+
45
+ protected
46
+
47
+ def build_navigation
48
+ @navigations = {}
49
+
50
+ presenters.each do |key, presenter|
51
+ @current_name = key.to_sym
52
+ run_registration_block &presenter.block
53
+ end
54
+
55
+ @navigations
56
+ end
57
+
58
+ # Runs the registration block inside this object
59
+ def run_registration_block(&block)
60
+ instance_exec &block if block_given?
61
+ end
40
62
  end
41
63
  end
42
64
  end
@@ -0,0 +1,31 @@
1
+ module Sunrise
2
+ module Config
3
+ # A simple object that gets used to present different aspects of views
4
+ #
5
+ # Initialize with a set of options and a block. The options become
6
+ # available using hash style syntax.
7
+ #
8
+ # Usage:
9
+ #
10
+ # presenter = PagePresenter.new as: :table do
11
+ # # some awesome stuff
12
+ # end
13
+ #
14
+ # presenter[:as] #=> :table
15
+ # presenter.block #=> The block passed in to new
16
+ #
17
+ class PagePresenter
18
+ attr_reader :block, :options
19
+
20
+ delegate :has_key?, to: :options
21
+
22
+ def initialize(options = {}, &block)
23
+ @options, @block = options, block
24
+ end
25
+
26
+ def [](key)
27
+ @options[key]
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,6 +1,7 @@
1
1
  module Sunrise
2
2
  module Config
3
3
  autoload :Navigation, 'sunrise/config/navigation'
4
+ autoload :PagePresenter, 'sunrise/config/page_presenter'
4
5
 
5
6
  # Paginate records per page
6
7
  mattr_accessor :default_items_per_page
@@ -18,16 +19,16 @@ module Sunrise
18
19
  mattr_accessor :label_methods
19
20
  @@label_methods = [:title, :name]
20
21
 
21
- # Defailt list template view
22
- mattr_accessor :default_list_view
23
- @@default_list_view = 'thumbs'
22
+ # Default index template view
23
+ mattr_accessor :default_index_view
24
+ @@default_index_view = :thumbs
24
25
 
25
- mattr_accessor :available_list_view
26
- @@available_list_view = [:list, :thumbs, :table]
26
+ mattr_accessor :available_index_views
27
+ @@available_index_views = [:tree, :thumbs, :table]
27
28
 
28
- # Defailt list template view
29
+ # Default sort column
29
30
  mattr_accessor :sort_column
30
- @@sort_column = 'sort_order'
31
+ @@sort_column = :sort_order
31
32
 
32
33
  # Find template before rendering
33
34
  mattr_accessor :scoped_views
@@ -42,19 +43,23 @@ module Sunrise
42
43
  mattr_accessor :transliteration
43
44
  @@transliteration = :russian
44
45
 
45
- # Set list toolbar buttons
46
+ # Set index toolbar buttons
46
47
  mattr_accessor :default_toolbar_buttons
47
48
  @@default_toolbar_buttons = [:delete, :edit, :new, :sort, :export]
48
49
 
49
- # Lists the formats that should be treated as navigational
50
+ # Index the formats that should be treated as navigational
50
51
  mattr_accessor :navigational_formats
51
52
  @@navigational_formats = [:html, :json]
52
53
 
54
+ # Welcome (root) controller path
55
+ mattr_accessor :root_controller
56
+ @@root_controller = "dashboard#index"
57
+
53
58
  def self.scoped_views?
54
59
  @@scoped_views === true
55
60
  end
56
61
 
57
- def self.nav
62
+ def self.navigation
58
63
  ::SunriseNavigation.instance.navigations
59
64
  end
60
65
  end
@@ -14,7 +14,6 @@ module Sunrise
14
14
 
15
15
  ActiveSupport.on_load :active_record do
16
16
  ActiveRecord::Base.send :include, Sunrise::CarrierWave::Glue
17
- ActiveRecord::Base.send :include, Sunrise::Utils::Mysql
18
17
  end
19
18
 
20
19
  ActiveSupport.on_load :action_view do
@@ -13,17 +13,17 @@ module Sunrise
13
13
  enumerated_attribute :position_type
14
14
 
15
15
  validates_presence_of :title
16
- validates_numericality_of :position_type_id, :only_integer => true
17
- validates_numericality_of :structure_type_id, :only_integer => true
16
+ validates_numericality_of :position_type_id, only_integer: true
17
+ validates_numericality_of :structure_type_id, only_integer: true
18
18
 
19
19
  acts_as_nested_set
20
20
 
21
- before_validation :generate_slug, :if => :should_generate_new_slug?
21
+ before_validation :generate_slug, if: :should_generate_new_slug?
22
22
 
23
- scope :visible, lambda { where(:is_visible => true) }
24
- scope :with_type, lambda {|structure_type| where(:structure_type_id => structure_type.id) }
25
- scope :with_depth, lambda {|level| where(:depth => level.to_i) }
26
- scope :with_position, lambda {|position_type| where(:position_type_id => position_type.id) }
23
+ scope :visible, lambda { where(is_visible: true) }
24
+ scope :with_type, lambda {|structure_type| where(structure_type_id: structure_type.id) }
25
+ scope :with_depth, lambda {|level| where(depth: level.to_i) }
26
+ scope :with_position, lambda {|position_type| where(position_type_id: position_type.id) }
27
27
  end
28
28
 
29
29
  module ClassMethods
data/lib/sunrise/utils.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  module Sunrise
2
2
  module Utils
3
3
  autoload :Transliteration, 'sunrise/utils/transliteration'
4
- autoload :Mysql, 'sunrise/utils/mysql'
5
4
  autoload :EvalHelpers, 'sunrise/utils/eval_helpers'
6
5
  autoload :CsvDocument, 'sunrise/utils/csv_document'
7
6
  autoload :SearchWrapper, 'sunrise/utils/search_wrapper'
@@ -1,3 +1,3 @@
1
1
  module Sunrise
2
- VERSION = "0.7.0.rc2".freeze
2
+ VERSION = "1.0.0.rc1".freeze
3
3
  end
@@ -4,8 +4,8 @@ describe Sunrise::SettingsController do
4
4
  render_views
5
5
 
6
6
  before(:all) do
7
- Settings.defaults[:some_setting] = "value"
8
- Settings.defaults[:some_setting2] = "value2"
7
+ Settings.some_setting = "value"
8
+ Settings.some_setting2 = "value2"
9
9
  end
10
10
 
11
11
  describe "admin" do
@@ -3,7 +3,7 @@ class SunrisePost < Sunrise::AbstractModel
3
3
 
4
4
  association :structure
5
5
 
6
- list :thumbs do
6
+ index :thumbs do
7
7
  buttons [:new, :edit, :delete, :sort]
8
8
 
9
9
  field :title
@@ -16,13 +16,13 @@ class SunrisePost < Sunrise::AbstractModel
16
16
  end
17
17
  end
18
18
 
19
- edit do
19
+ form do
20
20
  field :title
21
21
  field :content
22
22
  field :is_visible
23
23
  end
24
24
 
25
- list :export do
25
+ export do
26
26
  scope { Post.includes(:structure) }
27
27
 
28
28
  field :id
@@ -17,17 +17,13 @@ require "sunrise-cms"
17
17
 
18
18
  module Dummy
19
19
  class Application < Rails::Application
20
- # Settings in config/environments/* take precedence over those specified here.
21
- # Application configuration should go into files in config/initializers
22
- # -- all .rb files in that directory are automatically loaded.
23
-
24
20
  # Custom directories with classes and modules you want to be autoloadable.
25
21
  config.autoload_paths += %W(
26
22
  #{config.root}/../../lib/generators/sunrise/templates/models/#{SUNRISE_ORM}
27
23
  #{config.root}/../../lib/generators/sunrise/templates/uploaders
28
24
  #{config.root}/../../lib/generators/sunrise/templates/models/sunrise
29
25
  #{config.root}/app/models/#{SUNRISE_ORM}
30
- #{config.root}/app/models/sunrise)
26
+ #{config.root}/app/sunrise)
31
27
 
32
28
  # Only load the plugins named here, in the order given (default is alphabetical).
33
29
  # :all can be used as a placeholder for all plugins not explicitly named.
@@ -55,9 +51,5 @@ module Dummy
55
51
 
56
52
  # Version of your assets, change this if you want to expire all your assets
57
53
  config.assets.version = '1.0'
58
-
59
- # Disable the default whitelisting that occurs in later versions of Rails
60
- config.active_record.whitelist_attributes = false
61
54
  end
62
- end
63
-
55
+ end
@@ -27,4 +27,7 @@ Dummy::Application.configure do
27
27
 
28
28
  # Expands the lines which load the assets
29
29
  config.assets.debug = true
30
+
31
+ # Do not eager load code on boot.
32
+ config.eager_load = false
30
33
  end
@@ -57,4 +57,10 @@ Dummy::Application.configure do
57
57
 
58
58
  # Send deprecation notices to registered listeners
59
59
  config.active_support.deprecation = :notify
60
+
61
+ # Eager load code on boot. This eager loads most of Rails and
62
+ # your application in memory, allowing both thread web servers
63
+ # and those relying on copy on write to perform better.
64
+ # Rake tasks automatically ignore this option for performance.
65
+ config.eager_load = true
60
66
  end
@@ -11,9 +11,6 @@ Dummy::Application.configure do
11
11
  config.serve_static_assets = true
12
12
  config.static_cache_control = "public, max-age=3600"
13
13
 
14
- # Log error messages when you accidentally call methods on nil
15
- config.whiny_nils = true
16
-
17
14
  # Show full error reports and disable caching
18
15
  config.consider_all_requests_local = true
19
16
  config.action_controller.perform_caching = false
@@ -36,4 +33,9 @@ Dummy::Application.configure do
36
33
 
37
34
  # Print deprecation notices to the stderr
38
35
  config.active_support.deprecation = :stderr
36
+
37
+ # Do not eager load code on boot. This avoids loading your whole application
38
+ # just for the purpose of running a single test. If you are using a tool that
39
+ # preloads Rails for running tests, you may have to set it to true.
40
+ config.eager_load = false
39
41
  end
@@ -0,0 +1,90 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 20130214090723) do
15
+
16
+ create_table "activities", force: true do |t|
17
+ t.integer "trackable_id"
18
+ t.string "trackable_type"
19
+ t.integer "owner_id"
20
+ t.string "owner_type"
21
+ t.string "key"
22
+ t.text "parameters"
23
+ t.integer "recipient_id"
24
+ t.string "recipient_type"
25
+ t.datetime "created_at"
26
+ t.datetime "updated_at"
27
+ end
28
+
29
+ add_index "activities", ["owner_id", "owner_type"], name: "index_activities_on_owner_id_and_owner_type", using: :btree
30
+ add_index "activities", ["recipient_id", "recipient_type"], name: "index_activities_on_recipient_id_and_recipient_type", using: :btree
31
+ add_index "activities", ["trackable_id", "trackable_type"], name: "index_activities_on_trackable_id_and_trackable_type", using: :btree
32
+
33
+ create_table "audits", force: true do |t|
34
+ t.integer "auditable_id"
35
+ t.string "auditable_type"
36
+ t.integer "associated_id"
37
+ t.string "associated_type"
38
+ t.integer "user_id"
39
+ t.string "user_type"
40
+ t.string "username"
41
+ t.string "action"
42
+ t.text "audited_changes"
43
+ t.integer "version", default: 0
44
+ t.string "comment"
45
+ t.string "remote_address"
46
+ t.datetime "created_at"
47
+ end
48
+
49
+ add_index "audits", ["associated_id", "associated_type"], name: "associated_index", using: :btree
50
+ add_index "audits", ["auditable_id", "auditable_type"], name: "auditable_index", using: :btree
51
+ add_index "audits", ["created_at"], name: "index_audits_on_created_at", using: :btree
52
+ add_index "audits", ["user_id", "user_type"], name: "user_index", using: :btree
53
+
54
+ create_table "meta_tags", force: true do |t|
55
+ t.string "name", limit: 50, null: false
56
+ t.text "content"
57
+ t.boolean "is_dynamic", default: false
58
+ t.integer "taggable_id", null: false
59
+ t.string "taggable_type", limit: 50, null: false
60
+ t.datetime "created_at"
61
+ t.datetime "updated_at"
62
+ end
63
+
64
+ add_index "meta_tags", ["name"], name: "index_meta_tags_on_name", using: :btree
65
+ add_index "meta_tags", ["taggable_type", "taggable_id"], name: "index_meta_tags_on_taggable_type_and_taggable_id", using: :btree
66
+
67
+ create_table "page_parts", force: true do |t|
68
+ t.string "key", limit: 10, null: false
69
+ t.text "content"
70
+ t.integer "partable_id", null: false
71
+ t.string "partable_type", limit: 50, null: false
72
+ t.datetime "created_at"
73
+ t.datetime "updated_at"
74
+ end
75
+
76
+ add_index "page_parts", ["key"], name: "index_page_parts_on_key", using: :btree
77
+ add_index "page_parts", ["partable_type", "partable_id"], name: "index_page_parts_on_partable_type_and_partable_id", using: :btree
78
+
79
+ create_table "posts", force: true do |t|
80
+ t.string "title", null: false
81
+ t.text "content"
82
+ t.boolean "is_visible", default: true
83
+ t.integer "structure_id", null: false
84
+ t.datetime "created_at"
85
+ t.datetime "updated_at"
86
+ end
87
+
88
+ add_index "posts", ["structure_id"], name: "index_posts_on_structure_id", using: :btree
89
+
90
+ end
@@ -51,7 +51,7 @@ describe Avatar do
51
51
  end
52
52
 
53
53
  it "file size should be valid" do
54
- @avatar.data_file_size.should == 6428
54
+ @avatar.data_file_size.should == 6543
55
55
  end
56
56
 
57
57
  it "should be image" do
@@ -30,10 +30,6 @@ describe Sunrise::AbstractModel do
30
30
  @abstract_model.param_key.should == 'structure'
31
31
  end
32
32
 
33
- it "should return current list view" do
34
- @abstract_model.list_key.should == :list_tree
35
- end
36
-
37
33
  it "should not load parent record" do
38
34
  @abstract_model.parent_record.should be_nil
39
35
  end
@@ -48,8 +44,8 @@ describe Sunrise::AbstractModel do
48
44
  end
49
45
 
50
46
  it "should update current list view" do
51
- model = Sunrise::Utils.get_model("structures", {:view => 'table'})
52
- model.current_list.should == :table
47
+ model = Sunrise::Utils.get_model("structures", {:view => 'thumbs'})
48
+ model.current_list.should == :thumbs
53
49
  end
54
50
 
55
51
  it "should destroy all items" do
@@ -64,7 +60,7 @@ describe Sunrise::AbstractModel do
64
60
 
65
61
  describe "SunrisePage" do
66
62
  it "should not have config for list" do
67
- SunrisePage.config.list.should == false
63
+ SunrisePage.config.index.should == false
68
64
  end
69
65
 
70
66
  it "should load structure model" do
@@ -78,6 +74,7 @@ describe Sunrise::AbstractModel do
78
74
  end
79
75
 
80
76
  it "should not render list config" do
77
+ @abstract_model.without_index?.should == true
81
78
  @abstract_model.list.should == false
82
79
  end
83
80
  end
@@ -85,7 +82,7 @@ describe Sunrise::AbstractModel do
85
82
 
86
83
  describe "SunriseUser" do
87
84
  it "should return empty list on not defined fields" do
88
- SunrisePage.config.sections[:list_export].should be_nil
85
+ SunrisePage.config.sections[:list_table].should be_nil
89
86
  end
90
87
  end
91
88
  end
@@ -54,7 +54,7 @@ describe "Sunrise Manager Edit" do
54
54
  end
55
55
 
56
56
  it "should generate field to edit" do
57
- should have_selector "textarea[@name='structure[main]']"
57
+ should have_selector "textarea[@name='structure[content]']"
58
58
  should have_selector "textarea[@name='structure[sidebar]']"
59
59
  end
60
60
  end
@@ -25,7 +25,7 @@ describe "Sunrise Manager New" do
25
25
  end
26
26
 
27
27
  it "should generate field to edit" do
28
- SunriseStructure.config.edit.fields.each do |f|
28
+ SunriseStructure.config.form.fields.each do |f|
29
29
  if ['structure_type_id', 'parent_id', 'position_type_id'].include?(f.name)
30
30
  should have_selector "select[@name='structure[#{f.name}]']"
31
31
  else
@@ -42,11 +42,11 @@ describe "Sunrise Manager Edit" do
42
42
 
43
43
  describe "Update /manage/pages/:id/edit" do
44
44
  before(:each) do
45
- @page.update_attributes({:main => "Main", :sidebar => "Sidebar"})
45
+ @page.update_attributes({:content => "Main", :sidebar => "Sidebar"})
46
46
 
47
47
  visit edit_path(:model_name => "pages", :id => @page.id)
48
48
 
49
- fill_in "structure[main]", :with => "Main updated"
49
+ fill_in "structure[content]", :with => "Main updated"
50
50
  fill_in "structure[sidebar]", :with => "Sidebar updated"
51
51
 
52
52
  click_button "submit-button-hidden"
@@ -55,7 +55,7 @@ describe "Sunrise Manager Edit" do
55
55
  it "should update an object with correct attributes" do
56
56
  @page.reload
57
57
 
58
- @page.main.should == "Main updated"
58
+ @page.content.should == "Main updated"
59
59
  @page.sidebar.should == "Sidebar updated"
60
60
  end
61
61
  end
@@ -29,8 +29,9 @@ describe "Sunrise Manager Index many" do
29
29
  @post2 = FactoryGirl.create(:post, :title => "Good day", :structure => @page)
30
30
 
31
31
  visit index_path(:model_name => "posts", :parent_id => @page.id, :parent_type => @page.class.name)
32
-
32
+
33
33
  fill_in "search[title]", :with => "Good day"
34
+
34
35
  click_button "submit-button-search"
35
36
  end
36
37
 
@@ -22,7 +22,7 @@ describe "Sunrise Manager New many" do
22
22
  end
23
23
 
24
24
  it "should generate field to edit" do
25
- SunrisePost.config.edit.fields.each do |f|
25
+ SunrisePost.config.form.fields.each do |f|
26
26
  if ['content'].include?(f.name)
27
27
  should have_selector "textarea[@name='post[#{f.name}]']"
28
28
  else
data/spec/spec_helper.rb CHANGED
@@ -36,6 +36,20 @@ CarrierWave.configure do |config|
36
36
  config.enable_processing = false
37
37
  end
38
38
 
39
+ # use different dirs when testing
40
+ CarrierWave::Uploader::Base.descendants.each do |klass|
41
+ next if klass.anonymous?
42
+ klass.class_eval do
43
+ def cache_dir
44
+ "#{Rails.root}/spec/support/uploads/tmp"
45
+ end
46
+
47
+ def store_dir
48
+ "#{Rails.root}/spec/support/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
49
+ end
50
+ end
51
+ end
52
+
39
53
  # Load support files
40
54
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
41
55
 
@@ -63,6 +77,10 @@ RSpec.configure do |config|
63
77
 
64
78
  config.before(:all) do
65
79
  DatabaseCleaner.clean
80
+ end
81
+
82
+ config.after(:each) do
83
+ FileUtils.rm_rf(Dir["#{Rails.root}/spec/support/uploads"])
66
84
  end
67
85
 
68
86
  config.after(:all) do
data/spec/sunrise_spec.rb CHANGED
@@ -14,7 +14,7 @@ describe Sunrise do
14
14
  Sunrise.setup do |c|
15
15
  c.default_items_per_page = 50
16
16
  c.default_sort_mode = :asc
17
- c.default_list_view = 'table'
17
+ c.default_index_view = :table
18
18
  c.scoped_views = true
19
19
  end
20
20
  end
@@ -22,7 +22,7 @@ describe Sunrise do
22
22
  it "should store configuration" do
23
23
  Sunrise::Config.default_items_per_page.should == 50
24
24
  Sunrise::Config.default_sort_mode.should == :asc
25
- Sunrise::Config.default_list_view.should == 'table'
25
+ Sunrise::Config.default_index_view.should == :table
26
26
  Sunrise::Config.scoped_views.should == true
27
27
  end
28
28
  end