deluxe_publisher 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (239) hide show
  1. data/.document +5 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +29 -0
  4. data/LICENSE +20 -0
  5. data/README.rdoc +127 -0
  6. data/Rakefile +61 -0
  7. data/VERSION +1 -0
  8. data/app/controllers/deluxe_publisher/comments_controller.rb +93 -0
  9. data/app/controllers/deluxe_publisher/page_types_controller.rb +115 -0
  10. data/app/controllers/deluxe_publisher/pages_controller.rb +191 -0
  11. data/app/controllers/deluxe_publisher/presenter_controller.rb +185 -0
  12. data/app/controllers/deluxe_publisher/redirects_controller.rb +90 -0
  13. data/app/controllers/deluxe_publisher/sitemap_controller.rb +10 -0
  14. data/app/helpers/application_helper.rb +2 -0
  15. data/app/helpers/deluxe_publisher/comments_helper.rb +2 -0
  16. data/app/helpers/deluxe_publisher/page_types_helper.rb +13 -0
  17. data/app/helpers/deluxe_publisher/pages_helper.rb +41 -0
  18. data/app/helpers/deluxe_publisher/presenter_helper.rb +111 -0
  19. data/app/helpers/deluxe_publisher/redirects_helper.rb +2 -0
  20. data/app/helpers/deluxe_publisher/sitemap_helper.rb +2 -0
  21. data/app/models/ckeditor/asset.rb +88 -0
  22. data/app/models/ckeditor/attachment_file.rb +40 -0
  23. data/app/models/ckeditor/picture.rb +23 -0
  24. data/app/models/deluxe_publisher/comment.rb +6 -0
  25. data/app/models/deluxe_publisher/content.rb +6 -0
  26. data/app/models/deluxe_publisher/content_descriptor.rb +4 -0
  27. data/app/models/deluxe_publisher/page.rb +206 -0
  28. data/app/models/deluxe_publisher/page_type.rb +55 -0
  29. data/app/models/deluxe_publisher/redirect.rb +6 -0
  30. data/app/models/deluxe_publisher.rb +5 -0
  31. data/app/views/deluxe_publisher/comments/_form.html.erb +31 -0
  32. data/app/views/deluxe_publisher/comments/edit.html.erb +6 -0
  33. data/app/views/deluxe_publisher/comments/index.html.erb +31 -0
  34. data/app/views/deluxe_publisher/comments/new.html.erb +6 -0
  35. data/app/views/deluxe_publisher/comments/show.html.erb +30 -0
  36. data/app/views/deluxe_publisher/page_types/_content_descriptors.html.erb +15 -0
  37. data/app/views/deluxe_publisher/page_types/_form.html.erb +59 -0
  38. data/app/views/deluxe_publisher/page_types/content_areas_change.js.erb +3 -0
  39. data/app/views/deluxe_publisher/page_types/edit.html.erb +8 -0
  40. data/app/views/deluxe_publisher/page_types/index.html.erb +29 -0
  41. data/app/views/deluxe_publisher/page_types/new.html.erb +7 -0
  42. data/app/views/deluxe_publisher/page_types/show.html.erb +45 -0
  43. data/app/views/deluxe_publisher/pages/_form.html.erb +39 -0
  44. data/app/views/deluxe_publisher/pages/_general.html.erb +108 -0
  45. data/app/views/deluxe_publisher/pages/_page.html.erb +23 -0
  46. data/app/views/deluxe_publisher/pages/_page_content.html.erb +16 -0
  47. data/app/views/deluxe_publisher/pages/_page_links.html.erb +9 -0
  48. data/app/views/deluxe_publisher/pages/_seo.html.erb +27 -0
  49. data/app/views/deluxe_publisher/pages/edit.html.erb +5 -0
  50. data/app/views/deluxe_publisher/pages/index.html.erb +11 -0
  51. data/app/views/deluxe_publisher/pages/new.html.erb +6 -0
  52. data/app/views/deluxe_publisher/pages/page_type_change.js.erb +3 -0
  53. data/app/views/deluxe_publisher/pages/show.html.erb +115 -0
  54. data/app/views/deluxe_publisher/presenter/create_comment.js.erb +3 -0
  55. data/app/views/deluxe_publisher/presenter/create_comment_failed.js.erb +1 -0
  56. data/app/views/deluxe_publisher/presenter/new_comment.js.erb +7 -0
  57. data/app/views/deluxe_publisher/presenter/preview.html.erb +2 -0
  58. data/app/views/deluxe_publisher/redirects/_form.html.erb +29 -0
  59. data/app/views/deluxe_publisher/redirects/edit.html.erb +6 -0
  60. data/app/views/deluxe_publisher/redirects/index.html.erb +27 -0
  61. data/app/views/deluxe_publisher/redirects/new.html.erb +5 -0
  62. data/app/views/deluxe_publisher/redirects/show.html.erb +20 -0
  63. data/app/views/deluxe_publisher/sitemap/index.xml.builder +12 -0
  64. data/app/views/deluxe_publisher/templates/simple_blog.html.erb +19 -0
  65. data/app/views/deluxe_publisher/templates/simple_blog.rss.builder +23 -0
  66. data/app/views/deluxe_publisher/templates/simple_blog_story.html.erb +9 -0
  67. data/app/views/deluxe_publisher/templates/simple_page.html.erb +4 -0
  68. data/app/views/layouts/_deluxe_publisher_comment_form.html.erb +29 -0
  69. data/app/views/layouts/_deluxe_publisher_comments_list.html.erb +8 -0
  70. data/app/views/layouts/application.html.erb +14 -0
  71. data/app/views/layouts/deluxe_publisher.html.erb +36 -0
  72. data/app/views/layouts/deluxe_publisher_blog.html.erb +63 -0
  73. data/app/views/layouts/deluxe_publisher_simple.html.erb +30 -0
  74. data/config/routes.rb +49 -0
  75. data/deluxe_publisher.gemspec +466 -0
  76. data/lib/deluxe_publisher/deluxe_publisher_authentication.rb +37 -0
  77. data/lib/deluxe_publisher/engine.rb +5 -0
  78. data/lib/deluxe_publisher.rb +40 -0
  79. data/lib/generators/deluxe_publisher/base/USAGE +8 -0
  80. data/lib/generators/deluxe_publisher/base/base_generator.rb +45 -0
  81. data/lib/generators/deluxe_publisher/base/templates/images/add.png +0 -0
  82. data/lib/generators/deluxe_publisher/base/templates/images/btn_addNewPage.gif +0 -0
  83. data/lib/generators/deluxe_publisher/base/templates/images/btn_cancel.gif +0 -0
  84. data/lib/generators/deluxe_publisher/base/templates/images/btn_preview.gif +0 -0
  85. data/lib/generators/deluxe_publisher/base/templates/images/btn_save.gif +0 -0
  86. data/lib/generators/deluxe_publisher/base/templates/images/bullet.gif +0 -0
  87. data/lib/generators/deluxe_publisher/base/templates/images/content_bg.jpg +0 -0
  88. data/lib/generators/deluxe_publisher/base/templates/images/delete.png +0 -0
  89. data/lib/generators/deluxe_publisher/base/templates/images/edit.png +0 -0
  90. data/lib/generators/deluxe_publisher/base/templates/images/header_background.jpg +0 -0
  91. data/lib/generators/deluxe_publisher/base/templates/images/icon_published.gif +0 -0
  92. data/lib/generators/deluxe_publisher/base/templates/images/icon_unpublished.gif +0 -0
  93. data/lib/generators/deluxe_publisher/base/templates/images/logo.gif +0 -0
  94. data/lib/generators/deluxe_publisher/base/templates/images/minus.gif +0 -0
  95. data/lib/generators/deluxe_publisher/base/templates/images/plus.gif +0 -0
  96. data/lib/generators/deluxe_publisher/base/templates/images/show.png +0 -0
  97. data/lib/generators/deluxe_publisher/base/templates/images/tab_bg.gif +0 -0
  98. data/lib/generators/deluxe_publisher/base/templates/images/tabs_bg.jpg +0 -0
  99. data/lib/generators/deluxe_publisher/base/templates/initializer.rb +23 -0
  100. data/lib/generators/deluxe_publisher/base/templates/javascripts/deluxe_presenter.js +25 -0
  101. data/lib/generators/deluxe_publisher/base/templates/javascripts/deluxe_publisher.js +86 -0
  102. data/lib/generators/deluxe_publisher/base/templates/javascripts/jquery-rails.js +158 -0
  103. data/lib/generators/deluxe_publisher/base/templates/layouts/_deluxe_publisher_comment_form.html.erb +29 -0
  104. data/lib/generators/deluxe_publisher/base/templates/layouts/_deluxe_publisher_comments_list.html.erb +8 -0
  105. data/lib/generators/deluxe_publisher/base/templates/layouts/deluxe_publisher_blog.html.erb +74 -0
  106. data/lib/generators/deluxe_publisher/base/templates/layouts/deluxe_publisher_simple.html.erb +47 -0
  107. data/lib/generators/deluxe_publisher/base/templates/stylesheets/deluxe_presenter.css +458 -0
  108. data/lib/generators/deluxe_publisher/base/templates/stylesheets/deluxe_publisher.css +202 -0
  109. data/lib/generators/deluxe_publisher/base/templates/templates/simple_blog.html.erb +19 -0
  110. data/lib/generators/deluxe_publisher/base/templates/templates/simple_blog.rss.builder +23 -0
  111. data/lib/generators/deluxe_publisher/base/templates/templates/simple_blog_story.html.erb +12 -0
  112. data/lib/generators/deluxe_publisher/base/templates/templates/simple_page.html.erb +4 -0
  113. data/lib/generators/deluxe_publisher/migration/USAGE +0 -0
  114. data/lib/generators/deluxe_publisher/migration/migration_generator.rb +18 -0
  115. data/lib/generators/deluxe_publisher/migration/templates/migration.rb +98 -0
  116. data/lib/generators/deluxe_publisher/sample_site/sample_site_generator.rb +316 -0
  117. data/spec/controllers/deluxe_publisher/comments_controller_spec.rb +129 -0
  118. data/spec/controllers/deluxe_publisher/page_types_controller_spec.rb +125 -0
  119. data/spec/controllers/deluxe_publisher/pages_controller_spec.rb +129 -0
  120. data/spec/controllers/deluxe_publisher/presenter_controller_spec.rb +19 -0
  121. data/spec/controllers/deluxe_publisher/redirects_controller_spec.rb +118 -0
  122. data/spec/deluxe_publisher_spec.rb +7 -0
  123. data/spec/dummy/Rakefile +7 -0
  124. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  125. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  126. data/spec/dummy/app/views/deluxe_publisher/comments/_form.html.erb +31 -0
  127. data/spec/dummy/app/views/deluxe_publisher/comments/edit.html.erb +6 -0
  128. data/spec/dummy/app/views/deluxe_publisher/comments/index.html.erb +31 -0
  129. data/spec/dummy/app/views/deluxe_publisher/comments/new.html.erb +6 -0
  130. data/spec/dummy/app/views/deluxe_publisher/comments/show.html.erb +30 -0
  131. data/spec/dummy/app/views/deluxe_publisher/page_types/_content_descriptors.html.erb +15 -0
  132. data/spec/dummy/app/views/deluxe_publisher/page_types/_form.html.erb +59 -0
  133. data/spec/dummy/app/views/deluxe_publisher/page_types/content_areas_change.js.erb +3 -0
  134. data/spec/dummy/app/views/deluxe_publisher/page_types/edit.html.erb +8 -0
  135. data/spec/dummy/app/views/deluxe_publisher/page_types/index.html.erb +29 -0
  136. data/spec/dummy/app/views/deluxe_publisher/page_types/new.html.erb +7 -0
  137. data/spec/dummy/app/views/deluxe_publisher/page_types/show.html.erb +45 -0
  138. data/spec/dummy/app/views/deluxe_publisher/pages/_form.html.erb +36 -0
  139. data/spec/dummy/app/views/deluxe_publisher/pages/_general.html.erb +108 -0
  140. data/spec/dummy/app/views/deluxe_publisher/pages/_page.html.erb +23 -0
  141. data/spec/dummy/app/views/deluxe_publisher/pages/_page_content.html.erb +16 -0
  142. data/spec/dummy/app/views/deluxe_publisher/pages/_page_links.html.erb +9 -0
  143. data/spec/dummy/app/views/deluxe_publisher/pages/_seo.html.erb +27 -0
  144. data/spec/dummy/app/views/deluxe_publisher/pages/edit.html.erb +7 -0
  145. data/spec/dummy/app/views/deluxe_publisher/pages/index.html.erb +10 -0
  146. data/spec/dummy/app/views/deluxe_publisher/pages/new.html.erb +7 -0
  147. data/spec/dummy/app/views/deluxe_publisher/pages/page_type_change.js.erb +3 -0
  148. data/spec/dummy/app/views/deluxe_publisher/pages/show.html.erb +115 -0
  149. data/spec/dummy/app/views/deluxe_publisher/presenter/create_comment.js.erb +3 -0
  150. data/spec/dummy/app/views/deluxe_publisher/presenter/create_comment_failed.js.erb +1 -0
  151. data/spec/dummy/app/views/deluxe_publisher/presenter/new_comment.js.erb +7 -0
  152. data/spec/dummy/app/views/deluxe_publisher/presenter/preview.html.erb +2 -0
  153. data/spec/dummy/app/views/deluxe_publisher/templates/simple_blog.html.erb +19 -0
  154. data/spec/dummy/app/views/deluxe_publisher/templates/simple_blog.rss.builder +23 -0
  155. data/spec/dummy/app/views/deluxe_publisher/templates/simple_blog_story.html.erb +9 -0
  156. data/spec/dummy/app/views/deluxe_publisher/templates/simple_page.html.erb +4 -0
  157. data/spec/dummy/app/views/layouts/_deluxe_publisher_comment_form.html.erb +29 -0
  158. data/spec/dummy/app/views/layouts/_deluxe_publisher_comments_list.html.erb +8 -0
  159. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  160. data/spec/dummy/app/views/layouts/deluxe_publisher.html.erb +31 -0
  161. data/spec/dummy/app/views/layouts/deluxe_publisher_blog.html.erb +63 -0
  162. data/spec/dummy/app/views/layouts/deluxe_publisher_simple.html.erb +30 -0
  163. data/spec/dummy/config/application.rb +45 -0
  164. data/spec/dummy/config/boot.rb +10 -0
  165. data/spec/dummy/config/database.yml +22 -0
  166. data/spec/dummy/config/environment.rb +5 -0
  167. data/spec/dummy/config/environments/development.rb +26 -0
  168. data/spec/dummy/config/environments/production.rb +49 -0
  169. data/spec/dummy/config/environments/test.rb +35 -0
  170. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  171. data/spec/dummy/config/initializers/deluxe_publisher.rb +23 -0
  172. data/spec/dummy/config/initializers/inflections.rb +10 -0
  173. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  174. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  175. data/spec/dummy/config/initializers/session_store.rb +8 -0
  176. data/spec/dummy/config/locales/en.yml +5 -0
  177. data/spec/dummy/config/routes.rb +104 -0
  178. data/spec/dummy/config.ru +4 -0
  179. data/spec/dummy/db/migrate/20110405190943_create_deluxe_publisher.rb +135 -0
  180. data/spec/dummy/db/schema.rb +130 -0
  181. data/spec/dummy/public/404.html +26 -0
  182. data/spec/dummy/public/422.html +26 -0
  183. data/spec/dummy/public/500.html +26 -0
  184. data/spec/dummy/public/favicon.ico +0 -0
  185. data/spec/dummy/public/javascripts/application.js +2 -0
  186. data/spec/dummy/public/javascripts/controls.js +965 -0
  187. data/spec/dummy/public/javascripts/dragdrop.js +974 -0
  188. data/spec/dummy/public/javascripts/effects.js +1123 -0
  189. data/spec/dummy/public/javascripts/prototype.js +6001 -0
  190. data/spec/dummy/public/javascripts/rails.js +191 -0
  191. data/spec/dummy/public/stylesheets/.gitkeep +0 -0
  192. data/spec/dummy/script/rails +6 -0
  193. data/spec/factories/comment_factory.rb +4 -0
  194. data/spec/factories/content_descriptor_factory.rb +5 -0
  195. data/spec/factories/content_factory.rb +24 -0
  196. data/spec/factories/page_factory.rb +26 -0
  197. data/spec/factories/page_type_factory.rb +10 -0
  198. data/spec/factories/redirect_factory.rb +4 -0
  199. data/spec/helpers/deluxe_publisher/comments_helper_spec.rb +15 -0
  200. data/spec/helpers/deluxe_publisher/page_types_helper_spec.rb +26 -0
  201. data/spec/helpers/deluxe_publisher/pages_helper_spec.rb +65 -0
  202. data/spec/helpers/deluxe_publisher/presenter_helper_spec.rb +19 -0
  203. data/spec/helpers/deluxe_publisher/redirects_helper_spec.rb +15 -0
  204. data/spec/integration/navigation_spec.rb +9 -0
  205. data/spec/models/deluxe_publisher/comment_spec.rb +5 -0
  206. data/spec/models/deluxe_publisher/content_descriptor_spec.rb +5 -0
  207. data/spec/models/deluxe_publisher/content_spec.rb +5 -0
  208. data/spec/models/deluxe_publisher/page_spec.rb +358 -0
  209. data/spec/models/deluxe_publisher/page_type_spec.rb +62 -0
  210. data/spec/models/deluxe_publisher/redirect_spec.rb +17 -0
  211. data/spec/requests/deluxe_publisher/deluxe_publisher_comments_spec.rb +11 -0
  212. data/spec/requests/deluxe_publisher/deluxe_publisher_page_types_spec.rb +11 -0
  213. data/spec/requests/deluxe_publisher/deluxe_publisher_redirects_spec.rb +11 -0
  214. data/spec/requests/deluxe_publisher/pages_spec.rb +11 -0
  215. data/spec/routing/deluxe_publisher/comments_routing_spec.rb +35 -0
  216. data/spec/routing/deluxe_publisher/page_types_routing_spec.rb +47 -0
  217. data/spec/routing/deluxe_publisher/pages_routing_spec.rb +47 -0
  218. data/spec/routing/deluxe_publisher/presenter_routing_spec.rb +66 -0
  219. data/spec/routing/deluxe_publisher/redirects_routing_spec.rb +35 -0
  220. data/spec/spec_helper.rb +234 -0
  221. data/spec/views/deluxe_publisher/comments/edit.html.erb_spec.rb +24 -0
  222. data/spec/views/deluxe_publisher/comments/index.html.erb_spec.rb +32 -0
  223. data/spec/views/deluxe_publisher/comments/new.html.erb_spec.rb +24 -0
  224. data/spec/views/deluxe_publisher/comments/show.html.erb_spec.rb +24 -0
  225. data/spec/views/deluxe_publisher/page_types/edit.html.erb_spec.rb +32 -0
  226. data/spec/views/deluxe_publisher/page_types/index.html.erb_spec.rb +48 -0
  227. data/spec/views/deluxe_publisher/page_types/new.html.erb_spec.rb +32 -0
  228. data/spec/views/deluxe_publisher/page_types/show.html.erb_spec.rb +36 -0
  229. data/spec/views/deluxe_publisher/pages/edit.html.erb_spec.rb +58 -0
  230. data/spec/views/deluxe_publisher/pages/index.html.erb_spec.rb +100 -0
  231. data/spec/views/deluxe_publisher/pages/new.html.erb_spec.rb +81 -0
  232. data/spec/views/deluxe_publisher/pages/show.html.erb_spec.rb +75 -0
  233. data/spec/views/deluxe_publisher/presenter/present.html.erb_spec.rb +5 -0
  234. data/spec/views/deluxe_publisher/presenter/preview.html.erb_spec.rb +5 -0
  235. data/spec/views/deluxe_publisher/redirects/edit.html.erb_spec.rb +22 -0
  236. data/spec/views/deluxe_publisher/redirects/index.html.erb_spec.rb +28 -0
  237. data/spec/views/deluxe_publisher/redirects/new.html.erb_spec.rb +22 -0
  238. data/spec/views/deluxe_publisher/redirects/show.html.erb_spec.rb +21 -0
  239. metadata +1006 -0
@@ -0,0 +1,125 @@
1
+ require 'spec_helper'
2
+
3
+ # This spec was generated by rspec-rails when you ran the scaffold generator.
4
+ # It demonstrates how one might use RSpec to specify the controller code that
5
+ # was generated by the Rails when you ran the scaffold generator.
6
+
7
+ describe DeluxePublisher::PageTypesController do
8
+
9
+ def mock_page_type(stubs={})
10
+ @mock_page_type ||= mock_model(DeluxePublisher::PageType, stubs).as_null_object
11
+ end
12
+
13
+ describe "GET index" do
14
+ it "assigns all deluxe_publisher_page_types as @deluxe_publisher_page_types" do
15
+ DeluxePublisher::PageType.stub(:all) { [mock_page_type] }
16
+ get :index
17
+ assigns(:deluxe_publisher_page_types).should eq([mock_page_type])
18
+ end
19
+ end
20
+
21
+ describe "GET show" do
22
+ it "assigns the requested page_type as @page_type" do
23
+ DeluxePublisher::PageType.stub(:find).with("37") { mock_page_type }
24
+ get :show, :id => "37"
25
+ assigns(:deluxe_publisher_page_type).should be(mock_page_type)
26
+ end
27
+ end
28
+
29
+ describe "GET new" do
30
+ it "assigns a new page_type as @page_type" do
31
+ DeluxePublisher::PageType.stub(:new) { mock_page_type }
32
+ get :new
33
+ assigns(:deluxe_publisher_page_type).should be(mock_page_type)
34
+ end
35
+ end
36
+
37
+ describe "GET edit" do
38
+ it "assigns the requested page_type as @page_type" do
39
+ DeluxePublisher::PageType.stub(:find).with("37") { mock_page_type }
40
+ get :edit, :id => "37"
41
+ assigns(:deluxe_publisher_page_type).should be(mock_page_type)
42
+ end
43
+ end
44
+
45
+ describe "POST create" do
46
+ describe "with valid params" do
47
+ it "assigns a newly created page_type as @page_type" do
48
+ DeluxePublisher::PageType.stub(:new).with({'these' => 'params'}) { mock_page_type(:save => true) }
49
+ post :create, :deluxe_publisher_page_type => {'these' => 'params'}
50
+ assigns(:deluxe_publisher_page_type).should be(mock_page_type)
51
+ end
52
+
53
+ it "redirects to the created page_type" do
54
+ DeluxePublisher::PageType.stub(:new) { mock_page_type(:save => true) }
55
+ post :create, :deluxe_publisher_page_type => {}
56
+ response.should redirect_to(deluxe_publisher_page_type_url(mock_page_type))
57
+ end
58
+ end
59
+
60
+ describe "with invalid params" do
61
+ it "assigns a newly created but unsaved page_type as @page_type" do
62
+ DeluxePublisher::PageType.stub(:new).with({'these' => 'params'}) { mock_page_type(:save => false) }
63
+ post :create, :deluxe_publisher_page_type => {'these' => 'params'}
64
+ assigns(:deluxe_publisher_page_type).should be(mock_page_type)
65
+ end
66
+
67
+ it "re-renders the 'new' template" do
68
+ DeluxePublisher::PageType.stub(:new) { mock_page_type(:save => false) }
69
+ post :create, :page_type => {}
70
+ response.should render_template("new")
71
+ end
72
+ end
73
+ end
74
+
75
+ describe "PUT update" do
76
+ describe "with valid params" do
77
+ it "updates the requested page_type" do
78
+ DeluxePublisher::PageType.stub(:find).with("37") { mock_page_type }
79
+ mock_page_type.should_receive(:update_attributes).with({'these' => 'params'})
80
+ put :update, :id => "37", :deluxe_publisher_page_type => {'these' => 'params'}
81
+ end
82
+
83
+ it "assigns the requested page_type as @page_type" do
84
+ DeluxePublisher::PageType.stub(:find) { mock_page_type(:update_attributes => true) }
85
+ put :update, :id => "1"
86
+ assigns(:deluxe_publisher_page_type).should be(mock_page_type)
87
+ end
88
+
89
+ it "redirects to the page_type" do
90
+ DeluxePublisher::PageType.stub(:find) { mock_page_type(:update_attributes => true) }
91
+ put :update, :id => "1"
92
+ response.should redirect_to(deluxe_publisher_page_type_url(mock_page_type))
93
+ end
94
+ end
95
+
96
+ describe "with invalid params" do
97
+ it "assigns the page_type as @page_type" do
98
+ DeluxePublisher::PageType.stub(:find) { mock_page_type(:update_attributes => false) }
99
+ put :update, :id => "1"
100
+ assigns(:deluxe_publisher_page_type).should be(mock_page_type)
101
+ end
102
+
103
+ it "re-renders the 'edit' template" do
104
+ DeluxePublisher::PageType.stub(:find) { mock_page_type(:update_attributes => false) }
105
+ put :update, :id => "1"
106
+ response.should render_template("edit")
107
+ end
108
+ end
109
+ end
110
+
111
+ describe "DELETE destroy" do
112
+ it "destroys the requested page_type" do
113
+ DeluxePublisher::PageType.stub(:find).with("37") { mock_page_type }
114
+ mock_page_type.should_receive(:destroy)
115
+ delete :destroy, :id => "37"
116
+ end
117
+
118
+ it "redirects to the deluxe_publisher_page_types list" do
119
+ DeluxePublisher::PageType.stub(:find) { mock_page_type }
120
+ delete :destroy, :id => "1"
121
+ response.should redirect_to(deluxe_publisher_page_types_url)
122
+ end
123
+ end
124
+
125
+ end
@@ -0,0 +1,129 @@
1
+ require 'spec_helper'
2
+
3
+ # This spec was generated by rspec-rails when you ran the scaffold generator.
4
+ # It demonstrates how one might use RSpec to specify the controller code that
5
+ # was generated by the Rails when you ran the scaffold generator.
6
+
7
+ describe DeluxePublisher::PagesController do
8
+ include AwesomeCo
9
+
10
+ before do
11
+ reload_awesome_co
12
+ end
13
+
14
+
15
+
16
+ describe "GET index" do
17
+ it "assigns all pages as @pages" do
18
+ get :index
19
+ assigns(:pages).first.id.should eql(@homepage.id)
20
+ end
21
+ end
22
+
23
+ describe "GET show" do
24
+ it "assigns the requested page as @page" do
25
+
26
+ get :show, :id => @about_us
27
+ assigns(:page).should eql(@about_us)
28
+ end
29
+ end
30
+
31
+ describe "GET new" do
32
+ it "assigns a new page as @page" do
33
+
34
+ get :new
35
+ assigns(:page).should be_instance_of(DeluxePublisher::Page)
36
+ end
37
+ end
38
+
39
+ describe "GET edit" do
40
+ it "assigns the requested page as @page" do
41
+
42
+ get :edit, :id => @about_us
43
+ assigns(:page).should eql(@about_us)
44
+ end
45
+ end
46
+
47
+ describe "POST create" do
48
+ describe "with valid params" do
49
+ it "assigns a newly created page as @page" do
50
+ post :create, :deluxe_publisher_page => Factory.attributes_for(:page,
51
+ :parent_id => @about_us.id,
52
+ :menu_title => "Brad Jackson is Awesome",
53
+ :page_type_id => @simple_page_type.id)
54
+
55
+ assigns(:page).should be_instance_of(DeluxePublisher::Page)
56
+ assigns(:page).menu_title.should eql "Brad Jackson is Awesome"
57
+ assigns(:page).should be_a_valid_record
58
+ end
59
+
60
+ it "redirects to the pages" do
61
+ post :create, :deluxe_publisher_page => Factory.attributes_for(:page,
62
+ :parent_id => @about_us.id,
63
+ :menu_title => "Brad Jackson is Awesome",
64
+ :page_type_id => @simple_page_type.id)
65
+ response.should redirect_to(deluxe_publisher_pages_path)
66
+ end
67
+ end
68
+
69
+ describe "with invalid params" do
70
+ it "assigns a newly created but unsaved page as @page" do
71
+ post :create, :deluxe_publisher_page => Factory.attributes_for(:page, :parent_id => @about_us.id, :menu_title => "")
72
+ assigns(:page).should be_instance_of(DeluxePublisher::Page)
73
+ end
74
+
75
+ it "re-renders the 'new' template" do
76
+
77
+ post :create, :deluxe_publisher_page => Factory.attributes_for(:page, :parent_id => @about_us.id, :menu_title => "")
78
+ response.should render_template("new")
79
+ end
80
+ end
81
+ end
82
+
83
+ describe "PUT update" do
84
+ describe "with valid params" do
85
+ it "updates the requested page" do
86
+ put :update, :id => @about_us.id, :deluxe_publisher_page => {:menu_title => "Awesome US"}
87
+ DeluxePublisher::Page.find(@about_us).menu_title.should eql("Awesome US")
88
+ end
89
+
90
+ it "assigns the requested page as @page" do
91
+ put :update, :id => @about_us.id, :deluxe_publisher_page => {:menu_title => "Awesome US"}
92
+ assigns(:page).should be_instance_of(DeluxePublisher::Page)
93
+ end
94
+
95
+ it "redirects to the pages" do
96
+
97
+ put :update, :id => @about_us.id, :deluxe_publisher_page => {:menu_title => "Awesome US"}
98
+ response.should redirect_to(deluxe_publisher_pages_url)
99
+ end
100
+ end
101
+
102
+ describe "with invalid params" do
103
+ it "assigns the page as @page" do
104
+ put :update, :id => @about_us.id, :deluxe_publisher_page => {:menu_title => ""}
105
+ assigns(:page).should be_instance_of(DeluxePublisher::Page)
106
+ end
107
+
108
+ it "re-renders the 'edit' template" do
109
+
110
+ put :update, :id => @about_us.id, :deluxe_publisher_page => {:menu_title => ""}
111
+ response.should render_template("edit")
112
+ end
113
+ end
114
+ end
115
+
116
+ describe "DELETE destroy" do
117
+ it "destroys the requested page" do
118
+ delete :destroy, :id => @about_us.id
119
+ DeluxePublisher::Page.find_by_id(@about_us.id).should be_nil
120
+ end
121
+
122
+ it "redirects to the pages list" do
123
+
124
+ delete :destroy, :id => @about_us.id
125
+ response.should redirect_to(deluxe_publisher_pages_url)
126
+ end
127
+ end
128
+
129
+ end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ describe DeluxePublisher::PresenterController do
4
+
5
+ describe "GET 'present'" do
6
+ pending "should be successful" do
7
+ get '/some/awesome/path'
8
+ response.should be_success
9
+ end
10
+ end
11
+
12
+ describe "POST 'preview'" do
13
+ it "should be successful" do
14
+ post 'preview', {}
15
+ response.should be_success
16
+ end
17
+ end
18
+
19
+ end
@@ -0,0 +1,118 @@
1
+ require 'spec_helper'
2
+
3
+ # This spec was generated by rspec-rails when you ran the scaffold generator.
4
+ # It demonstrates how one might use RSpec to specify the controller code that
5
+ # was generated by the Rails when you ran the scaffold generator.
6
+
7
+ describe DeluxePublisher::RedirectsController do
8
+
9
+ describe "GET index" do
10
+ it "assigns all deluxe_publisher_redirects as @deluxe_publisher_redirects" do
11
+ get :index
12
+ assigns(:deluxe_publisher_redirects).should be_instance_of(Array)
13
+ end
14
+ end
15
+
16
+ describe "GET show" do
17
+ it "assigns the requested redirect as @redirect" do
18
+ redirect = Factory(:redirect)
19
+ get :show, :id => redirect.id
20
+ assigns(:deluxe_publisher_redirect).should be_instance_of(DeluxePublisher::Redirect)
21
+ end
22
+ end
23
+
24
+ describe "GET new" do
25
+ it "assigns a new redirect as @redirect" do
26
+
27
+ get :new
28
+ assigns(:deluxe_publisher_redirect).should be_instance_of(DeluxePublisher::Redirect)
29
+ end
30
+ end
31
+
32
+ describe "GET edit" do
33
+ it "assigns the requested redirect as @redirect" do
34
+ redirect = Factory(:redirect)
35
+ get :edit, :id => redirect.id
36
+ assigns(:deluxe_publisher_redirect).should be_instance_of(DeluxePublisher::Redirect)
37
+ end
38
+ end
39
+
40
+ describe "POST create" do
41
+ describe "with valid params" do
42
+ it "assigns a newly created redirect as @redirect" do
43
+
44
+ post :create, :deluxe_publisher_redirect => Factory.attributes_for(:redirect)
45
+ assigns(:deluxe_publisher_redirect).should be_instance_of(DeluxePublisher::Redirect)
46
+ end
47
+
48
+ it "redirects to the created redirect" do
49
+
50
+ post :create, :deluxe_publisher_redirect => Factory.attributes_for(:redirect)
51
+ response.should redirect_to(deluxe_publisher_redirect_url(assigns(:deluxe_publisher_redirect).id))
52
+ end
53
+ end
54
+
55
+ describe "with invalid params" do
56
+ it "assigns a newly created but unsaved redirect as @redirect" do
57
+ post :create, :deluxe_publisher_redirect => Factory.attributes_for(:redirect, :incoming_url => "")
58
+ assigns(:deluxe_publisher_redirect).should be_instance_of(DeluxePublisher::Redirect)
59
+ end
60
+
61
+ it "re-renders the 'new' template" do
62
+ post :create, :deluxe_publisher_redirect => Factory.attributes_for(:redirect, :incoming_url => "")
63
+ response.should render_template("new")
64
+ end
65
+ end
66
+ end
67
+
68
+ describe "PUT update" do
69
+ describe "with valid params" do
70
+ it "updates the requested redirect" do
71
+ redirect = Factory(:redirect)
72
+ put :update, :id => redirect.id, :deluxe_publisher_redirect => {:incoming_url => "/bob/smith"}
73
+ DeluxePublisher::Redirect.find(redirect.id).incoming_url.should eql "/bob/smith"
74
+ end
75
+
76
+ it "assigns the requested redirect as @redirect" do
77
+ redirect = Factory(:redirect)
78
+ put :update, :id => redirect.id
79
+ assigns(:deluxe_publisher_redirect).should be_instance_of(DeluxePublisher::Redirect)
80
+ end
81
+
82
+ it "redirects to the redirect" do
83
+ redirect = Factory(:redirect)
84
+ put :update, :id => redirect.id
85
+ response.should redirect_to(deluxe_publisher_redirect_url(redirect.id))
86
+ end
87
+ end
88
+
89
+ describe "with invalid params" do
90
+ it "assigns the redirect as @redirect" do
91
+ redirect = Factory(:redirect)
92
+ put :update, :id => redirect.id, :deluxe_publisher_redirect => {:incoming_url => ""}
93
+ assigns(:deluxe_publisher_redirect).should be_instance_of(DeluxePublisher::Redirect)
94
+ end
95
+
96
+ it "re-renders the 'edit' template" do
97
+ redirect = Factory(:redirect)
98
+ put :update, :id => redirect.id, :deluxe_publisher_redirect => {:incoming_url => ""}
99
+ response.should render_template("edit")
100
+ end
101
+ end
102
+ end
103
+
104
+ describe "DELETE destroy" do
105
+ it "destroys the requested redirect" do
106
+ redirect = Factory(:redirect)
107
+ delete :destroy, :id => redirect.id
108
+ DeluxePublisher::Redirect.find_by_id(redirect.id).should be_nil
109
+ end
110
+
111
+ it "redirects to the deluxe_publisher_redirects list" do
112
+ redirect = Factory(:redirect)
113
+ delete :destroy, :id => redirect.id
114
+ response.should redirect_to(deluxe_publisher_redirects_url)
115
+ end
116
+ end
117
+
118
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe DeluxePublisher do
4
+ it "should be valid" do
5
+ DeluxePublisher.should be_a(Module)
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+ require 'rake'
6
+
7
+ Dummy::Application.load_tasks
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,31 @@
1
+
2
+ <% if f.object.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@deluxe_publisher_comment.errors.count, "error") %> prohibited this Comment from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @deluxe_publisher_comment.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+
15
+ <div class="field">
16
+ <%= f.label :body %><br />
17
+ <%= f.text_area :body %>
18
+ </div>
19
+ <div class="field">
20
+ <%= f.label :author %><br />
21
+ <%= f.text_field :author %>
22
+ </div>
23
+ <div class="field">
24
+ <%= f.label :status %><br />
25
+ <%= f.select :status, ["pending", "approved", "declined"] %>
26
+ </div>
27
+
28
+ <div class="actions">
29
+ <%= f.submit %>
30
+ </div>
31
+
@@ -0,0 +1,6 @@
1
+ <h1>Editing deluxe_publisher_comment</h1>
2
+ <%= form_for(@deluxe_publisher_comment, :url => deluxe_publisher_page_comment_path(@page.id, @deluxe_publisher_comment)) do |f| %>
3
+ <%= render :partial => 'form', :locals => {:f => f} %>
4
+ <% end %>
5
+ <%= link_to 'Show', deluxe_publisher_page_comment_path(@page,@deluxe_publisher_comment) %> |
6
+ <%= link_to 'Back', deluxe_publisher_page_comments_path(@page) %>
@@ -0,0 +1,31 @@
1
+ <h1>Listing deluxe_publisher_comments</h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <th>Page</th>
6
+ <th>Author</th>
7
+ <th>Body</th>
8
+ <th>Status</th>
9
+ <th>Posted at</th>
10
+ <th></th>
11
+ <th></th>
12
+ <th></th>
13
+ </tr>
14
+
15
+ <% @deluxe_publisher_comments.each do |deluxe_publisher_comment| %>
16
+ <tr>
17
+ <td><%= deluxe_publisher_comment.page_id %></td>
18
+ <td><%= deluxe_publisher_comment.author %></td>
19
+ <td><%= deluxe_publisher_comment.body %></td>
20
+ <td><%= deluxe_publisher_comment.status %></td>
21
+ <td><%= deluxe_publisher_comment.posted_at %></td>
22
+ <td><%= link_to 'Show', deluxe_publisher_page_comment_path(@page, deluxe_publisher_comment) %></td>
23
+ <td><%= link_to 'Edit', edit_deluxe_publisher_page_comment_path(@page,deluxe_publisher_comment) %></td>
24
+ <td><%= link_to 'Destroy', deluxe_publisher_page_comment_path(@page, deluxe_publisher_comment), :confirm => 'Are you sure?', :method => :delete %></td>
25
+ </tr>
26
+ <% end %>
27
+ </table>
28
+
29
+ <br />
30
+
31
+ <%= link_to 'New Comment', new_deluxe_publisher_page_comment_path(@page) %>
@@ -0,0 +1,6 @@
1
+ <h1>New Comment</h1>
2
+ <%= form_for(@deluxe_publisher_comment, :url => deluxe_publisher_page_comments_path(@page.id)) do |f| %>
3
+ <%= render :partial => 'form', :locals => {:f => f} %>
4
+ <% end %>
5
+
6
+ <%= link_to 'Back', deluxe_publisher_page_comments_path(@page) %>
@@ -0,0 +1,30 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <b>Page:</b>
5
+ <%= @deluxe_publisher_comment.page_id %>
6
+ </p>
7
+
8
+ <p>
9
+ <b>Author:</b>
10
+ <%= @deluxe_publisher_comment.author %>
11
+ </p>
12
+
13
+ <p>
14
+ <b>Body:</b>
15
+ <%= @deluxe_publisher_comment.body %>
16
+ </p>
17
+
18
+ <p>
19
+ <b>Status:</b>
20
+ <%= @deluxe_publisher_comment.status %>
21
+ </p>
22
+
23
+ <p>
24
+ <b>Posted at:</b>
25
+ <%= @deluxe_publisher_comment.posted_at %>
26
+ </p>
27
+
28
+
29
+ <%= link_to 'Edit', edit_deluxe_publisher_page_comment_path(@page, @deluxe_publisher_comment) %> |
30
+ <%= link_to 'Back', deluxe_publisher_page_comments_path(@page) %>
@@ -0,0 +1,15 @@
1
+ <%= f.fields_for :content_descriptors, @deluxe_publisher_page_type.all_content_descriptors do |cd| %>
2
+ <div class="content_descriptor">
3
+ <h3>Content Area #<%= cd.object.position %></h3>
4
+ <div class="field">
5
+ <%= cd.label :title %>
6
+ <%= cd.text_field :title %>
7
+ </div>
8
+ <div class="field">
9
+ <%= cd.label :content_type, "Type" %>
10
+
11
+ <%= cd.select :content_type, [["Text Area", "text"],["Text Input", "string"]] %>
12
+ <%= cd.hidden_field :position %>
13
+ </div>
14
+ </div>
15
+ <% end %>
@@ -0,0 +1,59 @@
1
+
2
+ <%= form_for(@deluxe_publisher_page_type) do |f| %>
3
+ <article>
4
+ <% if @deluxe_publisher_page_type.errors.any? %>
5
+ <div id="error_explanation">
6
+ <h2><%= pluralize(@deluxe_publisher_page_type.errors.count, "error") %> prohibited this deluxe_publisher_page_type from being saved:</h2>
7
+
8
+ <ul>
9
+ <% @deluxe_publisher_page_type.errors.full_messages.each do |msg| %>
10
+ <li><%= msg %></li>
11
+ <% end %>
12
+ </ul>
13
+ </div>
14
+ <% end %>
15
+
16
+ <div class="field">
17
+ <%= f.label :name %><br />
18
+ <%= f.text_field :name %>
19
+ </div>
20
+ <div class="field">
21
+ <%= f.label :description %><br />
22
+ <%= f.text_area :description %>
23
+ </div>
24
+ <div class="field">
25
+ <%= f.check_box :is_published %> <%= f.label :is_published, "Publish" %>
26
+ </div>
27
+ <div class="field">
28
+ <%= f.label :position %><br />
29
+ <%= f.select :position, (1..100) %>
30
+ </div>
31
+ <div class="field">
32
+ <%= f.label :function_as %><br />
33
+ <%= f.radio_button :function_as, "web_page" %> <%= f.label :function_as_web_page, "Web Page"%>
34
+ <%= f.radio_button :function_as, "blog_page" %> <%= f.label :function_as_blog_page, "Blog Page"%>
35
+ <%= f.radio_button :function_as, "blog_story" %> <%= f.label :function_as_blog_story, "Blog Story"%>
36
+ </div>
37
+ <div class="field">
38
+ <%= f.label :number_of_content_areas %><br />
39
+ <%= f.select :number_of_content_areas, (1..25) %>
40
+ </div>
41
+ <div class="field">
42
+ <%= f.label :template %><br />
43
+ <%= f.select :template, template_options %>
44
+ </div>
45
+ <div class="field">
46
+ <%= f.label :layout %><br />
47
+ <%= f.select :layout, layout_options %>
48
+ </div>
49
+
50
+
51
+ <div id="content_descriptors">
52
+ <%= render :partial => 'content_descriptors', :locals => {:f => f} %>
53
+ </div>
54
+
55
+ <div class="actions">
56
+ <%= f.submit %>
57
+ </div>
58
+ </article>
59
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <%= fields_for(@deluxe_publisher_page_type) do |f| %>
2
+ $("#content_descriptors").html("<%= escape_javascript(render :partial => 'content_descriptors', :locals => {:f => f}) %>")
3
+ <% end %>
@@ -0,0 +1,8 @@
1
+ <header></header><h1>Page Type</h1></header>
2
+ <article>
3
+
4
+ <%= render 'form' %>
5
+
6
+ <%= link_to 'Show', @deluxe_publisher_page_type %> |
7
+ <%= link_to "Cancel, Don't Save", deluxe_publisher_page_types_path %>
8
+ </article>
@@ -0,0 +1,29 @@
1
+ <header></header><h1>Page Types</h1></header>
2
+ <article>
3
+
4
+ <table>
5
+ <tr>
6
+ <th>Name</th>
7
+
8
+ <th>Published</th>
9
+ <th></th>
10
+ <th></th>
11
+ <th></th>
12
+ </tr>
13
+
14
+ <% @deluxe_publisher_page_types.each do |deluxe_publisher_page_type| %>
15
+ <tr>
16
+ <td><%= deluxe_publisher_page_type.name %></td>
17
+
18
+ <td><%= "Yes" if deluxe_publisher_page_type.is_published? %></td>
19
+ <td><%= link_to 'Show', deluxe_publisher_page_type %></td>
20
+ <td><%= link_to 'Edit', edit_deluxe_publisher_page_type_path(deluxe_publisher_page_type) %></td>
21
+ <td><%= link_to 'Destroy', deluxe_publisher_page_type, :confirm => 'Are you sure?', :method => :delete %></td>
22
+ </tr>
23
+ <% end %>
24
+ </table>
25
+
26
+ <br />
27
+
28
+ <%= link_to 'New Page type', new_deluxe_publisher_page_type_path %>
29
+ </article>
@@ -0,0 +1,7 @@
1
+ <header></header><h1>Page Type</h1></header>
2
+ <article>
3
+
4
+ <%= render 'form' %>
5
+
6
+ <%= link_to "Cancel, Don't Save", deluxe_publisher_page_types_path %>
7
+ </article>