noodall-components-general-content 0.0.1

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.
Files changed (65) hide show
  1. data/.gitignore +7 -0
  2. data/Gemfile +21 -0
  3. data/Gemfile.lock +190 -0
  4. data/MIT-LICENSE +20 -0
  5. data/README.rdoc +3 -0
  6. data/Rakefile +39 -0
  7. data/app/models/general_content.rb +9 -0
  8. data/app/views/admin/components/_general_content.html.erb +38 -0
  9. data/app/views/components/_general_content.html.erb +6 -0
  10. data/cucumber.yml +8 -0
  11. data/features/general_content_component.feature +18 -0
  12. data/features/step_definitions/cms_node_steps.rb +9 -0
  13. data/features/step_definitions/component_steps.rb +35 -0
  14. data/features/step_definitions/web_steps.rb +219 -0
  15. data/features/support/env.rb +50 -0
  16. data/features/support/paths.rb +58 -0
  17. data/lib/noodall-components-general-content.rb +1 -0
  18. data/lib/noodall/components/general_content/engine.rb +11 -0
  19. data/lib/noodall/components/general_content/version.rb +7 -0
  20. data/noodall-components-general-content.gemspec +22 -0
  21. data/spec/dummy/Rakefile +7 -0
  22. data/spec/dummy/app/controllers/application_controller.rb +22 -0
  23. data/spec/dummy/app/helpers/application_helper.rb +3 -0
  24. data/spec/dummy/app/models/page_a.rb +8 -0
  25. data/spec/dummy/app/models/user.rb +12 -0
  26. data/spec/dummy/app/views/admin/nodes/_page_a.html.erb +47 -0
  27. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  28. data/spec/dummy/app/views/nodes/page_a.html.erb +14 -0
  29. data/spec/dummy/config.ru +4 -0
  30. data/spec/dummy/config/application.rb +46 -0
  31. data/spec/dummy/config/boot.rb +10 -0
  32. data/spec/dummy/config/database.yml +12 -0
  33. data/spec/dummy/config/environment.rb +5 -0
  34. data/spec/dummy/config/environments/development.rb +26 -0
  35. data/spec/dummy/config/environments/production.rb +49 -0
  36. data/spec/dummy/config/environments/test.rb +35 -0
  37. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  38. data/spec/dummy/config/initializers/dragonfly.rb +1 -0
  39. data/spec/dummy/config/initializers/inflections.rb +10 -0
  40. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  41. data/spec/dummy/config/initializers/mongo_mapper.rb +13 -0
  42. data/spec/dummy/config/initializers/noodall.rb +5 -0
  43. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  44. data/spec/dummy/config/initializers/session_store.rb +8 -0
  45. data/spec/dummy/config/locales/en.yml +5 -0
  46. data/spec/dummy/config/routes.rb +3 -0
  47. data/spec/dummy/public/404.html +26 -0
  48. data/spec/dummy/public/422.html +26 -0
  49. data/spec/dummy/public/500.html +26 -0
  50. data/spec/dummy/public/favicon.ico +0 -0
  51. data/spec/dummy/public/javascripts/application.js +2 -0
  52. data/spec/dummy/public/javascripts/controls.js +965 -0
  53. data/spec/dummy/public/javascripts/dragdrop.js +974 -0
  54. data/spec/dummy/public/javascripts/effects.js +1123 -0
  55. data/spec/dummy/public/javascripts/prototype.js +6001 -0
  56. data/spec/dummy/public/javascripts/rails.js +175 -0
  57. data/spec/dummy/public/stylesheets/.gitkeep +0 -0
  58. data/spec/dummy/script/rails +6 -0
  59. data/spec/factories/asset.rb +6 -0
  60. data/spec/factories/node.rb +6 -0
  61. data/spec/files/beef.png +0 -0
  62. data/spec/integration/navigation_spec.rb +9 -0
  63. data/spec/noodall_component_gallery_spec.rb +7 -0
  64. data/spec/spec_helper.rb +30 -0
  65. metadata +148 -0
@@ -0,0 +1,50 @@
1
+ # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
2
+ # It is recommended to regenerate this file in the future when you upgrade to a
3
+ # newer version of cucumber-rails. Consider adding your own code to a new file
4
+ # instead of editing this one. Cucumber will automatically load all features/**/*.rb
5
+ # files.
6
+
7
+ ENV["RAILS_ENV"] ||= "test"
8
+ require File.expand_path("../../../spec/dummy/config/environment.rb", __FILE__)
9
+
10
+ require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
11
+ require 'cucumber/rails/rspec'
12
+ require 'cucumber/rails/world'
13
+ require 'cucumber/web/tableish'
14
+ require 'cucumber/rspec/doubles'
15
+
16
+ require 'capybara/rails'
17
+ require 'capybara/cucumber'
18
+ require 'capybara/session'
19
+ # Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
20
+ # order to ease the transition to Capybara we set the default here. If you'd
21
+ # prefer to use XPath just remove this line and adjust any selectors in your
22
+ # steps to use the XPath syntax.
23
+ Capybara.default_selector = :css
24
+
25
+ # If you set this to false, any error raised from within your app will bubble
26
+ # up to your step definition and out to cucumber unless you catch it somewhere
27
+ # on the way. You can make Rails rescue errors and render error pages on a
28
+ # per-scenario basis by tagging a scenario or feature with the @allow-rescue tag.
29
+ #
30
+ # If you set this to true, Rails will rescue all errors and render error
31
+ # pages, more or less in the same way your application would behave in the
32
+ # default production environment. It's not recommended to do this for all
33
+ # of your scenarios, as this makes it hard to discover errors in your application.
34
+ ActionController::Base.allow_rescue = false
35
+
36
+ # How to clean your database when transactions are turned off. See
37
+ # http://github.com/bmabey/database_cleaner for more info.
38
+ require 'database_cleaner'
39
+ require 'database_cleaner/cucumber'
40
+ DatabaseCleaner.strategy = :truncation
41
+
42
+ require 'factory_girl'
43
+
44
+ Factory.definition_file_paths = [
45
+ File.expand_path("../../../spec/factories", __FILE__)
46
+ ]
47
+ Factory.find_definitions
48
+
49
+ require 'factory_girl/step_definitions'
50
+
@@ -0,0 +1,58 @@
1
+ require 'noodall/permalinks'
2
+
3
+ module NavigationHelpers
4
+ # Maps a name to a path. Used by the
5
+ #
6
+ # When /^I go to (.+)$/ do |page_name|
7
+ #
8
+ # step definition in web_steps.rb
9
+ #
10
+ def path_to(page_name)
11
+ case page_name
12
+
13
+ when /the (home\s?page|website)/i
14
+ root_path
15
+ when /the CMS/
16
+ '/admin'
17
+ when /^the (?:root )?content titled "([^\"]*)" page$/i
18
+ node = Node.find_by_title($1)
19
+ node_path(node)
20
+ when /^the content admin page$/
21
+ noodall_admin_nodes_path
22
+ when /^the site ?map page$/
23
+ noodall_sitemap_path
24
+ when /^a page that's content is in the "([^\"]*)" template$/
25
+ node = Node.first(:_type => $1.gsub(' ',''), :order => 'created_at DESC')
26
+ node_path(node)
27
+ when /^a page that's content is in the "([^\"]*)" template that does not have published children$/
28
+ node = Factory($1.gsub(' ','_').tableize.singularize, :publish => true)
29
+ node.children.each{|c| c.destroy }
30
+ node_path(node)
31
+ when /^a page that's content is in the "([^\"]*)" template that has published children$/
32
+ node = Factory($1.gsub(' ','_').tableize.singularize, :publish => true)
33
+ 3.times do
34
+ Factory(:page_a, :publish => true, :parent => node)
35
+ end
36
+ node_path(node)
37
+ when /^that page$/
38
+ node_path(@_content)
39
+
40
+ when /^the article list page$/
41
+ node_path(@_content)
42
+ when /content titled "([^\"]*)"$/
43
+ node_path(Node.find_by_title($1))
44
+ else
45
+ begin
46
+ page_name =~ /the (.*) page/
47
+ path_components = $1.split(/\s+/)
48
+ self.send(path_components.push('path').join('_').to_sym)
49
+ rescue Object => e
50
+ raise "Can't find a mapping from \"#{page_name}\" to a path.\n" +
51
+ "Please add one to #{__FILE__}"
52
+ end
53
+ end
54
+ end
55
+ end
56
+
57
+ World(NavigationHelpers)
58
+ World(Noodall::Permalinks)
@@ -0,0 +1 @@
1
+ require 'noodall/components/general_content/engine' if defined?(Rails) && Rails::VERSION::MAJOR == 3
@@ -0,0 +1,11 @@
1
+ module Noodall
2
+ module Components
3
+ module GeneralContent
4
+ class Engine < Rails::Engine
5
+ # initializer "static assets" do |app|
6
+ # app.middleware.use ::ActionDispatch::Static, "#{root}/public"
7
+ # end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ module Noodall
2
+ module Components
3
+ module GeneralContent
4
+ VERSION = "0.0.1"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path("../lib/noodall/components/general_content/version", __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "noodall-components-general-content"
6
+ s.version = Noodall::Components::GeneralContent::VERSION
7
+ s.platform = Gem::Platform::RUBY
8
+ s.authors = []
9
+ s.email = []
10
+ s.homepage = "http://rubygems.org/gems/noodall-components-general-content"
11
+ s.summary = "Noodall Components: General Content"
12
+ s.description = "A text and image component for Noodall"
13
+
14
+ s.required_rubygems_version = ">= 1.3.6"
15
+ # s.rubyforge_project = "noodall-component-gallery"
16
+
17
+ s.add_development_dependency "bundler", ">= 1.0.0"
18
+
19
+ s.files = `git ls-files`.split("\n")
20
+ s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
21
+ s.require_path = 'lib'
22
+ end
@@ -0,0 +1,7 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+ require 'rake'
6
+
7
+ Dummy::Application.load_tasks
@@ -0,0 +1,22 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ @@current_user = User.find_or_create_by_full_name("Demo User")
4
+
5
+ def self.current_user=(user)
6
+ @@current_user = user
7
+ end
8
+
9
+ def current_user
10
+ @@current_user
11
+ end
12
+ helper_method :current_user
13
+
14
+ def destroy_user_session_path
15
+ ''
16
+ end
17
+ helper_method :destroy_user_session_path
18
+
19
+ def authenticate_user!
20
+ true
21
+ end
22
+ end
@@ -0,0 +1,3 @@
1
+ module ApplicationHelper
2
+ include Noodall::ComponentsHelper
3
+ end
@@ -0,0 +1,8 @@
1
+ class PageA < Noodall::Node
2
+ root_template!
3
+
4
+ main_slots 1
5
+ small_slots 4
6
+ wide_slots 3
7
+
8
+ end
@@ -0,0 +1,12 @@
1
+ class User
2
+ include MongoMapper::Document
3
+ include Canable::Cans
4
+
5
+ key :email, String
6
+ key :full_name, String
7
+ key :groups, Array
8
+
9
+ def admin?
10
+ groups.include?('website administrator')
11
+ end
12
+ end
@@ -0,0 +1,47 @@
1
+ <%= render :partial => 'body', :locals => { :f => f } %>
2
+
3
+ <% content_for :component_table do %>
4
+ <table class="component-table">
5
+ <tr>
6
+ <td rowspan="2" class="content"></td>
7
+ <td colspan="3"><a href="#main_component_form_0" class="slot_link">1</a></td>
8
+ </tr>
9
+ <tr>
10
+ <td colspan="2" rowspan="4" class="content"></td>
11
+ <td><a href="#small_component_form_0" class="slot_link">5</a></td>
12
+ </tr>
13
+ <tr>
14
+ <td></td>
15
+ <td><a href="#small_component_form_1" class="slot_link">6</a></td>
16
+ </tr>
17
+ <tr>
18
+ <td></td>
19
+ <td><a href="#small_component_form_2" class="slot_link">7</a></td>
20
+ </tr>
21
+ <tr>
22
+ <td></td>
23
+ <td><a href="#small_component_form_3" class="slot_link">8</a></td>
24
+ </tr>
25
+ <tr>
26
+ <td></td>
27
+ <td colspan="2"><a href="#wide_component_form_0" class="slot_link">2</a></td>
28
+ <td></td>
29
+ </tr>
30
+ <tr>
31
+ <td></td>
32
+ <td colspan="2"><a href="#wide_component_form_1" class="slot_link">3</a></td>
33
+ <td></td>
34
+ </tr>
35
+ <tr>
36
+ <td></td>
37
+ <td colspan="2"><a href="#wide_component_form_2" class="slot_link">4</a></td>
38
+ <td></td>
39
+ </tr>
40
+ <tr>
41
+ <td></td>
42
+ <td></td>
43
+ <td></td>
44
+ <td></td>
45
+ </tr>
46
+ </table>
47
+ <% end -%>
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag :all %>
6
+ <%= javascript_include_tag :defaults %>
7
+ <%= csrf_meta_tag %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,14 @@
1
+ <h1><%=h @node.title %></h1>
2
+
3
+ <%= component(@node, 'main_slot_0') %>
4
+
5
+ <div id="body"><%= @node.body.html_safe %></div>
6
+
7
+ <%= component(@node, 'small_slot_0') %>
8
+ <%= component(@node, 'small_slot_1') %>
9
+ <%= component(@node, 'small_slot_2') %>
10
+ <%= component(@node, 'small_slot_3') %>
11
+
12
+ <%= component(@node, 'wide_slot_0') %>
13
+ <%= component(@node, 'wide_slot_1') %>
14
+ <%= component(@node, 'wide_slot_2') %>
@@ -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,46 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require "active_model/railtie"
4
+ require "action_controller/railtie"
5
+ require "action_view/railtie"
6
+ require "action_mailer/railtie"
7
+
8
+ Bundler.require
9
+ require "noodall-components-general-content"
10
+
11
+ module Dummy
12
+ class Application < Rails::Application
13
+ # Settings in config/environments/* take precedence over those specified here.
14
+ # Application configuration should go into files in config/initializers
15
+ # -- all .rb files in that directory are automatically loaded.
16
+
17
+ # Custom directories with classes and modules you want to be autoloadable.
18
+ # config.autoload_paths += %W(#{config.root}/extras)
19
+
20
+ # Only load the plugins named here, in the order given (default is alphabetical).
21
+ # :all can be used as a placeholder for all plugins not explicitly named.
22
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
23
+
24
+ # Activate observers that should always be running.
25
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
26
+
27
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
28
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
29
+ # config.time_zone = 'Central Time (US & Canada)'
30
+
31
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
32
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
33
+ # config.i18n.default_locale = :de
34
+
35
+ # JavaScript files you want as :defaults (application.js is always included).
36
+ # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
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
+
44
+ config.middleware.insert_after 'Rack::Lock', 'Dragonfly::Middleware', :noodall_assets, '/media'
45
+ end
46
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ if File.exist?(gemfile)
5
+ ENV['BUNDLE_GEMFILE'] = gemfile
6
+ require 'bundler'
7
+ Bundler.setup
8
+ end
9
+
10
+ $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,12 @@
1
+ development:
2
+ database: noodall-development
3
+
4
+ test:
5
+ database: noodallui-test
6
+
7
+ production:
8
+ database: noodallui-production
9
+
10
+ staging:
11
+ database: noodallui-staging
12
+
@@ -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,26 @@
1
+ Dummy::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
+
23
+ # Only use best-standards-support built into browsers
24
+ config.action_dispatch.best_standards_support = :builtin
25
+ end
26
+
@@ -0,0 +1,49 @@
1
+ Dummy::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