tb_core 1.1.10 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (259) hide show
  1. checksums.yaml +6 -14
  2. data/README.md +50 -2
  3. data/app/assets/javascripts/admin/core/application.js +2 -2
  4. data/app/assets/javascripts/admin/core/editor.js +1 -0
  5. data/app/assets/javascripts/admin/core/preinit.js +1 -1
  6. data/app/assets/javascripts/admin/core/split_pane.js +4 -0
  7. data/app/assets/javascripts/admin/core/users.js +59 -12
  8. data/app/assets/libs/bootstrap/css/{bootstrap.css → bootstrap.css.scss} +11 -11
  9. data/app/assets/libs/{tiny_mce → tinymce}/plugins/tableDropdown/editor_plugin.js +0 -0
  10. data/app/controllers/admin/application_controller.rb +0 -1
  11. data/app/controllers/admin/roles_controller.rb +10 -4
  12. data/app/controllers/admin/settings_controller.rb +10 -2
  13. data/app/controllers/admin/setup_controller.rb +7 -1
  14. data/app/controllers/admin/users_controller.rb +8 -2
  15. data/app/controllers/sitemaps_controller.rb +0 -1
  16. data/app/controllers/spud/application_controller.rb +9 -2
  17. data/app/helpers/spud/application_helper.rb +21 -0
  18. data/app/models/spud/spud_user_model.rb +79 -0
  19. data/app/models/spud_role.rb +0 -1
  20. data/app/models/spud_role_permission.rb +0 -1
  21. data/app/models/spud_user.rb +2 -80
  22. data/app/views/admin/roles/index.html.erb +4 -2
  23. data/app/views/admin/users/_form.html.erb +3 -0
  24. data/app/views/admin/users/_form_additions.html.erb +1 -0
  25. data/app/views/admin/users/_show_additions.html.erb +1 -0
  26. data/app/views/admin/users/show.html.erb +1 -0
  27. data/config/routes.rb +3 -3
  28. data/lib/generators/spud/module_generator.rb +5 -1
  29. data/lib/generators/spud/templates/admin_controller.rb.erb +6 -2
  30. data/lib/generators/spud/templates/views/admin/index.html.erb +5 -7
  31. data/lib/spud_core/engine.rb +2 -24
  32. data/lib/spud_core/version.rb +1 -1
  33. data/spec/controllers/admin/settings_controller_spec.rb +2 -2
  34. data/spec/controllers/sitemap_controllers_spec.rb +4 -3
  35. data/spec/dummy/config/application.rb +1 -0
  36. data/spec/dummy/config/environments/test.rb +9 -2
  37. data/spec/dummy/config/initializers/secret_token.rb +1 -0
  38. data/spec/dummy/log/test.log +12429 -0
  39. data/spec/dummy/tmp/cache/assets/test/sass/05388b0d18737541b44c9082e3fa19afa6bf3826/application.css.scssc +0 -0
  40. data/spec/dummy/tmp/cache/assets/test/sass/05388b0d18737541b44c9082e3fa19afa6bf3826/login.css.scssc +0 -0
  41. data/spec/dummy/tmp/cache/assets/test/sass/05388b0d18737541b44c9082e3fa19afa6bf3826/split_pane.css.scssc +0 -0
  42. data/spec/dummy/tmp/cache/assets/test/sass/05388b0d18737541b44c9082e3fa19afa6bf3826/users.css.scssc +0 -0
  43. data/spec/dummy/tmp/cache/assets/test/sass/e99c58815a3ff18987eada90ba5c7e95383074f2/bootstrap.css.scssc +0 -0
  44. data/spec/dummy/tmp/cache/assets/test/sprockets/0075c6e170e8012f220c7ed9fb5dc88b +0 -0
  45. data/spec/dummy/tmp/cache/assets/test/sprockets/01666d6af504317dcf63364a37ce60f4 +0 -0
  46. data/spec/dummy/tmp/cache/assets/test/sprockets/03dcdc877f0257624872c73967d201c6 +0 -0
  47. data/spec/dummy/tmp/cache/assets/test/sprockets/06d52af2fa483161bb27dd39c3b34ee3 +0 -0
  48. data/spec/dummy/tmp/cache/assets/test/sprockets/098869073bd11dbc41fcaa47716a0ce7 +0 -0
  49. data/spec/dummy/tmp/cache/assets/test/sprockets/0cabf8a5146f359edd424e4f820e07f1 +0 -0
  50. data/spec/dummy/tmp/cache/assets/test/sprockets/0f971f36ba87298fbaf46154fa8a5d30 +0 -0
  51. data/spec/dummy/tmp/cache/assets/test/sprockets/13809885160329b0a1a4e7885fb75ca4 +0 -0
  52. data/spec/dummy/tmp/cache/assets/test/sprockets/16243b3ad44c2997ad70996b58c56a2a +0 -0
  53. data/spec/dummy/tmp/cache/assets/test/sprockets/169b221054fadd95f44252a232a5f053 +0 -0
  54. data/spec/dummy/tmp/cache/assets/test/sprockets/1816341e15110810c4647824cc81d1aa +0 -0
  55. data/spec/dummy/tmp/cache/assets/test/sprockets/18d440ef7bcf78056d346ac1ff2a6793 +0 -0
  56. data/spec/dummy/tmp/cache/assets/test/sprockets/1c06ad369cba88ec3ff5afc06e982d7c +0 -0
  57. data/spec/dummy/tmp/cache/assets/test/sprockets/1fa18bd231ff77b2af93913518487967 +0 -0
  58. data/spec/dummy/tmp/cache/assets/test/sprockets/21e6a044a925c5f44f5a9d9b9e2d164a +0 -0
  59. data/spec/dummy/tmp/cache/assets/test/sprockets/2393e42173c512eb5171116ee479ab7e +0 -0
  60. data/spec/dummy/tmp/cache/assets/test/sprockets/2b94b5653a1151795fb999b3e98fd1d8 +0 -0
  61. data/spec/dummy/tmp/cache/assets/test/sprockets/2fe2bffc50d1c3cd5c0a896a5528e23b +0 -0
  62. data/spec/dummy/tmp/cache/assets/test/sprockets/3024a96b82ffd6a5f68295a953231c92 +0 -0
  63. data/spec/dummy/tmp/cache/assets/test/sprockets/3123e8917685babc03cb0c8aeccac695 +0 -0
  64. data/spec/dummy/tmp/cache/assets/test/sprockets/353180d0c9fd2a3ccef3718d7e6ace6c +0 -0
  65. data/spec/dummy/tmp/cache/assets/test/sprockets/37539a535fefc75cd61aa9438d821846 +0 -0
  66. data/spec/dummy/tmp/cache/assets/test/sprockets/38eabf5ce9c4dda42d09332aee816d3e +0 -0
  67. data/spec/dummy/tmp/cache/assets/test/sprockets/39efa102c753ebe9defd90062785a8aa +0 -0
  68. data/spec/dummy/tmp/cache/assets/test/sprockets/3cc30d9fb936455c063d7a950c46bb32 +0 -0
  69. data/spec/dummy/tmp/cache/assets/test/sprockets/4546971591261f8a01d0837f5a31af35 +0 -0
  70. data/spec/dummy/tmp/cache/assets/test/sprockets/45b53d5ab2cac60703cd9d2cf52c14eb +0 -0
  71. data/spec/dummy/tmp/cache/assets/test/sprockets/49d27d2d81616b48039efe15075da4f2 +0 -0
  72. data/spec/dummy/tmp/cache/assets/test/sprockets/4a689e727abc31a4f93798253a176295 +0 -0
  73. data/spec/dummy/tmp/cache/assets/test/sprockets/55d4fc42707dc9a3400faf92bed0360a +0 -0
  74. data/spec/dummy/tmp/cache/assets/test/sprockets/5759e8cff07b97209ca7ea6a93b3ed1a +0 -0
  75. data/spec/dummy/tmp/cache/assets/test/sprockets/5c4e1741d24424c6947eaff78829d41f +0 -0
  76. data/spec/dummy/tmp/cache/assets/test/sprockets/5cdaff8b68930bd29868b3d0fcb33766 +0 -0
  77. data/spec/dummy/tmp/cache/assets/test/sprockets/5de67e95811f3524bac96ba237505ae6 +0 -0
  78. data/spec/dummy/tmp/cache/assets/test/sprockets/5fe538b2e33228dd92d36cfce50cf4b7 +0 -0
  79. data/spec/dummy/tmp/cache/assets/test/sprockets/6671fad14ea054e577e2dfbcd98e571c +0 -0
  80. data/spec/dummy/tmp/cache/assets/test/sprockets/6d7103090b0047c9b8d5746d75e8fac9 +0 -0
  81. data/spec/dummy/tmp/cache/assets/test/sprockets/705426de92785d4afa88b06757d25f7d +0 -0
  82. data/spec/dummy/tmp/cache/assets/test/sprockets/71e715ef316e725981280e9bfe9d0527 +0 -0
  83. data/spec/dummy/tmp/cache/assets/test/sprockets/7391889bc52e8664fd5d590d58a7ec8f +0 -0
  84. data/spec/dummy/tmp/cache/assets/test/sprockets/7828cb89eaa43959329e301a04ef10a6 +0 -0
  85. data/spec/dummy/tmp/cache/assets/test/sprockets/80dda53c03df39ae9ed8c2400f05990a +0 -0
  86. data/spec/dummy/tmp/cache/assets/test/sprockets/8121614a686088a7f27165baf5d63da3 +0 -0
  87. data/spec/dummy/tmp/cache/assets/test/sprockets/85af4404353b8373764b166027ce78a4 +0 -0
  88. data/spec/dummy/tmp/cache/assets/test/sprockets/85cdc3810a743722e618b949199320ec +0 -0
  89. data/spec/dummy/tmp/cache/assets/test/sprockets/88099ac9106f32ee56c2cdde301f4aeb +0 -0
  90. data/spec/dummy/tmp/cache/assets/test/sprockets/89fbb1e40182037e0eec01e0d3bab067 +0 -0
  91. data/spec/dummy/tmp/cache/assets/test/sprockets/8bb56cbae5a8a5b5f1cf04183a746966 +0 -0
  92. data/spec/dummy/tmp/cache/assets/test/sprockets/8fb7066c091dc8956fadaa0c316fb808 +0 -0
  93. data/spec/dummy/tmp/cache/assets/test/sprockets/9214ad2c4fc7c0298ec351e00379a706 +0 -0
  94. data/spec/dummy/tmp/cache/assets/test/sprockets/9313c3ae5de2dc96635bfa4e6957a149 +0 -0
  95. data/spec/dummy/tmp/cache/assets/test/sprockets/940374cda01486d892775b6f65986599 +0 -0
  96. data/spec/dummy/tmp/cache/assets/test/sprockets/966f020d24b19c1d685c51c240d1923a +0 -0
  97. data/spec/dummy/tmp/cache/assets/test/sprockets/a444109f6d82fec9d3e8224e0508abc9 +0 -0
  98. data/spec/dummy/tmp/cache/assets/test/sprockets/a4adceeb24e0e96b3cd701b06c7b53d2 +0 -0
  99. data/spec/dummy/tmp/cache/assets/test/sprockets/a4c8d8c64ed3eca5b07e3c1478b00a81 +0 -0
  100. data/spec/dummy/tmp/cache/assets/test/sprockets/a7305f76eab9ded7ce734cea8967a8ee +0 -0
  101. data/spec/dummy/tmp/cache/assets/test/sprockets/aa893fde36bb6d9e2184bba8385ce160 +0 -0
  102. data/spec/dummy/tmp/cache/assets/test/sprockets/b26e8bc7c7c32058397f892cd9d046d8 +0 -0
  103. data/spec/dummy/tmp/cache/assets/test/sprockets/b8d4b4de990b07fda478ecb232a3b76f +0 -0
  104. data/spec/dummy/tmp/cache/assets/test/sprockets/ba173160d353bfb6e1f0f284bac8b9de +0 -0
  105. data/spec/dummy/tmp/cache/assets/test/sprockets/bc750b216ba26d779bcf79fac037b36b +0 -0
  106. data/spec/dummy/tmp/cache/assets/test/sprockets/bef9d4af2f246671b5c9d21c40b49545 +0 -0
  107. data/spec/dummy/tmp/cache/assets/test/sprockets/c0eaf65fe0db1674c49ba2ae6cccb410 +0 -0
  108. data/spec/dummy/tmp/cache/assets/test/sprockets/c4fa3869fe96ebf26a17b08d5b45d5fb +0 -0
  109. data/spec/dummy/tmp/cache/assets/test/sprockets/c666b756412f64241236e1112b2e403d +0 -0
  110. data/spec/dummy/tmp/cache/assets/test/sprockets/c7301f1b1c7ee199b8b8487f43ce78c8 +0 -0
  111. data/spec/dummy/tmp/cache/assets/test/sprockets/cb96d7509d3c2b2f16d6d3a1eaac2b79 +0 -0
  112. data/spec/dummy/tmp/cache/assets/test/sprockets/d02977fa67cf6643e31bb4c063a6d205 +0 -0
  113. data/spec/dummy/tmp/cache/assets/test/sprockets/d5b4ee9436615cb36bb22b9ba87791cf +0 -0
  114. data/spec/dummy/tmp/cache/assets/test/sprockets/daec02064da70ae5def8a75a5c36e58d +0 -0
  115. data/spec/dummy/tmp/cache/assets/test/sprockets/dd32919d4bcd591d7aa6937ba4b39ddb +0 -0
  116. data/spec/dummy/tmp/cache/assets/test/sprockets/e12ec2fd151046a8235cb53a379b3151 +0 -0
  117. data/spec/dummy/tmp/cache/assets/test/sprockets/e232a62130dade197fcabdd428cf737c +0 -0
  118. data/spec/dummy/tmp/cache/assets/test/sprockets/e7d7a71fa09119e96e640cba43763911 +0 -0
  119. data/spec/dummy/tmp/cache/assets/test/sprockets/f165c137fabbacd60c1bc9fbb6878ae9 +0 -0
  120. data/spec/dummy/tmp/cache/assets/test/sprockets/f365efd4df73b42e492cd479032636ca +0 -0
  121. data/spec/dummy/tmp/cache/assets/test/sprockets/f81f473be9c249d9ff823b35ba6c7130 +0 -0
  122. data/spec/dummy/tmp/cache/assets/test/sprockets/fda81067bc547bd67ac35e1bc4a7c167 +0 -0
  123. data/spec/dummy/tmp/cache/assets/test/sprockets/fde0dc66d618f90500842b827a11d83b +0 -0
  124. data/spec/dummy/tmp/cache/assets/test/sprockets/fe35aa99166bfe64fdab2f5f5373a80d +0 -0
  125. data/spec/dummy/tmp/cache/assets/test/sprockets/ff91e57c48a0748be0394a67cd555438 +0 -0
  126. metadata +240 -182
  127. data/app/assets/libs/tiny_mce/jquery.tinymce.js +0 -1
  128. data/app/assets/libs/tiny_mce/langs/en.js +0 -1
  129. data/app/assets/libs/tiny_mce/license.txt +0 -504
  130. data/app/assets/libs/tiny_mce/plugins/advhr/css/advhr.css +0 -5
  131. data/app/assets/libs/tiny_mce/plugins/advhr/editor_plugin.js +0 -1
  132. data/app/assets/libs/tiny_mce/plugins/advhr/editor_plugin_src.js +0 -57
  133. data/app/assets/libs/tiny_mce/plugins/advhr/js/rule.js +0 -43
  134. data/app/assets/libs/tiny_mce/plugins/advhr/langs/en_dlg.js +0 -1
  135. data/app/assets/libs/tiny_mce/plugins/advhr/rule.htm +0 -58
  136. data/app/assets/libs/tiny_mce/plugins/advimage/css/advimage.css +0 -13
  137. data/app/assets/libs/tiny_mce/plugins/advimage/editor_plugin.js +0 -1
  138. data/app/assets/libs/tiny_mce/plugins/advimage/editor_plugin_src.js +0 -50
  139. data/app/assets/libs/tiny_mce/plugins/advimage/image.htm +0 -235
  140. data/app/assets/libs/tiny_mce/plugins/advimage/img/sample.gif +0 -0
  141. data/app/assets/libs/tiny_mce/plugins/advimage/js/image.js +0 -462
  142. data/app/assets/libs/tiny_mce/plugins/advimage/langs/en_dlg.js +0 -1
  143. data/app/assets/libs/tiny_mce/plugins/advlink/css/advlink.css +0 -8
  144. data/app/assets/libs/tiny_mce/plugins/advlink/editor_plugin.js +0 -1
  145. data/app/assets/libs/tiny_mce/plugins/advlink/editor_plugin_src.js +0 -61
  146. data/app/assets/libs/tiny_mce/plugins/advlink/js/advlink.js +0 -539
  147. data/app/assets/libs/tiny_mce/plugins/advlink/langs/en_dlg.js +0 -1
  148. data/app/assets/libs/tiny_mce/plugins/advlink/link.htm +0 -338
  149. data/app/assets/libs/tiny_mce/plugins/autolink/editor_plugin.js +0 -1
  150. data/app/assets/libs/tiny_mce/plugins/autolink/editor_plugin_src.js +0 -174
  151. data/app/assets/libs/tiny_mce/plugins/inlinepopups/editor_plugin.js +0 -1
  152. data/app/assets/libs/tiny_mce/plugins/inlinepopups/editor_plugin_src.js +0 -699
  153. data/app/assets/libs/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif +0 -0
  154. data/app/assets/libs/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif +0 -0
  155. data/app/assets/libs/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif +0 -0
  156. data/app/assets/libs/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif +0 -0
  157. data/app/assets/libs/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif +0 -0
  158. data/app/assets/libs/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif +0 -0
  159. data/app/assets/libs/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif +0 -0
  160. data/app/assets/libs/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css +0 -90
  161. data/app/assets/libs/tiny_mce/plugins/inlinepopups/template.htm +0 -387
  162. data/app/assets/libs/tiny_mce/plugins/lists/editor_plugin.js +0 -1
  163. data/app/assets/libs/tiny_mce/plugins/lists/editor_plugin_src.js +0 -951
  164. data/app/assets/libs/tiny_mce/plugins/media/css/media.css +0 -17
  165. data/app/assets/libs/tiny_mce/plugins/media/editor_plugin.js +0 -1
  166. data/app/assets/libs/tiny_mce/plugins/media/editor_plugin_src.js +0 -890
  167. data/app/assets/libs/tiny_mce/plugins/media/js/embed.js +0 -73
  168. data/app/assets/libs/tiny_mce/plugins/media/js/media.js +0 -470
  169. data/app/assets/libs/tiny_mce/plugins/media/langs/en_dlg.js +0 -1
  170. data/app/assets/libs/tiny_mce/plugins/media/media.htm +0 -922
  171. data/app/assets/libs/tiny_mce/plugins/media/moxieplayer.swf +0 -0
  172. data/app/assets/libs/tiny_mce/plugins/paste/editor_plugin.js +0 -1
  173. data/app/assets/libs/tiny_mce/plugins/paste/editor_plugin_src.js +0 -871
  174. data/app/assets/libs/tiny_mce/plugins/paste/js/pastetext.js +0 -36
  175. data/app/assets/libs/tiny_mce/plugins/paste/js/pasteword.js +0 -51
  176. data/app/assets/libs/tiny_mce/plugins/paste/langs/en_dlg.js +0 -1
  177. data/app/assets/libs/tiny_mce/plugins/paste/pastetext.htm +0 -27
  178. data/app/assets/libs/tiny_mce/plugins/paste/pasteword.htm +0 -21
  179. data/app/assets/libs/tiny_mce/plugins/table/cell.htm +0 -180
  180. data/app/assets/libs/tiny_mce/plugins/table/css/cell.css +0 -17
  181. data/app/assets/libs/tiny_mce/plugins/table/css/row.css +0 -25
  182. data/app/assets/libs/tiny_mce/plugins/table/css/table.css +0 -13
  183. data/app/assets/libs/tiny_mce/plugins/table/editor_plugin.js +0 -1
  184. data/app/assets/libs/tiny_mce/plugins/table/editor_plugin_src.js +0 -1428
  185. data/app/assets/libs/tiny_mce/plugins/table/js/cell.js +0 -319
  186. data/app/assets/libs/tiny_mce/plugins/table/js/merge_cells.js +0 -27
  187. data/app/assets/libs/tiny_mce/plugins/table/js/row.js +0 -237
  188. data/app/assets/libs/tiny_mce/plugins/table/js/table.js +0 -489
  189. data/app/assets/libs/tiny_mce/plugins/table/langs/en_dlg.js +0 -1
  190. data/app/assets/libs/tiny_mce/plugins/table/merge_cells.htm +0 -32
  191. data/app/assets/libs/tiny_mce/plugins/table/row.htm +0 -158
  192. data/app/assets/libs/tiny_mce/plugins/table/table.htm +0 -188
  193. data/app/assets/libs/tiny_mce/themes/advanced/about.htm +0 -52
  194. data/app/assets/libs/tiny_mce/themes/advanced/anchor.htm +0 -26
  195. data/app/assets/libs/tiny_mce/themes/advanced/charmap.htm +0 -55
  196. data/app/assets/libs/tiny_mce/themes/advanced/color_picker.htm +0 -70
  197. data/app/assets/libs/tiny_mce/themes/advanced/editor_template.js +0 -1
  198. data/app/assets/libs/tiny_mce/themes/advanced/editor_template_src.js +0 -1467
  199. data/app/assets/libs/tiny_mce/themes/advanced/image.htm +0 -80
  200. data/app/assets/libs/tiny_mce/themes/advanced/img/colorpicker.jpg +0 -0
  201. data/app/assets/libs/tiny_mce/themes/advanced/img/flash.gif +0 -0
  202. data/app/assets/libs/tiny_mce/themes/advanced/img/icons.gif +0 -0
  203. data/app/assets/libs/tiny_mce/themes/advanced/img/iframe.gif +0 -0
  204. data/app/assets/libs/tiny_mce/themes/advanced/img/pagebreak.gif +0 -0
  205. data/app/assets/libs/tiny_mce/themes/advanced/img/quicktime.gif +0 -0
  206. data/app/assets/libs/tiny_mce/themes/advanced/img/realmedia.gif +0 -0
  207. data/app/assets/libs/tiny_mce/themes/advanced/img/shockwave.gif +0 -0
  208. data/app/assets/libs/tiny_mce/themes/advanced/img/trans.gif +0 -0
  209. data/app/assets/libs/tiny_mce/themes/advanced/img/video.gif +0 -0
  210. data/app/assets/libs/tiny_mce/themes/advanced/img/windowsmedia.gif +0 -0
  211. data/app/assets/libs/tiny_mce/themes/advanced/js/about.js +0 -73
  212. data/app/assets/libs/tiny_mce/themes/advanced/js/anchor.js +0 -44
  213. data/app/assets/libs/tiny_mce/themes/advanced/js/charmap.js +0 -363
  214. data/app/assets/libs/tiny_mce/themes/advanced/js/color_picker.js +0 -345
  215. data/app/assets/libs/tiny_mce/themes/advanced/js/image.js +0 -251
  216. data/app/assets/libs/tiny_mce/themes/advanced/js/link.js +0 -153
  217. data/app/assets/libs/tiny_mce/themes/advanced/js/source_editor.js +0 -78
  218. data/app/assets/libs/tiny_mce/themes/advanced/langs/en.js +0 -1
  219. data/app/assets/libs/tiny_mce/themes/advanced/langs/en_dlg.js +0 -1
  220. data/app/assets/libs/tiny_mce/themes/advanced/link.htm +0 -57
  221. data/app/assets/libs/tiny_mce/themes/advanced/shortcuts.htm +0 -47
  222. data/app/assets/libs/tiny_mce/themes/advanced/skins/default/content.css +0 -51
  223. data/app/assets/libs/tiny_mce/themes/advanced/skins/default/dialog.css +0 -118
  224. data/app/assets/libs/tiny_mce/themes/advanced/skins/default/img/buttons.png +0 -0
  225. data/app/assets/libs/tiny_mce/themes/advanced/skins/default/img/items.gif +0 -0
  226. data/app/assets/libs/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif +0 -0
  227. data/app/assets/libs/tiny_mce/themes/advanced/skins/default/img/menu_check.gif +0 -0
  228. data/app/assets/libs/tiny_mce/themes/advanced/skins/default/img/progress.gif +0 -0
  229. data/app/assets/libs/tiny_mce/themes/advanced/skins/default/img/tabs.gif +0 -0
  230. data/app/assets/libs/tiny_mce/themes/advanced/skins/default/ui.css +0 -215
  231. data/app/assets/libs/tiny_mce/themes/advanced/skins/highcontrast/content.css +0 -25
  232. data/app/assets/libs/tiny_mce/themes/advanced/skins/highcontrast/dialog.css +0 -106
  233. data/app/assets/libs/tiny_mce/themes/advanced/skins/highcontrast/ui.css +0 -102
  234. data/app/assets/libs/tiny_mce/themes/advanced/skins/o2k7/content.css +0 -49
  235. data/app/assets/libs/tiny_mce/themes/advanced/skins/o2k7/dialog.css +0 -118
  236. data/app/assets/libs/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png +0 -0
  237. data/app/assets/libs/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png +0 -0
  238. data/app/assets/libs/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png +0 -0
  239. data/app/assets/libs/tiny_mce/themes/advanced/skins/o2k7/ui.css +0 -218
  240. data/app/assets/libs/tiny_mce/themes/advanced/skins/o2k7/ui_black.css +0 -8
  241. data/app/assets/libs/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css +0 -5
  242. data/app/assets/libs/tiny_mce/themes/advanced/source_editor.htm +0 -25
  243. data/app/assets/libs/tiny_mce/themes/simple/editor_template.js +0 -1
  244. data/app/assets/libs/tiny_mce/themes/simple/editor_template_src.js +0 -84
  245. data/app/assets/libs/tiny_mce/themes/simple/img/icons.gif +0 -0
  246. data/app/assets/libs/tiny_mce/themes/simple/langs/en.js +0 -1
  247. data/app/assets/libs/tiny_mce/themes/simple/skins/default/content.css +0 -25
  248. data/app/assets/libs/tiny_mce/themes/simple/skins/default/ui.css +0 -32
  249. data/app/assets/libs/tiny_mce/themes/simple/skins/o2k7/content.css +0 -17
  250. data/app/assets/libs/tiny_mce/themes/simple/skins/o2k7/img/button_bg.png +0 -0
  251. data/app/assets/libs/tiny_mce/themes/simple/skins/o2k7/ui.css +0 -35
  252. data/app/assets/libs/tiny_mce/tiny_mce.js +0 -1
  253. data/app/assets/libs/tiny_mce/tiny_mce_popup.js +0 -5
  254. data/app/assets/libs/tiny_mce/tiny_mce_src.js +0 -16753
  255. data/app/assets/libs/tiny_mce/utils/editable_selects.js +0 -70
  256. data/app/assets/libs/tiny_mce/utils/form_utils.js +0 -210
  257. data/app/assets/libs/tiny_mce/utils/mctabs.js +0 -162
  258. data/app/assets/libs/tiny_mce/utils/validate.js +0 -252
  259. data/app/models/concerns/spud_authentication.rb +0 -10
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZjBkMzVhN2EyNDg1MmJkZjk1ZDdhOTBhOWUzZWM2Y2FjZGM0ZTY1MQ==
5
- data.tar.gz: !binary |-
6
- MmRiZjAxMjg4ZmNiNDZjNjRmZDEwZTM3ZTJjZDg1ZTk0MWY5OTA4Nw==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- YjZjZTJjYzMyYWI0ZDU3NjViYzYwOTU0Mjk3MDQxNmMyMGY5NWJkYTU3YjVi
10
- NTNhYzgwNTJiNDhiNmYwNDEzYjYyZTQxNDRmMDlhMTkyNzUzZGM2OTk5YTgx
11
- NDExNzg0NDRlMDM2MzI4OGY2MjU0YzBkNzVhMmNmMGEwNDhjNDM=
12
- data.tar.gz: !binary |-
13
- NDg0MzgyNzllZjEwZTIzMTdmYjk2OTcwOGM2MGM2OWUxZDVhMDU0M2EzYzFh
14
- MmJiMTk0NGQ2YmViOWM1Yzk0YTRjY2RkZDIxZGVjYTQ4YWY5MTMwYmQxY2M4
15
- MTk0MDg1NzIzMTI0ZjZmM2ZlOGI5NzI1NzZhYzUzN2VkZTUyNTE=
2
+ SHA1:
3
+ metadata.gz: 82e2cb963cff65ecfe9bce4a017ef9e7db5d8078
4
+ data.tar.gz: 366d9efb54c2822b29f656ba96b69786695e41a1
5
+ SHA512:
6
+ metadata.gz: 39d98a5216017a2cd7c338ca3a462032e917b2776212792c1afe6e0fa196df88963c065264b519189156c3002000a3b880afd2532e3095ec0228b3c90017b483
7
+ data.tar.gz: 7cbf045bb40e1abb89c5d1bd8b0d171d0688282e61173890f3952d43f614a56dec3c2421234d4b28fb8c5df81c98b66bbe5d246baade90ec06338d40d351fb13
data/README.md CHANGED
@@ -1,13 +1,21 @@
1
1
  Twice Baked Core
2
2
  ================
3
3
 
4
- TB Core is the base Twice Baked engine that provides user authentication, roles, and an admin dashboard upon which CRUD apps can be built. Use TB Core to power content-managed websites or as a quick-and-simple way to add a backend to your existing data models.
4
+ TB Core is the base Twice Baked engine that provides user authentication, roles, and an admin dashboard upon which CRUD apps can be built. Use TB Core to power content-managed websites or as a quick-and-simple way to add a backend to your existing data models.
5
+
6
+ Requirements
7
+ -----------
8
+
9
+ TB Core 1.2.x and higher requires Rails 4 and is developed using Ruby 2.1. Lower versions of Ruby may continue to work but are not heavily tested.
10
+
11
+ For Rails 3 compatiblity, stick to TB Core 1.1.x.
5
12
 
6
13
  Installation/Usage
7
14
  ------------------
8
15
 
9
16
  1. In your Gemfile add the following
10
17
 
18
+ gem 'authlogic', :github => 'binarylogic/authlogic', :ref => 'abc09970ed1fad98c6c12f4ca64d1670d37d11db'
11
19
  gem 'tb_core'
12
20
 
13
21
  2. Run bundle install
@@ -18,6 +26,7 @@ Installation/Usage
18
26
 
19
27
  4. run a rails server instance and point your browser to /admin
20
28
 
29
+ **Note about Authlogic:** The version of Authlogic up on Rubygems.org at the time of this writing is not fully compatible with Rails 4. Until an improved version is released, we are pointing to a more recent commit that contains various Rails 4 fixes.
21
30
 
22
31
  Setup Tasks
23
32
  -----------
@@ -42,7 +51,7 @@ The core engine provides various configuration options.
42
51
  - `site_name`: Controls the site name displayed in the dashboard and `tb_page_title` view helper.
43
52
  - `from_address`: Sender address used for password resets and other mailers.
44
53
  - `not_found_template`: ERB template used for 404 exceptions. Defaults to `layouts/not_found`.
45
- - `production_alert_domain`: When set, displays a prominent warning bar in the admin dashboard directing users to the production domain. Intended for staging websites. ex: `www.westlakedesign.com`.
54
+ - `production_alert_domain`: When set, displays a prominent warning bar in the admin dashboard directing users to the production domain. You should only set this value in `config/environments/staging.rb`.
46
55
 
47
56
  Adding Apps to the Dashboard
48
57
  ----------------------------
@@ -97,6 +106,45 @@ Finally, custom permissions may optionally be tied to one or more dashboard apps
97
106
  :apps => [:clients, :projects]
98
107
  }]
99
108
 
109
+ Extending the User Model
110
+ ------------------------
111
+
112
+ A common requirement is to add custom fields and functionality to the base `spud_user` model. We have provided several spots where you can do this.
113
+
114
+ ### Adding custom methods and attributes to the SpudUser class
115
+
116
+ Create a file in your app at `app/models/spud_user.rb`, and build a class called `SpudUser` that extends from `Spud::SpudUserModel`. You do not need any explicit requires - the autoloader will take care of the rest.
117
+
118
+ class SpudUser < Spud::SpudUserModel
119
+ has_attached_file :avatar
120
+ attr_accessible :avatar
121
+ def say_hello
122
+ return "Hello, World!"
123
+ end
124
+ end
125
+
126
+ ### Adding fields to the add/edit user form
127
+
128
+ Create a file in your app at `app/views/admin/users/_form_additions.html.erb`.
129
+
130
+ <div class="control-group">
131
+ <%= f.label :avatar, :class=>"control-label"%>
132
+ <div class="controls">
133
+ <%= f.file_field :avatar %>
134
+ </div>
135
+ </div>
136
+
137
+ ### Adding fields to the user show action
138
+
139
+ Create a file in your app at `app/views/admin/users/_show_additions.html.erb`.
140
+
141
+ <% if @user.avatar_file_name %>
142
+ <dt>Avatar</dt>
143
+ <dd>
144
+ <%= image_tag @user.avatar.url(:thumb) %>
145
+ </dd>
146
+ <% end %>
147
+
100
148
  404 Handling
101
149
  ------------
102
150
 
@@ -1,8 +1,8 @@
1
1
  //= require jquery
2
2
  //= require jquery_ujs
3
3
  //= require admin/core/preinit
4
- //= require tiny_mce/jquery.tinymce.js
5
- //= require tiny_mce/tiny_mce_src.js
4
+ //= require tinymce-jquery
5
+ //= require tinymce/plugins/tableDropdown/editor_plugin
6
6
  //= require bootstrap/js/bootstrap
7
7
  //= require datepicker/js/bootstrap-datepicker
8
8
  //= require jquery-ui/js/jquery-ui-1.9.1.custom
@@ -95,6 +95,7 @@ spud.admin.editor = {};
95
95
 
96
96
  $(element).tinymce({
97
97
  theme: theme,
98
+ language: 'en',
98
99
  plugins: registeredPlugins.join(','),
99
100
  theme_advanced_toolbar_location: "top",
100
101
  theme_advanced_buttons1: buttons[0].join(','),
@@ -1 +1 @@
1
- window.tinyMCEPreInit = {base: "/assets/tiny_mce", suffix:''};
1
+ //window.tinyMCEPreInit = {base: "/assets/tiny_mce", suffix:''};
@@ -134,5 +134,9 @@ spud.admin.SplitPane = (function(){
134
134
  this.leftPane.html(html);
135
135
  };
136
136
 
137
+ SplitPane.prototype.find = function(selector){
138
+ return this.contentArea.find(selector);
139
+ };
140
+
137
141
  return SplitPane;
138
142
  })();
@@ -11,11 +11,15 @@ spud.admin.users = {
11
11
  $('.admin-users-split-pane').on('click', '.admin-user-delete-btn', clickedDeleteUser);
12
12
  $('.admin-users-split-pane').on('submit', '.admin-user-form', submittedUserForm);
13
13
  $('body').on('click', '.split-pane-refresh-btn', clickedRefreshButton);
14
+ if(typeof(FormData) != 'undefined'){
15
+ _html5Upload = true;
16
+ }
14
17
  }
15
18
  };
16
19
 
17
20
  var _userHtmlCache;
18
21
  var _previouslySelected;
22
+ var _html5Upload;
19
23
 
20
24
  var clickedAddEditUser = function(e){
21
25
  e.preventDefault();
@@ -32,6 +36,11 @@ var clickedAddEditUser = function(e){
32
36
  success:function(html){
33
37
  splitPane.setContentAreaHtml(html);
34
38
  splitPane.setToolbarTitle(title);
39
+ if(!_html5Upload){
40
+ splitPane.find('input[type=file]').each(function(){
41
+ $(this).replaceWith('<em>File upload requires an HTML5-capable browser.</em>');
42
+ });
43
+ }
35
44
  }
36
45
  });
37
46
  };
@@ -61,18 +70,56 @@ var submittedUserForm = function(e){
61
70
  e.preventDefault();
62
71
  var form = $(this);
63
72
  var url = form.attr('action');
64
- $.ajax(url, {
65
- dataType:'html',
66
- type: 'post',
67
- data: form.serialize(),
68
- success:function(html, textStatus, jqXHR){
69
- splitPane.setContentAreaHtml(html);
70
- splitPane.refreshList();
71
- },
72
- error:function(jqXHR, textStatus, errorThrown){
73
- splitPane.setContentAreaHtml(jqXHR.responseText);
74
- }
75
- });
73
+
74
+ var submit = form.find('input[type=submit]');
75
+ submit.val(submit.attr('data-loading-text')).attr('disabled', true);
76
+
77
+ if(_html5Upload){
78
+ var fd = new FormData();
79
+ form.find('input, select').each(function(i, input){
80
+ input = $(input);
81
+ var name = input.prop('name');
82
+ var type = input.attr('type');
83
+ if(type == 'file'){
84
+ var file = input[0].files[0];
85
+ if(file !== undefined){
86
+ fd.append(name, file);
87
+ }
88
+ }
89
+ else if(type == 'checkbox'){
90
+ if(input.is(':checked')){
91
+ fd.append(name, input.val());
92
+ }
93
+ }
94
+ else{
95
+ fd.append(name, input.val());
96
+ }
97
+ });
98
+ var xhr = new XMLHttpRequest();
99
+ xhr.addEventListener('load', function(e){
100
+ splitPane.setContentAreaHtml(e.target.response);
101
+ if(this.status >= 200 && this.status < 400){
102
+ splitPane.refreshList();
103
+ }
104
+ });
105
+ xhr.open('POST', url);
106
+ xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
107
+ xhr.send(fd);
108
+ }
109
+ else{
110
+ $.ajax(url, {
111
+ dataType:'html',
112
+ type: 'post',
113
+ data: form.serialize(),
114
+ success:function(html, textStatus, jqXHR){
115
+ splitPane.setContentAreaHtml(html);
116
+ splitPane.refreshList();
117
+ },
118
+ error:function(jqXHR, textStatus, errorThrown){
119
+ splitPane.setContentAreaHtml(jqXHR.responseText);
120
+ }
121
+ });
122
+ }
76
123
  };
77
124
 
78
125
  var clickedRefreshButton = function(e){
@@ -1,12 +1,12 @@
1
- /*!
2
- * Bootstrap v2.2.1
3
- *
4
- * Copyright 2012 Twitter, Inc
5
- * Licensed under the Apache License v2.0
6
- * http://www.apache.org/licenses/LICENSE-2.0
7
- *
8
- * Designed and built with all the love in the world @twitter by @mdo and @fat.
9
- */
1
+ //
2
+ //Bootstrap v2.2.1
3
+ //
4
+ //Copyright 2012 Twitter, Inc
5
+ //Licensed under the Apache License v2.0
6
+ //http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ //Designed and built with all the love in the world @twitter by @mdo and @fat.
9
+ //
10
10
 
11
11
  article,
12
12
  aside,
@@ -2151,7 +2151,7 @@ table th[class*="span"],
2151
2151
  *margin-right: .3em;
2152
2152
  line-height: 14px;
2153
2153
  vertical-align: text-top;
2154
- background-image: url("/assets/bootstrap/img/glyphicons-halflings.png");
2154
+ background-image: image-url("bootstrap/img/glyphicons-halflings.png");
2155
2155
  background-position: 14px 14px;
2156
2156
  background-repeat: no-repeat;
2157
2157
  }
@@ -2171,7 +2171,7 @@ table th[class*="span"],
2171
2171
  .dropdown-menu > .active > a > [class*=" icon-"],
2172
2172
  .dropdown-submenu:hover > a > [class^="icon-"],
2173
2173
  .dropdown-submenu:hover > a > [class*=" icon-"] {
2174
- background-image: url("/assets/bootstrap/img/glyphicons-halflings-white.png");
2174
+ background-image: image-url("bootstrap/img/glyphicons-halflings-white.png");
2175
2175
  }
2176
2176
 
2177
2177
  .icon-glass {
@@ -39,7 +39,6 @@ private
39
39
  if(session[:admin_site] == nil)
40
40
  session[:admin_site] = 0
41
41
  end
42
-
43
42
  end
44
43
 
45
44
  def multisite_caching
@@ -7,7 +7,7 @@ class Admin::RolesController < Admin::ApplicationController
7
7
  add_breadcrumb "Roles", :admin_roles_path
8
8
 
9
9
  def index
10
- @roles = SpudRole.all
10
+ @roles = SpudRole.includes(:spud_role_permissions)
11
11
  respond_with @roles
12
12
  end
13
13
 
@@ -21,7 +21,9 @@ class Admin::RolesController < Admin::ApplicationController
21
21
  end
22
22
 
23
23
  def create
24
- @role = SpudRole.new(params[:spud_role])
24
+ logger.debug 'role_params:'
25
+ logger.debug role_params
26
+ @role = SpudRole.new(role_params)
25
27
  flash[:notice] = 'SpudRole created successfully' if @role.save
26
28
  respond_with @role, :location => admin_roles_path
27
29
  end
@@ -31,8 +33,8 @@ class Admin::RolesController < Admin::ApplicationController
31
33
  end
32
34
 
33
35
  def update
34
- params[:spud_role][:permission_tags] ||= []
35
- if @role.update_attributes(params[:spud_role])
36
+ #role_params[:permission_tags] ||= []
37
+ if @role.update_attributes(role_params)
36
38
  flash[:notice] = 'SpudRole updated successfully'
37
39
  end
38
40
  respond_with @role, :location => admin_roles_path
@@ -55,4 +57,8 @@ class Admin::RolesController < Admin::ApplicationController
55
57
  end
56
58
  end
57
59
 
60
+ def role_params
61
+ params.require(:spud_role).permit(:name, :permission_tags => [])
62
+ end
63
+
58
64
  end
@@ -14,10 +14,18 @@ class Admin::SettingsController < Admin::ApplicationController
14
14
  end
15
15
 
16
16
  def update
17
- if @current_user.update_attributes(params[:spud_user].slice :login,:first_name,:last_name,:email,:password,:password_confirmation,:time_zone)
17
+ if @current_user.update_attributes(user_params)
18
18
  flash[:notice] = "User settings saved successfully."
19
+ respond_with @current_user, :location => admin_settings_path
20
+ else
21
+ render 'edit'
19
22
  end
20
- render 'edit'
23
+ end
24
+
25
+ private
26
+
27
+ def user_params
28
+ params.require(:spud_user).permit(:login, :first_name, :last_name, :email, :password, :password_confirmation, :time_zone)
21
29
  end
22
30
 
23
31
  end
@@ -12,7 +12,7 @@ class Admin::SetupController < Admin::ApplicationController
12
12
  end
13
13
 
14
14
  def create
15
- @spud_user = SpudUser.new(params[:spud_user])
15
+ @spud_user = SpudUser.new(user_params)
16
16
  @spud_user.super_admin = true
17
17
  if @spud_user.save
18
18
  redirect_to admin_root_path
@@ -21,4 +21,10 @@ class Admin::SetupController < Admin::ApplicationController
21
21
  end
22
22
  end
23
23
 
24
+ private
25
+
26
+ def user_params
27
+ params.require(:spud_user).permit(:login, :email, :password, :password_confirmation)
28
+ end
29
+
24
30
  end
@@ -33,7 +33,7 @@ class Admin::UsersController < Admin::ApplicationController
33
33
  end
34
34
 
35
35
  def create
36
- @user = SpudUser.new(params[:spud_user], :as => :admin)
36
+ @user = SpudUser.new(user_params)
37
37
  if @user.save
38
38
  render 'show', :status => 200
39
39
  else
@@ -46,7 +46,7 @@ class Admin::UsersController < Admin::ApplicationController
46
46
  end
47
47
 
48
48
  def update
49
- @user.update_attributes(params[:spud_user], :as => :admin)
49
+ @user.update_attributes(user_params)
50
50
  respond_with @user, :location => admin_user_path(@user), :status => 200
51
51
  end
52
52
 
@@ -66,4 +66,10 @@ private
66
66
  return true
67
67
  end
68
68
 
69
+ # attr_accessible :login,:email,:first_name,:last_name,:password,:password_confirmation,:password_salt,:last_login_at,:last_request_at,:last_login_ip,:failed_login_count,:current_login_at,:login_count,:persistence_token,:perishable_token,:single_access_token,:crypted_password, :current_login_ip, :created_at, :updated_at,:time_zone, :as => [:default, :admin]
70
+ # attr_accessible :super_admin, :spud_role_id, :id, :as => :admin
71
+ def user_params
72
+ params.require(:spud_user).permit!
73
+ end
74
+
69
75
  end
@@ -1,6 +1,5 @@
1
1
  class SitemapsController < Spud::ApplicationController
2
2
  respond_to :xml
3
- caches_page :show,:expires_in => 1.day
4
3
  def show
5
4
  @sitemap_urls = Spud::Core.sitemap_urls
6
5
  respond_with @sitemap_urls
@@ -1,8 +1,7 @@
1
1
  class Spud::ApplicationController < ActionController::Base
2
2
 
3
- unloadable
4
3
  protect_from_forgery
5
- helper_method :current_user_session, :current_user
4
+ helper_method :current_user_session, :current_user, :current_user_id
6
5
  around_filter :set_time_zone
7
6
 
8
7
  if Spud::Core.multisite_mode_enabled
@@ -33,6 +32,14 @@ private
33
32
  @current_user = current_user_session && current_user_session.spud_user
34
33
  end
35
34
 
35
+ def current_user_id
36
+ if @current_user
37
+ return @current_user.id
38
+ else
39
+ 0
40
+ end
41
+ end
42
+
36
43
  def require_user
37
44
  unless current_user
38
45
  store_location
@@ -24,4 +24,25 @@ module Spud::ApplicationHelper
24
24
  return config[:site_id] unless config.blank?
25
25
  end
26
26
 
27
+ def cache_key_for_spud_collection(collection, key:'view', cache_params:[], for_user:false)
28
+ cache_keys = [controller_name, action_name, key]
29
+ cache_keys << collection.collect(&:updated_at).max().try(:utc).try(:to_i)
30
+ if for_user
31
+ cache_keys << current_user_id
32
+ end
33
+ if cache_params.any?
34
+ cache_keys += cache_params.collect{ |cache_param| params[cache_param] || 'nil' }
35
+ end
36
+ if Spud::Core.multisite_mode_enabled
37
+ cache_keys.unshift(current_site_id)
38
+ end
39
+ cache_keys += collection.collect(&:id)
40
+ cache_key = cache_keys.join('/')
41
+ if cache_key.length > 250
42
+ return Digest::SHA1.hexdigest(cache_key)
43
+ else
44
+ return cache_key
45
+ end
46
+ end
47
+
27
48
  end
@@ -0,0 +1,79 @@
1
+ class Spud::SpudUserModel < ActiveRecord::Base
2
+ self.table_name = 'spud_users'
3
+ acts_as_authentic
4
+
5
+ belongs_to :role, :class_name => 'SpudRole', :foreign_key => 'spud_role_id'
6
+ has_many :spud_user_settings
7
+
8
+ def full_name
9
+ if first_name.blank? && last_name.blank?
10
+ return self.login
11
+ end
12
+ if self.first_name.blank?
13
+ return self.last_name
14
+ elsif self.last_name.blank?
15
+ return self.first_name
16
+ end
17
+ return "#{self.first_name} #{self.last_name}"
18
+ end
19
+
20
+ # Returns true if user can view at least one dashboard app
21
+ def has_admin_rights?
22
+ if self.super_admin?
23
+ return true
24
+ else
25
+ return Spud::Core.admin_applications.find{ |app| self.can_view_app?(app) }.present?
26
+ end
27
+ end
28
+
29
+ # Returns true if the user can view a spud app based on it's key
30
+ def can_view_app?(admin_application)
31
+ if self.super_admin?
32
+ return true
33
+ else
34
+ key = admin_application[:key]
35
+ return self.permissions.find{ |p| p.apps.include?(key) }.present?
36
+ end
37
+ end
38
+
39
+ # Check if a user has a given list of permissions
40
+ #
41
+ # * if one tag is supplied, return true if the tag matches
42
+ # * if multiple tags are supplied, return true if ALL tags match
43
+ def has_permission?(*tags)
44
+ if self.super_admin?
45
+ return true
46
+ else
47
+ my_tags = self.permissions.collect(&:tag)
48
+ return tags.find{ |tag| !my_tags.include?(tag) }.blank?
49
+ end
50
+ end
51
+
52
+ # Check if a user has at least one out of a given list of permissions
53
+ #
54
+ # * if one tag is supplied, return true if the tag matches
55
+ # * if multiple tags are supplied, return true if ANY tag matches
56
+ def has_any_permission?(*tags)
57
+ if self.super_admin?
58
+ return true
59
+ else
60
+ return self.permissions.find{ |p| tags.include?(p.tag) }.present?
61
+ end
62
+ end
63
+
64
+ # Return a list of SpudPermission objects for the user's SpudRole
65
+ def permissions
66
+ if !self.role
67
+ return []
68
+ else
69
+ return self.role.permissions
70
+ end
71
+ end
72
+
73
+ # Returns an ActiveRecord::Relation performing a LIKE query against name columns
74
+ def self.where_name_like(string)
75
+ like = '%' + string + '%'
76
+ return self.where('login like ? or concat(`first_name`, " ", `last_name`) like ?', like, like)
77
+ end
78
+
79
+ end
@@ -1,5 +1,4 @@
1
1
  class SpudRole < ActiveRecord::Base
2
- attr_accessible :name, :permission_tags
3
2
 
4
3
  has_many :spud_role_permissions, :dependent => :destroy
5
4
  has_many :users, :class_name => 'SpudUser'
@@ -1,5 +1,4 @@
1
1
  class SpudRolePermission < ActiveRecord::Base
2
- attr_accessible :spud_permission_tag, :spud_role_id, :tag
3
2
  belongs_to :spud_role
4
3
 
5
4
  def permission
@@ -1,81 +1,3 @@
1
- class SpudUser < ActiveRecord::Base
2
- include Concerns::SpudAuthentication
3
-
4
- belongs_to :role, :class_name => 'SpudRole', :foreign_key => 'spud_role_id'
5
- has_many :spud_user_settings
6
-
7
- attr_accessible :login,:email,:first_name,:last_name,:password,:password_confirmation,:password_salt,:last_login_at,:last_request_at,:last_login_ip,:failed_login_count,:current_login_at,:login_count,:persistence_token,:perishable_token,:single_access_token,:crypted_password, :current_login_ip, :created_at, :updated_at,:time_zone, :as => [:default, :admin]
8
- attr_accessible :super_admin, :spud_role_id, :id, :as => :admin
9
-
10
- def full_name
11
- if first_name.blank? && last_name.blank?
12
- return self.login
13
- end
14
- if self.first_name.blank?
15
- return self.last_name
16
- elsif self.last_name.blank?
17
- return self.first_name
18
- end
19
- return "#{self.first_name} #{self.last_name}"
20
- end
21
-
22
- # Returns true if user can view at least one dashboard app
23
- def has_admin_rights?
24
- if self.super_admin?
25
- return true
26
- else
27
- return Spud::Core.admin_applications.find{ |app| self.can_view_app?(app) }.present?
28
- end
29
- end
30
-
31
- # Returns true if the user can view a spud app based on it's key
32
- def can_view_app?(admin_application)
33
- if self.super_admin?
34
- return true
35
- else
36
- key = admin_application[:key]
37
- return self.permissions.find{ |p| p.apps.include?(key) }.present?
38
- end
39
- end
40
-
41
- # Check if a user has a given list of permissions
42
- #
43
- # * if one tag is supplied, return true if the tag matches
44
- # * if multiple tags are supplied, return true if ALL tags match
45
- def has_permission?(*tags)
46
- if self.super_admin?
47
- return true
48
- else
49
- my_tags = self.permissions.collect(&:tag)
50
- return tags.find{ |tag| !my_tags.include?(tag) }.blank?
51
- end
52
- end
53
-
54
- # Check if a user has at least one out of a given list of permissions
55
- #
56
- # * if one tag is supplied, return true if the tag matches
57
- # * if multiple tags are supplied, return true if ANY tag matches
58
- def has_any_permission?(*tags)
59
- if self.super_admin?
60
- return true
61
- else
62
- return self.permissions.find{ |p| tags.include?(p.tag) }.present?
63
- end
64
- end
65
-
66
- # Return a list of SpudPermission objects for the user's SpudRole
67
- def permissions
68
- if !self.role
69
- return []
70
- else
71
- return self.role.permissions
72
- end
73
- end
74
-
75
- # Returns an ActiveRecord::Relation performing a LIKE query against name columns
76
- def self.where_name_like(string)
77
- like = '%' + string + '%'
78
- return self.where('login like ? or concat(`first_name`, " ", `last_name`) like ?', like, like)
79
- end
80
-
1
+ class SpudUser < Spud::SpudUserModel
2
+ # Copy this file to your app to extend the base SpudUser model
81
3
  end
@@ -5,11 +5,12 @@
5
5
  <% end %>
6
6
 
7
7
  <% content_for :detail do %>
8
- <table class="admin-table data-table">
8
+ <table class="table table-striped">
9
9
  <thead>
10
10
  <tr>
11
11
  <th>Name</th>
12
12
  <th># Users</th>
13
+ <th>Permissions</th>
13
14
  <th></th>
14
15
  </tr>
15
16
  </thead>
@@ -18,9 +19,10 @@
18
19
  <tr>
19
20
  <td><%= role.name %></td>
20
21
  <td><%= role.users.count %></td>
22
+ <td><%= role.permissions.collect(&:name).join(', ') %></td>
21
23
  <td align="right">
22
24
  <%= link_to 'Edit', edit_admin_role_path(role), :class => 'btn btn-mini' %>
23
- <%= link_to 'Delete', admin_role_path(role), :method => :delete, :confirm => 'Are you sure?', :class => 'btn btn-mini btn-danger' %>
25
+ <%= link_to 'Delete', admin_role_path(role), :method => :delete, :data => {:confirm => 'Are you sure?'}, :class => 'btn btn-mini btn-danger' %>
24
26
  </td>
25
27
  </tr>
26
28
  <% end %>