kuhsaft 1.8.6 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -8
  3. data/Rakefile +4 -25
  4. data/app/assets/javascripts/kuhsaft/cms/application.js.coffee +2 -2
  5. data/app/assets/stylesheets/kuhsaft/cms/application.css.sass +4 -8
  6. data/app/controllers/kuhsaft/cms/admin_controller.rb +4 -4
  7. data/app/controllers/kuhsaft/pages_controller.rb +1 -2
  8. data/app/models/kuhsaft/asset.rb +2 -2
  9. data/app/models/kuhsaft/brick_type.rb +3 -3
  10. data/app/models/kuhsaft/page.rb +5 -7
  11. data/app/uploaders/kuhsaft/asset_brick_asset_uploader.rb +1 -1
  12. data/app/uploaders/kuhsaft/image_brick_image_uploader.rb +1 -1
  13. data/app/views/kuhsaft/cms/pages/_form.html.haml +0 -1
  14. data/app/views/kuhsaft/pages/show.html.haml +2 -7
  15. data/config/locales/kuhsaft.de.yml +1 -4
  16. data/config/locales/kuhsaft.en.yml +0 -3
  17. data/config/locales/models/kuhsaft/page/de.yml +0 -1
  18. data/config/routes.rb +1 -1
  19. data/lib/kuhsaft.rb +3 -2
  20. data/lib/kuhsaft/searchable.rb +1 -3
  21. data/lib/kuhsaft/version.rb +1 -1
  22. data/spec/controllers/kuhsaft/pages_controller_spec.rb +25 -13
  23. data/spec/dummy/app/assets/javascripts/kuhsaft/cms/customizations.js.coffee +0 -0
  24. data/spec/dummy/app/assets/stylesheets/kuhsaft/cms/customizations.css.sass +0 -0
  25. data/spec/dummy/app/views/layouts/application.html.erb +1 -1
  26. data/spec/dummy/bin/bundle +3 -0
  27. data/spec/dummy/bin/rails +4 -0
  28. data/spec/dummy/bin/rake +4 -0
  29. data/spec/dummy/config/application.rb +6 -52
  30. data/spec/dummy/config/boot.rb +3 -9
  31. data/spec/dummy/config/environment.rb +2 -2
  32. data/spec/dummy/config/environments/development.rb +11 -19
  33. data/spec/dummy/config/environments/production.rb +41 -27
  34. data/spec/dummy/config/environments/test.rb +13 -14
  35. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  36. data/spec/dummy/config/initializers/inflections.rb +6 -5
  37. data/spec/dummy/config/initializers/kuhsaft.rb +5 -0
  38. data/spec/dummy/config/initializers/secret_token.rb +7 -2
  39. data/spec/dummy/config/initializers/session_store.rb +0 -5
  40. data/spec/dummy/config/initializers/wrap_parameters.rb +6 -6
  41. data/spec/dummy/config/locales/en.yml +20 -2
  42. data/spec/dummy/config/routes.rb +1 -1
  43. data/spec/features/search_spec.rb +2 -2
  44. data/spec/spec_helper.rb +10 -0
  45. metadata +72 -49
  46. data/db/migrate/13_add_page_title_to_pages.rb +0 -7
  47. data/db/migrate/14_move_kuhsaft_assets.rb +0 -22
  48. data/spec/support/default_url_options.rb +0 -36
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -1,15 +1,12 @@
1
1
  require File.expand_path('../boot', __FILE__)
2
2
 
3
- # Pick the frameworks you want:
4
- require "active_record/railtie"
5
- require "action_controller/railtie"
6
- require "action_mailer/railtie"
7
- require "active_resource/railtie"
8
- require "sprockets/railtie"
9
- # require "rails/test_unit/railtie"
3
+ require 'rails/all'
10
4
 
11
- Bundler.require
12
- require "kuhsaft"
5
+ # Require the gems listed in Gemfile, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(:default, Rails.env)
8
+
9
+ require 'kuhsaft'
13
10
 
14
11
  module Dummy
15
12
  class Application < Rails::Application
@@ -17,16 +14,6 @@ module Dummy
17
14
  # Application configuration should go into files in config/initializers
18
15
  # -- all .rb files in that directory are automatically loaded.
19
16
 
20
- # Custom directories with classes and modules you want to be autoloadable.
21
- # config.autoload_paths += %W(#{config.root}/extras)
22
-
23
- # Only load the plugins named here, in the order given (default is alphabetical).
24
- # :all can be used as a placeholder for all plugins not explicitly named.
25
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
26
-
27
- # Activate observers that should always be running.
28
- # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
29
-
30
17
  # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
31
18
  # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
32
19
  # config.time_zone = 'Central Time (US & Canada)'
@@ -34,38 +21,5 @@ module Dummy
34
21
  # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
35
22
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
36
23
  # config.i18n.default_locale = :de
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
- # Enable escaping HTML in JSON.
45
- config.active_support.escape_html_entities_in_json = true
46
-
47
- # Use SQL instead of Active Record's schema dumper when creating the database.
48
- # This is necessary if your schema can't be completely dumped by the schema dumper,
49
- # like if you have constraints or database-specific column types
50
- # config.active_record.schema_format = :sql
51
-
52
- # Enforce whitelist mode for mass assignment.
53
- # This will create an empty whitelist of attributes available for mass-assignment for all models
54
- # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
55
- # parameters by using an attr_accessible or attr_protected declaration.
56
- config.active_record.whitelist_attributes = true
57
-
58
- # Enable the asset pipeline
59
- config.assets.enabled = true
60
-
61
- # Version of your assets, change this if you want to expire all your assets
62
- config.assets.version = '1.0'
63
-
64
- config.to_prepare do
65
- Kuhsaft::Engine.configure do
66
- config.image_sizes.build_defaults! # creates 960x540 and 320x180 sizes
67
- end
68
- end
69
24
  end
70
25
  end
71
-
@@ -1,10 +1,4 @@
1
- require 'rubygems'
2
- gemfile = File.expand_path('../../../../Gemfile', __FILE__)
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
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__)
4
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -1,5 +1,5 @@
1
- # Load the rails application
1
+ # Load the Rails application.
2
2
  require File.expand_path('../application', __FILE__)
3
3
 
4
- # Initialize the rails application
4
+ # Initialize the Rails application.
5
5
  Dummy::Application.initialize!
@@ -1,37 +1,29 @@
1
1
  Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
4
  # In the development environment your application's code is reloaded on
5
5
  # every request. This slows down response time but is perfect for development
6
6
  # since you don't have to restart the web server when you make code changes.
7
7
  config.cache_classes = false
8
8
 
9
- # Log error messages when you accidentally call methods on nil.
10
- config.whiny_nils = true
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
11
11
 
12
- # Show full error reports and disable caching
12
+ # Show full error reports and disable caching.
13
13
  config.consider_all_requests_local = true
14
14
  config.action_controller.perform_caching = false
15
15
 
16
- # Don't care if the mailer can't send
16
+ # Don't care if the mailer can't send.
17
17
  config.action_mailer.raise_delivery_errors = false
18
18
 
19
- # Print deprecation notices to the Rails logger
19
+ # Print deprecation notices to the Rails logger.
20
20
  config.active_support.deprecation = :log
21
21
 
22
- # Only use best-standards-support built into browsers
23
- config.action_dispatch.best_standards_support = :builtin
22
+ # Raise an error on page load if there are pending migrations
23
+ config.active_record.migration_error = :page_load
24
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
25
+ # Debug mode disables concatenation and preprocessing of assets.
26
+ # This option may cause significant delays in view rendering with a large
27
+ # number of complex assets.
36
28
  config.assets.debug = true
37
29
  end
@@ -1,67 +1,81 @@
1
1
  Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
- # Code is not reloaded between requests
4
+ # Code is not reloaded between requests.
5
5
  config.cache_classes = true
6
6
 
7
- # Full error reports are disabled and caching is turned on
7
+ # Eager load code on boot. This eager loads most of Rails and
8
+ # your application in memory, allowing both thread web servers
9
+ # and those relying on copy on write to perform better.
10
+ # Rake tasks automatically ignore this option for performance.
11
+ config.eager_load = true
12
+
13
+ # Full error reports are disabled and caching is turned on.
8
14
  config.consider_all_requests_local = false
9
15
  config.action_controller.perform_caching = true
10
16
 
11
- # Disable Rails's static asset server (Apache or nginx will already do this)
17
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
+ # Add `rack-cache` to your Gemfile before enabling this.
19
+ # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20
+ # config.action_dispatch.rack_cache = true
21
+
22
+ # Disable Rails's static asset server (Apache or nginx will already do this).
12
23
  config.serve_static_assets = false
13
24
 
14
- # Compress JavaScripts and CSS
15
- config.assets.compress = true
25
+ # Compress JavaScripts and CSS.
26
+ config.assets.js_compressor = :uglifier
27
+ # config.assets.css_compressor = :sass
16
28
 
17
- # Don't fallback to assets pipeline if a precompiled asset is missed
29
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
18
30
  config.assets.compile = false
19
31
 
20
- # Generate digests for assets URLs
32
+ # Generate digests for assets URLs.
21
33
  config.assets.digest = true
22
34
 
23
- # Defaults to nil and saved in location specified by config.assets.prefix
24
- # config.assets.manifest = YOUR_PATH
35
+ # Version of your assets, change this if you want to expire all your assets.
36
+ config.assets.version = '1.0'
25
37
 
26
- # Specifies the header that your server uses for sending files
38
+ # Specifies the header that your server uses for sending files.
27
39
  # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
40
  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
29
41
 
30
42
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
43
  # config.force_ssl = true
32
44
 
33
- # See everything in the log (default is :info)
34
- # config.log_level = :debug
45
+ # Set to :debug to see everything in the log.
46
+ config.log_level = :info
35
47
 
36
- # Prepend all log lines with the following tags
48
+ # Prepend all log lines with the following tags.
37
49
  # config.log_tags = [ :subdomain, :uuid ]
38
50
 
39
- # Use a different logger for distributed setups
51
+ # Use a different logger for distributed setups.
40
52
  # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
41
53
 
42
- # Use a different cache store in production
54
+ # Use a different cache store in production.
43
55
  # config.cache_store = :mem_cache_store
44
56
 
45
- # Enable serving of images, stylesheets, and JavaScripts from an asset server
57
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
46
58
  # config.action_controller.asset_host = "http://assets.example.com"
47
59
 
48
- # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
60
+ # Precompile additional assets.
61
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
49
62
  # config.assets.precompile += %w( search.js )
63
+ config.assets.precompile += %w( kuhsaft/cms/customizations.css kuhsaft/cms/customizations.js kuhsaft/cms/ck-config.js )
50
64
 
51
- # Disable delivery errors, bad email addresses will be ignored
65
+ # Ignore bad email addresses and do not raise email delivery errors.
66
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
52
67
  # config.action_mailer.raise_delivery_errors = false
53
68
 
54
- # Enable threaded mode
55
- # config.threadsafe!
56
-
57
69
  # 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)
70
+ # the I18n.default_locale when a translation can not be found).
59
71
  config.i18n.fallbacks = true
60
72
 
61
- # Send deprecation notices to registered listeners
73
+ # Send deprecation notices to registered listeners.
62
74
  config.active_support.deprecation = :notify
63
75
 
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
76
+ # Disable automatic flushing of the log to improve performance.
77
+ # config.autoflush_log = false
78
+
79
+ # Use default logging formatter so that PID and timestamp are not suppressed.
80
+ config.log_formatter = ::Logger::Formatter.new
67
81
  end
@@ -1,5 +1,5 @@
1
1
  Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
4
  # The test environment is used exclusively to run your application's
5
5
  # test suite. You never need to work with it otherwise. Remember that
@@ -7,31 +7,30 @@ Dummy::Application.configure do
7
7
  # and recreated between test runs. Don't rely on the data there!
8
8
  config.cache_classes = true
9
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"
10
+ # Do not eager load code on boot. This avoids loading your whole application
11
+ # just for the purpose of running a single test. If you are using a tool that
12
+ # preloads Rails for running tests, you may have to set it to true.
13
+ config.eager_load = false
13
14
 
14
- # Log error messages when you accidentally call methods on nil
15
- config.whiny_nils = true
15
+ # Configure static asset server for tests with Cache-Control for performance.
16
+ config.serve_static_assets = true
17
+ config.static_cache_control = "public, max-age=3600"
16
18
 
17
- # Show full error reports and disable caching
19
+ # Show full error reports and disable caching.
18
20
  config.consider_all_requests_local = true
19
21
  config.action_controller.perform_caching = false
20
22
 
21
- # Raise exceptions instead of rendering exception templates
23
+ # Raise exceptions instead of rendering exception templates.
22
24
  config.action_dispatch.show_exceptions = false
23
25
 
24
- # Disable request forgery protection in test environment
25
- config.action_controller.allow_forgery_protection = false
26
+ # Disable request forgery protection in test environment.
27
+ config.action_controller.allow_forgery_protection = false
26
28
 
27
29
  # Tell Action Mailer not to deliver emails to the real world.
28
30
  # The :test delivery method accumulates sent emails in the
29
31
  # ActionMailer::Base.deliveries array.
30
32
  config.action_mailer.delivery_method = :test
31
33
 
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
34
+ # Print deprecation notices to the stderr.
36
35
  config.active_support.deprecation = :stderr
37
36
  end
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [:password]
@@ -1,15 +1,16 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- # Add new inflection rules using the following format
4
- # (all these examples are active by default):
5
- # ActiveSupport::Inflector.inflections do |inflect|
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
6
7
  # inflect.plural /^(ox)$/i, '\1en'
7
8
  # inflect.singular /^(ox)en/i, '\1'
8
9
  # inflect.irregular 'person', 'people'
9
10
  # inflect.uncountable %w( fish sheep )
10
11
  # end
11
- #
12
+
12
13
  # These inflection rules are supported but not enabled by default:
13
- # ActiveSupport::Inflector.inflections do |inflect|
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
14
15
  # inflect.acronym 'RESTful'
15
16
  # end
@@ -0,0 +1,5 @@
1
+ Rails.application.config.to_prepare do
2
+ Kuhsaft::Engine.configure do
3
+ config.image_sizes.build_defaults! # creates 960x540 and 320x180 sizes
4
+ end
5
+ end
@@ -1,7 +1,12 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- # Your secret key for verifying the integrity of signed cookies.
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
4
  # If you change this key, all old signed cookies will become invalid!
5
+
5
6
  # Make sure the secret is at least 30 characters and all random,
6
7
  # no regular words or you'll be exposed to dictionary attacks.
7
- Dummy::Application.config.secret_token = '5577820f2c8866989aa7588272eba883f77a3da3c23f151633a379a619dcbd803ef1e9cb9cf5f1c4103662fa5c8e149011cbbb3850c0f845c7707c583b937734'
8
+ # You can use `rake secret` to generate a secure secret key.
9
+
10
+ # Make sure your secret_key_base is kept private
11
+ # if you're sharing your code publicly.
12
+ Dummy::Application.config.secret_key_base = '6079ad1db3d798e3f31a91b36dec17bfcdfd5e88369b7c3b5024092ccf349f0b04e8ccef47292f3aceef113a1ab3438d76234485ef570d67a7feb991e102b672'
@@ -1,8 +1,3 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
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
@@ -1,14 +1,14 @@
1
1
  # Be sure to restart your server when you modify this file.
2
- #
2
+
3
3
  # This file contains settings for ActionController::ParamsWrapper which
4
4
  # is enabled by default.
5
5
 
6
6
  # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
7
  ActiveSupport.on_load(:action_controller) do
8
- wrap_parameters format: [:json]
8
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9
9
  end
10
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
11
+ # To enable root element in JSON for ActiveRecord objects.
12
+ # ActiveSupport.on_load(:active_record) do
13
+ # self.include_root_in_json = true
14
+ # end
@@ -1,5 +1,23 @@
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.
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # To learn more, please read the Rails Internationalization guide
20
+ # available at http://guides.rubyonrails.org/i18n.html.
3
21
 
4
22
  en:
5
23
  hello: "Hello world"
@@ -1,3 +1,3 @@
1
- Rails.application.routes.draw do
1
+ Dummy::Application.routes.draw do
2
2
  mount Kuhsaft::Engine => "/"
3
3
  end
@@ -32,13 +32,13 @@ describe 'pages#index' do
32
32
  end
33
33
 
34
34
  it 'highlights search term in preview' do
35
- within("ul.search-results strong.highlight") do
35
+ within("ul.search-results mark") do
36
36
  page.should have_content('Chromodorididae')
37
37
  end
38
38
  end
39
39
 
40
40
  it 'truncates the text' do
41
- find('.summary .fulltext').text.length.should < 200
41
+ find('.summary .fulltext').text.length.should == 208
42
42
  end
43
43
  end
44
44