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
@@ -3,26 +3,12 @@ require 'page_engine/instance_methods'
3
3
  require 'page_engine/exceptions'
4
4
 
5
5
  class << ActionController::Base
6
- def page_engine(options = {})
7
- # # Check options
8
- # raise PageEngine::PageEngineException.new("Options for page_engine must be in a hash.") unless options.is_a? Hash
9
- #
10
- # options = {
11
- # :layouts = ['application']
12
- # }.merge(options)
13
-
14
- # options.each do |key, value|
15
- # unless [:layouts].include?(key)
16
- # raise PageEngine::PageEngineException.new("Unknown option for page_engine: #{key.inspect} => #{value.inspect}.")
17
- # end
18
- # end
6
+ def page_engine
19
7
 
20
8
  include PageEngine::InstanceMethods
21
9
  extend PageEngine::ClassMethods
22
10
 
23
11
  before_filter :find_page
24
12
  layout :get_layout
25
-
26
- # PageEngine.layouts = options[:layouts].is_a?(Array) ? options[:layouts] : ['application']
27
13
  end
28
14
  end
@@ -8,14 +8,12 @@ module PageEngine
8
8
  end
9
9
  end
10
10
 
11
- def find_page(permalink=nil)
12
- current_user = nil unless defined?(current_user)
13
-
14
- unless params[:controller].split('/').first == "admin"
11
+ def find_page(permalink=nil)
12
+ if Page.should_be_found?(params)
15
13
  if permalink
16
- @page = Page.includes(:page_parts).published.viewable_by(current_user).where(:permalink => permalink)
14
+ @page = Page.includes(:page_parts).published.viewable_by(get_current_page_viewer).where(:permalink => permalink)
17
15
  else
18
- @page = Page.includes(:page_parts).published.viewable_by(current_user).with_url(request, params).first
16
+ @page = Page.includes(:page_parts).published.viewable_by(get_current_page_viewer).with_url(request, params).first
19
17
  end
20
18
  # See http://stackoverflow.com/questions/1595424/request-format-returning
21
19
  # This last format appears when the page is refreshed in IE
@@ -66,17 +64,23 @@ module PageEngine
66
64
  end
67
65
  end
68
66
  end
69
-
67
+
70
68
  private
71
69
 
72
70
  def get_breadcrumbs
73
- current_user = nil unless defined?(current_user)
74
71
  if @page
75
- @breadcrumbs = @page.ancestors.for_nav.published.viewable_by(current_user).all
72
+ @breadcrumbs = @page.ancestors.for_nav.published.viewable_by(get_current_page_viewer).all
76
73
  else
77
74
  @breadcrumbs = []
78
75
  end
79
76
  end
80
-
77
+
78
+ def get_current_page_viewer
79
+ if PageEngine.has_viewers?
80
+ user = send(PageEngine.current_viewer_helper)
81
+ else
82
+ user = nil
83
+ end
84
+ end
81
85
  end
82
86
  end
@@ -0,0 +1,3 @@
1
+ module PageEngine
2
+ VERSION = "0.0.5"
3
+ end
@@ -5,8 +5,118 @@
5
5
  *= require_self
6
6
  *= require page_engine
7
7
  *= require_tree .
8
+ *= require jquery-ui
8
9
  */
9
10
 
11
+ .js .hidden {
12
+ display: none;
13
+ }
14
+
15
+ .icon {
16
+ display: -moz-inline-box;
17
+ -moz-box-orient: vertical;
18
+ display: inline-block;
19
+ vertical-align: middle;
20
+ *vertical-align: auto;
21
+ height: 16px;
22
+ width: 16px;
23
+ text-indent: -119988px;
24
+ overflow: hidden;
25
+ text-align: left;
26
+ background-image: url(/assets/page_engine/ruby.png);
27
+ background-repeat: no-repeat;
28
+ background-position: 50% 50%;
29
+ vertical-align: middle;
30
+ cursor: pointer;
31
+ background-repeat: no-repeat;
32
+ background-position: center center;
33
+ }
34
+
35
+ .icon {
36
+ *display: inline;
37
+ }
38
+
39
+ .icon.add {
40
+ background-image: url(/assets/page_engine/add.png);
41
+ }
42
+
43
+ .icon.delete {
44
+ background-image: url(/assets/page_engine/delete.png);
45
+ }
46
+
47
+ .icon.edit {
48
+ background-image: url(/assets/page_engine/pencil.png);
49
+ }
50
+
51
+ .icon.show {
52
+ background-image: url(/assets/page_engine/zoom.png);
53
+ }
54
+
55
+ .icon.waiting {
56
+ background-image: url(/assets/page_engine/waiting.gif);
57
+ }
58
+
59
+ ol#page_engine li.placeholder {
60
+ border: dashed 1px #333;
61
+ }
62
+
63
+ ol#page_engine * {
64
+ list-style: none;
65
+ }
66
+
67
+ ol#page_engine,
68
+ ol#page_engine ol {
69
+ margin: 0;
70
+ padding: 0 0 0 16px;
71
+ border-left: solid white 1px;
72
+ }
73
+
74
+ ol#page_engine li.page {
75
+ background: white;
76
+ }
77
+
78
+ ol#page_engine .icon.add {
79
+ margin: 0 0 0 6px;
80
+ background-image: url(/assets/page_engine/page_add.png);
81
+ }
82
+
83
+ ol#page_engine .icon.edit {
84
+ background-image: url(/assets/page_engine/page_edit.png);
85
+ }
86
+
87
+ ol#page_engine .icon.delete {
88
+ background-image: url(/assets/page_engine/page_delete.png);
89
+ }
90
+
91
+ ol#page_engine .icon.duplicate {
92
+ background-image: url(/assets/page_engine/page_copy.png);
93
+ }
94
+
95
+ ol#page_engine .icon.published {
96
+ margin: 0 6px 0 0;
97
+ background-image: url(/assets/page_engine/page_green.png);
98
+ }
99
+
100
+ ol#page_engine .icon.live {
101
+ margin: 0 6px 0 0;
102
+ background-image: url(/assets/page_engine/page_lightning.png);
103
+ }
104
+
105
+ ol#page_engine .icon.draft {
106
+ margin: 0 6px 0 0;
107
+ background-image: url(/assets/page_engine/page_red.png);
108
+ }
109
+
110
+ ol#page_engine .icon.hidden {
111
+ margin: 0 6px 0 0;
112
+ background-image: url(/assets/page_engine/page_hidden.png);
113
+ }
114
+
115
+ ol#page_engine .icon.review {
116
+ margin: 0 6px 0 0;
117
+ background-image: url(/assets/page_engine/page_gear.png);
118
+ }
119
+
10
120
  form.simple_form {
11
121
  width: 836px;
12
122
  }
@@ -83,11 +193,11 @@ form.simple_form textarea {
83
193
  height: 250px;
84
194
  }
85
195
 
86
- form.simple_form .page_parts input.text, form.simple_form .page_parts input.title, form.simple_form .page_parts input[type=email], form.simple_form .page_parts input[type=text], form.simple_form .page_parts input.numeric, form.simple_form .page_parts input.tel, form.simple_form .page_parts input.url, form.simple_form .page_parts input[type=password] {
196
+ form.simple_form #page_engine_page_parts input.text, form.simple_form #page_engine_page_parts input.title, form.simple_form #page_engine_page_parts input[type=email], form.simple_form #page_engine_page_parts input[type=text], form.simple_form #page_engine_page_parts input.numeric, form.simple_form #page_engine_page_parts input.tel, form.simple_form #page_engine_page_parts input.url, form.simple_form #page_engine_page_parts input[type=password] {
87
197
  width: 804px;
88
198
  }
89
199
 
90
- form.simple_form .page_parts textarea {
200
+ form.simple_form #page_engine_page_parts textarea {
91
201
  width: 804px;
92
202
  }
93
203
 
@@ -246,6 +356,14 @@ form.simple_form iframe.markItUpPreviewFrame {
246
356
  width: 814px;
247
357
  }
248
358
 
359
+ form.simple_form .page_part {
360
+ padding: 5px;
361
+ }
362
+
363
+ form.simple_form .page_part .delete {
364
+ float: right;
365
+ }
366
+
249
367
  .CodeMirror {
250
368
  border: 1px solid #BBBBBB;
251
369
  padding: 5px;
@@ -256,3 +374,16 @@ form.simple_form iframe.markItUpPreviewFrame {
256
374
  -khtml-border-radius: 5px;
257
375
  border-radius: 5px;
258
376
  }
377
+
378
+ #page_engine_page_parts ul li.tab_with_errors {
379
+ background: #CC0000 !important;
380
+ }
381
+
382
+ #page_engine_page_parts ul li.tab_with_errors a {
383
+ color: white !important;
384
+ }
385
+
386
+ #page_engine_page_parts ul li span.delete {
387
+ float: left;
388
+ margin: 0.6em 0.2em 0 0;
389
+ }
@@ -2,4 +2,21 @@ class ApplicationController < ActionController::Base
2
2
  protect_from_forgery
3
3
 
4
4
  page_engine
5
+
6
+ layout :get_layout
7
+
8
+ def current_weird_user
9
+ WeirdUser.first
10
+ end
11
+ helper_method :current_weird_user
12
+
13
+ private
14
+
15
+ def get_layout
16
+ if request.params[:controller] =~ /admin\//
17
+ "admin/application"
18
+ else
19
+ "application"
20
+ end
21
+ end
5
22
  end
@@ -0,0 +1,5 @@
1
+ class OddRole < ActiveRecord::Base
2
+ # Relationships
3
+ has_and_belongs_to_many :weird_users
4
+ end
5
+
@@ -0,0 +1,8 @@
1
+ class WeirdUser < ActiveRecord::Base
2
+ # Relationships
3
+ has_and_belongs_to_many :odd_roles
4
+
5
+ def to_s
6
+ self.name
7
+ end
8
+ end
@@ -0,0 +1,15 @@
1
+ !!! 5
2
+ %html
3
+ %head
4
+ %title PageEngine Admin
5
+ = stylesheet_link_tag "application"
6
+ = javascript_include_tag "application"
7
+ = csrf_meta_tags
8
+ %body
9
+
10
+ %ul#nav
11
+ %li= link_to('Pages', admin_pages_path)
12
+ %li= link_to('Page snippets', admin_page_snippets_path)
13
+
14
+ #content
15
+ = yield
@@ -0,0 +1,29 @@
1
+ !!! 5
2
+ %html
3
+ %head
4
+ %title= page_title('Dummy')
5
+ = stylesheet_link_tag "application"
6
+ = javascript_include_tag "application", :page_engine
7
+ = page_meta_keywords
8
+ = page_meta_description
9
+ = csrf_meta_tags
10
+ = page_css
11
+ %body
12
+ #nav
13
+ = navigation :include_root => true, :depth => 5
14
+
15
+ #header
16
+ = breadcrumbs :format => :inline
17
+
18
+ #content
19
+ %p This layout is troubled
20
+
21
+ = yield
22
+
23
+ = navigation :root => @page
24
+
25
+ = page_js
26
+
27
+ #footer
28
+
29
+ = page_snippet :footer
@@ -1,13 +1,34 @@
1
1
  PageEngine.setup do |config|
2
2
  # Layouts available to the psge
3
- config.layouts = [:application]
3
+ config.layouts = [:application, :trouble]
4
4
 
5
5
  # Page parts that are created by default with a new page
6
- config.page_parts = %w{ body left right header footer }
6
+ # config.page_parts = %w{ body left right header footer }
7
7
 
8
8
  # Extra page status options, added to defaults
9
- config.statuses = []
9
+ # config.statuses = []
10
10
 
11
11
  # Filters that can be applied to the page parts content
12
- config.filters = %w{ none html textile markdown }
12
+ # config.filters = %w{ none html textile markdown }
13
+
14
+ # List of actions that should be included when getting the available routes
15
+ # config.required_route_actions = %w{ index show new edit create update }
16
+
17
+ # List of controllers that should be excluded when getting the available routes
18
+ # config.excluded_route_controllers = []
19
+
20
+ # To give more control over which controllers are returned
21
+ # config.excluded_route_controllers_regex = /^admin.*/
22
+
23
+ # If a page should only be vieawable by a specific role set the role class here
24
+ config.role_class = 'OddRole' # or nil, 'Role' for example
25
+
26
+ # Author class for the created pages
27
+ config.author_class = 'WeirdUser' # or nil, 'User' for example
28
+
29
+ # Set the helper method that will be used to get the current author
30
+ config.current_author_helper = 'current_weird_user'
31
+
32
+ # Set the helper method that will be used to get the current viewer
33
+ config.current_viewer_helper = 'current_weird_user'
13
34
  end
@@ -0,0 +1,16 @@
1
+ class AddOddRoles < ActiveRecord::Migration
2
+ def up
3
+ create_table :odd_roles do |t|
4
+ t.string :name
5
+ end
6
+
7
+ # Create some random roles for the dummy application
8
+ ['Admin', 'Editor', 'Author', 'User'].each do |name|
9
+ OddRole.create(:name => name)
10
+ end
11
+ end
12
+
13
+ def down
14
+ drop_table :odd_roles
15
+ end
16
+ end