enju_grid 0.1.1 → 0.2.0.beta.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +3 -0
  3. data/app/views/manifestations/index.html.erb +8 -8
  4. data/lib/enju_grid/version.rb +1 -1
  5. data/spec/dummy/app/controllers/application_controller.rb +7 -4
  6. data/spec/dummy/app/models/user.rb +5 -3
  7. data/spec/dummy/config/application.rb +12 -44
  8. data/spec/dummy/config/environments/development.rb +22 -18
  9. data/spec/dummy/config/environments/production.rb +46 -34
  10. data/spec/dummy/config/environments/test.rb +21 -15
  11. data/spec/dummy/db/migrate/149_create_message_templates.rb +18 -0
  12. data/spec/dummy/db/migrate/154_create_messages.rb +23 -0
  13. data/spec/dummy/db/migrate/20080819181903_create_message_requests.rb +18 -0
  14. data/spec/dummy/db/migrate/20110913115320_add_lft_and_rgt_to_message.rb +11 -0
  15. data/spec/dummy/db/migrate/20120125050502_add_depth_to_message.rb +6 -0
  16. data/spec/dummy/db/migrate/20140518111006_create_message_transitions.rb +18 -0
  17. data/spec/dummy/db/migrate/20140518135713_create_message_request_transitions.rb +18 -0
  18. data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +13 -0
  19. data/spec/dummy/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +9 -0
  20. data/spec/dummy/db/migrate/20160610093229_add_html_snippet_to_library_group.rb +5 -0
  21. data/spec/dummy/db/migrate/20160627232219_add_most_recent_to_user_import_file_transitions.rb +9 -0
  22. data/spec/dummy/db/migrate/20160627232316_add_most_recent_to_user_export_file_transitions.rb +9 -0
  23. data/spec/dummy/db/migrate/20160703185015_add_most_recent_to_message_transitions.rb +9 -0
  24. data/spec/dummy/db/migrate/20160813191533_add_book_jacket_source_to_library_group.rb +5 -0
  25. data/spec/dummy/db/migrate/20160813191647_add_max_number_of_results_to_library_group.rb +5 -0
  26. data/spec/dummy/db/migrate/20160813191733_add_family_name_first_to_library_group.rb +5 -0
  27. data/spec/dummy/db/migrate/20160813191820_add_screenshot_generator_to_library_group.rb +5 -0
  28. data/spec/dummy/db/migrate/20160813192542_add_pub_year_facet_range_interval_to_library_group.rb +5 -0
  29. data/spec/dummy/db/migrate/20160813203039_add_user_id_to_library_group.rb +5 -0
  30. data/spec/dummy/db/migrate/20160814165332_add_most_recent_to_message_request_transitions.rb +9 -0
  31. data/spec/dummy/db/schema.rb +96 -5
  32. data/spec/fixtures/library_groups.yml +5 -2
  33. data/spec/rails_helper.rb +77 -0
  34. data/spec/spec_helper.rb +90 -42
  35. data/spec/support/devise.rb +2 -2
  36. data/spec/views/manifestations/index.html.erb_spec.rb +5 -5
  37. data/spec/views/manifestations/show.html.erb_spec.rb +3 -4
  38. metadata +441 -334
  39. data/app/views/layouts/manifestations.html.erb +0 -28
  40. data/spec/dummy/app/models/ability.rb +0 -201
  41. data/spec/dummy/config/application.yml +0 -42
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 173734b6c742456f9599f0f108ab5ad71dfab6f1
4
- data.tar.gz: aa7c068326c4cb56a8120d6728b8be48d05caa86
3
+ metadata.gz: 7d23a8d3bc3a236dafbacfa8dbac6eb73d9c0848
4
+ data.tar.gz: 69323b18bef07f8a9be242e7fe6abe19c216fe5f
5
5
  SHA512:
6
- metadata.gz: 333792a11e8ad5fbfea7c37d0e480bee7154ebf5236098c495b8e2e582f69205551a82eab9b4dc489fc7cbbba017521160e7309d6aaa384e8b53055cad619c8f
7
- data.tar.gz: 8565f14913cbe0ab1a22282b781b2b8d1218607c65ffb2a638978cc8dcb3058487d31d76c9892cf2d48a2c594905d21879752eebd5990e3157c286e19a2d43c6
6
+ metadata.gz: d7ab3cf03fcc57d00a2e16c46239239613b0cdf38769a19344cca182c2685a7777688325e2a03490f4f580b5b676638e8a31b955a51775e1630b00f7ff46676d
7
+ data.tar.gz: 6b0f886e5c5df5b40705a22b235b51454b81e346c332ea0ef4df1c1f4cad42551a7ca75b769c2ab6f7728238ee49fcb84ccf262f02f23444ae28243ef548e741
data/README.rdoc CHANGED
@@ -1,4 +1,7 @@
1
1
  = Next-L Enju Grid
2
+ {<img src="https://travis-ci.org/next-l/enju_grid.svg?branch=1.2" alt="Build Status" />}[https://travis-ci.org/next-l/enju_grid]
3
+ {<img src="https://coveralls.io/repos/next-l/enju_grid/badge.svg?branch=1.2&service=github" alt="Coverage Status" />}[https://coveralls.io/github/next-l/enju_grid?branch=1.2]
4
+ {<img src="https://hakiri.io/github/next-l/enju_grid/1.2.svg" alt="security" />}[https://hakiri.io/github/next-l/enju_grid/1.2]
2
5
 
3
6
  == Related projects
4
7
  * {Next-L Enju Flower}[https://github.com/next-l/enju_flower]
@@ -40,17 +40,17 @@
40
40
  <%- if params[:sort_by].blank? -%>
41
41
  <strong><%= t('manifestation.date_of_acquisition') -%></strong>
42
42
  <%- else -%>
43
- <%= link_to t('manifestation.date_of_acquisition'), url_for(params.merge(sort_by: nil, only_path: true)) -%>
43
+ <%= link_to t('manifestation.date_of_acquisition'), url_for(params.permit.merge(sort_by: nil, only_path: true)) -%>
44
44
  <%- end -%>
45
45
  <%- if params[:sort_by] == 'pub_date' -%>
46
46
  <strong><%= t('activerecord.attributes.manifestation.date_of_publication') -%></strong>
47
47
  <%- else -%>
48
- <%= link_to t('activerecord.attributes.manifestation.date_of_publication'), url_for(params.merge(sort_by: 'pub_date', only_path: true)) -%>
48
+ <%= link_to t('activerecord.attributes.manifestation.date_of_publication'), url_for(params.permit.merge(sort_by: 'pub_date', only_path: true)) -%>
49
49
  <%- end -%>
50
50
  <%- if params[:sort_by] == 'title' -%>
51
51
  <strong><%= t('page.title') -%></strong>
52
52
  <%- else -%>
53
- <%= link_to t('page.title'), url_for(params.merge(sort_by: 'title', only_path: true)) -%>
53
+ <%= link_to t('page.title'), url_for(params.permit.merge(sort_by: 'title', only_path: true)) -%>
54
54
  <%- end -%>
55
55
  </p>
56
56
 
@@ -92,18 +92,18 @@
92
92
  </div>
93
93
 
94
94
  <div id="submenu" class="ui-corner-all ui-widget-content">
95
- <% if @parent and can?(:update, @parent) %>
95
+ <% if @parent and policy(@parent).update? %>
96
96
  <%= render 'submenu_parent' %>
97
97
  <% end %>
98
- <h3><%= link_to h("#{t('page.total')}: #{@count[:query_result]}"), url_for(params.merge(action: 'index', view: nil, carrier_type: nil, library: nil, language: nil, subject: nil, only_path: true)) -%></h3>
98
+ <h3><%= link_to h("#{t('page.total')}: #{@count[:query_result]}"), url_for(params.permit.merge(action: 'index', view: nil, carrier_type: nil, library: nil, language: nil, subject: nil, only_path: true)) -%></h3>
99
99
  <%- if @manifestations.total_count > 0 -%>
100
100
  <%= render 'manifestations/all_facet' -%>
101
101
  <%- end -%>
102
102
  <div>
103
103
  <%- if params[:library_id].blank? -%>
104
- <%= link_to((image_tag 'icons/feed.png', size: '16x16', alt: t('page.feed'), class: 'icon'), url_for(params.merge(format: :rss, page: nil, library_id: nil, only_path: true))) -%> <%= link_to t('page.search_result_feed'), url_for(params.merge(format: :rss, page: nil, library_id: nil, commit: nil, only_path: true)) -%>
104
+ <%= link_to((image_tag 'icons/feed.png', size: '16x16', class: 'enju_icon', alt: t('page.feed')), url_for(params.permit.merge(format: :rss, page: nil, library_id: nil, only_path: true))) -%> <%= link_to t('page.search_result_feed'), url_for(params.permit.merge(format: :rss, page: nil, library_id: nil, commit: nil, only_path: true)) -%>
105
105
  <%- else -%>
106
- <%= link_to((image_tag 'icons/feed.png', size: '16x16', alt: t('page.feed'), class: 'icon'), url_for(params.merge(format: :rss, page: nil, only_path: true))) -%> <%= link_to t('page.search_result_feed'), url_for(params.merge(format: :rss, page: nil, commit: nil, only_path: true)) -%>
106
+ <%= link_to((image_tag 'icons/feed.png', size: '16x16', class: 'enju_icon', alt: t('page.feed')), url_for(params.permit.merge(format: :rss, page: nil, only_path: true))) -%> <%= link_to t('page.search_result_feed'), url_for(params.permit.merge(format: :rss, page: nil, commit: nil, only_path: true)) -%>
107
107
  <%- end -%>
108
108
  </div>
109
109
  </div>
@@ -111,7 +111,7 @@
111
111
  <% if defined?(EnjuBookmark) %>
112
112
  <script type="text/javascript">
113
113
  window.onload = function() {
114
- $("#tag_cloud_list").load('<%= url_for(params.merge(view: "tag_cloud", only_path: true)) -%>', hideTagCloudSpinner);
114
+ $("#tag_cloud_list").load('<%= url_for(params.permit.merge(view: "tag_cloud", only_path: true)) -%>', hideTagCloudSpinner);
115
115
  }
116
116
 
117
117
  function hideTagCloudSpinner(){
@@ -1,3 +1,3 @@
1
1
  module EnjuGrid
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0.beta.3"
3
3
  end
@@ -1,8 +1,11 @@
1
1
  class ApplicationController < ActionController::Base
2
2
  protect_from_forgery
3
3
 
4
- enju_leaf
5
- enju_biblio
6
- enju_library
7
- enju_subject
4
+ include EnjuLibrary::Controller
5
+ include EnjuBiblio::Controller
6
+ include EnjuSubject::Controller
7
+ before_action :set_paper_trail_whodunnit
8
+ after_action :verify_authorized
9
+
10
+ include Pundit
8
11
  end
@@ -1,9 +1,11 @@
1
- # -*- encoding: utf-8 -*-
2
1
  class User < ActiveRecord::Base
3
2
  devise :database_authenticatable, #:registerable,
4
3
  :recoverable, :rememberable, :trackable, #, :validatable
5
4
  :lockable, :lock_strategy => :none, :unlock_strategy => :none
6
5
 
7
- enju_leaf_user_model
8
- enju_circulation_user_model
6
+ include EnjuSeed::EnjuUser
7
+ include EnjuCirculation::EnjuUser
9
8
  end
9
+
10
+ Manifestation.include(EnjuSubject::EnjuManifestation)
11
+ Item.include(EnjuCirculation::EnjuItem)
@@ -2,8 +2,14 @@ require File.expand_path('../boot', __FILE__)
2
2
 
3
3
  require 'rails/all'
4
4
 
5
- Bundler.require
6
- require "enju_grid"
5
+ Bundler.require(*Rails.groups)
6
+ require 'enju_grid'
7
+ require 'enju_leaf'
8
+ require 'enju_circulation'
9
+ require 'enju_subject'
10
+ require 'enju_manifestation_viewer'
11
+ require 'globalize'
12
+ require 'globalize-accessors'
7
13
 
8
14
  module Dummy
9
15
  class Application < Rails::Application
@@ -11,54 +17,16 @@ module Dummy
11
17
  # Application configuration should go into files in config/initializers
12
18
  # -- all .rb files in that directory are automatically loaded.
13
19
 
14
- # Custom directories with classes and modules you want to be autoloadable.
15
- # config.autoload_paths += %W(#{config.root}/extras)
16
-
17
- # Only load the plugins named here, in the order given (default is alphabetical).
18
- # :all can be used as a placeholder for all plugins not explicitly named.
19
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
20
-
21
- # Activate observers that should always be running.
22
- # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
23
-
24
20
  # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
25
21
  # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
26
- config.time_zone = 'Tokyo'
22
+ # config.time_zone = 'Central Time (US & Canada)'
27
23
 
28
24
  # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
29
25
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
30
- config.i18n.default_locale = :ja
31
-
32
- # Configure the default encoding used in templates for Ruby 1.9.
33
- config.encoding = "utf-8"
34
-
35
- # Configure sensitive parameters which will be filtered from the log file.
36
- config.filter_parameters += [:password]
26
+ # config.i18n.default_locale = :de
37
27
 
38
- # Enable escaping HTML in JSON.
39
- config.active_support.escape_html_entities_in_json = true
40
-
41
- # Use SQL instead of Active Record's schema dumper when creating the database.
42
- # This is necessary if your schema can't be completely dumped by the schema dumper,
43
- # like if you have constraints or database-specific column types
44
- # config.active_record.schema_format = :sql
45
-
46
- # Enforce whitelist mode for mass assignment.
47
- # This will create an empty whitelist of attributes available for mass-assignment for all models
48
- # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
49
- # parameters by using an attr_accessible or attr_protected declaration.
50
- #config.active_record.whitelist_attributes = true
51
-
52
- # Enable the asset pipeline
53
- config.assets.enabled = true
54
-
55
- # Version of your assets, change this if you want to expire all your assets
56
- config.assets.version = '1.0'
28
+ # Do not swallow errors in after_commit/after_rollback callbacks.
29
+ config.active_record.raise_in_transactional_callbacks = true
57
30
  end
58
31
  end
59
32
 
60
- require 'enju_leaf'
61
- require 'enju_circulation'
62
- require 'enju_bookmark'
63
- require 'enju_manifestation_viewer'
64
- require 'enju_subject'
@@ -1,37 +1,41 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
1
+ Rails.application.configure do
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
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.
28
+ config.assets.debug = true
27
29
 
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
30
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
31
+ # yet still be able to expire them through the digest params.
32
+ config.assets.digest = true
31
33
 
32
- # Do not compress assets
33
- config.assets.compress = false
34
+ # Adds additional error checking when serving assets at runtime.
35
+ # Checks for improperly declared sprockets dependencies.
36
+ # Raises helpful error messages.
37
+ config.assets.raise_runtime_errors = true
34
38
 
35
- # Expands the lines which load the assets
36
- config.assets.debug = true
39
+ # Raises error for missing translations
40
+ # config.action_view.raise_on_missing_translations = true
37
41
  end
@@ -1,67 +1,79 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
1
+ Rails.application.configure do
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 threaded 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)
12
- config.serve_static_assets = false
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
20
+ # NGINX, varnish or squid.
21
+ # config.action_dispatch.rack_cache = true
22
+
23
+ # Disable serving static files from the `/public` folder by default since
24
+ # Apache or NGINX already handles this.
25
+ config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
13
26
 
14
- # Compress JavaScripts and CSS
15
- config.assets.compress = true
27
+ # Compress JavaScripts and CSS.
28
+ config.assets.js_compressor = :uglifier
29
+ # config.assets.css_compressor = :sass
16
30
 
17
- # Don't fallback to assets pipeline if a precompiled asset is missed
31
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
18
32
  config.assets.compile = false
19
33
 
20
- # Generate digests for assets URLs
34
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
35
+ # yet still be able to expire them through the digest params.
21
36
  config.assets.digest = true
22
37
 
23
- # Defaults to nil and saved in location specified by config.assets.prefix
24
- # config.assets.manifest = YOUR_PATH
38
+ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
25
39
 
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
40
+ # Specifies the header that your server uses for sending files.
41
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
42
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
29
43
 
30
44
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
45
  # config.force_ssl = true
32
46
 
33
- # See everything in the log (default is :info)
34
- # config.log_level = :debug
47
+ # Use the lowest log level to ensure availability of diagnostic information
48
+ # when problems arise.
49
+ config.log_level = :debug
35
50
 
36
- # Prepend all log lines with the following tags
51
+ # Prepend all log lines with the following tags.
37
52
  # config.log_tags = [ :subdomain, :uuid ]
38
53
 
39
- # Use a different logger for distributed setups
54
+ # Use a different logger for distributed setups.
40
55
  # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
41
56
 
42
- # Use a different cache store in production
57
+ # Use a different cache store in production.
43
58
  # config.cache_store = :mem_cache_store
44
59
 
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 )
60
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
61
+ # config.action_controller.asset_host = 'http://assets.example.com'
50
62
 
51
- # Disable delivery errors, bad email addresses will be ignored
63
+ # Ignore bad email addresses and do not raise email delivery errors.
64
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
52
65
  # config.action_mailer.raise_delivery_errors = false
53
66
 
54
- # Enable threaded mode
55
- # config.threadsafe!
56
-
57
67
  # 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)
68
+ # the I18n.default_locale when a translation cannot be found).
59
69
  config.i18n.fallbacks = true
60
70
 
61
- # Send deprecation notices to registered listeners
71
+ # Send deprecation notices to registered listeners.
62
72
  config.active_support.deprecation = :notify
63
73
 
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
74
+ # Use default logging formatter so that PID and timestamp are not suppressed.
75
+ config.log_formatter = ::Logger::Formatter.new
76
+
77
+ # Do not dump schema after migrations.
78
+ config.active_record.dump_schema_after_migration = false
67
79
  end
@@ -1,6 +1,5 @@
1
- Dummy::Application.configure do
2
- config.action_mailer.default_url_options = {:host => 'localhost:3000'}
3
- # Settings specified here will take precedence over those in config/application.rb
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
4
3
 
5
4
  # The test environment is used exclusively to run your application's
6
5
  # test suite. You never need to work with it otherwise. Remember that
@@ -8,31 +7,38 @@ Dummy::Application.configure do
8
7
  # and recreated between test runs. Don't rely on the data there!
9
8
  config.cache_classes = true
10
9
 
11
- # Configure static asset server for tests with Cache-Control for performance
12
- config.serve_static_assets = true
13
- 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
14
14
 
15
- # Log error messages when you accidentally call methods on nil
16
- config.whiny_nils = true
15
+ # Configure static file server for tests with Cache-Control for performance.
16
+ config.serve_static_files = true
17
+ config.static_cache_control = 'public, max-age=3600'
17
18
 
18
- # Show full error reports and disable caching
19
+ # Show full error reports and disable caching.
19
20
  config.consider_all_requests_local = true
20
21
  config.action_controller.perform_caching = false
21
22
 
22
- # Raise exceptions instead of rendering exception templates
23
+ # Raise exceptions instead of rendering exception templates.
23
24
  config.action_dispatch.show_exceptions = false
24
25
 
25
- # Disable request forgery protection in test environment
26
- config.action_controller.allow_forgery_protection = false
26
+ # Disable request forgery protection in test environment.
27
+ config.action_controller.allow_forgery_protection = false
27
28
 
28
29
  # Tell Action Mailer not to deliver emails to the real world.
29
30
  # The :test delivery method accumulates sent emails in the
30
31
  # ActionMailer::Base.deliveries array.
31
32
  config.action_mailer.delivery_method = :test
32
33
 
33
- # Raise exception on mass assignment protection for Active Record models
34
- #config.active_record.mass_assignment_sanitizer = :strict
34
+ # Randomize the order test cases are executed.
35
+ config.active_support.test_order = :random
35
36
 
36
- # Print deprecation notices to the stderr
37
+ # Print deprecation notices to the stderr.
37
38
  config.active_support.deprecation = :stderr
39
+
40
+ # Raises error for missing translations
41
+ # config.action_view.raise_on_missing_translations = true
42
+
43
+ config.action_mailer.default_url_options = {:host => 'localhost:3000'}
38
44
  end
@@ -0,0 +1,18 @@
1
+ class CreateMessageTemplates < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :message_templates do |t|
4
+ t.string :status, :null => false
5
+ t.text :title, :null => false
6
+ t.text :body, :null => false
7
+ t.integer :position
8
+ t.string :locale, :default => I18n.default_locale.to_s
9
+
10
+ t.timestamps
11
+ end
12
+ add_index :message_templates, :status, :unique => true
13
+ end
14
+
15
+ def self.down
16
+ drop_table :message_templates
17
+ end
18
+ end
@@ -0,0 +1,23 @@
1
+ class CreateMessages < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :messages, :force => true do |t|
4
+ t.datetime :read_at
5
+ t.integer :receiver_id, :sender_id
6
+ t.string :subject, :null => false
7
+ t.text :body
8
+ t.integer :message_request_id
9
+ t.integer :parent_id
10
+
11
+ t.timestamps
12
+ end
13
+
14
+ add_index :messages, :sender_id
15
+ add_index :messages, :receiver_id
16
+ add_index :messages, :message_request_id
17
+ add_index :messages, :parent_id
18
+ end
19
+
20
+ def self.down
21
+ drop_table :messages
22
+ end
23
+ end
@@ -0,0 +1,18 @@
1
+ class CreateMessageRequests < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :message_requests do |t|
4
+ t.integer :sender_id
5
+ t.integer :receiver_id
6
+ t.integer :message_template_id
7
+ t.datetime :sent_at
8
+ t.datetime :deleted_at
9
+ t.text :body
10
+
11
+ t.timestamps
12
+ end
13
+ end
14
+
15
+ def self.down
16
+ drop_table :message_requests
17
+ end
18
+ end
@@ -0,0 +1,11 @@
1
+ class AddLftAndRgtToMessage < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :messages, :lft, :integer
4
+ add_column :messages, :rgt, :integer
5
+ end
6
+
7
+ def self.down
8
+ remove_column :messages, :rgt
9
+ remove_column :messages, :lft
10
+ end
11
+ end
@@ -0,0 +1,6 @@
1
+ class AddDepthToMessage < ActiveRecord::Migration
2
+ def change
3
+ add_column :messages, :depth, :integer
4
+
5
+ end
6
+ end
@@ -0,0 +1,18 @@
1
+ class CreateMessageTransitions < ActiveRecord::Migration
2
+ def change
3
+ create_table :message_transitions do |t|
4
+ t.string :to_state
5
+ if ActiveRecord::Base.configurations[Rails.env]["adapter"].try(:match, /mysql/)
6
+ t.text :metadata
7
+ else
8
+ t.text :metadata, default: "{}"
9
+ end
10
+ t.integer :sort_key
11
+ t.integer :message_id
12
+ t.timestamps
13
+ end
14
+
15
+ add_index :message_transitions, :message_id
16
+ add_index :message_transitions, [:sort_key, :message_id], unique: true
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ class CreateMessageRequestTransitions < ActiveRecord::Migration
2
+ def change
3
+ create_table :message_request_transitions do |t|
4
+ t.string :to_state
5
+ if ActiveRecord::Base.configurations[Rails.env]["adapter"].try(:match, /mysql/)
6
+ t.text :metadata
7
+ else
8
+ t.text :metadata, default: "{}"
9
+ end
10
+ t.integer :sort_key
11
+ t.integer :message_request_id
12
+ t.timestamps
13
+ end
14
+
15
+ add_index :message_request_transitions, :message_request_id
16
+ add_index :message_request_transitions, [:sort_key, :message_request_id], unique: true, name: "index_message_request_transitions_on_sort_key_and_request_id"
17
+ end
18
+ end
@@ -0,0 +1,13 @@
1
+ class AddTranslationTableToLibraryGroup < ActiveRecord::Migration
2
+ def up
3
+ LibraryGroup.create_translation_table!({
4
+ login_banner: :text
5
+ }, {
6
+ migrate_data: true
7
+ })
8
+ end
9
+
10
+ def down
11
+ LibraryGroup.drop_translation_table! migrate_data: true
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ class AddFooterBannerToLibraryGroup < ActiveRecord::Migration
2
+ def up
3
+ LibraryGroup.add_translation_fields! footer_banner: :text
4
+ end
5
+
6
+ def down
7
+ remove_column :library_group_translations, :footer_banner
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ class AddHtmlSnippetToLibraryGroup < ActiveRecord::Migration
2
+ def change
3
+ add_column :library_groups, :html_snippet, :text
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ class AddMostRecentToUserImportFileTransitions < ActiveRecord::Migration
2
+ def up
3
+ add_column :user_import_file_transitions, :most_recent, :boolean, null: true
4
+ end
5
+
6
+ def down
7
+ remove_column :user_import_file_transitions, :most_recent
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class AddMostRecentToUserExportFileTransitions < ActiveRecord::Migration
2
+ def up
3
+ add_column :user_export_file_transitions, :most_recent, :boolean, null: true
4
+ end
5
+
6
+ def down
7
+ remove_column :user_export_file_transitions, :most_recent
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class AddMostRecentToMessageTransitions < ActiveRecord::Migration
2
+ def up
3
+ add_column :message_transitions, :most_recent, :boolean, null: true
4
+ end
5
+
6
+ def down
7
+ remove_column :message_transitions, :most_recent
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ class AddBookJacketSourceToLibraryGroup < ActiveRecord::Migration
2
+ def change
3
+ add_column :library_groups, :book_jacket_source, :string
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddMaxNumberOfResultsToLibraryGroup < ActiveRecord::Migration
2
+ def change
3
+ add_column :library_groups, :max_number_of_results, :integer, default: 500
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddFamilyNameFirstToLibraryGroup < ActiveRecord::Migration
2
+ def change
3
+ add_column :library_groups, :family_name_first, :boolean, default: true
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddScreenshotGeneratorToLibraryGroup < ActiveRecord::Migration
2
+ def change
3
+ add_column :library_groups, :screenshot_generator, :string
4
+ end
5
+ end