comfortable_mexican_sofa 0.0.18 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (263) hide show
  1. data/.gitignore +8 -8
  2. data/Gemfile +11 -0
  3. data/Gemfile.lock +91 -0
  4. data/README.md +4 -0
  5. data/Rakefile +28 -57
  6. data/VERSION +1 -1
  7. data/app/controllers/application_controller.rb +5 -0
  8. data/app/controllers/cms_admin/base_controller.rb +1 -21
  9. data/app/controllers/cms_admin/layouts_controller.rb +23 -38
  10. data/app/controllers/cms_admin/pages_controller.rb +24 -40
  11. data/app/controllers/cms_admin/snippets_controller.rb +26 -34
  12. data/app/controllers/cms_admin/uploads_controller.rb +27 -0
  13. data/app/controllers/cms_content_controller.rb +22 -19
  14. data/app/models/cms_block.rb +20 -6
  15. data/app/models/cms_layout.rb +34 -80
  16. data/app/models/cms_page.rb +44 -102
  17. data/app/models/cms_snippet.rb +12 -7
  18. data/app/models/cms_upload.rb +36 -0
  19. data/app/views/cms_admin/layouts/_form.html.erb +6 -0
  20. data/app/views/cms_admin/layouts/_index_branch.html.erb +24 -0
  21. data/app/views/cms_admin/layouts/edit.html.erb +6 -0
  22. data/app/views/cms_admin/layouts/index.html.erb +6 -0
  23. data/app/views/cms_admin/layouts/new.html.erb +6 -0
  24. data/app/views/cms_admin/pages/_form.html.erb +14 -0
  25. data/app/views/cms_admin/pages/_form_blocks.html.erb +7 -0
  26. data/app/views/cms_admin/pages/_index_branch.html.erb +27 -0
  27. data/app/views/cms_admin/pages/edit.html.erb +6 -0
  28. data/app/views/cms_admin/pages/form_blocks.js.erb +1 -0
  29. data/app/views/cms_admin/pages/index.html.erb +6 -0
  30. data/app/views/cms_admin/pages/new.html.erb +6 -0
  31. data/app/views/cms_admin/snippets/_form.html.erb +2 -0
  32. data/app/views/cms_admin/snippets/edit.html.erb +6 -0
  33. data/app/views/cms_admin/snippets/index.html.erb +3 -0
  34. data/app/views/cms_admin/snippets/new.html.erb +6 -0
  35. data/app/views/cms_admin/uploads/_index.html.erb +8 -0
  36. data/app/views/cms_admin/uploads/_upload.html.erb +11 -0
  37. data/app/views/cms_admin/uploads/destroy.js.erb +3 -0
  38. data/app/views/cms_admin/uploads/index.html.erb +2 -0
  39. data/app/views/layouts/cms_admin.html.erb +36 -0
  40. data/comfortable_mexican_sofa.gemspec +141 -197
  41. data/config.ru +4 -0
  42. data/config/application.rb +44 -0
  43. data/config/boot.rb +13 -0
  44. data/{test/rails_root/config → config}/database.yml +0 -0
  45. data/config/environment.rb +5 -0
  46. data/config/environments/development.rb +22 -0
  47. data/config/environments/production.rb +49 -0
  48. data/config/environments/test.rb +35 -0
  49. data/{test/rails_root/config → config}/initializers/backtrace_silencers.rb +2 -2
  50. data/{test/rails_root/config → config}/initializers/inflections.rb +1 -1
  51. data/{test/rails_root/config → config}/initializers/mime_types.rb +0 -0
  52. data/config/initializers/paperclip.rb +3 -0
  53. data/config/initializers/secret_token.rb +7 -0
  54. data/config/initializers/session_store.rb +8 -0
  55. data/{test/rails_root/config → config}/locales/en.yml +1 -1
  56. data/config/routes.rb +20 -0
  57. data/db/migrate/01_create_cms.rb +73 -0
  58. data/db/seeds.rb +7 -0
  59. data/doc/README_FOR_APP +95 -0
  60. data/lib/comfortable_mexican_sofa.rb +34 -39
  61. data/lib/comfortable_mexican_sofa/cms_acts_as_tree.rb +42 -49
  62. data/lib/comfortable_mexican_sofa/cms_form_builder.rb +107 -0
  63. data/lib/comfortable_mexican_sofa/cms_rails_extensions.rb +25 -5
  64. data/lib/comfortable_mexican_sofa/cms_tag.rb +90 -85
  65. data/lib/comfortable_mexican_sofa/cms_tag/field_datetime.rb +26 -0
  66. data/lib/comfortable_mexican_sofa/cms_tag/field_integer.rb +26 -0
  67. data/lib/comfortable_mexican_sofa/cms_tag/field_string.rb +26 -0
  68. data/lib/comfortable_mexican_sofa/cms_tag/field_text.rb +26 -0
  69. data/lib/comfortable_mexican_sofa/cms_tag/page_datetime.rb +22 -0
  70. data/lib/comfortable_mexican_sofa/cms_tag/page_integer.rb +22 -0
  71. data/lib/comfortable_mexican_sofa/cms_tag/page_string.rb +22 -0
  72. data/lib/comfortable_mexican_sofa/cms_tag/page_text.rb +22 -0
  73. data/lib/comfortable_mexican_sofa/cms_tag/partial.rb +20 -0
  74. data/lib/comfortable_mexican_sofa/cms_tag/snippet.rb +18 -0
  75. data/{generators/cms/templates → lib/generators}/README +0 -20
  76. data/lib/generators/cms_generator.rb +28 -0
  77. data/public/404.html +26 -0
  78. data/public/422.html +26 -0
  79. data/public/500.html +26 -0
  80. data/{test/rails_root/public → public}/favicon.ico +0 -0
  81. data/public/images/comfortable_mexican_sofa/body_bg.jpg +0 -0
  82. data/{generators/cms/templates/images → public/images/comfortable_mexican_sofa}/icon_regular.gif +0 -0
  83. data/public/javascripts/comfortable_mexican_sofa/cms.js +53 -0
  84. data/public/javascripts/comfortable_mexican_sofa/jquery-ui.js +325 -0
  85. data/public/javascripts/comfortable_mexican_sofa/jquery.js +154 -0
  86. data/public/javascripts/comfortable_mexican_sofa/plupload/plupload.full.min.js +1 -0
  87. data/public/javascripts/comfortable_mexican_sofa/plupload/plupload.html4.min.js +1 -0
  88. data/public/javascripts/comfortable_mexican_sofa/plupload/plupload.html5.min.js +1 -0
  89. data/public/javascripts/comfortable_mexican_sofa/rails.js +132 -0
  90. data/public/javascripts/comfortable_mexican_sofa/uploader.js +47 -0
  91. data/{test/rails_root/public → public}/robots.txt +0 -0
  92. data/public/stylesheets/comfortable_mexican_sofa/jquery-ui.css +305 -0
  93. data/public/stylesheets/comfortable_mexican_sofa/reset.css +1 -0
  94. data/public/stylesheets/comfortable_mexican_sofa/structure.css +194 -0
  95. data/public/stylesheets/comfortable_mexican_sofa/typography.css +20 -0
  96. data/script/rails +6 -0
  97. data/test/fixtures/README.md +22 -0
  98. data/test/fixtures/cms_blocks.yml +10 -34
  99. data/test/fixtures/cms_layouts.yml +37 -33
  100. data/test/fixtures/cms_pages.yml +11 -32
  101. data/test/fixtures/cms_snippets.yml +2 -6
  102. data/test/fixtures/cms_uploads.yml +4 -0
  103. data/test/fixtures/files/invalid_file.gif +9 -0
  104. data/test/fixtures/files/valid_image.jpg +0 -0
  105. data/test/functional/cms_admin/base_controller_test.rb +9 -0
  106. data/test/functional/cms_admin/layouts_controller_test.rb +61 -46
  107. data/test/functional/cms_admin/pages_controller_test.rb +201 -102
  108. data/test/functional/cms_admin/snippets_controller_test.rb +46 -39
  109. data/test/functional/cms_admin/uploads_controller_test.rb +32 -0
  110. data/test/functional/cms_content_controller_test.rb +37 -32
  111. data/test/test_helper.rb +29 -9
  112. data/test/unit/cms_block_test.rb +60 -0
  113. data/test/unit/cms_layout_test.rb +48 -0
  114. data/test/unit/cms_page_test.rb +122 -0
  115. data/test/unit/cms_snippet_test.rb +23 -0
  116. data/test/unit/cms_tag_test.rb +149 -0
  117. data/test/unit/cms_tags/field_datetime_test.rb +36 -0
  118. data/test/unit/cms_tags/field_integer_test.rb +35 -0
  119. data/test/unit/cms_tags/field_string_test.rb +35 -0
  120. data/test/unit/cms_tags/field_text_test.rb +34 -0
  121. data/test/unit/cms_tags/page_datetime_test.rb +36 -0
  122. data/test/unit/cms_tags/page_integer_test.rb +35 -0
  123. data/test/unit/cms_tags/page_string_test.rb +35 -0
  124. data/test/unit/cms_tags/page_text_test.rb +36 -0
  125. data/test/unit/cms_tags/partial_test.rb +30 -0
  126. data/test/unit/cms_tags/snippet_test.rb +34 -0
  127. data/test/unit/cms_upload_test.rb +30 -0
  128. metadata +176 -215
  129. data/CHANGELOG.rdoc +0 -2
  130. data/LICENSE +0 -20
  131. data/README.rdoc +0 -55
  132. data/app/controllers/cms_admin/attachments_controller.rb +0 -55
  133. data/app/controllers/cms_admin/categories_controller.rb +0 -69
  134. data/app/controllers/cms_admin/sections_controller.rb +0 -17
  135. data/app/controllers/cms_common/render_page.rb +0 -47
  136. data/app/helpers/cms_helper.rb +0 -12
  137. data/app/models/cms_attachment.rb +0 -17
  138. data/app/models/cms_attachment_categorization.rb +0 -5
  139. data/app/models/cms_category.rb +0 -36
  140. data/app/models/cms_page_categorization.rb +0 -6
  141. data/app/views/cms_admin/attachments/_details.html.haml +0 -27
  142. data/app/views/cms_admin/attachments/_form.html.haml +0 -24
  143. data/app/views/cms_admin/attachments/edit.html.haml +0 -10
  144. data/app/views/cms_admin/attachments/index.html.haml +0 -36
  145. data/app/views/cms_admin/attachments/new.html.haml +0 -8
  146. data/app/views/cms_admin/categories/_category.html.haml +0 -21
  147. data/app/views/cms_admin/categories/_category_subform.html.haml +0 -12
  148. data/app/views/cms_admin/categories/_form.html.haml +0 -18
  149. data/app/views/cms_admin/categories/_new.html.haml +0 -7
  150. data/app/views/cms_admin/categories/_toggle_link.html.haml +0 -9
  151. data/app/views/cms_admin/categories/_tree_branch.html.haml +0 -36
  152. data/app/views/cms_admin/categories/children.js.rjs +0 -10
  153. data/app/views/cms_admin/categories/create.js.rjs +0 -9
  154. data/app/views/cms_admin/categories/edit.html.haml +0 -10
  155. data/app/views/cms_admin/categories/index.html.haml +0 -7
  156. data/app/views/cms_admin/categories/new.html.haml +0 -8
  157. data/app/views/cms_admin/categories/show.html.haml +0 -17
  158. data/app/views/cms_admin/layouts/_details.html.haml +0 -6
  159. data/app/views/cms_admin/layouts/_form.html.haml +0 -19
  160. data/app/views/cms_admin/layouts/_toggle_link.html.haml +0 -9
  161. data/app/views/cms_admin/layouts/_tree_branch.html.haml +0 -39
  162. data/app/views/cms_admin/layouts/children.js.rjs +0 -10
  163. data/app/views/cms_admin/layouts/edit.html.haml +0 -10
  164. data/app/views/cms_admin/layouts/index.html.haml +0 -7
  165. data/app/views/cms_admin/layouts/new.html.haml +0 -8
  166. data/app/views/cms_admin/pages/_details.html.haml +0 -25
  167. data/app/views/cms_admin/pages/_form.html.haml +0 -45
  168. data/app/views/cms_admin/pages/_form_blocks.html.haml +0 -48
  169. data/app/views/cms_admin/pages/_toggle_link.html.haml +0 -10
  170. data/app/views/cms_admin/pages/_tree_branch.html.haml +0 -41
  171. data/app/views/cms_admin/pages/children.js.rjs +0 -10
  172. data/app/views/cms_admin/pages/edit.html.haml +0 -11
  173. data/app/views/cms_admin/pages/form_blocks.js.rjs +0 -1
  174. data/app/views/cms_admin/pages/index.html.haml +0 -6
  175. data/app/views/cms_admin/pages/new.html.haml +0 -9
  176. data/app/views/cms_admin/sections/show.html.haml +0 -23
  177. data/app/views/cms_admin/snippets/_form.html.haml +0 -10
  178. data/app/views/cms_admin/snippets/edit.html.haml +0 -10
  179. data/app/views/cms_admin/snippets/index.html.haml +0 -26
  180. data/app/views/cms_admin/snippets/new.html.haml +0 -8
  181. data/app/views/cms_content/show.xml.rxml +0 -27
  182. data/app/views/cms_content/sitemap.xml.rxml +0 -16
  183. data/app/views/layouts/cms_admin.html.haml +0 -44
  184. data/config/cms_routes.rb +0 -25
  185. data/generators/cms/cms_generator.rb +0 -55
  186. data/generators/cms/templates/images/arrow_bottom.gif +0 -0
  187. data/generators/cms/templates/images/arrow_right.gif +0 -0
  188. data/generators/cms/templates/images/icon_attachment.gif +0 -0
  189. data/generators/cms/templates/images/icon_category.gif +0 -0
  190. data/generators/cms/templates/images/icon_draft.gif +0 -0
  191. data/generators/cms/templates/images/icon_layout.gif +0 -0
  192. data/generators/cms/templates/images/icon_move.gif +0 -0
  193. data/generators/cms/templates/images/icon_snippet.gif +0 -0
  194. data/generators/cms/templates/images/logo.png +0 -0
  195. data/generators/cms/templates/initializers/cms.rb +0 -14
  196. data/generators/cms/templates/initializers/paperclip.rb +0 -14
  197. data/generators/cms/templates/javascripts/codemirror_init.js +0 -16
  198. data/generators/cms/templates/javascripts/mce_init.js +0 -17
  199. data/generators/cms/templates/javascripts/utilities.js +0 -27
  200. data/generators/cms/templates/migrations/create_cms.rb +0 -113
  201. data/generators/cms/templates/stylesheets/cms_master.sass +0 -414
  202. data/init.rb +0 -1
  203. data/lib/comfortable_mexican_sofa/acts_as_categorized.rb +0 -87
  204. data/lib/comfortable_mexican_sofa/acts_as_published.rb +0 -60
  205. data/lib/comfortable_mexican_sofa/cms_tags/attachment.rb +0 -3
  206. data/lib/comfortable_mexican_sofa/cms_tags/block.rb +0 -117
  207. data/lib/comfortable_mexican_sofa/cms_tags/helper.rb +0 -3
  208. data/lib/comfortable_mexican_sofa/cms_tags/page_block.rb +0 -119
  209. data/lib/comfortable_mexican_sofa/cms_tags/partial.rb +0 -19
  210. data/lib/comfortable_mexican_sofa/cms_tags/snippet.rb +0 -19
  211. data/rails/init.rb +0 -1
  212. data/test/fixtures/cms_attachment_categorizations.yml +0 -7
  213. data/test/fixtures/cms_attachments.yml +0 -6
  214. data/test/fixtures/cms_categories.yml +0 -19
  215. data/test/fixtures/cms_page_categorizations.yml +0 -15
  216. data/test/fixtures/files/upload_file.txt +0 -1
  217. data/test/functional/cms_admin/attachments_controller_test.rb +0 -63
  218. data/test/functional/cms_admin/categories_controller_test.rb +0 -86
  219. data/test/functional/cms_admin/sections_controller_test.rb +0 -9
  220. data/test/models/cms_attachment_test.rb +0 -16
  221. data/test/models/cms_block_test.rb +0 -11
  222. data/test/models/cms_categorization_test.rb +0 -39
  223. data/test/models/cms_category_test.rb +0 -71
  224. data/test/models/cms_layout_test.rb +0 -44
  225. data/test/models/cms_page_test.rb +0 -55
  226. data/test/models/cms_snippet_test.rb +0 -16
  227. data/test/models/cms_tag_test.rb +0 -70
  228. data/test/rails_root/README +0 -243
  229. data/test/rails_root/Rakefile +0 -10
  230. data/test/rails_root/app/controllers/application_controller.rb +0 -10
  231. data/test/rails_root/app/helpers/application_helper.rb +0 -3
  232. data/test/rails_root/app/views/cms/under-development.html.haml +0 -1
  233. data/test/rails_root/app/views/complex_page/_example.html.erb +0 -1
  234. data/test/rails_root/config/boot.rb +0 -110
  235. data/test/rails_root/config/environment.rb +0 -48
  236. data/test/rails_root/config/environments/development.rb +0 -17
  237. data/test/rails_root/config/environments/production.rb +0 -28
  238. data/test/rails_root/config/environments/test.rb +0 -28
  239. data/test/rails_root/config/initializers/new_rails_defaults.rb +0 -19
  240. data/test/rails_root/config/initializers/session_store.rb +0 -15
  241. data/test/rails_root/config/routes.rb +0 -43
  242. data/test/rails_root/doc/README_FOR_APP +0 -2
  243. data/test/rails_root/public/404.html +0 -30
  244. data/test/rails_root/public/422.html +0 -30
  245. data/test/rails_root/public/500.html +0 -30
  246. data/test/rails_root/public/images/rails.png +0 -0
  247. data/test/rails_root/public/index.html +0 -275
  248. data/test/rails_root/public/javascripts/application.js +0 -2
  249. data/test/rails_root/public/javascripts/controls.js +0 -963
  250. data/test/rails_root/public/javascripts/dragdrop.js +0 -973
  251. data/test/rails_root/public/javascripts/effects.js +0 -1128
  252. data/test/rails_root/public/javascripts/prototype.js +0 -4320
  253. data/test/rails_root/public/stylesheets/sass/cms_master.sass +0 -414
  254. data/test/rails_root/script/about +0 -4
  255. data/test/rails_root/script/console +0 -3
  256. data/test/rails_root/script/dbconsole +0 -3
  257. data/test/rails_root/script/destroy +0 -3
  258. data/test/rails_root/script/generate +0 -3
  259. data/test/rails_root/script/performance/benchmarker +0 -3
  260. data/test/rails_root/script/performance/profiler +0 -3
  261. data/test/rails_root/script/plugin +0 -3
  262. data/test/rails_root/script/runner +0 -3
  263. data/test/rails_root/script/server +0 -3
data/config.ru ADDED
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run ComfortableMexicanSofa::Application
@@ -0,0 +1,44 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ # If you have a Gemfile, require the gems listed there, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(:default, Rails.env) if defined?(Bundler)
8
+
9
+ module ComfortableMexicanSofa
10
+ class Application < Rails::Application
11
+
12
+ require 'comfortable_mexican_sofa'
13
+
14
+ # Settings in config/environments/* take precedence over those specified here.
15
+ # Application configuration should go into files in config/initializers
16
+ # -- all .rb files in that directory are automatically loaded.
17
+
18
+ # Custom directories with classes and modules you want to be autoloadable.
19
+ # config.autoload_paths += %W(#{config.root}/extras)
20
+
21
+ # Only load the plugins named here, in the order given (default is alphabetical).
22
+ # :all can be used as a placeholder for all plugins not explicitly named.
23
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
24
+
25
+ # Activate observers that should always be running.
26
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
27
+
28
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
29
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
30
+ # config.time_zone = 'Central Time (US & Canada)'
31
+
32
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
33
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
34
+ # config.i18n.default_locale = :de
35
+
36
+ # JavaScript files you want as :defaults (application.js is always included).
37
+
38
+ # Configure the default encoding used in templates for Ruby 1.9.
39
+ config.encoding = "utf-8"
40
+
41
+ # Configure sensitive parameters which will be filtered from the log file.
42
+ config.filter_parameters += [:password]
43
+ end
44
+ end
data/config/boot.rb ADDED
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ gemfile = File.expand_path('../../Gemfile', __FILE__)
5
+ begin
6
+ ENV['BUNDLE_GEMFILE'] = gemfile
7
+ require 'bundler'
8
+ Bundler.setup
9
+ rescue Bundler::GemNotFound => e
10
+ STDERR.puts e.message
11
+ STDERR.puts "Try running `bundle install`."
12
+ exit!
13
+ end if File.exist?(gemfile)
File without changes
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ ComfortableMexicanSofa::Application.initialize!
@@ -0,0 +1,22 @@
1
+ ComfortableMexicanSofa::Application.configure do
2
+ # Settings specified here will take precedence over those in config/environment.rb
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the webserver when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.consider_all_requests_local = true
14
+ config.action_view.debug_rjs = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Don't care if the mailer can't send
18
+ config.action_mailer.raise_delivery_errors = false
19
+
20
+ # Print deprecation notices to the Rails logger
21
+ config.active_support.deprecation = :log
22
+ end
@@ -0,0 +1,49 @@
1
+ ComfortableMexicanSofa::Application.configure do
2
+ # Settings specified here will take precedence over those in config/environment.rb
3
+
4
+ # The production environment is meant for finished, "live" apps.
5
+ # Code is not reloaded between requests
6
+ config.cache_classes = true
7
+
8
+ # Full error reports are disabled and caching is turned on
9
+ config.consider_all_requests_local = false
10
+ config.action_controller.perform_caching = true
11
+
12
+ # Specifies the header that your server uses for sending files
13
+ config.action_dispatch.x_sendfile_header = "X-Sendfile"
14
+
15
+ # For nginx:
16
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
17
+
18
+ # If you have no front-end server that supports something like X-Sendfile,
19
+ # just comment this out and Rails will serve the files
20
+
21
+ # See everything in the log (default is :info)
22
+ # config.log_level = :debug
23
+
24
+ # Use a different logger for distributed setups
25
+ # config.logger = SyslogLogger.new
26
+
27
+ # Use a different cache store in production
28
+ # config.cache_store = :mem_cache_store
29
+
30
+ # Disable Rails's static asset server
31
+ # In production, Apache or nginx will already do this
32
+ config.serve_static_assets = false
33
+
34
+ # Enable serving of images, stylesheets, and javascripts from an asset server
35
+ # config.action_controller.asset_host = "http://assets.example.com"
36
+
37
+ # Disable delivery errors, bad email addresses will be ignored
38
+ # config.action_mailer.raise_delivery_errors = false
39
+
40
+ # Enable threaded mode
41
+ # config.threadsafe!
42
+
43
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
44
+ # the I18n.default_locale when a translation can not be found)
45
+ config.i18n.fallbacks = true
46
+
47
+ # Send deprecation notices to registered listeners
48
+ config.active_support.deprecation = :notify
49
+ end
@@ -0,0 +1,35 @@
1
+ ComfortableMexicanSofa::Application.configure do
2
+ # Settings specified here will take precedence over those in config/environment.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Log error messages when you accidentally call methods on nil.
11
+ config.whiny_nils = true
12
+
13
+ # Show full error reports and disable caching
14
+ config.consider_all_requests_local = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Raise exceptions instead of rendering exception templates
18
+ config.action_dispatch.show_exceptions = false
19
+
20
+ # Disable request forgery protection in test environment
21
+ config.action_controller.allow_forgery_protection = false
22
+
23
+ # Tell Action Mailer not to deliver emails to the real world.
24
+ # The :test delivery method accumulates sent emails in the
25
+ # ActionMailer::Base.deliveries array.
26
+ config.action_mailer.delivery_method = :test
27
+
28
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
29
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
30
+ # like if you have constraints or database-specific column types
31
+ # config.active_record.schema_format = :sql
32
+
33
+ # Print deprecation notices to the stderr
34
+ config.active_support.deprecation = :stderr
35
+ end
@@ -3,5 +3,5 @@
3
3
  # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
4
  # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
5
 
6
- # You can also remove all the silencers if you're trying do debug a problem that might steem from framework code.
7
- # Rails.backtrace_cleaner.remove_silencers!
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -1,6 +1,6 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- # Add new inflection rules using the following format
3
+ # Add new inflection rules using the following format
4
4
  # (all these examples are active by default):
5
5
  # ActiveSupport::Inflector.inflections do |inflect|
6
6
  # inflect.plural /^(ox)$/i, '\1en'
@@ -0,0 +1,3 @@
1
+ Paperclip.options[:command_path] = case Rails.env
2
+ when 'development' then "/opt/local/bin"
3
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ ComfortableMexicanSofa::Application.config.secret_token = 'e0fef4ab56c1cacd8845864fe2cb2a27f5caad72823419f87b2774785187090a654b83229bf9cef70ce475a83bfa561dbbaa2015788181ea837c456964c1e0f6'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ ComfortableMexicanSofa::Application.config.session_store :cookie_store, :key => '_comfortable_mexican_sofa_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rake db:sessions:create")
8
+ # ComfortableMexicanSofa::Application.config.session_store :active_record_store
@@ -2,4 +2,4 @@
2
2
  # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
3
 
4
4
  en:
5
- hello: "Hello world"
5
+ hello: "Hello world"
data/config/routes.rb ADDED
@@ -0,0 +1,20 @@
1
+ Rails.application.routes.draw do
2
+
3
+ namespace :cms_admin, :path => 'cms-admin', :except => :show do
4
+ resources :layouts
5
+ resources :pages do
6
+ member do
7
+ match :form_blocks
8
+ end
9
+ end
10
+ resources :snippets
11
+ resources :uploads
12
+ end
13
+
14
+ scope :controller => :cms_content do
15
+ get '/cms-css/:id' => :render_css, :format => 'css'
16
+ get '/cms-js/:id' => :render_js, :format => 'js'
17
+ get '/' => :render_html, :path => '(*cms_path)'
18
+ end
19
+
20
+ end
@@ -0,0 +1,73 @@
1
+ class CreateCms < ActiveRecord::Migration
2
+
3
+ def self.up
4
+
5
+ # -- Layouts ------------------------------------------------------------
6
+ create_table :cms_layouts do |t|
7
+ t.integer :parent_id
8
+ t.string :app_layout
9
+ t.string :label
10
+ t.text :content
11
+ t.text :css
12
+ t.text :js
13
+ t.integer :position, :null => false, :default => 0
14
+ t.timestamps
15
+ end
16
+ add_index :cms_layouts, :label
17
+ add_index :cms_layouts, [:parent_id, :position]
18
+
19
+ # -- Pages --------------------------------------------------------------
20
+ create_table :cms_pages do |t|
21
+ t.integer :cms_layout_id
22
+ t.integer :parent_id
23
+ t.string :label
24
+ t.string :slug
25
+ t.string :full_path
26
+ t.text :content
27
+ t.integer :position, :null => false, :default => 0
28
+ t.integer :children_count, :null => false, :default => 0
29
+ t.timestamps
30
+ end
31
+ add_index :cms_pages, :full_path
32
+ add_index :cms_pages, [:parent_id, :position]
33
+
34
+ # -- Page Blocks --------------------------------------------------------
35
+ create_table :cms_blocks do |t|
36
+ t.string :type
37
+ t.integer :cms_page_id
38
+ t.string :label
39
+ t.string :content_string
40
+ t.text :content_text
41
+ t.integer :content_integer
42
+ t.datetime :content_datetime
43
+ t.timestamps
44
+ end
45
+ add_index :cms_blocks, [:cms_page_id, :type, :label]
46
+ # TODO: index this
47
+
48
+ # -- Snippets -----------------------------------------------------------
49
+ create_table :cms_snippets do |t|
50
+ t.string :label
51
+ t.text :content
52
+ t.timestamps
53
+ end
54
+ add_index :cms_snippets, :label, :unique => true
55
+
56
+ # -- Assets -------------------------------------------------------------
57
+ create_table :cms_uploads do |t|
58
+ t.string :file_file_name
59
+ t.string :file_content_type
60
+ t.integer :file_file_size
61
+ t.timestamps
62
+ end
63
+
64
+ end
65
+
66
+ def self.down
67
+ drop_table :cms_layouts
68
+ drop_table :cms_pages
69
+ drop_table :cms_snippets
70
+ drop_table :cms_blocks
71
+ drop_table :cms_uploads
72
+ end
73
+ end
data/db/seeds.rb ADDED
@@ -0,0 +1,7 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
7
+ # Mayor.create(:name => 'Daley', :city => cities.first)
@@ -0,0 +1,95 @@
1
+ :type can be 'string', 'text', ('rich_text', 'datetime')
2
+
3
+ < cms:page:default >
4
+
5
+ < cms:page:label:type > # page content that gets rendered
6
+ < cms:field:label:type > # page content that not rendered, but accessible via @cms_page object
7
+ < cms:snippet:label > # snippet content that gets rendered
8
+ < cms:partial:path > # interface to Rails partial
9
+
10
+ ??? pages need to be aware of tags inside of them
11
+
12
+
13
+ MAYBE: allow html escaping based on tag definition
14
+
15
+
16
+ Example:
17
+ --------
18
+ parent layout:
19
+
20
+ <cms:field:css/>
21
+ <cms:field:meta_keywords/>
22
+ <cms:field:google_tracking/>
23
+
24
+ <cms:page:header>
25
+ <cms:page:content> <- child layout content goes here
26
+ <cms:page:footer>
27
+
28
+ child layout
29
+
30
+ <cms:page:left>
31
+ <cms:page:image:file>
32
+ <cms:page:right>
33
+
34
+ Repeatable partials:
35
+ --------------------
36
+ Stored as a serialized array data
37
+
38
+ <cms:group:person>
39
+ <person:name:string/>
40
+ <person:bio/>
41
+ </cms:group:person>
42
+
43
+ -- Person ---
44
+ Blah: [ ]
45
+ Meh: [ ]
46
+ + add more person
47
+
48
+ -- Car ---
49
+ Something: [ ]
50
+ + add more car
51
+
52
+
53
+ File Upload Field
54
+ -----------------
55
+ < cms:page:avatar:file >
56
+ !!! this allows uploading of files and attaches them to an Asset system. Content stores ID of the asset.
57
+
58
+
59
+ < cms:group:person:face:file > <- this will make many files, how to link???
60
+ < cms:group:person:name >
61
+
62
+
63
+ STI?? [ merging CmsTag class with CmsPageContent AR class ]
64
+ -----------------------------------------------------------
65
+
66
+ CmsPageContent <- generic old 'cms_block'
67
+ CmsPageStringContent
68
+ CmsPageTextContent
69
+ CmsPageFileContent ???
70
+ CmsGroupContent
71
+
72
+ CmsFieldStringContent < CmsPageContent
73
+
74
+
75
+ IRB Escaping
76
+ ------------
77
+ < cms:partial:blsh> -> "<%= render blah %>" <-------- this is OK
78
+ <%= blah %> <-------- this is NOT OK
79
+
80
+
81
+ Can run irb escaping after pages and snippets are expanded.
82
+ Partials are injected later and should not be escaped.
83
+
84
+
85
+ Rendering Process
86
+ -----------------
87
+ Layout
88
+ => Form
89
+ -> render form, with possible db content
90
+ -> save form
91
+ => Page
92
+ -> get defined tags
93
+ -> replace tags with content from db
94
+
95
+ Page
@@ -1,46 +1,41 @@
1
- require 'comfortable_mexican_sofa/cms_rails_extensions'
2
- require 'comfortable_mexican_sofa/cms_acts_as_tree'
3
- require 'comfortable_mexican_sofa/acts_as_published'
4
- require 'comfortable_mexican_sofa/acts_as_categorized'
1
+ [ 'comfortable_mexican_sofa/cms_rails_extensions',
2
+ 'comfortable_mexican_sofa/cms_form_builder',
3
+ 'comfortable_mexican_sofa/cms_acts_as_tree',
4
+ '../app/models/cms_block',
5
+ '../app/models/cms_snippet',
6
+ 'comfortable_mexican_sofa/cms_tag'
7
+ ].each do |path|
8
+ require File.expand_path(path, File.dirname(__FILE__))
9
+ end
10
+
11
+ Dir.glob(File.expand_path('comfortable_mexican_sofa/cms_tag/*.rb', File.dirname(__FILE__))).each do |tag_path|
12
+ require tag_path
13
+ end
5
14
 
6
- require 'comfortable_mexican_sofa/cms_tag'
7
- require 'comfortable_mexican_sofa/cms_tags/block'
8
- require 'comfortable_mexican_sofa/cms_tags/page_block'
9
- require 'comfortable_mexican_sofa/cms_tags/snippet'
10
- require 'comfortable_mexican_sofa/cms_tags/partial'
11
- # require 'comfortable_mexican_sofa/cms_tags/helper'
12
- # require 'comfortable_mexican_sofa/cms_tags/attachment'
15
+ ActionView::Helpers::AssetTagHelper.register_javascript_expansion :cms => [
16
+ 'comfortable_mexican_sofa/jquery',
17
+ 'comfortable_mexican_sofa/jquery-ui',
18
+ 'comfortable_mexican_sofa/rails',
19
+ 'comfortable_mexican_sofa/cms',
20
+ 'comfortable_mexican_sofa/tiny_mce/jquery.tinymce',
21
+ 'comfortable_mexican_sofa/tiny_mce/tiny_mce',
22
+ 'comfortable_mexican_sofa/codemirror/codemirror',
23
+ 'comfortable_mexican_sofa/plupload/plupload.full.min',
24
+ 'comfortable_mexican_sofa/uploader',
25
+ 'comfortable_mexican_sofa/rteditor',
26
+ 'comfortable_mexican_sofa/syntax_highlighter'
27
+ ]
28
+ ActionView::Helpers::AssetTagHelper.register_stylesheet_expansion :cms => [
29
+ 'comfortable_mexican_sofa/reset',
30
+ 'comfortable_mexican_sofa/structure',
31
+ 'comfortable_mexican_sofa/typography',
32
+ 'comfortable_mexican_sofa/jquery-ui'
33
+ ]
13
34
 
14
- # Helper inclusion
15
- ActionView::Base.send(:include, CmsHelper)
35
+ FILE_ICONS = Dir.glob(File.expand_path('public/images/cms/file_icons/*.png', Rails.root)).collect{|f| f.split('/').last.gsub('.png', '')}
16
36
 
17
37
  module ComfortableMexicanSofa
18
- class Config
19
- def self.cattr_accessor_with_default(name, value = nil)
20
- cattr_accessor name
21
- self.send("#{name}=", value) if value
22
- end
23
-
24
- cattr_accessor_with_default :http_auth_enabled, true
25
- cattr_accessor_with_default :http_auth_username, 'username'
26
- cattr_accessor_with_default :http_auth_password, 'password'
27
- cattr_accessor_with_default :cms_title
28
- cattr_accessor_with_default :additional_cms_tabs, {}
29
- cattr_accessor_with_default :paperclip_options, {}
30
- end
31
38
 
32
- def self.config(&block)
33
- yield ComfortableMexicanSofa::Config
34
- end
35
- end
36
-
37
- # loading engine routes
38
- class ActionController::Routing::RouteSet
39
- def load_routes_with_cms!
40
- cms_routes = File.join(File.dirname(__FILE__), *%w[.. config cms_routes.rb])
41
- add_configuration_file(cms_routes) unless configuration_files.include? cms_routes
42
- load_routes_without_cms!
43
- end
39
+ # TODO
44
40
 
45
- alias_method_chain :load_routes!, :cms
46
41
  end