page_engine 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. data/README.markdown +43 -33
  2. data/Rakefile +0 -13
  3. data/app/assets/javascripts/page_engine.js +36 -9
  4. data/app/assets/stylesheets/page_engine.css +0 -224
  5. data/app/controllers/admin/page_snippets_controller.rb +1 -3
  6. data/app/controllers/admin/pages_controller.rb +7 -6
  7. data/app/helpers/pages_helper.rb +29 -16
  8. data/app/models/page.rb +25 -34
  9. data/app/models/page_role.rb +7 -5
  10. data/app/views/admin/page_snippets/_form.html.haml +2 -2
  11. data/app/views/admin/pages/_form.html.haml +13 -11
  12. data/app/views/admin/pages/_page_part_fields.html.haml +2 -4
  13. data/db/seed.rb +1 -6
  14. data/lib/generators/page_engine/install/install_generator.rb +10 -10
  15. data/lib/generators/page_engine/templates/page_engine.rb +34 -0
  16. data/lib/page_engine.rb +59 -18
  17. data/lib/page_engine/extensions.rb +1 -15
  18. data/lib/page_engine/instance_methods.rb +14 -10
  19. data/lib/page_engine/version.rb +3 -0
  20. data/{vendor → spec/dummy/app}/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  21. data/{vendor → spec/dummy/app}/assets/images/jquery-ui/ui-bg_flat_75_ffffff_40x100.png +0 -0
  22. data/{vendor → spec/dummy/app}/assets/images/jquery-ui/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  23. data/{vendor → spec/dummy/app}/assets/images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
  24. data/{vendor → spec/dummy/app}/assets/images/jquery-ui/ui-bg_glass_75_dadada_1x400.png +0 -0
  25. data/{vendor → spec/dummy/app}/assets/images/jquery-ui/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  26. data/{vendor → spec/dummy/app}/assets/images/jquery-ui/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  27. data/{vendor → spec/dummy/app}/assets/images/jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  28. data/{vendor → spec/dummy/app}/assets/images/jquery-ui/ui-icons_222222_256x240.png +0 -0
  29. data/{vendor → spec/dummy/app}/assets/images/jquery-ui/ui-icons_2e83ff_256x240.png +0 -0
  30. data/{vendor → spec/dummy/app}/assets/images/jquery-ui/ui-icons_454545_256x240.png +0 -0
  31. data/{vendor → spec/dummy/app}/assets/images/jquery-ui/ui-icons_888888_256x240.png +0 -0
  32. data/{vendor → spec/dummy/app}/assets/images/jquery-ui/ui-icons_cd0a0a_256x240.png +0 -0
  33. data/{app → spec/dummy/app}/assets/images/page_engine/add.png +0 -0
  34. data/{app → spec/dummy/app}/assets/images/page_engine/bullet_add.png +0 -0
  35. data/{app → spec/dummy/app}/assets/images/page_engine/bullet_go.png +0 -0
  36. data/{app → spec/dummy/app}/assets/images/page_engine/delete.png +0 -0
  37. data/{app → spec/dummy/app}/assets/images/page_engine/page_add.png +0 -0
  38. data/{app → spec/dummy/app}/assets/images/page_engine/page_copy.png +0 -0
  39. data/{app → spec/dummy/app}/assets/images/page_engine/page_delete.png +0 -0
  40. data/{app → spec/dummy/app}/assets/images/page_engine/page_edit.png +0 -0
  41. data/{app → spec/dummy/app}/assets/images/page_engine/page_gear.png +0 -0
  42. data/{app → spec/dummy/app}/assets/images/page_engine/page_green.png +0 -0
  43. data/{app → spec/dummy/app}/assets/images/page_engine/page_hidden.png +0 -0
  44. data/{app → spec/dummy/app}/assets/images/page_engine/page_lightning.png +0 -0
  45. data/{app → spec/dummy/app}/assets/images/page_engine/page_line.jpg +0 -0
  46. data/{app → spec/dummy/app}/assets/images/page_engine/page_red.png +0 -0
  47. data/{app → spec/dummy/app}/assets/images/page_engine/pencil.png +0 -0
  48. data/{app → spec/dummy/app}/assets/images/page_engine/waiting.gif +0 -0
  49. data/{app → spec/dummy/app}/assets/images/page_engine/zoom.png +0 -0
  50. data/spec/dummy/app/assets/stylesheets/application.css +133 -2
  51. data/{app → spec/dummy/app}/assets/stylesheets/jquery-ui.css +0 -0
  52. data/spec/dummy/app/controllers/application_controller.rb +17 -0
  53. data/spec/dummy/app/models/odd_role.rb +5 -0
  54. data/spec/dummy/app/models/weird_user.rb +8 -0
  55. data/spec/dummy/app/views/layouts/admin/application.html.haml +15 -0
  56. data/spec/dummy/app/views/layouts/trouble.html.haml +29 -0
  57. data/spec/dummy/config/initializers/page_engine.rb +25 -4
  58. data/spec/dummy/db/development.sqlite3 +0 -0
  59. data/spec/dummy/db/migrate/20111002171742_add_odd_roles.rb +16 -0
  60. data/spec/dummy/db/migrate/20111002230859_add_users.rb +21 -0
  61. data/spec/dummy/db/schema.rb +14 -1
  62. data/spec/dummy/log/development.log +24264 -0
  63. data/spec/dummy/tmp/cache/assets/C1F/4A0/sprockets%2Fb257125f39b2a708d678262f26152408 +0 -0
  64. data/spec/dummy/tmp/cache/assets/C4A/E50/sprockets%2Ff1447b533430f0b0366994087c742f1a +0 -0
  65. data/spec/dummy/tmp/cache/assets/C50/9E0/sprockets%2F5273207c05e438fab77180339ef07418 +0 -0
  66. data/spec/dummy/tmp/cache/assets/C5C/BA0/sprockets%2Fe97992f1040b2aa956168498b5e56142 +0 -0
  67. data/spec/dummy/tmp/cache/assets/C83/E20/sprockets%2F2d6f03d170965f27d7626502373e8cd2 +0 -0
  68. data/spec/dummy/tmp/cache/assets/CAA/DD0/sprockets%2F45aba9186167d40fb01c6213bd693559 +0 -0
  69. data/spec/dummy/tmp/cache/assets/CB1/EE0/sprockets%2F9610f802b5b028336d81cf3f019e7e66 +0 -0
  70. data/spec/dummy/tmp/cache/assets/CB8/880/sprockets%2F3b651a5763758db2fc0347488e69a3e1 +0 -0
  71. data/spec/dummy/tmp/cache/assets/CBA/0A0/sprockets%2F2983f7dd6130a7c24892da333c18d779 +0 -0
  72. data/spec/dummy/tmp/cache/assets/CBC/870/sprockets%2Fd85b473139826715974f58b6a6aa29aa +0 -0
  73. data/spec/dummy/tmp/cache/assets/CD1/EB0/sprockets%2Fba17700b36ee975c05d06042a6af9631 +0 -0
  74. data/spec/dummy/tmp/cache/assets/CDA/A30/sprockets%2Fd1a7692303d59c495dd61cd1d41246b5 +0 -0
  75. data/spec/dummy/tmp/cache/assets/CE0/CD0/sprockets%2Fd206c4ec51748382823dee1e7f28055a +0 -0
  76. data/spec/dummy/tmp/cache/assets/CE3/C10/sprockets%2F05a63f093f971cd73662695fab452b0f +0 -0
  77. data/spec/dummy/tmp/cache/assets/CE7/5E0/sprockets%2F520141de9bf7351de829ee484b761d37 +0 -0
  78. data/spec/dummy/tmp/cache/assets/CEE/2B0/sprockets%2F75f58ee42279991f91ac43260b9b0fe3 +0 -0
  79. data/spec/dummy/tmp/cache/assets/CF3/CF0/sprockets%2Fb9232c5dfbe22949e8559fc03898242e +0 -0
  80. data/spec/dummy/tmp/cache/assets/CF8/730/sprockets%2F2e8b471c690843c889c86cef3273fd19 +0 -0
  81. data/spec/dummy/tmp/cache/assets/D04/230/sprockets%2F3081bc655eafedc2c77018c5b9000385 +0 -0
  82. data/spec/dummy/tmp/cache/assets/D0B/B40/sprockets%2Fb7d60dd0218956953d1afbb4d6d95220 +0 -0
  83. data/spec/dummy/tmp/cache/assets/D0D/000/sprockets%2Fbb689a9183e1482be8c02ab4f536083b +0 -0
  84. data/spec/dummy/tmp/cache/assets/D0D/3C0/sprockets%2F09db8b6dc9be3a7645321407ecf74313 +0 -0
  85. data/spec/dummy/tmp/cache/assets/D10/500/sprockets%2F14244cebaa065f6e0c461f88521d89e7 +0 -0
  86. data/spec/dummy/tmp/cache/assets/D13/FF0/sprockets%2Fd62e2814c718d1a22c84c7b3a78eb948 +0 -0
  87. data/spec/dummy/tmp/cache/assets/D1A/140/sprockets%2Fe5dbcc46887452182b85e8da04994ea0 +0 -0
  88. data/spec/dummy/tmp/cache/assets/D1B/490/sprockets%2Fe37c84afab109b736f593d271f94916c +0 -0
  89. data/spec/dummy/tmp/cache/assets/D22/630/sprockets%2F96268b95a26ee16a7b2d169e78af38c4 +0 -0
  90. data/spec/dummy/tmp/cache/assets/D27/2F0/sprockets%2F6b6e52b5006574d3fef8d34ef639978d +0 -0
  91. data/spec/dummy/tmp/cache/assets/D2F/D10/sprockets%2Fdcfcecea73a06520b314144da9180748 +0 -0
  92. data/spec/dummy/tmp/cache/assets/D30/ED0/sprockets%2Fea74cc14e1532ac70f928d8d205c5a13 +0 -0
  93. data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  94. data/spec/dummy/tmp/cache/assets/D35/4A0/sprockets%2F1b20d80f1d472f213983c30fc7a8d8ad +0 -0
  95. data/spec/dummy/tmp/cache/assets/D3B/4D0/sprockets%2Faf8a08611a00ade8c7f16d626708eb67 +0 -0
  96. data/spec/dummy/tmp/cache/assets/D3B/BA0/sprockets%2F7b8e66f1a87012c23d18d5c80a518adf +0 -0
  97. data/spec/dummy/tmp/cache/assets/D3D/A00/sprockets%2Fe3c096ab6843a7f814bebf45b743316b +0 -0
  98. data/spec/dummy/tmp/cache/assets/D3F/1E0/sprockets%2F39fbfd2f4caf4d71b4232cf516175574 +0 -0
  99. data/spec/dummy/tmp/cache/assets/D40/720/sprockets%2Fe798537f2ae8abbbac509070c9e06506 +0 -0
  100. data/spec/dummy/tmp/cache/assets/D40/A70/sprockets%2Fffa6c67811911b1a6624281ce7e7dea6 +0 -0
  101. data/spec/dummy/tmp/cache/assets/D47/1D0/sprockets%2F904ef275b101c77ee529b4fe7cf323f7 +0 -0
  102. data/spec/dummy/tmp/cache/assets/D4C/EE0/sprockets%2F7ee487bf0d625668f3fcb075c89a420d +0 -0
  103. data/spec/dummy/tmp/cache/assets/D4D/6A0/sprockets%2F34ff66b81d54df8b855b5ad0609d384f +0 -0
  104. data/spec/dummy/tmp/cache/assets/D52/ED0/sprockets%2F7d4cc173f38eb1746547ac686f80ffd6 +0 -0
  105. data/spec/dummy/tmp/cache/assets/D54/ED0/sprockets%2F71c9fa01091d432b131da3bb73faf3d4 +0 -0
  106. data/spec/dummy/tmp/cache/assets/D58/450/sprockets%2F9bdf9046afa29f99222ffadf85572089 +0 -0
  107. data/spec/dummy/tmp/cache/assets/D58/B30/sprockets%2F211e7cc7898367fb09c489d4a8ccdd59 +0 -0
  108. data/spec/dummy/tmp/cache/assets/D59/BE0/sprockets%2Fb60619702caaaa748c6404a3a05fa7fc +0 -0
  109. data/spec/dummy/tmp/cache/assets/D5D/740/sprockets%2F7cfc90aad94f2822a4ce02701ca834b2 +0 -0
  110. data/spec/dummy/tmp/cache/assets/D63/F80/sprockets%2F9e27b3ca9c333b4cac10427d5524f3df +0 -0
  111. data/spec/dummy/tmp/cache/assets/D67/0C0/sprockets%2Fee349089edd8715f0039b0a1dd4fba30 +0 -0
  112. data/spec/dummy/tmp/cache/assets/D69/7E0/sprockets%2F95dc7c01f25afc8afc40e4353395cb15 +0 -0
  113. data/spec/dummy/tmp/cache/assets/D69/910/sprockets%2F05abeb33740bac77bef60b5445695c8c +0 -0
  114. data/spec/dummy/tmp/cache/assets/D6B/E70/sprockets%2F30cda0697c0ea9dc88d4aa885d00582c +0 -0
  115. data/spec/dummy/tmp/cache/assets/D6C/7E0/sprockets%2Fd3abe581052fc2ffd33b9f465b477b14 +0 -0
  116. data/spec/dummy/tmp/cache/assets/D70/280/sprockets%2F99a543e2b6be1d37c3ccc8a90261f87a +0 -0
  117. data/spec/dummy/tmp/cache/assets/D70/730/sprockets%2F626ce09065ee0bde629097e4a3e9faa1 +0 -0
  118. data/spec/dummy/tmp/cache/assets/D70/B60/sprockets%2F79c6e65f6ae3ca5d1f2791e304a6e4b1 +0 -0
  119. data/spec/dummy/tmp/cache/assets/D73/830/sprockets%2F38d93d829b7d163c372f3acd557c2eab +0 -0
  120. data/spec/dummy/tmp/cache/assets/D74/120/sprockets%2Ffbe442bef82371edd6525fe5622de319 +0 -0
  121. data/spec/dummy/tmp/cache/assets/D76/270/sprockets%2F7fa38bbc51591249e64f86df7da17d0a +0 -0
  122. data/spec/dummy/tmp/cache/assets/D76/F30/sprockets%2Fe47ed642049b57cdf8b9a48b00a9c7e2 +0 -0
  123. data/spec/dummy/tmp/cache/assets/D77/7C0/sprockets%2Fcf660249e6eb81370e70cfe24d771dfe +0 -0
  124. data/spec/dummy/tmp/cache/assets/D7A/710/sprockets%2F082db977dca9043b3cf64dd7b9a1799b +0 -0
  125. data/spec/dummy/tmp/cache/assets/D7C/660/sprockets%2Fbb4ce966494c0b544c7ea5f4e9c2b866 +0 -0
  126. data/spec/dummy/tmp/cache/assets/D7E/BE0/sprockets%2F336d946cd6267eee56681fcee16faa71 +0 -0
  127. data/spec/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 +0 -0
  128. data/spec/dummy/tmp/cache/assets/D87/FA0/sprockets%2Fed7ffae98375a3c9819ee641f00e388d +0 -0
  129. data/spec/dummy/tmp/cache/assets/D89/AA0/sprockets%2Fd214a96f1dca3c24f09149acd0acb390 +0 -0
  130. data/spec/dummy/tmp/cache/assets/D92/E50/sprockets%2F09a8ce459d99efe497507cad2ed88f56 +0 -0
  131. data/spec/dummy/tmp/cache/assets/D93/670/sprockets%2Fdf4cd8447459d7b31b077d0af7aba00b +0 -0
  132. data/spec/dummy/tmp/cache/assets/D96/510/sprockets%2F400b6fa7eb374fe27379be14bfb5ad13 +0 -0
  133. data/spec/dummy/tmp/cache/assets/D96/AE0/sprockets%2F6c450fd116d891f54a32bcfcbd4b762b +0 -0
  134. data/spec/dummy/tmp/cache/assets/D99/2A0/sprockets%2Fb758a4b47a5ef2e0a7c21478d0ca48ec +0 -0
  135. data/spec/dummy/tmp/cache/assets/D9A/F50/sprockets%2Fbd3168f97958b4fceaccd13f33aa2412 +0 -0
  136. data/spec/dummy/tmp/cache/assets/D9D/5E0/sprockets%2F405561b1dd3d76d9f2e1fcb0fd45c9f2 +0 -0
  137. data/spec/dummy/tmp/cache/assets/DA0/940/sprockets%2F9e3e91e2e1bee749a3a7b2ac62eb5294 +0 -0
  138. data/spec/dummy/tmp/cache/assets/DA2/0E0/sprockets%2F71a404ff712a059b23edee96c9bfcd75 +0 -0
  139. data/spec/dummy/tmp/cache/assets/DA2/410/sprockets%2F536cbf8fb330ef944baf1d7e45364fa4 +0 -0
  140. data/spec/dummy/tmp/cache/assets/DA6/860/sprockets%2Ff5526cc6647cdd14b05aed999377abbc +0 -0
  141. data/spec/dummy/tmp/cache/assets/DA7/5F0/sprockets%2Fe92688bcadd7fcddd86227c04b9712e1 +0 -0
  142. data/spec/dummy/tmp/cache/assets/DAB/C00/sprockets%2Fe755d63d3a434bd07ffc887af6aca398 +0 -0
  143. data/spec/dummy/tmp/cache/assets/DAB/E90/sprockets%2F7c1bf428eb83b9b91e619f5ae6cd3e73 +0 -0
  144. data/spec/dummy/tmp/cache/assets/DAF/F20/sprockets%2Ffefb6dc410d3c50be89565fb3e8e3788 +0 -0
  145. data/spec/dummy/tmp/cache/assets/DC6/630/sprockets%2F3098ccedf5502a0cd6e25aaeb8e9e232 +0 -0
  146. data/spec/dummy/tmp/cache/assets/DCA/BB0/sprockets%2F1a792cae50966aef0d0d4131fe5fafd9 +0 -0
  147. data/spec/dummy/tmp/cache/assets/DD9/E90/sprockets%2Fd44526e0ec17dcbbccf7e14db768e869 +0 -0
  148. data/spec/dummy/tmp/cache/assets/DDC/270/sprockets%2Fadb8f369db4f8784c76fd2ee1d3633ac +0 -0
  149. data/spec/dummy/tmp/cache/assets/DDE/420/sprockets%2F69cf180e779eb3095cebe85edbfc22b7 +0 -0
  150. data/spec/dummy/tmp/cache/assets/DE0/250/sprockets%2F1559ff83d17dd6b788d6ab7fada65ee1 +0 -0
  151. data/spec/dummy/tmp/cache/assets/DE1/B40/sprockets%2F9c7deec5e90b5957c6d5b31ded7fe074 +0 -0
  152. data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  153. data/spec/dummy/tmp/cache/assets/E17/820/sprockets%2F37aabaff64eddfc141bc07013ad183fc +0 -0
  154. data/spec/dummy/tmp/cache/assets/E32/C40/sprockets%2Faade2bb8a94be3f057fe7d4a6fd65a84 +0 -0
  155. data/spec/dummy/tmp/cache/assets/E59/310/sprockets%2Fbc56e556d3e7aae7c8bf341d3dcea2bd +0 -0
  156. data/spec/dummy/tmp/cache/assets/E70/2B0/sprockets%2F7eedcfada8bf8bff28c96d9ea93521d3 +0 -0
  157. data/spec/dummy/tmp/cache/assets/E8B/160/sprockets%2Fe6d7a8c67d36fddcd9aaa40e10ade4ee +0 -0
  158. data/spec/dummy/tmp/cache/assets/E95/DC0/sprockets%2F7f2f99b25afac7fbe91a83f0cebcbcd8 +0 -0
  159. data/spec/dummy/tmp/pids/server.pid +1 -1
  160. metadata +465 -354
  161. data/app/views/layouts/admin.html.haml +0 -20
  162. data/lib/page_engine/routes_finder.rb +0 -23
@@ -1,88 +1,98 @@
1
- # Page Engine
2
-
3
1
  Page engine is a (_reasonably_) simple way to extend your rails application with pages. This allows you to automatically generate navigation, breadcrumbs and create page snippets to use anywhere in your app views.
4
2
 
5
- ## Installation
3
+ Installation
4
+ ------------
6
5
 
7
6
  For rails 3 and above simply add the following to your gemfile:
8
7
 
9
- gem 'page_engine'
8
+ `gem 'page_engine'`
10
9
 
11
10
  Then bundle install.
12
11
 
13
12
  To make use of the assets in the gem add the following to your stylesheets manifest
14
13
 
15
- *= require page_engine
16
-
14
+ `*= require page_engine`
15
+
17
16
  and after jquery in your javascripts manifest
18
17
 
19
- //= require page_engine
20
-
21
- Since rails 3.0 doesn't support the asset pipeline out of the box you will also need to install the gems assets (images, css and javascript) using:
18
+ `//= require page_engine`
22
19
 
23
- rails g page_engine
20
+ Run the installation generator to install the config file in config/initializers (for versions of rails that don't support the asset pipeline the assets will be copied across at the same time).
24
21
 
25
- If you've managed to get the asset pipeline working in rails 3.0 then you can skip the above step... and feel free to give yourself a biscuit.
22
+ `rails g page_engine:install`
26
23
 
27
24
  To install the migrations run
28
25
 
29
- rake page_engine_engine:install:migrations
30
-
31
-
26
+ `rake page_engine_engine:install:migrations`
32
27
 
33
- ## Usage
28
+ Usage
29
+ -----
34
30
 
35
31
  In application_controller add the line
36
32
 
37
- page_engine
33
+ `page_engine`
38
34
 
39
35
  and you're good to go.
40
36
 
41
- You can supply options to page engine, currently just the layouts that should be available to the pages, and you can do this using
37
+ You can supply options to page engine by editing the page_engine.rb initializer file.
38
+
39
+ For rails 3 the required stylesheet and javascript files can be included with:
42
40
 
43
- page_engine { :layouts => ['application'] }
41
+ `stylesheet_link_tag :page_engine`
44
42
 
45
- ## How it works
43
+ and
44
+
45
+ `javascript_include_tag :page_engine`
46
+
47
+ How it works
48
+ ------------
46
49
 
47
50
  PageEngine comes with an admin namespace where you can CRUD your pages. It uses [jquery.nestedSortable](http://mjsarfatti.com/sandbox/nestedSortable/ "jquery.nestedSortable") to allow reordering and nesting of pages using drag and drop. When you create the page you can set a url or a controller and action and PageEngine use these to find the correct page. So, for example, say you have a welcome page at welcome#index, if you set the url to '/welcome' or choose welcome#index from the dropdown that page record will be retrieved when the welcome index page is hit and be available to your views.
48
51
 
49
52
  Using [MarkItUp](http://markitup.jaysalvat.com/home/ "MarkItUp") it's possible to write page content using textile, markdown or plain html. There's also the option to use erb but this is pretty dangerous and open to abuse so don't count on it being in there forever.
50
53
 
51
- ## In the views
54
+ In the views
55
+ ------------
52
56
 
53
57
  PageEngine comes with a few helpers:
54
58
 
55
- navigation(root page permalink, options)
59
+ `navigation(root page permalink, options)`
56
60
 
57
61
  This generates an unordered list (ul) containing the root page and it's descendants up to the depth specified in the options.
58
62
 
59
- page_content
63
+ `page_content`
60
64
 
61
65
  Renders the page content using the filter specified (textile, markdown etc). Defaults to using the automatically found page and it's body page part but this can be overriden in the options
62
66
 
63
- breadcrumbs
67
+ `breadcrumbs`
64
68
 
65
69
  Generates a set of links that represent the current page and it's ancestors
66
70
 
67
- page_title
68
-
71
+ `page_title(default_text)`
69
72
 
70
- page_js
73
+ Outputs the page title, or the default text if no page record has been found.
71
74
 
75
+ `page_js`
72
76
 
73
- page_css
77
+ Outputs a javascript tag containing the page javascript, or just the straight css if :with_tags => false.
74
78
 
79
+ `page_css`
75
80
 
76
- page_meta_keywords
81
+ Outputs a stylesheet tag containing the page css, or just the straight css if :with_tags => false.
77
82
 
83
+ `page_meta_keywords`
78
84
 
79
- page_meta_description
80
-
85
+ Outputs a meta tag containing the pages keywords, or just the keywords if :with_tags => false
86
+
87
+ `page_meta_description`
81
88
 
82
- page_snippet snippet name
89
+ Outputs a meta tag containing the pages description, or just the description if :with_tags => false
90
+
91
+ `page_snippet(snippet name)`
83
92
 
84
- Renders the named snippet
93
+ Renders the named snippet.
85
94
 
86
- ## Rails engine
95
+ Rails engine
96
+ ------------
87
97
 
88
98
  Since this was built using the rails 3.1 plugin generator you can test the gem using the dummy application which can be found under spec/dummy.
data/Rakefile CHANGED
@@ -23,17 +23,4 @@ end
23
23
  APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
24
24
  load 'rails/tasks/engine.rake'
25
25
 
26
-
27
26
  Bundler::GemHelper.install_tasks
28
-
29
- require 'rake/testtask'
30
-
31
- Rake::TestTask.new(:test) do |t|
32
- t.libs << 'lib'
33
- t.libs << 'test'
34
- t.pattern = 'test/**/*_test.rb'
35
- t.verbose = false
36
- end
37
-
38
-
39
- task :default => :test
@@ -39,17 +39,18 @@ $(document).ready(function(){
39
39
  return false;
40
40
  });
41
41
 
42
- var selected_tab = 0;
43
- var page_parts = $('.page_parts').tabs({
44
- select: function(event, ui){
45
- selected_tab = ui.index;
46
- }
42
+ var page_parts = $('#page_engine_page_parts').tabs({
43
+ tabTemplate: "<li><a href='#{href}'>#{label}</a> <span class='icon delete'>Remove page part</span></li>"
47
44
  });
48
45
 
49
- $('.page_part a.delete').live('click', function(){
50
- $(this).prev().val(true);
51
- $('.page_parts').after($(this).prev());
52
- page_parts.tabs('remove', selected_tab);
46
+ $('#page_engine_page_parts ul li span.delete').live('click', function(){
47
+ hidden_delete = $($(this).prev().attr('href')).find('input[type=hidden]:first');
48
+ hidden_delete.val(true);
49
+ $('.page_parts').after(hidden_delete);
50
+
51
+ var index = $("li", page_parts).index($(this).parent());
52
+ page_parts.tabs('remove', index);
53
+
53
54
  return false;
54
55
  });
55
56
 
@@ -94,6 +95,32 @@ $(document).ready(function(){
94
95
  return false;
95
96
  }
96
97
  });
98
+
99
+ $('#add_page_part').click(function(){
100
+ page_part_name = prompt('Enter the new page part name').replace(/[^a-z0-9\-_]+/ig, '-');
101
+
102
+ if (page_part_name != ''){
103
+ if ($('#page_part_' + page_part_name).length == 0){
104
+ var new_id = new Date().getTime();
105
+ var content = unescape($('#page_engine_page_parts').attr('data-fields'));
106
+
107
+ content = content.replace(/name="page_parts/g, 'name="page[page_parts_attributes][' + new_id + ']');
108
+ content = content.replace(/for="page_parts/g, 'for="page_page_parts_attributes_' + new_id);
109
+
110
+ $('#page_engine_page_parts').tabs('add', '#' + new_id, page_part_name);
111
+ $('#' + new_id).html(content);
112
+ $('#' + new_id).addClass('page_part');
113
+ $('#' + new_id + ' .input:first input').val(page_part_name);
114
+ }
115
+ else {
116
+ alert('Name already exists');
117
+ }
118
+ } else {
119
+ alert('You need to specify a name');
120
+ }
121
+
122
+ return false;
123
+ });
97
124
  });
98
125
 
99
126
  check_filter = function(filter){
@@ -1,5 +1,4 @@
1
1
  /*
2
- *= require jquery-ui
3
2
  *= require markitup/skins/simple/style
4
3
  *= require markitup/sets/html/style
5
4
  *= require markitup/sets/textile/style
@@ -9,226 +8,3 @@
9
8
  *= require codemirror/codemirror
10
9
  *= require codemirror/themes/default
11
10
  */
12
-
13
- .js .hidden {
14
- display: none;
15
- }
16
-
17
- .icon, nav.pagination .first a, nav.pagination .prev a, nav.pagination .next a, nav.pagination .last a {
18
- display: -moz-inline-box;
19
- -moz-box-orient: vertical;
20
- display: inline-block;
21
- vertical-align: middle;
22
- *vertical-align: auto;
23
- height: 16px;
24
- width: 16px;
25
- text-indent: -119988px;
26
- overflow: hidden;
27
- text-align: left;
28
- background-image: url(/assets/page_engine/ruby.png);
29
- background-repeat: no-repeat;
30
- background-position: 50% 50%;
31
- vertical-align: middle;
32
- cursor: pointer;
33
- background-repeat: no-repeat;
34
- background-position: center center;
35
- }
36
-
37
- .icon, nav.pagination .first a, nav.pagination .prev a, nav.pagination .next a, nav.pagination .last a {
38
- *display: inline;
39
- }
40
-
41
- .icon.add {
42
- background-image: url(/assets/page_engine/add.png);
43
- }
44
-
45
- .icon.delete {
46
- background-image: url(/assets/page_engine/delete.png);
47
- }
48
-
49
- .icon.edit {
50
- background-image: url(/assets/page_engine/pencil.png);
51
- }
52
-
53
- .icon.show {
54
- background-image: url(/assets/page_engine/zoom.png);
55
- }
56
-
57
-
58
- .icon.waiting {
59
- background-image: url(/assets/page_engine/waiting.gif);
60
- }
61
-
62
- form.button_to {
63
- display: inline;
64
- }
65
-
66
- form.button_to * {
67
- display: inline;
68
- }
69
-
70
- ol#page_engine,
71
- ol#page_engine ol {
72
- margin: 0;
73
- padding: 0 0 0 16px;
74
- border-left: solid white 1px;
75
- }
76
-
77
- ol#page_engine li.page {
78
- background: white;
79
- }
80
-
81
- ol#page_engine li.placeholder {
82
- border: dashed 1px #333;
83
- }
84
-
85
- ol#page_engine * {
86
- list-style: none;
87
- }
88
-
89
- ol#page_engine .icon.add {
90
- margin: 0 0 0 6px;
91
- background-image: url(/assets/page_engine/page_add.png);
92
- }
93
-
94
- ol#page_engine .icon.edit {
95
- background-image: url(/assets/page_engine/page_edit.png);
96
- }
97
-
98
- ol#page_engine .icon.delete {
99
- background-image: url(/assets/page_engine/page_delete.png);
100
- }
101
-
102
- ol#page_engine .icon.duplicate {
103
- background-image: url(/assets/page_engine/page_copy.png);
104
- }
105
-
106
- ol#page_engine .icon.published {
107
- margin: 0 6px 0 0;
108
- background-image: url(/assets/page_engine/page_green.png);
109
- }
110
-
111
- ol#page_engine .icon.live {
112
- margin: 0 6px 0 0;
113
- background-image: url(/assets/page_engine/page_lightning.png);
114
- }
115
-
116
- ol#page_engine .icon.draft {
117
- margin: 0 6px 0 0;
118
- background-image: url(/assets/page_engine/page_red.png);
119
- }
120
-
121
- ol#page_engine .icon.hidden {
122
- margin: 0 6px 0 0;
123
- background-image: url(/assets/page_engine/page_hidden.png);
124
- }
125
-
126
- ol#page_engine .icon.review {
127
- margin: 0 6px 0 0;
128
- background-image: url(/assets/page_engine/page_gear.png);
129
- }
130
-
131
- .page_part .delete {
132
- float: right;
133
- }
134
-
135
- .page_part.ui-tabs-panel {
136
- padding: 5px;
137
- }
138
-
139
- .page_part .field textarea {
140
- width: 98.5%;
141
- }
142
-
143
- .tabs li.tab_with_errors {
144
- background: #CC0000 !important;
145
- }
146
-
147
- .tabs li.tab_with_errors a {
148
- color: white !important;
149
- }
150
-
151
- .page_form br {
152
- display: none;
153
- }
154
-
155
- .page_form .field input[type="text"] {
156
- width: 44.6em;
157
- }
158
-
159
- .page_form #new_page_part_name {
160
- width: 20em;
161
- }
162
-
163
- .page_form .field.new_page_part_name {
164
- text-align: right;
165
- }
166
-
167
- .page_form .field.page_part_title label {
168
- width: 6em;
169
- display: inline-block;
170
- text-align: right;
171
- }
172
-
173
- .page_form .field.status label,
174
- .page_form .field.css label,
175
- .page_form .field.js label,
176
- .page_form .field.no_publish_window label,
177
- .page_form .field.publish_from label,
178
- .page_form .field.publish_to label,
179
- .page_form .field.controller_action label,
180
- .page_form .field.url label,
181
- .page_form .field.display_in_sitemap label,
182
- .page_form .field.display_in_menu label,
183
- .page_form .field.menu_css_class label,
184
- .page_form .field.no_link label,
185
- .page_form .field.layout label,
186
- .page_form .field.title label,
187
- .page_form .field.permalink label,
188
- .page_form .field.meta_description label,
189
- .page_form .field.meta_keywords label,
190
- .page_form .field.page_part_title label,
191
- .page_form .field.filter label,
192
- .page_form .field.roles label:first-child {
193
- padding: 0 10px 0 0;
194
- width: 10em;
195
- display: inline-block;
196
- text-align: right;
197
- }
198
-
199
- .page_form .field.page_part_title label,
200
- .page_form .field.filter label {
201
- width: 4em;
202
- }
203
-
204
- .page_form #page_meta_keywords,
205
- .page_form #page_meta_description,
206
- .page_form #page_css,
207
- .page_form #page_js {
208
- height: 12em;
209
- vertical-align: middle;
210
- width: 49.5em;
211
- }
212
-
213
- .page_form .field.roles .roles_list {
214
- display: inline;
215
- }
216
-
217
- form#page_snippet .field.name br,
218
- form#page_snippet .field.filter br {
219
- display: none;
220
- }
221
-
222
- form#page_snippet .field.name label,
223
- form#page_snippet .field.filter label {
224
- display: inline-block;
225
- width: 80px;
226
- }
227
-
228
- form#page_snippet .field.name input[type="text"] {
229
- width: 645px;
230
- }
231
-
232
- form#page_snippet .field.content textarea {
233
- width: 98.4%;
234
- }
@@ -1,6 +1,4 @@
1
- class Admin::PageSnippetsController < ApplicationController
2
- layout 'admin'
3
-
1
+ class Admin::PageSnippetsController < ApplicationController
4
2
  def index
5
3
  @page_snippets = PageSnippet.all
6
4