brightcontent 2.0.0.alpha2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (178) hide show
  1. data/.gitignore +8 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +44 -0
  4. data/Rakefile +14 -0
  5. data/brightcontent.gemspec +21 -0
  6. data/core/.gitignore +9 -0
  7. data/core/Gemfile +17 -0
  8. data/core/Gemfile.lock +163 -0
  9. data/core/MIT-LICENSE +20 -0
  10. data/core/README.md +44 -0
  11. data/core/Rakefile +14 -0
  12. data/core/app/assets/images/brightcontent/.gitkeep +0 -0
  13. data/core/app/assets/images/brightcontent/glyphicons-halflings-white.png +0 -0
  14. data/core/app/assets/images/brightcontent/glyphicons-halflings.png +0 -0
  15. data/core/app/assets/javascripts/brightcontent/bootstrap.min.js +6 -0
  16. data/core/app/assets/javascripts/brightcontent/brightcontent.js +17 -0
  17. data/core/app/assets/javascripts/brightcontent/custom.js +1 -0
  18. data/core/app/assets/javascripts/brightcontent/main.js +3 -0
  19. data/core/app/assets/stylesheets/brightcontent/bootstrap-responsive.min.css +9 -0
  20. data/core/app/assets/stylesheets/brightcontent/bootstrap.min.css +9 -0
  21. data/core/app/assets/stylesheets/brightcontent/brightcontent.css +17 -0
  22. data/core/app/assets/stylesheets/brightcontent/custom.css +1 -0
  23. data/core/app/assets/stylesheets/brightcontent/main.css +44 -0
  24. data/core/app/controllers/brightcontent/admin_users_controller.rb +6 -0
  25. data/core/app/controllers/brightcontent/application_controller.rb +22 -0
  26. data/core/app/controllers/brightcontent/base_controller.rb +27 -0
  27. data/core/app/controllers/brightcontent/sessions_controller.rb +24 -0
  28. data/core/app/helpers/brightcontent/application_helper.rb +4 -0
  29. data/core/app/helpers/brightcontent/base_helper.rb +17 -0
  30. data/core/app/models/brightcontent/admin_user.rb +7 -0
  31. data/core/app/views/brightcontent/application/_menu.html.erb +3 -0
  32. data/core/app/views/brightcontent/application/_show_flash_names.html.erb +5 -0
  33. data/core/app/views/brightcontent/base/_form.html.erb +10 -0
  34. data/core/app/views/brightcontent/base/_list.html.erb +8 -0
  35. data/core/app/views/brightcontent/base/_list_actions.html.erb +2 -0
  36. data/core/app/views/brightcontent/base/edit.html.erb +3 -0
  37. data/core/app/views/brightcontent/base/index.html.erb +22 -0
  38. data/core/app/views/brightcontent/base/new.html.erb +3 -0
  39. data/core/app/views/brightcontent/sessions/new.html.erb +12 -0
  40. data/core/app/views/layouts/brightcontent/application.html.erb +53 -0
  41. data/core/brightcontent-core.gemspec +31 -0
  42. data/core/config/initializers/simple_form.rb +142 -0
  43. data/core/config/initializers/simple_form_bootstrap.rb +45 -0
  44. data/core/config/initializers/will_paginate.rb +28 -0
  45. data/core/config/routes.rb +9 -0
  46. data/core/db/migrate/20121206121725_create_brightcontent_admin_users.rb +12 -0
  47. data/core/lib/brightcontent/core/version.rb +5 -0
  48. data/core/lib/brightcontent/core.rb +32 -0
  49. data/core/lib/brightcontent/default_actions.rb +19 -0
  50. data/core/lib/brightcontent/engine.rb +9 -0
  51. data/core/lib/brightcontent/pagination.rb +24 -0
  52. data/core/lib/brightcontent/rails/routes.rb +16 -0
  53. data/core/lib/brightcontent/routes_parser.rb +38 -0
  54. data/core/lib/brightcontent-core.rb +1 -0
  55. data/core/lib/generators/brightcontent/install_generator.rb +34 -0
  56. data/core/lib/generators/brightcontent/resource_generator.rb +22 -0
  57. data/core/lib/generators/brightcontent/templates/brightcontent_controller.rb +2 -0
  58. data/core/lib/generators/brightcontent/templates/initializer.rb +8 -0
  59. data/core/script/rails +8 -0
  60. data/core/spec/dummy/README.rdoc +261 -0
  61. data/core/spec/dummy/Rakefile +7 -0
  62. data/core/spec/dummy/app/assets/javascripts/application.js +15 -0
  63. data/core/spec/dummy/app/assets/javascripts/brightcontent/custom.js +1 -0
  64. data/core/spec/dummy/app/assets/stylesheets/application.css +13 -0
  65. data/core/spec/dummy/app/assets/stylesheets/brightcontent/custom.css +1 -0
  66. data/core/spec/dummy/app/controllers/application_controller.rb +3 -0
  67. data/core/spec/dummy/app/controllers/brightcontent/blogs_controller.rb +2 -0
  68. data/core/spec/dummy/app/controllers/pages_controller.rb +8 -0
  69. data/core/spec/dummy/app/helpers/application_helper.rb +2 -0
  70. data/core/spec/dummy/app/mailers/.gitkeep +0 -0
  71. data/core/spec/dummy/app/models/.gitkeep +0 -0
  72. data/core/spec/dummy/app/models/blog.rb +3 -0
  73. data/core/spec/dummy/app/views/layouts/application.html.erb +14 -0
  74. data/core/spec/dummy/app/views/pages/index.html.erb +1 -0
  75. data/core/spec/dummy/config/application.rb +59 -0
  76. data/core/spec/dummy/config/boot.rb +10 -0
  77. data/core/spec/dummy/config/database.yml +25 -0
  78. data/core/spec/dummy/config/environment.rb +5 -0
  79. data/core/spec/dummy/config/environments/development.rb +37 -0
  80. data/core/spec/dummy/config/environments/production.rb +67 -0
  81. data/core/spec/dummy/config/environments/test.rb +37 -0
  82. data/core/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  83. data/core/spec/dummy/config/initializers/brightcontent.rb +3 -0
  84. data/core/spec/dummy/config/initializers/inflections.rb +15 -0
  85. data/core/spec/dummy/config/initializers/mime_types.rb +5 -0
  86. data/core/spec/dummy/config/initializers/secret_token.rb +7 -0
  87. data/core/spec/dummy/config/initializers/session_store.rb +8 -0
  88. data/core/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  89. data/core/spec/dummy/config/locales/en.yml +5 -0
  90. data/core/spec/dummy/config/routes.rb +7 -0
  91. data/core/spec/dummy/config.ru +4 -0
  92. data/core/spec/dummy/db/migrate/20121206225720_create_blogs.rb +10 -0
  93. data/core/spec/dummy/db/schema.rb +30 -0
  94. data/core/spec/dummy/lib/assets/.gitkeep +0 -0
  95. data/core/spec/dummy/public/404.html +26 -0
  96. data/core/spec/dummy/public/422.html +26 -0
  97. data/core/spec/dummy/public/500.html +25 -0
  98. data/core/spec/dummy/public/favicon.ico +0 -0
  99. data/core/spec/dummy/script/rails +6 -0
  100. data/core/spec/factories.rb +16 -0
  101. data/core/spec/features/login_spec.rb +29 -0
  102. data/core/spec/features/menu_spec.rb +27 -0
  103. data/core/spec/features/resources_form_spec.rb +51 -0
  104. data/core/spec/features/resources_index_spec.rb +50 -0
  105. data/core/spec/lib/brightcontent/routes_parser_spec.rb +34 -0
  106. data/core/spec/spec_helper.rb +18 -0
  107. data/core/spec/support/acceptance_helper.rb +8 -0
  108. data/lib/brightcontent.rb +2 -0
  109. data/lib/tasks/release.rake +0 -0
  110. data/lib/tasks/rspec.rake +5 -0
  111. data/pages/.gitignore +9 -0
  112. data/pages/Gemfile +5 -0
  113. data/pages/Gemfile.lock +173 -0
  114. data/pages/MIT-LICENSE +20 -0
  115. data/pages/README.md +35 -0
  116. data/pages/Rakefile +14 -0
  117. data/pages/app/assets/images/brightcontent/.gitkeep +0 -0
  118. data/pages/app/controllers/brightcontent/pages_controller.rb +16 -0
  119. data/pages/app/helpers/brightcontent/pages_helper.rb +13 -0
  120. data/pages/app/models/brightcontent/page.rb +27 -0
  121. data/pages/app/views/brightcontent/pages/_form_field_parent_id.html.erb +1 -0
  122. data/pages/app/views/brightcontent/pages/_list_field_name.html.erb +1 -0
  123. data/pages/brightcontent-pages.gemspec +26 -0
  124. data/pages/config/routes.rb +3 -0
  125. data/pages/db/migrate/20121207132810_create_brightcontent_pages.rb +16 -0
  126. data/pages/lib/brightcontent/pages/engine.rb +14 -0
  127. data/pages/lib/brightcontent/pages/methods.rb +9 -0
  128. data/pages/lib/brightcontent/pages/version.rb +5 -0
  129. data/pages/lib/brightcontent/pages.rb +10 -0
  130. data/pages/lib/brightcontent-pages.rb +1 -0
  131. data/pages/lib/generators/brightcontent/pages/install_generator.rb +15 -0
  132. data/pages/script/rails +8 -0
  133. data/pages/spec/dummy/README.rdoc +261 -0
  134. data/pages/spec/dummy/Rakefile +7 -0
  135. data/pages/spec/dummy/app/assets/javascripts/application.js +15 -0
  136. data/pages/spec/dummy/app/assets/javascripts/brightcontent/custom.js +1 -0
  137. data/pages/spec/dummy/app/assets/stylesheets/application.css +13 -0
  138. data/pages/spec/dummy/app/assets/stylesheets/brightcontent/custom.css +1 -0
  139. data/pages/spec/dummy/app/controllers/application_controller.rb +3 -0
  140. data/pages/spec/dummy/app/controllers/brightcontent/blogs_controller.rb +2 -0
  141. data/pages/spec/dummy/app/controllers/pages_controller.rb +8 -0
  142. data/pages/spec/dummy/app/helpers/application_helper.rb +2 -0
  143. data/pages/spec/dummy/app/mailers/.gitkeep +0 -0
  144. data/pages/spec/dummy/app/models/.gitkeep +0 -0
  145. data/pages/spec/dummy/app/models/blog.rb +3 -0
  146. data/pages/spec/dummy/app/views/layouts/application.html.erb +14 -0
  147. data/pages/spec/dummy/app/views/pages/index.html.erb +1 -0
  148. data/pages/spec/dummy/config/application.rb +59 -0
  149. data/pages/spec/dummy/config/boot.rb +10 -0
  150. data/pages/spec/dummy/config/database.yml +25 -0
  151. data/pages/spec/dummy/config/environment.rb +5 -0
  152. data/pages/spec/dummy/config/environments/development.rb +37 -0
  153. data/pages/spec/dummy/config/environments/production.rb +67 -0
  154. data/pages/spec/dummy/config/environments/test.rb +37 -0
  155. data/pages/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  156. data/pages/spec/dummy/config/initializers/brightcontent.rb +3 -0
  157. data/pages/spec/dummy/config/initializers/inflections.rb +15 -0
  158. data/pages/spec/dummy/config/initializers/mime_types.rb +5 -0
  159. data/pages/spec/dummy/config/initializers/secret_token.rb +7 -0
  160. data/pages/spec/dummy/config/initializers/session_store.rb +8 -0
  161. data/pages/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  162. data/pages/spec/dummy/config/locales/en.yml +5 -0
  163. data/pages/spec/dummy/config/routes.rb +6 -0
  164. data/pages/spec/dummy/config.ru +4 -0
  165. data/pages/spec/dummy/db/schema.rb +44 -0
  166. data/pages/spec/dummy/lib/assets/.gitkeep +0 -0
  167. data/pages/spec/dummy/public/404.html +26 -0
  168. data/pages/spec/dummy/public/422.html +26 -0
  169. data/pages/spec/dummy/public/500.html +25 -0
  170. data/pages/spec/dummy/public/favicon.ico +0 -0
  171. data/pages/spec/dummy/script/rails +6 -0
  172. data/pages/spec/factories.rb +16 -0
  173. data/pages/spec/features/menu_spec.rb +16 -0
  174. data/pages/spec/features/pages_spec.rb +18 -0
  175. data/pages/spec/models/brightcontent/page_spec.rb +49 -0
  176. data/pages/spec/spec_helper.rb +18 -0
  177. data/pages/spec/support/acceptance_helper.rb +8 -0
  178. metadata +253 -0
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Dummy::Application.initialize!
@@ -0,0 +1,37 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.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 web server 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_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger
20
+ config.active_support.deprecation = :log
21
+
22
+ # Only use best-standards-support built into browsers
23
+ config.action_dispatch.best_standards_support = :builtin
24
+
25
+ # Raise exception on mass assignment protection for Active Record models
26
+ config.active_record.mass_assignment_sanitizer = :strict
27
+
28
+ # Log the query plan for queries taking more than this (works
29
+ # with SQLite, MySQL, and PostgreSQL)
30
+ config.active_record.auto_explain_threshold_in_seconds = 0.5
31
+
32
+ # Do not compress assets
33
+ config.assets.compress = false
34
+
35
+ # Expands the lines which load the assets
36
+ config.assets.debug = true
37
+ end
@@ -0,0 +1,67 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # Code is not reloaded between requests
5
+ config.cache_classes = true
6
+
7
+ # Full error reports are disabled and caching is turned on
8
+ config.consider_all_requests_local = false
9
+ config.action_controller.perform_caching = true
10
+
11
+ # Disable Rails's static asset server (Apache or nginx will already do this)
12
+ config.serve_static_assets = false
13
+
14
+ # Compress JavaScripts and CSS
15
+ config.assets.compress = true
16
+
17
+ # Don't fallback to assets pipeline if a precompiled asset is missed
18
+ config.assets.compile = false
19
+
20
+ # Generate digests for assets URLs
21
+ config.assets.digest = true
22
+
23
+ # Defaults to nil and saved in location specified by config.assets.prefix
24
+ # config.assets.manifest = YOUR_PATH
25
+
26
+ # Specifies the header that your server uses for sending files
27
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
29
+
30
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
+ # config.force_ssl = true
32
+
33
+ # See everything in the log (default is :info)
34
+ # config.log_level = :debug
35
+
36
+ # Prepend all log lines with the following tags
37
+ # config.log_tags = [ :subdomain, :uuid ]
38
+
39
+ # Use a different logger for distributed setups
40
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
41
+
42
+ # Use a different cache store in production
43
+ # config.cache_store = :mem_cache_store
44
+
45
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
46
+ # config.action_controller.asset_host = "http://assets.example.com"
47
+
48
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
49
+ # config.assets.precompile += %w( search.js )
50
+
51
+ # Disable delivery errors, bad email addresses will be ignored
52
+ # config.action_mailer.raise_delivery_errors = false
53
+
54
+ # Enable threaded mode
55
+ # config.threadsafe!
56
+
57
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
58
+ # the I18n.default_locale when a translation can not be found)
59
+ config.i18n.fallbacks = true
60
+
61
+ # Send deprecation notices to registered listeners
62
+ config.active_support.deprecation = :notify
63
+
64
+ # Log the query plan for queries taking more than this (works
65
+ # with SQLite, MySQL, and PostgreSQL)
66
+ # config.active_record.auto_explain_threshold_in_seconds = 0.5
67
+ end
@@ -0,0 +1,37 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.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
+ # Configure static asset server for tests with Cache-Control for performance
11
+ config.serve_static_assets = true
12
+ config.static_cache_control = "public, max-age=3600"
13
+
14
+ # Log error messages when you accidentally call methods on nil
15
+ config.whiny_nils = true
16
+
17
+ # Show full error reports and disable caching
18
+ config.consider_all_requests_local = true
19
+ config.action_controller.perform_caching = false
20
+
21
+ # Raise exceptions instead of rendering exception templates
22
+ config.action_dispatch.show_exceptions = false
23
+
24
+ # Disable request forgery protection in test environment
25
+ config.action_controller.allow_forgery_protection = false
26
+
27
+ # Tell Action Mailer not to deliver emails to the real world.
28
+ # The :test delivery method accumulates sent emails in the
29
+ # ActionMailer::Base.deliveries array.
30
+ config.action_mailer.delivery_method = :test
31
+
32
+ # Raise exception on mass assignment protection for Active Record models
33
+ config.active_record.mass_assignment_sanitizer = :strict
34
+
35
+ # Print deprecation notices to the stderr
36
+ config.active_support.deprecation = :stderr
37
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
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!
@@ -0,0 +1,3 @@
1
+ Brightcontent.setup do |config|
2
+ #No config options yet!
3
+ end
@@ -0,0 +1,15 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
11
+ #
12
+ # These inflection rules are supported but not enabled by default:
13
+ # ActiveSupport::Inflector.inflections do |inflect|
14
+ # inflect.acronym 'RESTful'
15
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -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
+ Dummy::Application.config.secret_token = '1582af16879d84e4319aa02ea51964c7c27576e6468838ea1bcadf1286623d44e9117613a747386fde1bc2253a9a49c291a2c100fec64ae5c2cc5c75efa553ef'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_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 "rails generate session_migration")
8
+ # Dummy::Application.config.session_store :active_record_store
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json]
9
+ end
10
+
11
+ # Disable root element in JSON by default.
12
+ ActiveSupport.on_load(:active_record) do
13
+ self.include_root_in_json = false
14
+ end
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,6 @@
1
+ Rails.application.routes.draw do
2
+ brightcontent_resources do
3
+ end
4
+ root to: "pages#index"
5
+ get "*path" => "pages#show"
6
+ end
@@ -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 Dummy::Application
@@ -0,0 +1,44 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended to check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(:version => 20121207132810) do
15
+
16
+ create_table "blogs", :force => true do |t|
17
+ t.string "name"
18
+ t.text "body"
19
+ t.datetime "created_at", :null => false
20
+ t.datetime "updated_at", :null => false
21
+ end
22
+
23
+ create_table "brightcontent_admin_users", :force => true do |t|
24
+ t.string "email"
25
+ t.string "password_digest"
26
+ t.datetime "created_at", :null => false
27
+ t.datetime "updated_at", :null => false
28
+ end
29
+
30
+ create_table "brightcontent_pages", :force => true do |t|
31
+ t.string "name"
32
+ t.text "body"
33
+ t.string "slug"
34
+ t.integer "depth"
35
+ t.integer "lft"
36
+ t.integer "rgt"
37
+ t.integer "parent_id"
38
+ t.datetime "created_at", :null => false
39
+ t.datetime "updated_at", :null => false
40
+ end
41
+
42
+ add_index "brightcontent_pages", ["slug"], :name => "index_brightcontent_pages_on_slug"
43
+
44
+ end
File without changes
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,16 @@
1
+ FactoryGirl.define do
2
+ sequence :email do |n|
3
+ "person#{n}@example.com"
4
+ end
5
+
6
+ factory :admin_user, class: Brightcontent::AdminUser do
7
+ email
8
+ password "password"
9
+ password_confirmation "password"
10
+ end
11
+
12
+ factory :page, class: Brightcontent::Page do
13
+ name "Pagina"
14
+ body "Body"
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ feature "Menu" do
4
+
5
+ scenario "Shows menu for extra resources" do
6
+ sign_in
7
+ menu_should_have_link "Pages"
8
+ end
9
+
10
+ def menu_should_have_link(link_name)
11
+ within "#menu" do
12
+ page.should have_link link_name
13
+ end
14
+ end
15
+
16
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ feature "Pages" do
4
+ background do
5
+ @page = create :page , name: "Homepage"
6
+ end
7
+
8
+ scenario "visit root page" do
9
+ visit root_path
10
+ page.should have_content @page.name
11
+ end
12
+
13
+ scenario "visit specific page" do
14
+ @page2 = create :page, name: "Test page"
15
+ visit "/test-page"
16
+ page.should have_content @page2.name
17
+ end
18
+ end
@@ -0,0 +1,49 @@
1
+ require 'spec_helper'
2
+
3
+ module Brightcontent
4
+ describe Page do
5
+ describe "validations" do
6
+ it "validates persence of name" do
7
+ build_stubbed(:page, name: nil).should_not be_valid
8
+ end
9
+ end
10
+
11
+ describe "slugs" do
12
+ context "first page" do
13
+ subject { create(:page, name: "Homepage") }
14
+ its(:slug) { should be_empty }
15
+ end
16
+
17
+ context "second page" do
18
+ let!(:homepage) { create(:page, name: "Homepage") }
19
+
20
+ it "generates slug for siblings" do
21
+ create(:page, name: "About us").slug.should eq "about-us"
22
+ end
23
+
24
+ it "creates a slug for children" do
25
+ create(:page, name: "About us", parent: homepage).slug.should eq "homepage/about-us"
26
+ end
27
+
28
+ it "persists the slug" do
29
+ page = create(:page, name: "About us", parent: homepage).reload
30
+ page.slug.should eq "homepage/about-us"
31
+ end
32
+ end
33
+ end
34
+
35
+ describe ".homepage?" do
36
+ subject { create(:page, name: "Homepage") }
37
+
38
+ context "is homepage" do
39
+ it { should be_homepage }
40
+ end
41
+
42
+ context "is not homepage" do
43
+ before { create(:page) }
44
+ subject { create(:page, name: "Second_page") }
45
+ it { should_not be_homepage }
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,18 @@
1
+ ENV["RAILS_ENV"] = "test"
2
+ ENGINE_RAILS_ROOT = File.join(File.dirname(__FILE__), '../')
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ require 'rspec/rails'
6
+ require 'capybara/rspec'
7
+ require 'factory_girl_rails'
8
+ require 'brightcontent-pages'
9
+
10
+ Dir[File.join(ENGINE_RAILS_ROOT, "spec/support/**/*.rb")].each {|f| require f }
11
+
12
+ Rails.backtrace_cleaner.remove_silencers!
13
+
14
+ RSpec.configure do |config|
15
+ config.mock_with :rspec
16
+ config.use_transactional_fixtures = true
17
+ config.include FactoryGirl::Syntax::Methods
18
+ end
@@ -0,0 +1,8 @@
1
+ def sign_in
2
+ user = create(:admin_user)
3
+ visit "/admin"
4
+ fill_in "Email", with: user.email
5
+ fill_in "Password", with: "password"
6
+ click_button "Login"
7
+ user
8
+ end