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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/trix-core.js +8 -8
- data/app/assets/javascripts/trix.js +10 -14
- data/app/assets/stylesheets/trix.css +268 -177
- data/lib/trix_on_rails/version.rb +1 -1
- data/test/dummy/Rakefile +1 -1
- data/test/dummy/app/assets/javascripts/application.js +2 -1
- data/test/dummy/app/assets/javascripts/cable.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +1 -0
- data/test/dummy/app/channels/application_cable/channel.rb +4 -0
- data/test/dummy/app/channels/application_cable/connection.rb +4 -0
- data/test/dummy/app/controllers/application_controller.rb +0 -2
- data/test/dummy/app/controllers/pages_controller.rb +58 -0
- data/test/dummy/app/mailers/application_mailer.rb +4 -0
- data/test/dummy/app/models/application_record.rb +3 -0
- data/test/dummy/app/models/page.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +9 -9
- data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/test/dummy/app/views/pages/_form.html.erb +34 -0
- data/test/dummy/app/views/pages/edit.html.erb +6 -0
- data/test/dummy/app/views/pages/index.html.erb +31 -0
- data/test/dummy/app/views/pages/new.html.erb +5 -0
- data/test/dummy/app/views/pages/show.html.erb +19 -0
- data/test/dummy/bin/rails +1 -1
- data/test/dummy/bin/setup +8 -4
- data/test/dummy/bin/update +4 -4
- data/test/dummy/bin/yarn +11 -0
- data/test/dummy/config.ru +2 -1
- data/test/dummy/config/application.rb +4 -9
- data/test/dummy/config/boot.rb +2 -2
- data/test/dummy/config/cable.yml +10 -0
- data/test/dummy/config/database.yml +15 -8
- data/test/dummy/config/environment.rb +1 -1
- data/test/dummy/config/environments/development.rb +14 -11
- data/test/dummy/config/environments/production.rb +23 -10
- data/test/dummy/config/environments/test.rb +4 -6
- data/test/dummy/config/initializers/application_controller_renderer.rb +8 -6
- data/test/dummy/config/initializers/assets.rb +6 -3
- data/test/dummy/config/initializers/cookies_serializer.rb +2 -0
- data/test/dummy/config/locales/en.yml +10 -0
- data/test/dummy/config/puma.rb +56 -0
- data/test/dummy/config/routes.rb +2 -0
- data/test/dummy/config/secrets.yml +1 -5
- data/test/dummy/config/spring.rb +6 -0
- data/test/dummy/db/migrate/20171116134443_create_pages.rb +11 -0
- data/test/dummy/db/schema.rb +23 -0
- data/test/dummy/package.json +5 -0
- data/test/dummy/public/404.html +6 -6
- data/test/dummy/public/422.html +6 -6
- data/test/dummy/public/500.html +6 -6
- data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/test/dummy/public/apple-touch-icon.png +0 -0
- data/test/dummy/test/application_system_test_case.rb +5 -0
- data/test/dummy/test/controllers/pages_controller_test.rb +48 -0
- data/test/dummy/test/fixtures/pages.yml +11 -0
- data/test/dummy/test/models/page_test.rb +7 -0
- data/test/dummy/test/system/pages_test.rb +9 -0
- metadata +82 -38
- data/test/dummy/README.md +0 -24
- data/test/dummy/config/initializers/active_record_belongs_to_required_by_default.rb +0 -4
- data/test/dummy/config/initializers/callback_terminator.rb +0 -4
- data/test/dummy/config/initializers/cors.rb +0 -14
- data/test/dummy/config/initializers/session_store.rb +0 -3
- data/test/dummy/log/test.log +0 -8
data/test/dummy/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
2
|
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
3
|
|
4
|
-
|
4
|
+
require_relative 'config/application'
|
5
5
|
|
6
6
|
Rails.application.load_tasks
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// Action Cable provides the framework to deal with WebSockets in Rails.
|
2
|
+
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
|
3
|
+
//
|
4
|
+
//= require action_cable
|
5
|
+
//= require_self
|
6
|
+
//= require_tree ./channels
|
7
|
+
|
8
|
+
(function() {
|
9
|
+
this.App || (this.App = {});
|
10
|
+
|
11
|
+
App.cable = ActionCable.createConsumer();
|
12
|
+
|
13
|
+
}).call(this);
|
@@ -0,0 +1,58 @@
|
|
1
|
+
class PagesController < ApplicationController
|
2
|
+
before_action :set_page, only: [:show, :edit, :update, :destroy]
|
3
|
+
|
4
|
+
# GET /pages
|
5
|
+
def index
|
6
|
+
@pages = Page.all
|
7
|
+
end
|
8
|
+
|
9
|
+
# GET /pages/1
|
10
|
+
def show
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /pages/new
|
14
|
+
def new
|
15
|
+
@page = Page.new
|
16
|
+
end
|
17
|
+
|
18
|
+
# GET /pages/1/edit
|
19
|
+
def edit
|
20
|
+
end
|
21
|
+
|
22
|
+
# POST /pages
|
23
|
+
def create
|
24
|
+
@page = Page.new(page_params)
|
25
|
+
|
26
|
+
if @page.save
|
27
|
+
redirect_to @page, notice: 'Page was successfully created.'
|
28
|
+
else
|
29
|
+
render :new
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# PATCH/PUT /pages/1
|
34
|
+
def update
|
35
|
+
if @page.update(page_params)
|
36
|
+
redirect_to @page, notice: 'Page was successfully updated.'
|
37
|
+
else
|
38
|
+
render :edit
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# DELETE /pages/1
|
43
|
+
def destroy
|
44
|
+
@page.destroy
|
45
|
+
redirect_to pages_url, notice: 'Page was successfully destroyed.'
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
# Use callbacks to share common setup or constraints between actions.
|
50
|
+
def set_page
|
51
|
+
@page = Page.find(params[:id])
|
52
|
+
end
|
53
|
+
|
54
|
+
# Only allow a trusted parameter "white list" through.
|
55
|
+
def page_params
|
56
|
+
params.require(:page).permit(:header, :title, :page)
|
57
|
+
end
|
58
|
+
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
|
-
<head>
|
4
|
-
|
5
|
-
|
6
|
-
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
7
|
-
<%= csrf_meta_tags %>
|
8
|
-
</head>
|
9
|
-
<body>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= csrf_meta_tags %>
|
10
6
|
|
11
|
-
<%=
|
7
|
+
<%= stylesheet_link_tag 'application', media: 'all' %>
|
8
|
+
<%= javascript_include_tag 'application' %>
|
9
|
+
</head>
|
12
10
|
|
13
|
-
|
11
|
+
<body>
|
12
|
+
<%= yield %>
|
13
|
+
</body>
|
14
14
|
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<%= form_with(model: page, local: true) do |form| %>
|
2
|
+
<% if page.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%= pluralize(page.errors.count, "error") %> prohibited this page from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% page.errors.full_messages.each do |message| %>
|
8
|
+
<li><%= message %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= form.label :header %>
|
16
|
+
<%= form.text_field :header, id: :page_header %>
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<div class="field">
|
20
|
+
<%= form.label :title %>
|
21
|
+
<%= form.text_field :title, id: :page_title %>
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<div class="field">
|
25
|
+
<%= form.label :page %>
|
26
|
+
<%= form.text_area :page, id: :page_page %>
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<div class="actions">
|
30
|
+
<%= form.submit %>
|
31
|
+
</div>
|
32
|
+
<% end %>
|
33
|
+
|
34
|
+
<trix-editor></trix-editor>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<h1>Pages</h1>
|
4
|
+
|
5
|
+
<table>
|
6
|
+
<thead>
|
7
|
+
<tr>
|
8
|
+
<th>Header</th>
|
9
|
+
<th>Title</th>
|
10
|
+
<th>Page</th>
|
11
|
+
<th colspan="3"></th>
|
12
|
+
</tr>
|
13
|
+
</thead>
|
14
|
+
|
15
|
+
<tbody>
|
16
|
+
<% @pages.each do |page| %>
|
17
|
+
<tr>
|
18
|
+
<td><%= page.header %></td>
|
19
|
+
<td><%= page.title %></td>
|
20
|
+
<td><%= page.page %></td>
|
21
|
+
<td><%= link_to 'Show', page %></td>
|
22
|
+
<td><%= link_to 'Edit', edit_page_path(page) %></td>
|
23
|
+
<td><%= link_to 'Destroy', page, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
24
|
+
</tr>
|
25
|
+
<% end %>
|
26
|
+
</tbody>
|
27
|
+
</table>
|
28
|
+
|
29
|
+
<br>
|
30
|
+
|
31
|
+
<%= link_to 'New Page', new_page_path %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
<strong>Header:</strong>
|
5
|
+
<%= @page.header %>
|
6
|
+
</p>
|
7
|
+
|
8
|
+
<p>
|
9
|
+
<strong>Title:</strong>
|
10
|
+
<%= @page.title %>
|
11
|
+
</p>
|
12
|
+
|
13
|
+
<p>
|
14
|
+
<strong>Page:</strong>
|
15
|
+
<%= @page.page %>
|
16
|
+
</p>
|
17
|
+
|
18
|
+
<%= link_to 'Edit', edit_page_path(@page) %> |
|
19
|
+
<%= link_to 'Back', pages_path %>
|
data/test/dummy/bin/rails
CHANGED
data/test/dummy/bin/setup
CHANGED
@@ -16,7 +16,11 @@ chdir APP_ROOT do
|
|
16
16
|
|
17
17
|
puts '== Installing dependencies =='
|
18
18
|
system! 'gem install bundler --conservative'
|
19
|
-
system('bundle check')
|
19
|
+
system('bundle check') || system!('bundle install')
|
20
|
+
|
21
|
+
# Install JavaScript dependencies if using Yarn
|
22
|
+
# system('bin/yarn')
|
23
|
+
|
20
24
|
|
21
25
|
# puts "\n== Copying sample files =="
|
22
26
|
# unless File.exist?('config/database.yml')
|
@@ -24,11 +28,11 @@ chdir APP_ROOT do
|
|
24
28
|
# end
|
25
29
|
|
26
30
|
puts "\n== Preparing database =="
|
27
|
-
system! '
|
31
|
+
system! 'bin/rails db:setup'
|
28
32
|
|
29
33
|
puts "\n== Removing old logs and tempfiles =="
|
30
|
-
system! '
|
34
|
+
system! 'bin/rails log:clear tmp:clear'
|
31
35
|
|
32
36
|
puts "\n== Restarting application server =="
|
33
|
-
system! '
|
37
|
+
system! 'bin/rails restart'
|
34
38
|
end
|
data/test/dummy/bin/update
CHANGED
@@ -16,14 +16,14 @@ chdir APP_ROOT do
|
|
16
16
|
|
17
17
|
puts '== Installing dependencies =='
|
18
18
|
system! 'gem install bundler --conservative'
|
19
|
-
system
|
19
|
+
system('bundle check') || system!('bundle install')
|
20
20
|
|
21
21
|
puts "\n== Updating database =="
|
22
|
-
system! 'bin/
|
22
|
+
system! 'bin/rails db:migrate'
|
23
23
|
|
24
24
|
puts "\n== Removing old logs and tempfiles =="
|
25
|
-
system! 'bin/
|
25
|
+
system! 'bin/rails log:clear tmp:clear'
|
26
26
|
|
27
27
|
puts "\n== Restarting application server =="
|
28
|
-
system! 'bin/
|
28
|
+
system! 'bin/rails restart'
|
29
29
|
end
|
data/test/dummy/bin/yarn
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
VENDOR_PATH = File.expand_path('..', __dir__)
|
3
|
+
Dir.chdir(VENDOR_PATH) do
|
4
|
+
begin
|
5
|
+
exec "yarnpkg #{ARGV.join(" ")}"
|
6
|
+
rescue Errno::ENOENT
|
7
|
+
$stderr.puts "Yarn executable was not detected in the system."
|
8
|
+
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
|
9
|
+
exit 1
|
10
|
+
end
|
11
|
+
end
|
data/test/dummy/config.ru
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require_relative 'boot'
|
2
2
|
|
3
3
|
require 'rails/all'
|
4
4
|
|
@@ -7,17 +7,12 @@ require "trix_on_rails"
|
|
7
7
|
|
8
8
|
module Dummy
|
9
9
|
class Application < Rails::Application
|
10
|
+
# Initialize configuration defaults for originally generated Rails version.
|
11
|
+
config.load_defaults 5.1
|
12
|
+
|
10
13
|
# Settings in config/environments/* take precedence over those specified here.
|
11
14
|
# Application configuration should go into files in config/initializers
|
12
15
|
# -- all .rb files in that directory are automatically loaded.
|
13
|
-
|
14
|
-
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
15
|
-
# Run "rake time:zones:all" for a time zone names list. Default is UTC.
|
16
|
-
# config.time_zone = 'Central Time (US & Canada)'
|
17
|
-
|
18
|
-
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
19
|
-
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
20
|
-
# config.i18n.default_locale = :de
|
21
16
|
end
|
22
17
|
end
|
23
18
|
|
data/test/dummy/config/boot.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Set up gems listed in the Gemfile.
|
2
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('
|
2
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
|
3
3
|
|
4
4
|
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
5
|
-
$LOAD_PATH.unshift File.expand_path('
|
5
|
+
$LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
|
@@ -1,9 +1,20 @@
|
|
1
|
+
# MySQL. Versions 5.1.10 and up are supported.
|
2
|
+
#
|
3
|
+
# Install the MySQL driver
|
4
|
+
# gem install mysql2
|
5
|
+
#
|
6
|
+
# Ensure the MySQL gem is defined in your Gemfile
|
7
|
+
# gem 'mysql2'
|
8
|
+
#
|
9
|
+
# And be sure to use new-style password hashing:
|
10
|
+
# http://dev.mysql.com/doc/refman/5.7/en/old-client.html
|
11
|
+
#
|
1
12
|
default: &default
|
2
13
|
adapter: mysql2
|
3
14
|
encoding: utf8
|
4
|
-
pool: 5
|
5
|
-
username: <%=Rails.application.secrets.database[
|
6
|
-
password: <%=Rails.application.secrets.database[
|
15
|
+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
16
|
+
username: <%=Rails.application.secrets.database[:user]%>
|
17
|
+
password: <%=Rails.application.secrets.database[:password]%>
|
7
18
|
socket: /tmp/mysql.sock
|
8
19
|
|
9
20
|
development:
|
@@ -12,8 +23,4 @@ development:
|
|
12
23
|
|
13
24
|
test:
|
14
25
|
<<: *default
|
15
|
-
database: dummy_test
|
16
|
-
|
17
|
-
production:
|
18
|
-
<<: *default
|
19
|
-
database: dummy_production
|
26
|
+
database: dummy_test
|