cmsimple 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +31 -0
- data/.rspec +1 -0
- data/.travis.yml +16 -0
- data/Gemfile +20 -0
- data/Gemfile.ci +5 -0
- data/LICENSE +19 -0
- data/README.md +118 -0
- data/Rakefile +47 -0
- data/app/assets/javascripts/cmsimple.js +61 -0
- data/app/assets/javascripts/cmsimple/controllers/editor.coffee +102 -0
- data/app/assets/javascripts/cmsimple/lib/namespaces.coffee +3 -0
- data/app/assets/javascripts/cmsimple/lib/support.coffee +4 -0
- data/app/assets/javascripts/cmsimple/mercury/config.js +462 -0
- data/app/assets/javascripts/cmsimple/mercury/handlers.coffee +9 -0
- data/app/assets/javascripts/cmsimple/models/image.coffee +49 -0
- data/app/assets/javascripts/cmsimple/models/page.coffee +106 -0
- data/app/assets/javascripts/cmsimple/models/path.coffee +31 -0
- data/app/assets/javascripts/cmsimple/models/version.coffee +29 -0
- data/app/assets/javascripts/cmsimple/panels/images/index.coffee +2 -0
- data/app/assets/javascripts/cmsimple/panels/images/list.coffee +48 -0
- data/app/assets/javascripts/cmsimple/panels/images/panel.coffee +69 -0
- data/app/assets/javascripts/cmsimple/panels/images/selection.coffee +52 -0
- data/app/assets/javascripts/cmsimple/panels/page_metadata.coffee +42 -0
- data/app/assets/javascripts/cmsimple/panels/publish.coffee +32 -0
- data/app/assets/javascripts/cmsimple/panels/redirects/form.coffee +51 -0
- data/app/assets/javascripts/cmsimple/panels/redirects/index.coffee +2 -0
- data/app/assets/javascripts/cmsimple/panels/redirects/list.coffee +34 -0
- data/app/assets/javascripts/cmsimple/panels/redirects/panel.coffee +39 -0
- data/app/assets/javascripts/cmsimple/panels/sitemap/index.coffee +2 -0
- data/app/assets/javascripts/cmsimple/panels/sitemap/panel.coffee +40 -0
- data/app/assets/javascripts/cmsimple/panels/sitemap/sortable.coffee +55 -0
- data/app/assets/javascripts/cmsimple/panels/sitemap/tree.coffee +61 -0
- data/app/assets/javascripts/cmsimple/panels/versions/index.coffee +2 -0
- data/app/assets/javascripts/cmsimple/panels/versions/list.coffee +51 -0
- data/app/assets/javascripts/cmsimple/panels/versions/panel.coffee +53 -0
- data/app/assets/javascripts/cmsimple/views/image_library/_item.jst.hamlc +24 -0
- data/app/assets/javascripts/cmsimple/views/image_library/list.jst.hamlc +8 -0
- data/app/assets/javascripts/cmsimple/views/redirects/_path.jst.hamlc +6 -0
- data/app/assets/javascripts/cmsimple/views/redirects/list.jst.hamlc +19 -0
- data/app/assets/javascripts/cmsimple/views/sitemap/_page.jst.hamlc +9 -0
- data/app/assets/javascripts/cmsimple/views/sitemap/tree.jst.hamlc +5 -0
- data/app/assets/javascripts/cmsimple/views/versions/_item.jst.hamlc +6 -0
- data/app/assets/javascripts/cmsimple/views/versions/list.jst.hamlc +4 -0
- data/app/assets/stylesheets/cmsimple.css +15 -0
- data/app/assets/stylesheets/cmsimple/forms.css +10 -0
- data/app/assets/stylesheets/cmsimple/panels.css +399 -0
- data/app/assets/stylesheets/cmsimple/toolbar-images.css +27 -0
- data/app/assets/stylesheets/mercury_overrides.css +2 -0
- data/app/controllers/cmsimple/front_controller.rb +38 -0
- data/app/controllers/cmsimple/images_controller.rb +28 -0
- data/app/controllers/cmsimple/mercury_controller.rb +7 -0
- data/app/controllers/cmsimple/pages_controller.rb +89 -0
- data/app/controllers/cmsimple/paths_controller.rb +23 -0
- data/app/controllers/cmsimple/snippets_controller.rb +23 -0
- data/app/controllers/cmsimple/versions_controller.rb +17 -0
- data/app/helpers/cmsimple/regions_helper.rb +38 -0
- data/app/models/cmsimple/image.rb +19 -0
- data/app/models/cmsimple/page.rb +203 -0
- data/app/models/cmsimple/path.rb +63 -0
- data/app/models/cmsimple/region.rb +43 -0
- data/app/models/cmsimple/snippet.rb +64 -0
- data/app/models/cmsimple/version.rb +18 -0
- data/app/uploaders/image_attachment_uploader.rb +53 -0
- data/app/views/cmsimple/images/_form.html.haml +13 -0
- data/app/views/cmsimple/images/new.html.haml +5 -0
- data/app/views/cmsimple/pages/_form.html.haml +49 -0
- data/app/views/cmsimple/pages/_form_extras.html.haml +2 -0
- data/app/views/cmsimple/pages/edit.html.haml +3 -0
- data/app/views/cmsimple/pages/new.html.haml +3 -0
- data/app/views/cmsimple/pages/publish.html.haml +12 -0
- data/app/views/cmsimple/snippets/index.html.haml +5 -0
- data/app/views/cmsimple/templates/default.html.haml +4 -0
- data/app/views/layouts/editor.html.haml +12 -0
- data/app/views/layouts/panel.html.haml +9 -0
- data/cmsimple.gemspec +44 -0
- data/config.ru +4 -0
- data/config/application.rb +1 -0
- data/config/cucumber.yml +8 -0
- data/config/environment.rb +2 -0
- data/config/routes.rb +34 -0
- data/db/migrate/20120201221410_create_cmsimple_pages.rb +10 -0
- data/db/migrate/20120222185901_add_title_parent_id_and_position_to_pages.rb +10 -0
- data/db/migrate/20120229185214_add_slug_to_pages.rb +7 -0
- data/db/migrate/20120323200439_add_is_root_to_page.rb +5 -0
- data/db/migrate/20120328174339_add_meta_info_to_cmsimple_pages.rb +9 -0
- data/db/migrate/20120329172857_create_cmsimple_path.rb +11 -0
- data/db/migrate/20120407024752_create_cmsimple_images.rb +13 -0
- data/db/migrate/20120410041105_add_timestamps_to_cmsimple_pages.rb +7 -0
- data/db/migrate/20120425211937_add_published_at_to_cmsimple_pages.rb +6 -0
- data/db/migrate/20120430175047_create_cmsimple_versions.rb +13 -0
- data/db/migrate/20120831233927_rename_path_to_current_uri_on_paths.rb +5 -0
- data/features/create.feature +18 -0
- data/features/delete.feature +12 -0
- data/features/edit.feature +54 -0
- data/features/publishing.feature +31 -0
- data/features/redirects.feature +27 -0
- data/features/step_definitions/mercury_steps.rb +440 -0
- data/features/step_definitions/page_steps.rb +269 -0
- data/features/step_definitions/web_steps.rb +254 -0
- data/features/support/env.rb +77 -0
- data/features/support/mercury_content.rb +25 -0
- data/features/support/mercury_selectors.rb +148 -0
- data/features/support/paths.rb +16 -0
- data/features/support/selectors.rb +26 -0
- data/features/support/utils.rb +18 -0
- data/features/versioning.feature +27 -0
- data/features/visit.feature +7 -0
- data/lib/cmsimple.rb +22 -0
- data/lib/cmsimple/configuration.rb +65 -0
- data/lib/cmsimple/exts/to_bool.rb +25 -0
- data/lib/cmsimple/page_responder.rb +46 -0
- data/lib/cmsimple/rails.rb +5 -0
- data/lib/cmsimple/regions_proxy.rb +32 -0
- data/lib/cmsimple/template_resolver.rb +14 -0
- data/lib/cmsimple/template_responder.rb +12 -0
- data/lib/cmsimple/version.rb +3 -0
- data/lib/generators/cmsimple/install/install_generator.rb +46 -0
- data/lib/generators/cmsimple/install/templates/default.html.erb +10 -0
- data/lib/generators/cmsimple/install/templates/default.html.haml +6 -0
- data/lib/generators/cmsimple/install/templates/initializer.rb +22 -0
- data/lib/generators/cmsimple/snippet/snippet_generator.rb +56 -0
- data/lib/generators/cmsimple/snippet/templates/cell.rb +18 -0
- data/lib/generators/cmsimple/snippet/templates/display.html.erb +14 -0
- data/lib/generators/cmsimple/snippet/templates/display.html.haml +11 -0
- data/lib/generators/cmsimple/snippet/templates/options.html.erb +18 -0
- data/lib/generators/cmsimple/snippet/templates/options.html.haml +12 -0
- data/script/app +2 -0
- data/script/migrate +2 -0
- data/script/rails +8 -0
- data/spec/fixtures/rails.png +0 -0
- data/spec/helpers/regions_helper_spec.rb +62 -0
- data/spec/javascripts/controllers/editor_spec.coffee +57 -0
- data/spec/javascripts/models/image_geometry_spec.coffee +64 -0
- data/spec/javascripts/models/image_spec.coffee +4 -0
- data/spec/javascripts/models/page_spec.coffee +121 -0
- data/spec/javascripts/models/path_spec.coffee +39 -0
- data/spec/javascripts/models/version_spec.coffee +31 -0
- data/spec/javascripts/panels/images/selection_spec.coffee +104 -0
- data/spec/javascripts/panels/sitemap/panel_spec.coffee +10 -0
- data/spec/javascripts/panels/sitemap/sortable_spec.coffee +63 -0
- data/spec/javascripts/panels/sitemap/tree_spec.coffee +62 -0
- data/spec/javascripts/spec_helper.coffee +25 -0
- data/spec/javascripts/support/stubs.coffee +16 -0
- data/spec/lib/page_responder_spec.rb +58 -0
- data/spec/lib/regions_proxy_spec.rb +47 -0
- data/spec/models/image_spec.rb +46 -0
- data/spec/models/page_spec.rb +237 -0
- data/spec/models/path_spec.rb +71 -0
- data/spec/models/region_spec.rb +14 -0
- data/spec/models/snippet_spec.rb +57 -0
- data/spec/models/version_spec.rb +7 -0
- data/spec/rails_app/.gitignore +33 -0
- data/spec/rails_app/Rakefile +7 -0
- data/spec/rails_app/app/assets/images/rails.png +0 -0
- data/spec/rails_app/app/assets/javascripts/application.js +9 -0
- data/spec/rails_app/app/assets/stylesheets/application.css +7 -0
- data/spec/rails_app/app/cells/example/display.html.haml +2 -0
- data/spec/rails_app/app/cells/example/options.html.haml +15 -0
- data/spec/rails_app/app/cells/example_cell.rb +19 -0
- data/spec/rails_app/app/cells/image_example/display.html.haml +4 -0
- data/spec/rails_app/app/cells/image_example/options.html.haml +15 -0
- data/spec/rails_app/app/cells/image_example_cell.rb +18 -0
- data/spec/rails_app/app/controllers/application_controller.rb +3 -0
- data/spec/rails_app/app/helpers/application_helper.rb +2 -0
- data/spec/rails_app/app/mailers/.gitkeep +0 -0
- data/spec/rails_app/app/models/.gitkeep +0 -0
- data/spec/rails_app/app/views/cmsimple/_snippet_list.html.haml +8 -0
- data/spec/rails_app/app/views/cmsimple/templates/default.html.haml +19 -0
- data/spec/rails_app/app/views/cmsimple/templates/test.html.haml +2 -0
- data/spec/rails_app/app/views/layouts/application.html.haml +13 -0
- data/spec/rails_app/config.ru +4 -0
- data/spec/rails_app/config/application.rb +65 -0
- data/spec/rails_app/config/boot.rb +9 -0
- data/spec/rails_app/config/database.example.yml +22 -0
- data/spec/rails_app/config/database.travis.yml +8 -0
- data/spec/rails_app/config/environment.rb +5 -0
- data/spec/rails_app/config/environments/development.rb +30 -0
- data/spec/rails_app/config/environments/test.rb +39 -0
- data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/rails_app/config/initializers/cells.rb +1 -0
- data/spec/rails_app/config/initializers/cmsimple.rb +3 -0
- data/spec/rails_app/config/initializers/inflections.rb +10 -0
- data/spec/rails_app/config/initializers/mime_types.rb +5 -0
- data/spec/rails_app/config/initializers/secret_token.rb +7 -0
- data/spec/rails_app/config/initializers/session_store.rb +8 -0
- data/spec/rails_app/config/initializers/teabag.rb +58 -0
- data/spec/rails_app/config/initializers/wrap_parameters.rb +14 -0
- data/spec/rails_app/config/locales/en.yml +5 -0
- data/spec/rails_app/config/routes.rb +61 -0
- data/spec/rails_app/db/seeds.rb +11 -0
- data/spec/rails_app/lib/assets/.gitkeep +0 -0
- data/spec/rails_app/lib/tasks/.gitkeep +0 -0
- data/spec/rails_app/public/404.html +26 -0
- data/spec/rails_app/public/422.html +26 -0
- data/spec/rails_app/public/500.html +26 -0
- data/spec/rails_app/public/robots.txt +5 -0
- data/spec/rails_app/script/rails +6 -0
- data/spec/rails_app/vendor/assets/stylesheets/.gitkeep +0 -0
- data/spec/rails_app/vendor/plugins/.gitkeep +0 -0
- data/spec/spec_helper.rb +31 -0
- data/spec/support/active_model_lint_example.rb +14 -0
- data/spec/teabag_env.rb +28 -0
- data/vendor/assets/images/sitemap/has-changes.png +0 -0
- data/vendor/assets/images/sitemap/published.png +0 -0
- data/vendor/assets/images/sitemap/unpublished.png +0 -0
- data/vendor/assets/images/toolbar/metadata.png +0 -0
- data/vendor/assets/images/toolbar/publish.png +0 -0
- data/vendor/assets/images/toolbar/redirect.png +0 -0
- data/vendor/assets/images/toolbar/sitemap.png +0 -0
- data/vendor/assets/images/toolbar/snippets.png +0 -0
- data/vendor/assets/images/toolbar/unpublished.png +0 -0
- data/vendor/assets/images/tree-line-horizontal-last.png +0 -0
- data/vendor/assets/images/tree-line-horizontal.png +0 -0
- data/vendor/assets/images/tree-line-vertical.png +0 -0
- data/vendor/assets/javascripts/jquery-serializeObject.js +107 -0
- data/vendor/assets/javascripts/jquery.to-json.js +74 -0
- data/vendor/assets/javascripts/jquery.ui.nestedSortable-1.3.4.js +391 -0
- data/vendor/assets/javascripts/moment-1.6.2.js +918 -0
- data/vendor/assets/javascripts/underscore-1.3.1.js +31 -0
- data/vendor/assets/stylesheets/jasmine-modified.css +216 -0
- metadata +686 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
RailsTestApp::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
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
|
33
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
|
34
|
+
# like if you have constraints or database-specific column types
|
|
35
|
+
# config.active_record.schema_format = :sql
|
|
36
|
+
|
|
37
|
+
# Print deprecation notices to the stderr
|
|
38
|
+
config.active_support.deprecation = :stderr
|
|
39
|
+
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 @@
|
|
|
1
|
+
Cell::Rails.append_view_path Rails.root.join('app/cells')
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
|
@@ -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
|
+
RailsTestApp::Application.config.secret_token = '813099d43c82bede661b26577b12c9ecee2fff48bdb10a44a94e49d656c5e1b4197ef2d2d368019ecddfdfb3135dcf4eb16b0639a3b20d00a64e65e1dfea3f7b'
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
3
|
+
RailsTestApp::Application.config.session_store :cookie_store, key: '_cmsimple_railstestapp_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
|
+
# Cmsimple::Application.config.session_store :active_record_store
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Teabag.setup do |config|
|
|
2
|
+
|
|
3
|
+
# This determines where the Teabag routes will be mounted. Changing this to "/jasmine" would allow you to browse to
|
|
4
|
+
# http://localhost:3000/jasmine to run your specs.
|
|
5
|
+
config.mount_at = "/teabag"
|
|
6
|
+
|
|
7
|
+
# This defaults to Rails.root if left nil. If you're testing an engine using a dummy application it can be useful to
|
|
8
|
+
# set this to your engines root.. E.g. `Teabag::Engine.root`
|
|
9
|
+
config.root = Cmsimple::Engine.root
|
|
10
|
+
|
|
11
|
+
# These paths are appended to the Rails assets paths (relative to config.root), and by default is an array that you
|
|
12
|
+
# can replace or add to.
|
|
13
|
+
config.asset_paths = ["spec/javascripts", "spec/javascripts/stylesheets"]
|
|
14
|
+
|
|
15
|
+
# Fixtures are rendered through a standard controller. This means you can use things like HAML or RABL/JBuilder, etc.
|
|
16
|
+
# to generate fixtures within this path.
|
|
17
|
+
config.fixture_path = "spec/javascripts/fixtures"
|
|
18
|
+
|
|
19
|
+
# You can modify the default suite configuration and create new suites here. Suites can be isolated from one another.
|
|
20
|
+
# When defining a suite you can provide a name and a block. If the name is left blank, :default is assumed. You can
|
|
21
|
+
# omit various directives and the defaults will be used.
|
|
22
|
+
#
|
|
23
|
+
# To run a specific suite
|
|
24
|
+
# - in the browser: http://localhost/teabag/[suite_name]
|
|
25
|
+
# - from the command line: rake teabag suite=[suite_name]
|
|
26
|
+
config.suite do |suite|
|
|
27
|
+
|
|
28
|
+
# You can specify a file matcher and all matching files will be loaded when the suite is run. It's important that
|
|
29
|
+
# these files are serve-able from sprockets.
|
|
30
|
+
#
|
|
31
|
+
# Note: Can also be set to nil.
|
|
32
|
+
suite.matcher = "{spec/javascripts,app/assets}/**/*_spec.{js,js.coffee,coffee}"
|
|
33
|
+
|
|
34
|
+
# Each suite can load a different helper, which can in turn require additional files. This file is loaded before
|
|
35
|
+
# your specs are loaded, and can be used as a manifest.
|
|
36
|
+
suite.helper = "spec_helper"
|
|
37
|
+
|
|
38
|
+
# These are the core Teabag javascripts. It's strongly encouraged to include only the base files here. You can
|
|
39
|
+
# require other support libraries in your spec helper, which allows you to change them without having to restart the
|
|
40
|
+
# server.
|
|
41
|
+
#
|
|
42
|
+
# Available frameworks: teabag-jasmine, teabag-mocha, teabag-qunit
|
|
43
|
+
#
|
|
44
|
+
# Note: To use the CoffeeScript source files use `"teabag/jasmine"` etc.
|
|
45
|
+
suite.javascripts = ["teabag-jasmine"]
|
|
46
|
+
|
|
47
|
+
# If you want to change how Teabag looks, or include your own stylesheets you can do that here. The default is the
|
|
48
|
+
# stylesheet for the HTML reporter.
|
|
49
|
+
suite.stylesheets = ["teabag"]
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Example suite. Since we're just filtering to files already within the root spec/javascripts, these files will also
|
|
53
|
+
# be run in the default suite -- but can be focused into a more specific suite.
|
|
54
|
+
#config.suite :targeted do |suite|
|
|
55
|
+
# suite.matcher = "spec/javascripts/targeted/*_spec.{js,js.coffee,coffee}"
|
|
56
|
+
#end
|
|
57
|
+
|
|
58
|
+
end if defined?(Teabag) && Teabag.respond_to?(:setup) # let Teabag be undefined outside of development/test/asset groups
|
|
@@ -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,61 @@
|
|
|
1
|
+
RailsTestApp::Application.routes.draw do
|
|
2
|
+
|
|
3
|
+
mount Cmsimple::Engine, :at => '/'
|
|
4
|
+
|
|
5
|
+
# The priority is based upon order of creation:
|
|
6
|
+
# first created -> highest priority.
|
|
7
|
+
|
|
8
|
+
# Sample of regular route:
|
|
9
|
+
# match 'products/:id' => 'catalog#view'
|
|
10
|
+
# Keep in mind you can assign values other than :controller and :action
|
|
11
|
+
|
|
12
|
+
# Sample of named route:
|
|
13
|
+
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
|
|
14
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
|
15
|
+
|
|
16
|
+
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
|
17
|
+
# resources :products
|
|
18
|
+
|
|
19
|
+
# Sample resource route with options:
|
|
20
|
+
# resources :products do
|
|
21
|
+
# member do
|
|
22
|
+
# get 'short'
|
|
23
|
+
# post 'toggle'
|
|
24
|
+
# end
|
|
25
|
+
#
|
|
26
|
+
# collection do
|
|
27
|
+
# get 'sold'
|
|
28
|
+
# end
|
|
29
|
+
# end
|
|
30
|
+
|
|
31
|
+
# Sample resource route with sub-resources:
|
|
32
|
+
# resources :products do
|
|
33
|
+
# resources :comments, :sales
|
|
34
|
+
# resource :seller
|
|
35
|
+
# end
|
|
36
|
+
|
|
37
|
+
# Sample resource route with more complex sub-resources
|
|
38
|
+
# resources :products do
|
|
39
|
+
# resources :comments
|
|
40
|
+
# resources :sales do
|
|
41
|
+
# get 'recent', :on => :collection
|
|
42
|
+
# end
|
|
43
|
+
# end
|
|
44
|
+
|
|
45
|
+
# Sample resource route within a namespace:
|
|
46
|
+
# namespace :admin do
|
|
47
|
+
# # Directs /admin/products/* to Admin::ProductsController
|
|
48
|
+
# # (app/controllers/admin/products_controller.rb)
|
|
49
|
+
# resources :products
|
|
50
|
+
# end
|
|
51
|
+
|
|
52
|
+
# You can have the root of your site routed with "root"
|
|
53
|
+
# just remember to delete public/index.html.
|
|
54
|
+
# root :to => 'welcome#index'
|
|
55
|
+
|
|
56
|
+
# See how all your routes lay out with "rake routes"
|
|
57
|
+
|
|
58
|
+
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
|
59
|
+
# Note: This route will make all actions in every controller accessible via GET requests.
|
|
60
|
+
# match ':controller(/:action(/:id(.:format)))'
|
|
61
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
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: 'Emanuel', city: cities.first)
|
|
8
|
+
unless Cmsimple::Page.where(is_root: true).first
|
|
9
|
+
page = Cmsimple::Page.create is_root: true, title: 'Home'
|
|
10
|
+
page.publish!
|
|
11
|
+
end
|
|
File without changes
|
|
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,26 @@
|
|
|
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
|
+
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
|
|
24
|
+
</div>
|
|
25
|
+
</body>
|
|
26
|
+
</html>
|
|
@@ -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'
|
|
File without changes
|
|
File without changes
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
|
2
|
+
ENV["RAILS_ENV"] ||= 'test'
|
|
3
|
+
require File.expand_path("../../config/environment", __FILE__)
|
|
4
|
+
require 'rspec/rails'
|
|
5
|
+
require 'shoulda/matchers'
|
|
6
|
+
require 'timecop'
|
|
7
|
+
|
|
8
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
|
9
|
+
# in spec/support/ and its subdirectories.
|
|
10
|
+
Dir[File.expand_path("../support/**/*.rb", __FILE__)].each {|f| require f}
|
|
11
|
+
|
|
12
|
+
RSpec.configure do |config|
|
|
13
|
+
# == Mock Framework
|
|
14
|
+
#
|
|
15
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
|
16
|
+
#
|
|
17
|
+
# config.mock_with :mocha
|
|
18
|
+
# config.mock_with :flexmock
|
|
19
|
+
# config.mock_with :rr
|
|
20
|
+
# config.mock_with :rspec
|
|
21
|
+
|
|
22
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
|
23
|
+
# config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
|
24
|
+
|
|
25
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
|
26
|
+
# examples within a transaction, remove the following line or assign false
|
|
27
|
+
# instead of true.
|
|
28
|
+
config.use_transactional_fixtures = true
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
shared_examples_for "ActiveModel" do
|
|
2
|
+
include ActiveModel::Lint::Tests
|
|
3
|
+
|
|
4
|
+
# to_s is to support ruby-1.9
|
|
5
|
+
ActiveModel::Lint::Tests.public_instance_methods.map{|m| m.to_s}.grep(/^test/).each do |m|
|
|
6
|
+
example m.gsub('_',' ') do
|
|
7
|
+
send m
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def model
|
|
12
|
+
subject
|
|
13
|
+
end
|
|
14
|
+
end
|
data/spec/teabag_env.rb
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# This file allows you to override various Teabag configuration directives when running from the command line. It is not
|
|
2
|
+
# required from within the Rails environment, so overriding directives that have been defined within the initializer
|
|
3
|
+
# is not possible.
|
|
4
|
+
#
|
|
5
|
+
# Set RAILS_ROOT and load the environment.
|
|
6
|
+
ENV["RAILS_ROOT"] = File.expand_path("../../", __FILE__)
|
|
7
|
+
require File.expand_path("../../config/environment", __FILE__)
|
|
8
|
+
|
|
9
|
+
# Provide default configuration.
|
|
10
|
+
#
|
|
11
|
+
# You can override various configuration directives defined here by using arguments with the teabag command.
|
|
12
|
+
#
|
|
13
|
+
# teabag --driver=selenium --suppress-log
|
|
14
|
+
# rake teabag DRIVER=selenium SUPPRESS_LOG=false
|
|
15
|
+
Teabag.setup do |config|
|
|
16
|
+
# Driver
|
|
17
|
+
#config.driver = "phantomjs" # available: phantomjs, selenium
|
|
18
|
+
#config.phantomjs_bin = nil
|
|
19
|
+
|
|
20
|
+
# Behaviors
|
|
21
|
+
#config.server_timeout = 20 # timeout for starting the server
|
|
22
|
+
#config.fail_fast = true # abort after the first failing suite
|
|
23
|
+
|
|
24
|
+
# Output
|
|
25
|
+
#config.formatters = "dot" # available: dot, tap_y, swayze_or_oprah
|
|
26
|
+
#config.suppress_log = false # suppress logs coming from console[log/error/debug]
|
|
27
|
+
#config.color = true
|
|
28
|
+
end
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|