refinerycms-core 0.9.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (305) hide show
  1. data/app/controllers/admin/base_controller.rb +10 -0
  2. data/app/controllers/admin/dialogs_controller.rb +26 -0
  3. data/app/controllers/admin/refinery_core_controller.rb +12 -0
  4. data/app/controllers/application_controller.rb +6 -0
  5. data/app/controllers/refinery/fast_controller.rb +9 -0
  6. data/app/controllers/sitemap_controller.rb +14 -0
  7. data/app/helpers/application_helper.rb +5 -0
  8. data/app/views/admin/_head.html.erb +43 -0
  9. data/app/views/admin/_javascripts.html.erb +32 -0
  10. data/app/views/admin/_menu.html.erb +17 -0
  11. data/app/views/admin/dialogs/show.html.erb +19 -0
  12. data/app/views/layouts/admin.html.erb +24 -0
  13. data/app/views/layouts/admin_dialog.html.erb +14 -0
  14. data/app/views/layouts/application.html.erb +21 -0
  15. data/app/views/shared/_content_page.html.erb +63 -0
  16. data/app/views/shared/_draft_page_message.html.erb +3 -0
  17. data/app/views/shared/_footer.html.erb +4 -0
  18. data/app/views/shared/_google_analytics.html.erb +8 -0
  19. data/app/views/shared/_head.html.erb +42 -0
  20. data/app/views/shared/_header.html.erb +8 -0
  21. data/app/views/shared/_html_tag.html.erb +6 -0
  22. data/app/views/shared/_ie6check.html.erb +63 -0
  23. data/app/views/shared/_javascripts.html.erb +10 -0
  24. data/app/views/shared/_menu.html.erb +30 -0
  25. data/app/views/shared/_menu_branch.html.erb +26 -0
  26. data/app/views/shared/_message.html.erb +10 -0
  27. data/app/views/shared/_no_script.html.erb +9 -0
  28. data/app/views/shared/_site_bar.html.erb +25 -0
  29. data/app/views/shared/admin/_continue_editing.html.erb +3 -0
  30. data/app/views/shared/admin/_error_messages.html.erb +16 -0
  31. data/app/views/shared/admin/_form_actions.html.erb +75 -0
  32. data/app/views/shared/admin/_image_picker.html.erb +60 -0
  33. data/app/views/shared/admin/_make_sortable.html.erb +13 -0
  34. data/app/views/shared/admin/_resource_picker.html.erb +66 -0
  35. data/app/views/shared/admin/_search.html.erb +6 -0
  36. data/app/views/shared/admin/_sortable_list.html.erb +7 -0
  37. data/app/views/shared/admin/_tabbed_fields.html.erb +42 -0
  38. data/app/views/welcome.html.erb +17 -0
  39. data/app/views/wymiframe.html.erb +15 -0
  40. data/config/locales/cs.yml +77 -0
  41. data/config/locales/da.yml +75 -0
  42. data/config/locales/de.yml +75 -0
  43. data/config/locales/el.yml +75 -0
  44. data/config/locales/en.yml +75 -0
  45. data/config/locales/es.yml +68 -0
  46. data/config/locales/fr.yml +72 -0
  47. data/config/locales/it.yml +96 -0
  48. data/config/locales/lolcat.yml +68 -0
  49. data/config/locales/lt.yml +75 -0
  50. data/config/locales/lv.yml +72 -0
  51. data/config/locales/nb.yml +75 -0
  52. data/config/locales/nl.yml +75 -0
  53. data/config/locales/pl.yml +75 -0
  54. data/config/locales/pt-BR.yml +72 -0
  55. data/config/locales/rs.yml +76 -0
  56. data/config/locales/ru.yml +71 -0
  57. data/config/locales/sl.yml +72 -0
  58. data/config/locales/sv.yml +75 -0
  59. data/config/locales/vi.yml +75 -0
  60. data/config/locales/zh-CN.yml +75 -0
  61. data/config/locales/zh-TW.yml +75 -0
  62. data/config/routes.rb +19 -0
  63. data/crud.md +197 -0
  64. data/doc/included-jquery-ui-packages.jpg +0 -0
  65. data/engines.md +179 -0
  66. data/features/search.feature +55 -0
  67. data/features/site_bar.feature +24 -0
  68. data/features/step_definitions/core_steps.rb +61 -0
  69. data/features/support/paths.rb +14 -0
  70. data/features/uploads/beach.jpeg +0 -0
  71. data/features/uploads/refinery_is_awesome.txt +1 -0
  72. data/lib/gemspec.rb +43 -0
  73. data/lib/generators/refinerycms_generator.rb +110 -0
  74. data/lib/generators/templates/.gitignore +83 -0
  75. data/lib/generators/templates/app/views/sitemap/index.xml.builder +22 -0
  76. data/lib/generators/templates/autotest/autotest.rb +17 -0
  77. data/lib/generators/templates/autotest/discover.rb +2 -0
  78. data/lib/generators/templates/config/database.yml.mysql +20 -0
  79. data/lib/generators/templates/config/database.yml.postgresql +57 -0
  80. data/lib/generators/templates/config/database.yml.sqlite3 +26 -0
  81. data/lib/generators/templates/config/i18n-js.yml +6 -0
  82. data/lib/generators/templates/config/initializers/devise.rb +142 -0
  83. data/lib/generators/templates/config/settings.rb +2 -0
  84. data/lib/generators/templates/db/seeds.rb +5 -0
  85. data/lib/refinery/activity.rb +45 -0
  86. data/lib/refinery/admin/base_controller.rb +111 -0
  87. data/lib/refinery/admin_base_controller.rb +5 -0
  88. data/lib/refinery/application.rb +48 -0
  89. data/lib/refinery/application_controller.rb +120 -0
  90. data/lib/refinery/application_helper.rb +19 -0
  91. data/lib/refinery/base_presenter.rb +27 -0
  92. data/lib/refinery/catch_all_routes.rb +11 -0
  93. data/lib/refinery/crud.rb +295 -0
  94. data/lib/refinery/helpers/form_helper.rb +66 -0
  95. data/lib/refinery/helpers/head_helper.rb +17 -0
  96. data/lib/refinery/helpers/html_truncation_helper.rb +25 -0
  97. data/lib/refinery/helpers/image_helper.rb +49 -0
  98. data/lib/refinery/helpers/menu_helper.rb +68 -0
  99. data/lib/refinery/helpers/meta_helper.rb +67 -0
  100. data/lib/refinery/helpers/pagination_helper.rb +16 -0
  101. data/lib/refinery/helpers/script_helper.rb +36 -0
  102. data/lib/refinery/helpers/site_bar_helper.rb +24 -0
  103. data/lib/refinery/helpers/tag_helper.rb +21 -0
  104. data/lib/refinery/helpers/translation_helper.rb +17 -0
  105. data/lib/refinery/link_renderer.rb +55 -0
  106. data/lib/refinery/plugin.rb +106 -0
  107. data/lib/refinery/plugins.rb +75 -0
  108. data/lib/refinerycms-core.rb +156 -0
  109. data/lib/tasks/doc.rake +29 -0
  110. data/lib/tasks/refinery.rake +231 -0
  111. data/lib/tasks/yard.rake +30 -0
  112. data/license.md +21 -0
  113. data/public/404.html +26 -0
  114. data/public/422.html +26 -0
  115. data/public/500.html +26 -0
  116. data/public/favicon.ico +0 -0
  117. data/public/images/refinery/add.png +0 -0
  118. data/public/images/refinery/admin_bg.png +0 -0
  119. data/public/images/refinery/ajax-loader.gif +0 -0
  120. data/public/images/refinery/branch-end.gif +0 -0
  121. data/public/images/refinery/branch-start.gif +0 -0
  122. data/public/images/refinery/branch.gif +0 -0
  123. data/public/images/refinery/carousel-left.png +0 -0
  124. data/public/images/refinery/carousel-right.png +0 -0
  125. data/public/images/refinery/cross.png +0 -0
  126. data/public/images/refinery/dialogLoadingAnimation.gif +0 -0
  127. data/public/images/refinery/header_background.png +0 -0
  128. data/public/images/refinery/hover-gradient.jpg +0 -0
  129. data/public/images/refinery/icons/accept.png +0 -0
  130. data/public/images/refinery/icons/add.png +0 -0
  131. data/public/images/refinery/icons/ajax-loader.gif +0 -0
  132. data/public/images/refinery/icons/application_edit.png +0 -0
  133. data/public/images/refinery/icons/application_go.png +0 -0
  134. data/public/images/refinery/icons/arrow_left.png +0 -0
  135. data/public/images/refinery/icons/arrow_switch.png +0 -0
  136. data/public/images/refinery/icons/arrow_up.png +0 -0
  137. data/public/images/refinery/icons/bin.png +0 -0
  138. data/public/images/refinery/icons/bin_closed.png +0 -0
  139. data/public/images/refinery/icons/cancel.png +0 -0
  140. data/public/images/refinery/icons/cog_add.png +0 -0
  141. data/public/images/refinery/icons/cog_edit.png +0 -0
  142. data/public/images/refinery/icons/cross.png +0 -0
  143. data/public/images/refinery/icons/delete.png +0 -0
  144. data/public/images/refinery/icons/doc.png +0 -0
  145. data/public/images/refinery/icons/down.gif +0 -0
  146. data/public/images/refinery/icons/edit.png +0 -0
  147. data/public/images/refinery/icons/email.png +0 -0
  148. data/public/images/refinery/icons/email_edit.png +0 -0
  149. data/public/images/refinery/icons/email_go.png +0 -0
  150. data/public/images/refinery/icons/email_open.png +0 -0
  151. data/public/images/refinery/icons/eye.png +0 -0
  152. data/public/images/refinery/icons/folder_page_white.png +0 -0
  153. data/public/images/refinery/icons/image_add.png +0 -0
  154. data/public/images/refinery/icons/image_edit.png +0 -0
  155. data/public/images/refinery/icons/img.png +0 -0
  156. data/public/images/refinery/icons/information.png +0 -0
  157. data/public/images/refinery/icons/layout_add.png +0 -0
  158. data/public/images/refinery/icons/layout_edit.png +0 -0
  159. data/public/images/refinery/icons/music.png +0 -0
  160. data/public/images/refinery/icons/page_add.png +0 -0
  161. data/public/images/refinery/icons/page_edit.png +0 -0
  162. data/public/images/refinery/icons/page_white_edit.png +0 -0
  163. data/public/images/refinery/icons/page_white_gear.png +0 -0
  164. data/public/images/refinery/icons/page_white_put.png +0 -0
  165. data/public/images/refinery/icons/pdf.png +0 -0
  166. data/public/images/refinery/icons/ppt.png +0 -0
  167. data/public/images/refinery/icons/star.png +0 -0
  168. data/public/images/refinery/icons/tick.png +0 -0
  169. data/public/images/refinery/icons/up.gif +0 -0
  170. data/public/images/refinery/icons/user_add.png +0 -0
  171. data/public/images/refinery/icons/user_comment.png +0 -0
  172. data/public/images/refinery/icons/user_edit.png +0 -0
  173. data/public/images/refinery/icons/xls.png +0 -0
  174. data/public/images/refinery/icons/zip.png +0 -0
  175. data/public/images/refinery/icons/zoom.png +0 -0
  176. data/public/images/refinery/logo-large.png +0 -0
  177. data/public/images/refinery/logo-medium.png +0 -0
  178. data/public/images/refinery/logo-site-bar.png +0 -0
  179. data/public/images/refinery/logo-small-medium.png +0 -0
  180. data/public/images/refinery/logo-small.png +0 -0
  181. data/public/images/refinery/logo-tiny.png +0 -0
  182. data/public/images/refinery/logo.png +0 -0
  183. data/public/images/refinery/nav-3-background.gif +0 -0
  184. data/public/images/refinery/nav_inactive_background.png +0 -0
  185. data/public/images/refinery/orange_button.png +0 -0
  186. data/public/images/refinery/page_bg.png +0 -0
  187. data/public/images/refinery/resolve_digital_footer_logo.png +0 -0
  188. data/public/images/refinery/text_field_background.png +0 -0
  189. data/public/images/refinery/tooltip-nib.gif +0 -0
  190. data/public/images/refinery/tooltip-nib.png +0 -0
  191. data/public/images/wymeditor/skins/refinery/arrow_redo.png +0 -0
  192. data/public/images/wymeditor/skins/refinery/arrow_undo.png +0 -0
  193. data/public/images/wymeditor/skins/refinery/eye.png +0 -0
  194. data/public/images/wymeditor/skins/refinery/iframe/lbl-blockquote.png +0 -0
  195. data/public/images/wymeditor/skins/refinery/iframe/lbl-h1.png +0 -0
  196. data/public/images/wymeditor/skins/refinery/iframe/lbl-h2.png +0 -0
  197. data/public/images/wymeditor/skins/refinery/iframe/lbl-h3.png +0 -0
  198. data/public/images/wymeditor/skins/refinery/iframe/lbl-h4.png +0 -0
  199. data/public/images/wymeditor/skins/refinery/iframe/lbl-h5.png +0 -0
  200. data/public/images/wymeditor/skins/refinery/iframe/lbl-h6.png +0 -0
  201. data/public/images/wymeditor/skins/refinery/iframe/lbl-p.png +0 -0
  202. data/public/images/wymeditor/skins/refinery/iframe/lbl-pre.png +0 -0
  203. data/public/images/wymeditor/skins/refinery/link_add.png +0 -0
  204. data/public/images/wymeditor/skins/refinery/link_break.png +0 -0
  205. data/public/images/wymeditor/skins/refinery/page_code.png +0 -0
  206. data/public/images/wymeditor/skins/refinery/page_paste.png +0 -0
  207. data/public/images/wymeditor/skins/refinery/photo_add.png +0 -0
  208. data/public/images/wymeditor/skins/refinery/right.png +0 -0
  209. data/public/images/wymeditor/skins/refinery/style.png +0 -0
  210. data/public/images/wymeditor/skins/refinery/table_add.png +0 -0
  211. data/public/images/wymeditor/skins/refinery/text_align_center.png +0 -0
  212. data/public/images/wymeditor/skins/refinery/text_align_justify.png +0 -0
  213. data/public/images/wymeditor/skins/refinery/text_align_left.png +0 -0
  214. data/public/images/wymeditor/skins/refinery/text_align_right.png +0 -0
  215. data/public/images/wymeditor/skins/refinery/text_bold.png +0 -0
  216. data/public/images/wymeditor/skins/refinery/text_heading_1.png +0 -0
  217. data/public/images/wymeditor/skins/refinery/text_heading_2.png +0 -0
  218. data/public/images/wymeditor/skins/refinery/text_heading_3.png +0 -0
  219. data/public/images/wymeditor/skins/refinery/text_heading_4.png +0 -0
  220. data/public/images/wymeditor/skins/refinery/text_heading_5.png +0 -0
  221. data/public/images/wymeditor/skins/refinery/text_heading_6.png +0 -0
  222. data/public/images/wymeditor/skins/refinery/text_indent.png +0 -0
  223. data/public/images/wymeditor/skins/refinery/text_indent_remove.png +0 -0
  224. data/public/images/wymeditor/skins/refinery/text_italic.png +0 -0
  225. data/public/images/wymeditor/skins/refinery/text_list_bullets.png +0 -0
  226. data/public/images/wymeditor/skins/refinery/text_list_numbers.png +0 -0
  227. data/public/images/wymeditor/skins/refinery/text_paragraph.png +0 -0
  228. data/public/images/wymeditor/skins/refinery/text_strikethrough.png +0 -0
  229. data/public/images/wymeditor/skins/refinery/text_subscript.png +0 -0
  230. data/public/images/wymeditor/skins/refinery/text_superscript.png +0 -0
  231. data/public/images/wymeditor/skins/refinery/text_underline.png +0 -0
  232. data/public/images/wymeditor/skins/wymeditor_icon.png +0 -0
  233. data/public/javascripts/admin.js +7 -0
  234. data/public/javascripts/application.js +1 -0
  235. data/public/javascripts/dd_belatedpng.js +13 -0
  236. data/public/javascripts/i18n-messages.js +2 -0
  237. data/public/javascripts/jquery-min.js +16 -0
  238. data/public/javascripts/jquery-ui-custom-min.js +251 -0
  239. data/public/javascripts/jquery.js +8176 -0
  240. data/public/javascripts/jquery/GPL-LICENSE.txt +278 -0
  241. data/public/javascripts/jquery/MIT-LICENSE.txt +20 -0
  242. data/public/javascripts/jquery/jquery.corner.js +345 -0
  243. data/public/javascripts/jquery/jquery.html5-placeholder-shim.js +88 -0
  244. data/public/javascripts/jquery/jquery.jcarousel.js +900 -0
  245. data/public/javascripts/jquery/jquery.textTruncate.js +174 -0
  246. data/public/javascripts/jquery/jquery.timers.js +138 -0
  247. data/public/javascripts/modernizr-min.js +30 -0
  248. data/public/javascripts/rails.js +175 -0
  249. data/public/javascripts/refinery/admin.js +1114 -0
  250. data/public/javascripts/refinery/boot_wym.js +285 -0
  251. data/public/javascripts/refinery/core.js +18 -0
  252. data/public/javascripts/refinery/i18n.js +340 -0
  253. data/public/javascripts/refinery/nestedsortables.js +164 -0
  254. data/public/javascripts/refinery/serializelist.js +66 -0
  255. data/public/javascripts/refinery/site_bar.js +16 -0
  256. data/public/javascripts/refinery/submenu.js +49 -0
  257. data/public/javascripts/wymeditor/jquery.refinery.wymeditor.js +5156 -0
  258. data/public/javascripts/wymeditor/lang/ca.js +45 -0
  259. data/public/javascripts/wymeditor/lang/cs.js +45 -0
  260. data/public/javascripts/wymeditor/lang/da.js +48 -0
  261. data/public/javascripts/wymeditor/lang/de.js +45 -0
  262. data/public/javascripts/wymeditor/lang/en.js +47 -0
  263. data/public/javascripts/wymeditor/lang/es.js +48 -0
  264. data/public/javascripts/wymeditor/lang/fa.js +46 -0
  265. data/public/javascripts/wymeditor/lang/fr.js +45 -0
  266. data/public/javascripts/wymeditor/lang/he.js +45 -0
  267. data/public/javascripts/wymeditor/lang/hu.js +45 -0
  268. data/public/javascripts/wymeditor/lang/it.js +48 -0
  269. data/public/javascripts/wymeditor/lang/lv.js +47 -0
  270. data/public/javascripts/wymeditor/lang/nb.js +48 -0
  271. data/public/javascripts/wymeditor/lang/nl.js +47 -0
  272. data/public/javascripts/wymeditor/lang/nn.js +45 -0
  273. data/public/javascripts/wymeditor/lang/pl.js +45 -0
  274. data/public/javascripts/wymeditor/lang/pt-BR.js +47 -0
  275. data/public/javascripts/wymeditor/lang/pt.js +45 -0
  276. data/public/javascripts/wymeditor/lang/rs.js +47 -0
  277. data/public/javascripts/wymeditor/lang/ru.js +45 -0
  278. data/public/javascripts/wymeditor/lang/sl.js +47 -0
  279. data/public/javascripts/wymeditor/lang/sv.js +45 -0
  280. data/public/javascripts/wymeditor/lang/tr.js +45 -0
  281. data/public/javascripts/wymeditor/lang/vi.js +47 -0
  282. data/public/javascripts/wymeditor/lang/zh_cn.js +47 -0
  283. data/public/javascripts/wymeditor/skins/refinery/skin.js +48 -0
  284. data/public/robots.txt +3 -0
  285. data/public/stylesheets/application.css +4 -0
  286. data/public/stylesheets/formatting.css +4 -0
  287. data/public/stylesheets/home.css +4 -0
  288. data/public/stylesheets/refinery/application.css +72 -0
  289. data/public/stylesheets/refinery/formatting.css +57 -0
  290. data/public/stylesheets/refinery/home.css +0 -0
  291. data/public/stylesheets/refinery/refinery.css +1579 -0
  292. data/public/stylesheets/refinery/site_bar.css +87 -0
  293. data/public/stylesheets/refinery/submenu.css +22 -0
  294. data/public/stylesheets/refinery/theme.css +36 -0
  295. data/public/stylesheets/refinery/tooltips.css +34 -0
  296. data/public/stylesheets/refinery/ui.css +107 -0
  297. data/public/stylesheets/theme.css +4 -0
  298. data/public/stylesheets/wymeditor/skins/refinery/skin.css +528 -0
  299. data/public/stylesheets/wymeditor/skins/refinery/wymiframe.css +96 -0
  300. data/public/wymeditor/GPL-license.txt +278 -0
  301. data/public/wymeditor/MIT-license.txt +20 -0
  302. data/public/wymeditor/README +35 -0
  303. data/refinerycms-core.gemspec +391 -0
  304. data/spec/lib/refinery/plugins_spec.rb +90 -0
  305. metadata +482 -0
Binary file
data/engines.md ADDED
@@ -0,0 +1,179 @@
1
+ # Extending Refinery with Engines
2
+
3
+ ## Introduction
4
+
5
+ __Refinery is designed to be easily extended so you can quickly customise your Refinery site to manage new areas you want to add to your site. If you see something you want to customise, the chances are you can customise it.__
6
+
7
+ The main way of extending Refinery is through adding new engines to your app. By default you can edit pages in Refinery's backend, but how do you add a new section to manage like products?
8
+
9
+ See: [The Refinery Engine Generator](http://github.com/resolve/refinerycms-generators/blob/master/readme.md#readme)
10
+
11
+ ## The Structure of an Engine
12
+
13
+ Think of a engine in Refinery as a small Rails app. Engines have a structure that is extremely similar to a Rails app. Here's an example of Refinery's pages engine (located in Refinery's ``pages/`` folder)
14
+
15
+ pages
16
+ |- app
17
+ | |- controllers
18
+ | | |- admin
19
+ | | | |- pages_dialogs_controller.rb
20
+ | | | |- page_parts_controller.rb
21
+ | | | |- pages_controller.rb
22
+ | | |- pages_controller.rb
23
+ | |- helpers
24
+ | | |- pages_helper.rb
25
+ | |- models
26
+ | | |- page.rb
27
+ | |- views
28
+ | |- pages
29
+ | | |- home.html.erb
30
+ | | |- show.html.erb
31
+ | |- admin
32
+ | |- pages
33
+ | |- _form.html.erb
34
+ | |- edit.html.erb
35
+ | |- index.html.erb
36
+ | |- new.html.erb
37
+ |- config
38
+ | |- routes.rb
39
+ |- rails
40
+ |- init.rb
41
+
42
+
43
+ ### app/controllers
44
+
45
+ In this example you see one "public" controller ``app/controllers/pages_controller`` that is responsible for managing the front end when I view a page.
46
+
47
+ ### app/controllers/admin
48
+
49
+ This bit is important. It's where all the controllers are held to manage pages in the Refinery back end in this example. You can ignore the ``pages_dialogs_controller.rb`` and ``page_parts_controller.rb`` for now and let's just focus on the ``admin/pages_controller.rb`` file. Here's what that looks like inside at a basic level:
50
+
51
+ module Admin
52
+ class PagesController < Admin::BaseController
53
+
54
+ crudify :page, :conditions => {:parent_id => nil},
55
+ :order => "position ASC", :paging => false
56
+
57
+ end
58
+ end
59
+
60
+ This single controller allows us to create, read, update and delete pages in the backend. With a little bit of Refinery magic we utilise the [crudify mixin](http://github.com/resolve/refinerycms/blob/master/core/crud.md) which gives us all of these regular features out of the box.
61
+
62
+ How crudify works is an entire topic of it's own. Checkout the [crudify documentation](http://github.com/resolve/refinerycms/blob/master/core/crud.md) to get an insight into how that works.
63
+
64
+ ### app/views and app/helpers
65
+
66
+ Works exactly the same as ``app/views`` and ``app/helpers`` in a normal Rails app. You just put the views and helpers related to this engine in here instead of in your actual main app directory.
67
+
68
+ ### config/routes.rb
69
+
70
+ Works exactly the same as ``config/routes.rb`` in your app except this routes file only loads the routes for this engine.
71
+
72
+ ### rails/init.rb
73
+
74
+ This file runs when your site is started up. All is does is registers this engine with Refinery so it knows that it exists, how to handle it in the Refinery admin menu and how to render recent activity on the Dashboard (see "Getting your Engine to Report Activity in the Dashboard")
75
+
76
+ NOTE: The latest version of Refinery requires that you only specify a engine.name. plugin.title &amp; plugin.description will be looked up by the I18n system.
77
+
78
+ # pages/lib/pages.rb
79
+ ::Refinery::Plugin.register do |plugin|
80
+ plugin.name = "pages"
81
+ plugin.version = 1.0
82
+ plugin.menu_match = /(refinery|admin)\/page(_dialog|part)?s$/
83
+ plugin.activity = {
84
+ :class => Page,
85
+ :url_prefix => "edit_",
86
+ :title => "title",
87
+ :created_image => "page_add.png",
88
+ :updated_image => "page_edit.png"
89
+ }
90
+ end
91
+
92
+ # pages/config/locales/en.yml
93
+ en:
94
+ plugins:
95
+ refinery_pages:
96
+ title: Pages
97
+ description: Manage content pages
98
+
99
+ ## Getting your Engine to Report Activity in the Dashboard
100
+
101
+ Recent activity reporting is built right in, so all you need to do is follow the convention below and your engine will start showing up in the recent activity list of the Dashboard.
102
+
103
+ In our example above we showed the use of ``plugin.activity`` for the pages engine.
104
+
105
+ ::Refinery::Plugin.register do |plugin|
106
+ plugin.name = "pages"
107
+ plugin.version = 1.0
108
+ plugin.menu_match = /(refinery|admin)\/page(_dialog|part)?s$/
109
+ plugin.activity = {
110
+ :class => Page,
111
+ :url_prefix => "edit_",
112
+ :title => "title",
113
+ :created_image => "page_add.png",
114
+ :updated_image => "page_edit.png"
115
+ }
116
+ end
117
+
118
+ Here's what the different activity options mean:
119
+
120
+ ### Required
121
+
122
+ :class
123
+ # the name of the class we're watching.
124
+
125
+ :url_prefix
126
+ # Just use "edit_" if you're not sure how this works.
127
+ #
128
+ # When it says "'About' page was updated about 4 hours ago", the page title "About"
129
+ # is linked to that page in a way we specify. So by setting "_edit" as a :url_prefix what
130
+ # we're doing is making it link to the page that allows us to edit this page.
131
+ # So the next result is edit_admin_page_url(page)
132
+
133
+ :title
134
+ # which attribute on the :class should be in the activty message. In our case it's "title"
135
+ # because we want it to run something like this "#{page.title} was updated about ...."
136
+
137
+ ### Optional
138
+
139
+ :created_image and :updated_image
140
+ # the activity monitor knows if something is created or updated and shows a different icon
141
+ # depending on how you want that to look. You can specify the filename to any image you
142
+ # want in the public/images/refinery/icons/ directory.
143
+
144
+ ## Search Engine Optimisation: Improving the default URLs
145
+
146
+ In our example above we extended Refinery to manage a products area. The problem is when I look at a product on the front end I get a URL like [http://localhost:3000/products/1](http://localhost:3000/products/1) but I would really like it to be something like [http://localhost:3000/products/my-product](http://localhost:3000/products/my-product)
147
+
148
+ To achieve this all you need to do is open up the product model (found in ``/vendor/plugins/products/app/models/product.rb``) and add the following line inside your class:
149
+
150
+ has_friendly_id :title, :use_slug => true
151
+
152
+ Note you want to change ``:title`` to the field which you want to show up in the URL.
153
+
154
+ This will work just fine for new products added from this point, but you'll want to migrate any existing products you have to use this new URL format. All you have to do is save each product you have in the database to make it create a nice URL for you.
155
+
156
+ ruby script/console
157
+ >> Product.all.each {|p| p.save };nil
158
+
159
+ Now all the products in your database will have nice URLs.
160
+
161
+ ## How to get a WYSIWYG editor to show on your form fields
162
+
163
+ Refinery uses a standards compliant visual editor called [WYMeditor](http://www.wymeditor.org/)
164
+
165
+ _Note: When using the Refinery generator, if you apply a field type of "text" to any of your fields, they automatically load as a WYMEditor._
166
+
167
+ The WYSIWYG editor can only be applied to a ``textarea``. All you need to do is add a class of "wymeditor widest" to a ``textarea`` in your form and a WYSIWYG WYMEditor will load right in place.
168
+
169
+ ### Example
170
+
171
+ Again going back to our product plugin example if you had this in your ``vendor/plugins/products/app/views/admin/products/_form.html.erb`` file:
172
+
173
+ <%= f.text_area :description %>
174
+
175
+ Just change that to:
176
+
177
+ <%= f.text_area :description, :class => "wymeditor widest" %>
178
+
179
+ Refresh and you're done.
@@ -0,0 +1,55 @@
1
+ @refinerycms @search
2
+ Feature: Search
3
+ In order find content more quickly
4
+ As an administrator
5
+ I want to use search
6
+
7
+ Background:
8
+ Given I am a logged in refinery user
9
+
10
+ @search-existing
11
+ Scenario Outline: Search Existing Item
12
+ Given I have a <item> titled "<title>"
13
+ When I go to the list of <location>
14
+ And I fill in "search" with "<title>"
15
+ And I press "Search"
16
+ Then I should see "<title>"
17
+
18
+ Examples:
19
+ | item | title | location |
20
+ |page |testitem|pages |
21
+ |setting |testitem|settings |
22
+
23
+ # This will only run when resources engine is installed.
24
+ @search-file
25
+ Scenario: Search File
26
+ When I upload the file at "refinery_is_awesome.txt"
27
+ And I go to the list of files
28
+ And I fill in "search" with "Refinery Is Awesome"
29
+ And I press "Search"
30
+ Then I should see "Refinery Is Awesome"
31
+
32
+ # This will only run when images engine is installed.
33
+ @search-image
34
+ Scenario: Search Image
35
+ When I upload the image at "beach.jpeg"
36
+ And I go to the list of images
37
+ And I fill in "search" with "Beach"
38
+ And I press "Search"
39
+ Then I should see "Beach"
40
+
41
+ @search-nonexisting
42
+ Scenario Outline: Search Nonexisting Item
43
+ Given I have no <item>
44
+ When I go to the list of <location>
45
+ And I fill in "search" with "nonexisting"
46
+ And I press "Search"
47
+ Then I should see "Sorry, no results found"
48
+
49
+ Examples:
50
+ | item | location |
51
+ |pages |pages |
52
+ |images |images |
53
+ |files |files |
54
+ |settings |settings |
55
+
@@ -0,0 +1,24 @@
1
+ @refinerycms @site_bar
2
+ Feature: Site Bar
3
+ In order to allow administrators to easily switch between editing and viewing their website
4
+ I want logged in refinery users to see a site bar
5
+ And I want logged in customers to not see a site bar
6
+
7
+ Background:
8
+ Given I have a page titled "Home" with a custom url "/"
9
+ And I am not logged in
10
+
11
+ Scenario: Not logged in
12
+ When I go to the home page
13
+ Then I should not see "Log out"
14
+
15
+ Scenario: Logged in as a Refinery user
16
+ Given I am a logged in refinery user
17
+ When I go to the home page
18
+ Then I should see "Log out"
19
+
20
+ Scenario: Logged in as a customer
21
+ Given A Refinery user exists
22
+ And I am a logged in customer
23
+ When I go to the home page
24
+ Then I should not see "Switch to your website editor"
@@ -0,0 +1,61 @@
1
+ # Login stuff
2
+ Given %r`not logged in$` do
3
+ visit destroy_user_session_path
4
+ end
5
+
6
+ Given /locale is (.+?)$/ do |locale|
7
+ if defined?(::Refinery::I18n)
8
+ ::Refinery::I18n.current_locale = locale.to_sym
9
+ end
10
+ end
11
+
12
+ Given %r`(?:log|am logged) in as "([^\"]+)"$` do |login|
13
+ @my_username = login
14
+ visit refinery_login_path
15
+ And %Q`enter the username "#{login}"`
16
+ And %Q`enter the password "#{login}-123"`
17
+ And "press the login button"
18
+ end
19
+
20
+ Then 'I should( not)? see a login form' do |negative|
21
+ expect_opposite_if(negative) do
22
+ response.should have_tag('form#new_user_session') do
23
+ field_labeled('Username').should_not be_nil
24
+ field_labeled('Password', :password).should_not be_nil
25
+ end
26
+ end
27
+ end
28
+
29
+ When %r`enter the username "(.+)"$` do |login|
30
+ fill_in 'user_session[login]' , :with => login
31
+ end
32
+
33
+ When %r`enter the password "(.+)-123"$` do |login|
34
+ fill_in 'user_session[password]', :with => "#{login}-123"
35
+ end
36
+
37
+ When %r`press the login button$` do
38
+ click_button 'Sign In'
39
+ end
40
+
41
+ Then %r`not be allowed to log in$` do
42
+ When %Q`log in as "#{@my_username}"`
43
+ Then 'I should see a login form'
44
+ end
45
+
46
+ Then %r`be redirected to login$` do
47
+ request.fullpath.should == refinery_login_path
48
+ end
49
+
50
+ Then /^"([^\"]*)" can log in$/ do |name|
51
+ user = User.find_by_login!(name)
52
+ visit refinery_login_path
53
+ When %Q`I enter the username "#{name}"`
54
+ And %Q`I enter the password "#{name}-123"`
55
+ And 'I press the login button'
56
+ Then 'I should not see a login form'
57
+ end
58
+
59
+ Then /^I should be redirected back to "([^\"]*)"$/ do |page_name|
60
+ visit path_to(page_name)
61
+ end
@@ -0,0 +1,14 @@
1
+ module NavigationHelpers
2
+ module Refinery
3
+ module Core
4
+ def path_to(page_name)
5
+ # no paths
6
+ nil
7
+ #case page_name
8
+ #else
9
+ # nil
10
+ #end
11
+ end
12
+ end
13
+ end
14
+ end
Binary file
@@ -0,0 +1 @@
1
+ http://www.refineryhq.com/
data/lib/gemspec.rb ADDED
@@ -0,0 +1,43 @@
1
+ require 'pathname'
2
+ gempath = Pathname.new(File.expand_path('../../', __FILE__))
3
+ require gempath.join('..', 'base', 'lib', 'base', 'refinery')
4
+
5
+ gemspec = <<EOF
6
+ # DO NOT EDIT THIS FILE DIRECTLY! Instead, use lib/gemspec.rb to generate it.
7
+
8
+ Gem::Specification.new do |s|
9
+ s.name = %q{#{gemname = 'refinerycms-core'}}
10
+ s.version = %q{#{::Refinery.version}}
11
+ s.summary = %q{Core engine for Refinery CMS}
12
+ s.description = %q{The core of Refinery CMS. This handles the common functionality and is required by most engines}
13
+ s.date = %q{#{Time.now.strftime('%Y-%m-%d')}}
14
+ s.email = %q{info@refinerycms.com}
15
+ s.homepage = %q{http://refinerycms.com}
16
+ s.rubyforge_project = %q{refinerycms}
17
+ s.authors = ['Resolve Digital', 'Philip Arndt', 'David Jones', 'Steven Heidel']
18
+ s.license = %q{MIT}
19
+ s.require_paths = %w(lib)
20
+ s.executables = %w(#{Pathname.glob(gempath.join('bin/*')).map{|d| d.relative_path_from(gempath)}.sort.join(" ")})
21
+
22
+ s.add_dependency 'refinerycms-base', '~> #{::Refinery::Version}'
23
+ s.add_dependency 'refinerycms-settings', '~> #{::Refinery::Version}'
24
+ s.add_dependency 'refinerycms-generators', '~> 0.9.9.3'
25
+ s.add_dependency 'acts_as_indexed', '~> 0.7'
26
+ s.add_dependency 'friendly_id_globalize3', '~> 3.2.0'
27
+ s.add_dependency 'globalize3', '>= 0.1.0.beta'
28
+ s.add_dependency 'moretea-awesome_nested_set', '= 1.4.3.1'
29
+ s.add_dependency 'rails', '~> 3.0.3'
30
+ s.add_dependency 'rdoc', '>= 2.5.11' # helps fix ubuntu
31
+ s.add_dependency 'truncate_html', '~> 0.5'
32
+ s.add_dependency 'will_paginate', '~> 3.0.pre'
33
+
34
+ s.files = [
35
+ '#{%w( **/{*,.rspec,.gitignore,.yardopts} ).map { |file| Pathname.glob(gempath.join(file)) }.flatten.reject{|f|
36
+ !f.exist? or f.to_s =~ /\.gem$/ or (f.directory? and f.children.empty?)
37
+ }.map{|d| d.relative_path_from(gempath)}.uniq.sort.join("',\n '")}'
38
+ ]
39
+ end
40
+ EOF
41
+
42
+ (gemfile = gempath.join("#{gemname}.gemspec")).open('w') {|f| f.puts(gemspec)}
43
+ puts `cd #{gempath} && gem build #{gemfile}` if ARGV.any?{|a| a == "BUILD=true"}
@@ -0,0 +1,110 @@
1
+ require 'refinery/generators'
2
+
3
+ class RefinerycmsGenerator < ::Refinery::Generators::EngineInstaller
4
+
5
+ engine_name :refinerycms
6
+ source_root Pathname.new(File.expand_path('../templates', __FILE__))
7
+
8
+ class_option :update, :type => :boolean, :aliases => nil, :group => :runtime,
9
+ :desc => "Update an existing Refinery CMS based application"
10
+
11
+ def generate
12
+ # Ensure the generator doesn't output anything using 'puts'
13
+ self.silence_puts = true
14
+
15
+ # Only pretend to do the next actions if this is Refinery to stay DRY
16
+ if Rails.root == Refinery.root
17
+ say_status :'-- pretending to make changes that happen in an actual installation --', nil, :yellow
18
+ old_pretend = self.options[:pretend]
19
+ new_options = self.options.dup
20
+ new_options[:pretend] = true
21
+ self.options = new_options
22
+ end
23
+
24
+ # First, effectively move / rename files that get in the way of Refinery CMS
25
+ %w(public/index.html config/cucumber.yml app/views/layouts/application.html.erb).each do |roadblock|
26
+ if (roadblock_path = Rails.root.join(roadblock)).file?
27
+ create_file "#{roadblock}.backup",
28
+ :verbose => true do roadblock_path.read end
29
+ remove_file roadblock_path, :verbose => true
30
+ end
31
+ end
32
+
33
+ unless self.options[:update]
34
+ # Copy asset files (JS, CSS) so they're ready to use.
35
+ %w(application.css formatting.css home.css theme.css).map{ |ss|
36
+ Refinery.roots('core').join('public', 'stylesheets', ss)
37
+ }.reject{|ss| !ss.file?}.each do |stylesheet|
38
+ copy_file stylesheet,
39
+ Rails.root.join('public', 'stylesheets', stylesheet.split.last),
40
+ :verbose => true
41
+ end
42
+ copy_file Refinery.roots('core').join('public', 'javascripts', 'admin.js'),
43
+ Rails.root.join('public', 'javascripts', 'admin.js'),
44
+ :verbose => true
45
+ end
46
+
47
+ # Ensure the config.serve_static_assets setting is present and enabled
48
+ %w(development test production).map{|e| "config/environments/#{e}.rb"}.each do |env|
49
+ gsub_file env, %r{#.*config.serve_static_assets}, 'config.serve_static_assets', :verbose => false
50
+
51
+ gsub_file env, "serve_static_assets = false", "serve_static_assets = true # Refinery CMS requires this to be true", :verbose => false
52
+
53
+ unless Rails.root.join(env).read =~ %r{Refinery.rescue_not_found}
54
+ append_file env, "Refinery.rescue_not_found = #{env.split('/').last.split('.rb').first == 'production'}"
55
+ end
56
+ end
57
+
58
+ # Stop pretending
59
+ if Rails.root == Refinery.root
60
+ say_status :'-- finished pretending --', nil, :yellow
61
+ new_options = self.options.dup
62
+ new_options[:pretend] = old_pretend
63
+ self.options = new_options
64
+ end
65
+
66
+ # Ensure .gitignore exists and append our rules to it.
67
+ create_file ".gitignore" unless Rails.root.join('.gitignore').file?
68
+ our_ignore_rules = self.class.source_root.join('.gitignore').read
69
+ our_ignore_rules = our_ignore_rules.split('# REFINERY CMS DEVELOPMENT').first if Rails.root != Refinery.root
70
+ append_file ".gitignore", our_ignore_rules
71
+
72
+ # If the admin/base_controller.rb file exists, ensure it does not do the old inheritance
73
+ if (admin_base = Rails.root.join('app', 'controllers', 'admin', 'base_controller.rb')).file?
74
+ gsub_file admin_base,
75
+ "# You can extend refinery backend with your own functions here and they will likely not get overriden in an update.",
76
+ "",
77
+ :verbose => self.options[:update]
78
+
79
+ gsub_file admin_base, "< Refinery::AdminBaseController", "< ActionController::Base",
80
+ :verbose => self.options[:update]
81
+ end
82
+
83
+
84
+ # Append seeds.
85
+ append_file 'db/seeds.rb', :verbose => true do
86
+ self.class.source_root.join('db', 'seeds.rb').read
87
+ end
88
+
89
+ force_options = self.options.dup
90
+ force_options[:force] = self.options[:force] || self.options[:update]
91
+ self.options = force_options
92
+ # Seeds and migrations now need to be copied from their various engines.
93
+ existing_source_root = self.class.source_root
94
+ ::Refinery::Plugins.registered.pathnames.reject{|p| !p.join('db').directory?}.sort.each do |pathname|
95
+ self.class.source_root pathname
96
+ super
97
+ end
98
+ self.class.source_root existing_source_root
99
+
100
+ super
101
+
102
+ # The engine installer only installs database templates.
103
+ Pathname.glob(self.class.source_root.join('**', '*')).reject{|f|
104
+ f.directory? or f.to_s =~ /\/db\//
105
+ }.sort.each do |path|
106
+ copy_file path, path.to_s.gsub(self.class.source_root.to_s, Rails.root.to_s)
107
+ end
108
+ end
109
+
110
+ end