trix_on_rails 0.1.4 → 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.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/trix-core.js +8 -8
  3. data/app/assets/javascripts/trix.js +10 -14
  4. data/app/assets/stylesheets/trix.css +268 -177
  5. data/lib/trix_on_rails/version.rb +1 -1
  6. data/test/dummy/Rakefile +1 -1
  7. data/test/dummy/app/assets/javascripts/application.js +2 -1
  8. data/test/dummy/app/assets/javascripts/cable.js +13 -0
  9. data/test/dummy/app/assets/stylesheets/application.css +1 -0
  10. data/test/dummy/app/channels/application_cable/channel.rb +4 -0
  11. data/test/dummy/app/channels/application_cable/connection.rb +4 -0
  12. data/test/dummy/app/controllers/application_controller.rb +0 -2
  13. data/test/dummy/app/controllers/pages_controller.rb +58 -0
  14. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  15. data/test/dummy/app/models/application_record.rb +3 -0
  16. data/test/dummy/app/models/page.rb +2 -0
  17. data/test/dummy/app/views/layouts/application.html.erb +9 -9
  18. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  19. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  20. data/test/dummy/app/views/pages/_form.html.erb +34 -0
  21. data/test/dummy/app/views/pages/edit.html.erb +6 -0
  22. data/test/dummy/app/views/pages/index.html.erb +31 -0
  23. data/test/dummy/app/views/pages/new.html.erb +5 -0
  24. data/test/dummy/app/views/pages/show.html.erb +19 -0
  25. data/test/dummy/bin/rails +1 -1
  26. data/test/dummy/bin/setup +8 -4
  27. data/test/dummy/bin/update +4 -4
  28. data/test/dummy/bin/yarn +11 -0
  29. data/test/dummy/config.ru +2 -1
  30. data/test/dummy/config/application.rb +4 -9
  31. data/test/dummy/config/boot.rb +2 -2
  32. data/test/dummy/config/cable.yml +10 -0
  33. data/test/dummy/config/database.yml +15 -8
  34. data/test/dummy/config/environment.rb +1 -1
  35. data/test/dummy/config/environments/development.rb +14 -11
  36. data/test/dummy/config/environments/production.rb +23 -10
  37. data/test/dummy/config/environments/test.rb +4 -6
  38. data/test/dummy/config/initializers/application_controller_renderer.rb +8 -6
  39. data/test/dummy/config/initializers/assets.rb +6 -3
  40. data/test/dummy/config/initializers/cookies_serializer.rb +2 -0
  41. data/test/dummy/config/locales/en.yml +10 -0
  42. data/test/dummy/config/puma.rb +56 -0
  43. data/test/dummy/config/routes.rb +2 -0
  44. data/test/dummy/config/secrets.yml +1 -5
  45. data/test/dummy/config/spring.rb +6 -0
  46. data/test/dummy/db/migrate/20171116134443_create_pages.rb +11 -0
  47. data/test/dummy/db/schema.rb +23 -0
  48. data/test/dummy/package.json +5 -0
  49. data/test/dummy/public/404.html +6 -6
  50. data/test/dummy/public/422.html +6 -6
  51. data/test/dummy/public/500.html +6 -6
  52. data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
  53. data/test/dummy/public/apple-touch-icon.png +0 -0
  54. data/test/dummy/test/application_system_test_case.rb +5 -0
  55. data/test/dummy/test/controllers/pages_controller_test.rb +48 -0
  56. data/test/dummy/test/fixtures/pages.yml +11 -0
  57. data/test/dummy/test/models/page_test.rb +7 -0
  58. data/test/dummy/test/system/pages_test.rb +9 -0
  59. metadata +82 -38
  60. data/test/dummy/README.md +0 -24
  61. data/test/dummy/config/initializers/active_record_belongs_to_required_by_default.rb +0 -4
  62. data/test/dummy/config/initializers/callback_terminator.rb +0 -4
  63. data/test/dummy/config/initializers/cors.rb +0 -14
  64. data/test/dummy/config/initializers/session_store.rb +0 -3
  65. data/test/dummy/log/test.log +0 -8
@@ -10,22 +10,27 @@ Rails.application.configure do
10
10
  config.eager_load = false
11
11
 
12
12
  # Show full error reports.
13
- config.consider_all_requests_local = true
13
+ config.consider_all_requests_local = true
14
14
 
15
15
  # Enable/disable caching. By default caching is disabled.
16
16
  if Rails.root.join('tmp/caching-dev.txt').exist?
17
17
  config.action_controller.perform_caching = true
18
- config.static_cache_control = "public, max-age=172800"
18
+
19
19
  config.cache_store = :memory_store
20
+ config.public_file_server.headers = {
21
+ 'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}"
22
+ }
20
23
  else
21
24
  config.action_controller.perform_caching = false
25
+
22
26
  config.cache_store = :null_store
23
27
  end
24
28
 
25
-
26
29
  # Don't care if the mailer can't send.
27
30
  config.action_mailer.raise_delivery_errors = false
28
31
 
32
+ config.action_mailer.perform_caching = false
33
+
29
34
  # Print deprecation notices to the Rails logger.
30
35
  config.active_support.deprecation = :log
31
36
 
@@ -37,15 +42,13 @@ Rails.application.configure do
37
42
  # number of complex assets.
38
43
  config.assets.debug = true
39
44
 
40
- # Asset digests allow you to set far-future HTTP expiration dates on all assets,
41
- # yet still be able to expire them through the digest params.
42
- config.assets.digest = true
43
-
44
- # Adds additional error checking when serving assets at runtime.
45
- # Checks for improperly declared sprockets dependencies.
46
- # Raises helpful error messages.
47
- config.assets.raise_runtime_errors = true
45
+ # Suppress logger output for asset requests.
46
+ config.assets.quiet = true
48
47
 
49
48
  # Raises error for missing translations
50
49
  # config.action_view.raise_on_missing_translations = true
50
+
51
+ # Use an evented file watcher to asynchronously detect changes in source code,
52
+ # routes, locales, etc. This feature depends on the listen gem.
53
+ # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
51
54
  end
@@ -14,9 +14,14 @@ Rails.application.configure do
14
14
  config.consider_all_requests_local = false
15
15
  config.action_controller.perform_caching = true
16
16
 
17
+ # Attempt to read encrypted secrets from `config/secrets.yml.enc`.
18
+ # Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or
19
+ # `config/secrets.yml.key`.
20
+ config.read_encrypted_secrets = true
21
+
17
22
  # Disable serving static files from the `/public` folder by default since
18
23
  # Apache or NGINX already handles this.
19
- config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
24
+ config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
20
25
 
21
26
  # Compress JavaScripts and CSS.
22
27
  config.assets.js_compressor = :uglifier
@@ -25,10 +30,6 @@ Rails.application.configure do
25
30
  # Do not fallback to assets pipeline if a precompiled asset is missed.
26
31
  config.assets.compile = false
27
32
 
28
- # Asset digests allow you to set far-future HTTP expiration dates on all assets,
29
- # yet still be able to expire them through the digest params.
30
- config.assets.digest = true
31
-
32
33
  # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
33
34
 
34
35
  # Enable serving of images, stylesheets, and JavaScripts from an asset server.
@@ -38,6 +39,11 @@ Rails.application.configure do
38
39
  # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
39
40
  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
40
41
 
42
+ # Mount Action Cable outside main process or domain
43
+ # config.action_cable.mount_path = nil
44
+ # config.action_cable.url = 'wss://example.com/cable'
45
+ # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
46
+
41
47
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
42
48
  # config.force_ssl = true
43
49
 
@@ -46,11 +52,7 @@ Rails.application.configure do
46
52
  config.log_level = :debug
47
53
 
48
54
  # Prepend all log lines with the following tags.
49
- # config.log_tags = [ :subdomain, :request_id ]
50
-
51
- # Use a different logger for distributed setups.
52
- # require 'syslog/logger'
53
- # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
55
+ config.log_tags = [ :request_id ]
54
56
 
55
57
  # Use a different cache store in production.
56
58
  # config.cache_store = :mem_cache_store
@@ -58,6 +60,7 @@ Rails.application.configure do
58
60
  # Use a real queuing backend for Active Job (and separate queues per environment)
59
61
  # config.active_job.queue_adapter = :resque
60
62
  # config.active_job.queue_name_prefix = "dummy_#{Rails.env}"
63
+ config.action_mailer.perform_caching = false
61
64
 
62
65
  # Ignore bad email addresses and do not raise email delivery errors.
63
66
  # Set this to true and configure the email server for immediate delivery to raise delivery errors.
@@ -73,6 +76,16 @@ Rails.application.configure do
73
76
  # Use default logging formatter so that PID and timestamp are not suppressed.
74
77
  config.log_formatter = ::Logger::Formatter.new
75
78
 
79
+ # Use a different logger for distributed setups.
80
+ # require 'syslog/logger'
81
+ # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
82
+
83
+ if ENV["RAILS_LOG_TO_STDOUT"].present?
84
+ logger = ActiveSupport::Logger.new(STDOUT)
85
+ logger.formatter = config.log_formatter
86
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
87
+ end
88
+
76
89
  # Do not dump schema after migrations.
77
90
  config.active_record.dump_schema_after_migration = false
78
91
  end
@@ -12,10 +12,10 @@ Rails.application.configure do
12
12
  # preloads Rails for running tests, you may have to set it to true.
13
13
  config.eager_load = false
14
14
 
15
- # Configure static file server for tests with Cache-Control for performance.
16
- config.serve_static_files = true
15
+ # Configure public file server for tests with Cache-Control for performance.
16
+ config.public_file_server.enabled = true
17
17
  config.public_file_server.headers = {
18
- 'Cache-Control' => 'public, max-age=3600'
18
+ 'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}"
19
19
  }
20
20
 
21
21
  # Show full error reports and disable caching.
@@ -27,15 +27,13 @@ Rails.application.configure do
27
27
 
28
28
  # Disable request forgery protection in test environment.
29
29
  config.action_controller.allow_forgery_protection = false
30
+ config.action_mailer.perform_caching = false
30
31
 
31
32
  # Tell Action Mailer not to deliver emails to the real world.
32
33
  # The :test delivery method accumulates sent emails in the
33
34
  # ActionMailer::Base.deliveries array.
34
35
  config.action_mailer.delivery_method = :test
35
36
 
36
- # Randomize the order test cases are executed.
37
- config.active_support.test_order = :random
38
-
39
37
  # Print deprecation notices to the stderr.
40
38
  config.active_support.deprecation = :stderr
41
39
 
@@ -1,6 +1,8 @@
1
- ## Change renderer defaults here.
2
- #
3
- # ApplicationController.renderer.defaults.merge!(
4
- # http_host: 'example.org',
5
- # https: false
6
- # )
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # ActiveSupport::Reloader.to_prepare do
4
+ # ApplicationController.renderer.defaults.merge!(
5
+ # http_host: 'example.org',
6
+ # https: false
7
+ # )
8
+ # end
@@ -3,9 +3,12 @@
3
3
  # Version of your assets, change this if you want to expire all your assets.
4
4
  Rails.application.config.assets.version = '1.0'
5
5
 
6
- # Add additional assets to the asset load path
6
+ # Add additional assets to the asset load path.
7
7
  # Rails.application.config.assets.paths << Emoji.images_path
8
+ # Add Yarn node_modules folder to the asset load path.
9
+ Rails.application.config.assets.paths << Rails.root.join('node_modules')
8
10
 
9
11
  # Precompile additional assets.
10
- # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
11
- # Rails.application.config.assets.precompile += %w( search.js )
12
+ # application.js, application.css, and all non-JS/CSS in the app/assets
13
+ # folder are already added.
14
+ # Rails.application.config.assets.precompile += %w( admin.js admin.css )
@@ -1,3 +1,5 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
+ # Specify a serializer for the signed and encrypted cookie jars.
4
+ # Valid options are :json, :marshal, and :hybrid.
3
5
  Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -16,6 +16,16 @@
16
16
  #
17
17
  # This would use the information in config/locales/es.yml.
18
18
  #
19
+ # The following keys must be escaped otherwise they will not be retrieved by
20
+ # the default I18n backend:
21
+ #
22
+ # true, false, on, off, yes, no
23
+ #
24
+ # Instead, surround them with single quotes.
25
+ #
26
+ # en:
27
+ # 'true': 'foo'
28
+ #
19
29
  # To learn more, please read the Rails Internationalization guide
20
30
  # available at http://guides.rubyonrails.org/i18n.html.
21
31
 
@@ -0,0 +1,56 @@
1
+ # Puma can serve each request in a thread from an internal thread pool.
2
+ # The `threads` method setting takes two numbers: a minimum and maximum.
3
+ # Any libraries that use thread pools should be configured to match
4
+ # the maximum value specified for Puma. Default is set to 5 threads for minimum
5
+ # and maximum; this matches the default thread size of Active Record.
6
+ #
7
+ threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
8
+ threads threads_count, threads_count
9
+
10
+ # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
11
+ #
12
+ port ENV.fetch("PORT") { 3000 }
13
+
14
+ # Specifies the `environment` that Puma will run in.
15
+ #
16
+ environment ENV.fetch("RAILS_ENV") { "development" }
17
+
18
+ # Specifies the number of `workers` to boot in clustered mode.
19
+ # Workers are forked webserver processes. If using threads and workers together
20
+ # the concurrency of the application would be max `threads` * `workers`.
21
+ # Workers do not work on JRuby or Windows (both of which do not support
22
+ # processes).
23
+ #
24
+ # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
25
+
26
+ # Use the `preload_app!` method when specifying a `workers` number.
27
+ # This directive tells Puma to first boot the application and load code
28
+ # before forking the application. This takes advantage of Copy On Write
29
+ # process behavior so workers use less memory. If you use this option
30
+ # you need to make sure to reconnect any threads in the `on_worker_boot`
31
+ # block.
32
+ #
33
+ # preload_app!
34
+
35
+ # If you are preloading your application and using Active Record, it's
36
+ # recommended that you close any connections to the database before workers
37
+ # are forked to prevent connection leakage.
38
+ #
39
+ # before_fork do
40
+ # ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
41
+ # end
42
+
43
+ # The code in the `on_worker_boot` will be called if you are using
44
+ # clustered mode by specifying a number of `workers`. After each worker
45
+ # process is booted, this block will be run. If you are using the `preload_app!`
46
+ # option, you will want to use this block to reconnect to any threads
47
+ # or connections that may have been created at application boot, as Ruby
48
+ # cannot share connections between processes.
49
+ #
50
+ # on_worker_boot do
51
+ # ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
52
+ # end
53
+ #
54
+
55
+ # Allow puma to be restarted by `rails restart` command.
56
+ plugin :tmp_restart
@@ -1,3 +1,5 @@
1
1
  Rails.application.routes.draw do
2
+ resources :pages
3
+ root :to => "pages#index"
2
4
  # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
3
5
  end
@@ -1,5 +1,5 @@
1
1
  default: &default
2
- secret_key_base: 1990a148935d067cc1bc4571e1184fced31163f1c44add3cc175e68119e7cf8ba9a333f156383d89f01e75a28e40fcd256aad4b8c6ba93b467af963e72459519
2
+ secret_key_base: 8f79ea23abbd37386b20fb148a0be008cf4273eb461845e1d3ab17fba1d58e9a12c2659738b924272d76674639db69f3e452bba2a3372f539a1d78b0244d9c54
3
3
 
4
4
  database:
5
5
  user: <%= ENV["DUMMY_SQL_USER"] %>
@@ -10,7 +10,3 @@ development:
10
10
 
11
11
  test:
12
12
  <<: *default
13
-
14
- production:
15
- <<: *default
16
- secret_key_base: <%= ENV["DUMMY_SECRET_KEY_BASE"] %>
@@ -0,0 +1,6 @@
1
+ %w(
2
+ .ruby-version
3
+ .rbenv-vars
4
+ tmp/restart.txt
5
+ tmp/caching-dev.txt
6
+ ).each { |path| Spring.watch(path) }
@@ -0,0 +1,11 @@
1
+ class CreatePages < ActiveRecord::Migration[5.1]
2
+ def change
3
+ create_table :pages do |t|
4
+ t.string :header
5
+ t.string :title
6
+ t.text :page
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,23 @@
1
+ # This file is auto-generated from the current state of the database. Instead
2
+ # of editing this file, please use the migrations feature of Active Record to
3
+ # incrementally modify your database, and then regenerate this schema definition.
4
+ #
5
+ # Note that this schema.rb definition is the authoritative source for your
6
+ # database schema. If you need to create the application database on another
7
+ # system, you should be using db:schema:load, not running all the migrations
8
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
10
+ #
11
+ # It's strongly recommended that you check this file into your version control system.
12
+
13
+ ActiveRecord::Schema.define(version: 20171116134443) do
14
+
15
+ create_table "pages", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t|
16
+ t.string "header"
17
+ t.string "title"
18
+ t.text "page"
19
+ t.datetime "created_at", null: false
20
+ t.datetime "updated_at", null: false
21
+ end
22
+
23
+ end
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "dummy",
3
+ "private": true,
4
+ "dependencies": {}
5
+ }
@@ -4,7 +4,7 @@
4
4
  <title>The page you were looking for doesn't exist (404)</title>
5
5
  <meta name="viewport" content="width=device-width,initial-scale=1">
6
6
  <style>
7
- body {
7
+ .rails-default-error-page {
8
8
  background-color: #EFEFEF;
9
9
  color: #2E2F30;
10
10
  text-align: center;
@@ -12,13 +12,13 @@
12
12
  margin: 0;
13
13
  }
14
14
 
15
- div.dialog {
15
+ .rails-default-error-page div.dialog {
16
16
  width: 95%;
17
17
  max-width: 33em;
18
18
  margin: 4em auto 0;
19
19
  }
20
20
 
21
- div.dialog > div {
21
+ .rails-default-error-page div.dialog > div {
22
22
  border: 1px solid #CCC;
23
23
  border-right-color: #999;
24
24
  border-left-color: #999;
@@ -31,13 +31,13 @@
31
31
  box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
32
  }
33
33
 
34
- h1 {
34
+ .rails-default-error-page h1 {
35
35
  font-size: 100%;
36
36
  color: #730E15;
37
37
  line-height: 1.5em;
38
38
  }
39
39
 
40
- div.dialog > p {
40
+ .rails-default-error-page div.dialog > p {
41
41
  margin: 0 0 1em;
42
42
  padding: 1em;
43
43
  background-color: #F7F7F7;
@@ -54,7 +54,7 @@
54
54
  </style>
55
55
  </head>
56
56
 
57
- <body>
57
+ <body class="rails-default-error-page">
58
58
  <!-- This file lives in public/404.html -->
59
59
  <div class="dialog">
60
60
  <div>
@@ -4,7 +4,7 @@
4
4
  <title>The change you wanted was rejected (422)</title>
5
5
  <meta name="viewport" content="width=device-width,initial-scale=1">
6
6
  <style>
7
- body {
7
+ .rails-default-error-page {
8
8
  background-color: #EFEFEF;
9
9
  color: #2E2F30;
10
10
  text-align: center;
@@ -12,13 +12,13 @@
12
12
  margin: 0;
13
13
  }
14
14
 
15
- div.dialog {
15
+ .rails-default-error-page div.dialog {
16
16
  width: 95%;
17
17
  max-width: 33em;
18
18
  margin: 4em auto 0;
19
19
  }
20
20
 
21
- div.dialog > div {
21
+ .rails-default-error-page div.dialog > div {
22
22
  border: 1px solid #CCC;
23
23
  border-right-color: #999;
24
24
  border-left-color: #999;
@@ -31,13 +31,13 @@
31
31
  box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
32
  }
33
33
 
34
- h1 {
34
+ .rails-default-error-page h1 {
35
35
  font-size: 100%;
36
36
  color: #730E15;
37
37
  line-height: 1.5em;
38
38
  }
39
39
 
40
- div.dialog > p {
40
+ .rails-default-error-page div.dialog > p {
41
41
  margin: 0 0 1em;
42
42
  padding: 1em;
43
43
  background-color: #F7F7F7;
@@ -54,7 +54,7 @@
54
54
  </style>
55
55
  </head>
56
56
 
57
- <body>
57
+ <body class="rails-default-error-page">
58
58
  <!-- This file lives in public/422.html -->
59
59
  <div class="dialog">
60
60
  <div>
@@ -4,7 +4,7 @@
4
4
  <title>We're sorry, but something went wrong (500)</title>
5
5
  <meta name="viewport" content="width=device-width,initial-scale=1">
6
6
  <style>
7
- body {
7
+ .rails-default-error-page {
8
8
  background-color: #EFEFEF;
9
9
  color: #2E2F30;
10
10
  text-align: center;
@@ -12,13 +12,13 @@
12
12
  margin: 0;
13
13
  }
14
14
 
15
- div.dialog {
15
+ .rails-default-error-page div.dialog {
16
16
  width: 95%;
17
17
  max-width: 33em;
18
18
  margin: 4em auto 0;
19
19
  }
20
20
 
21
- div.dialog > div {
21
+ .rails-default-error-page div.dialog > div {
22
22
  border: 1px solid #CCC;
23
23
  border-right-color: #999;
24
24
  border-left-color: #999;
@@ -31,13 +31,13 @@
31
31
  box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
32
  }
33
33
 
34
- h1 {
34
+ .rails-default-error-page h1 {
35
35
  font-size: 100%;
36
36
  color: #730E15;
37
37
  line-height: 1.5em;
38
38
  }
39
39
 
40
- div.dialog > p {
40
+ .rails-default-error-page div.dialog > p {
41
41
  margin: 0 0 1em;
42
42
  padding: 1em;
43
43
  background-color: #F7F7F7;
@@ -54,7 +54,7 @@
54
54
  </style>
55
55
  </head>
56
56
 
57
- <body>
57
+ <body class="rails-default-error-page">
58
58
  <!-- This file lives in public/500.html -->
59
59
  <div class="dialog">
60
60
  <div>