refinerycms-core 4.0.3 → 4.1.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/config/refinery_core_manifest.js +9 -1
- data/app/assets/images/refinery/logo-large.png +0 -0
- data/app/assets/images/refinery/logo-medium.png +0 -0
- data/app/assets/images/refinery/logo-site-bar.png +0 -0
- data/app/assets/images/refinery/logo-small-medium.png +0 -0
- data/app/assets/images/refinery/logo-small.png +0 -0
- data/app/assets/images/refinery/logo-tiny.png +0 -0
- data/app/assets/images/refinery/logo.png +0 -0
- data/app/assets/images/refinery/refinery-cms-logo.svg +1 -558
- data/app/assets/javascripts/refinery/admin.js.erb +37 -21
- data/app/assets/javascripts/refinery/ajaxy_pagination.js +16 -0
- data/app/assets/javascripts/refinery/image_crop.js +101 -0
- data/app/assets/javascripts/refinery/interface.js.erb +42 -0
- data/app/assets/javascripts/refinery/refinery.js.erb +3 -3
- data/app/assets/javascripts/refinery/submit_continue.js.erb +23 -0
- data/app/assets/stylesheets/refinery/components/_file_type_icons.scss +36 -0
- data/app/assets/stylesheets/refinery/components/_icons.scss +89 -47
- data/app/assets/stylesheets/refinery/global/_colours.scss +12 -5
- data/app/assets/stylesheets/refinery/mixins/_images.scss +99 -0
- data/app/assets/stylesheets/refinery/mixins/_locales.scss +22 -0
- data/app/assets/stylesheets/refinery/mixins/_rounded.scss +9 -23
- data/app/assets/stylesheets/refinery/plugins/_ui.scss +7 -4
- data/app/assets/stylesheets/refinery/refinery.scss +4 -1
- data/app/assets/stylesheets/refinery/sections/_layout.scss +490 -265
- data/app/controllers/refinery/admin/dialogs_controller.rb +6 -6
- data/app/helpers/refinery/action_helper.rb +75 -0
- data/app/helpers/refinery/icon_helper.rb +51 -0
- data/app/helpers/refinery/image_helper.rb +1 -1
- data/app/helpers/refinery/pagination_helper.rb +1 -0
- data/app/helpers/refinery/site_bar_helper.rb +10 -7
- data/app/helpers/refinery/tag_helper.rb +5 -36
- data/app/helpers/refinery/translation_helper.rb +12 -1
- data/app/views/refinery/_head.html.erb +1 -0
- data/app/views/refinery/_matomo_analytics.html.erb +18 -0
- data/app/views/refinery/_site_bar.html.erb +9 -9
- data/app/views/refinery/admin/_error_messages.html.erb +4 -4
- data/app/views/refinery/admin/_locale_picker.html.erb +8 -14
- data/config/initializers/assets.rb +5 -1
- data/config/initializers/zeitwerk.rb +12 -0
- data/config/locales/en.yml +3 -1
- data/config/locales/sk.yml +7 -0
- data/lib/generators/refinery/cms/cms_generator.rb +24 -20
- data/lib/generators/refinery/core/templates/config/initializers/refinery/core.rb.erb +5 -0
- data/lib/generators/refinery/dummy/dummy_generator.rb +32 -10
- data/lib/generators/refinery/dummy/templates/rails/application.rb.erb +27 -7
- data/lib/generators/refinery/dummy/templates/rails/boot.rb.erb +1 -2
- data/lib/generators/refinery/dummy/templates/rails/database.yml +55 -14
- data/lib/generators/refinery/dummy/templates/rails/manifest.js +3 -0
- data/lib/generators/refinery/dummy/templates/rails/storage.yml +7 -0
- data/lib/generators/refinery/engine/engine_generator.rb +1 -0
- data/lib/generators/refinery/engine/templates/Gemfile +1 -2
- data/lib/generators/refinery/engine/templates/Rakefile +2 -2
- data/lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/admin/plural_name_controller.rb.erb +1 -1
- data/lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/plural_name_controller.rb.erb +1 -1
- data/lib/generators/refinery/engine/templates/app/models/refinery/namespace/singular_name.rb.erb +1 -0
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_form.html.erb +1 -1
- data/lib/generators/refinery/engine/templates/db/migrate/1_create_namespace_plural_name.rb.erb +15 -4
- data/lib/generators/refinery/engine/templates/lib/generators/refinery/extension_plural_name_generator.rb.erb +1 -1
- data/lib/generators/refinery/engine/templates/lib/refinery/plural_name.rb.erb +1 -1
- data/lib/refinery/admin/base_controller.rb +2 -2
- data/lib/refinery/application_controller.rb +1 -2
- data/lib/refinery/cli.rb +1 -1
- data/lib/refinery/core/configuration.rb +4 -1
- data/lib/refinery/core/engine.rb +20 -0
- data/lib/refinery/core.rb +0 -1
- data/lib/refinery/crud.rb +33 -32
- data/lib/refinery/extension_generation.rb +55 -8
- data/lib/refinery/generators/generated_attribute.rb +13 -0
- data/lib/refinery/plugins.rb +1 -1
- data/lib/refinery/version.rb +4 -4
- data/lib/refinery.rb +9 -2
- data/lib/refinerycms/core.rb +1 -0
- data/lib/tasks/refinery.rake +3 -3
- data/refinerycms-core.gemspec +21 -27
- data/spec/controllers/refinery/sitemap_controller_spec.rb +1 -1
- data/spec/helpers/refinery/tag_helper_spec.rb +1 -1
- data/spec/helpers/refinery/translation_helper_spec.rb +46 -10
- data/spec/lib/generators/refinery/cms/cms_generator_spec.rb +6 -6
- data/spec/lib/generators/refinery/engine/engine_generator_multiple_resources_spec.rb +23 -2
- data/spec/lib/refinery/cli_spec.rb +2 -2
- data/spec/lib/refinery/{users_manager_spec.rb → core/users_manager_spec.rb} +1 -1
- data/spec/lib/refinery/crud_spec.rb +2 -1
- data/spec/presenters/refinery/translated_field_presenter_spec.rb +5 -7
- data/spec/support/refinery.rb +2 -2
- data/spec/{features → system}/refinery/admin/custom_assets_spec.rb +1 -1
- data/spec/system/refinery/admin/dialogs_spec.rb +29 -0
- data/spec/{features → system}/refinery/admin/xhr_paging_spec.rb +10 -7
- data/spec/{features → system}/refinery/application_layout_spec.rb +3 -4
- data/spec/{features → system}/refinery/core_spec.rb +1 -1
- data/spec/{features → system}/refinery/site_bar_spec.rb +5 -3
- data/vendor/assets/javascripts/canvas-to-blob.js +126 -0
- data/vendor/assets/javascripts/cropper.js +3715 -0
- data/vendor/assets/stylesheets/cropper.css +305 -0
- metadata +108 -171
- checksums.yaml.gz.sig +0 -0
- data/app/assets/javascripts/refinery/ajaxy_pagination.js.coffee +0 -10
- data/app/assets/javascripts/refinery/interface.js.coffee.erb +0 -33
- data/app/assets/javascripts/refinery/submit_continue.js.coffee.erb +0 -12
- data/spec/features/refinery/admin/dialogs_spec.rb +0 -29
- data/spec/support/database_cleaner.rb +0 -21
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -5
- /data/lib/generators/refinery/cms/templates/config/{database.yml.mysql → database.mysql.yml} +0 -0
- /data/lib/generators/refinery/cms/templates/config/{database.yml.postgresql → database.postgresql.yml} +0 -0
- /data/lib/generators/refinery/cms/templates/config/{database.yml.sqlite3 → database.sqlite3.yml} +0 -0
- /data/lib/refinery/{users_manager.rb → core/users_manager.rb} +0 -0
|
@@ -13,8 +13,22 @@ module Refinery
|
|
|
13
13
|
paths.flatten
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
+
|
|
16
17
|
PASSTHROUGH_OPTIONS = [
|
|
17
|
-
:
|
|
18
|
+
:database,
|
|
19
|
+
:force,
|
|
20
|
+
:pretend,
|
|
21
|
+
:quiet,
|
|
22
|
+
:skip,
|
|
23
|
+
:skip_action_cable,
|
|
24
|
+
:skip_action_mailbox,
|
|
25
|
+
:skip_action_mailer,
|
|
26
|
+
:skip_action_text,
|
|
27
|
+
:skip_active_job,
|
|
28
|
+
:skip_active_record,
|
|
29
|
+
:skip_active_storage,
|
|
30
|
+
:skip_hotwire,
|
|
31
|
+
:skip_javascript
|
|
18
32
|
]
|
|
19
33
|
|
|
20
34
|
def generate_test_dummy
|
|
@@ -23,7 +37,13 @@ module Refinery
|
|
|
23
37
|
opts[:force] = true
|
|
24
38
|
opts[:skip_bundle] = true
|
|
25
39
|
opts[:skip_action_cable] = true
|
|
40
|
+
opts[:skip_action_mailbox] = true
|
|
26
41
|
opts[:skip_action_mailer] = true
|
|
42
|
+
opts[:skip_action_text] = true
|
|
43
|
+
opts[:skip_active_job] = true
|
|
44
|
+
opts[:skip_active_storage] = true
|
|
45
|
+
opts[:skip_hotwire] = true
|
|
46
|
+
opts[:skip_javascript] = true
|
|
27
47
|
|
|
28
48
|
invoke Rails::Generators::AppGenerator, [ File.expand_path(dummy_path, destination_root) ], opts
|
|
29
49
|
end
|
|
@@ -31,14 +51,16 @@ module Refinery
|
|
|
31
51
|
def test_dummy_config
|
|
32
52
|
@database = options[:database]
|
|
33
53
|
|
|
34
|
-
template "rails/database.yml", "#{dummy_path}/config/database.yml", :
|
|
35
|
-
template "rails/boot.rb.erb", "#{dummy_path}/config/boot.rb", :
|
|
36
|
-
template "rails/application.rb.erb", "#{dummy_path}/config/application.rb", :
|
|
37
|
-
template "rails/routes.rb", "#{dummy_path}/config/routes.rb", :
|
|
38
|
-
template "rails/
|
|
39
|
-
template "rails/
|
|
40
|
-
template
|
|
41
|
-
template
|
|
54
|
+
template "rails/database.yml", "#{dummy_path}/config/database.yml", force: true
|
|
55
|
+
template "rails/boot.rb.erb", "#{dummy_path}/config/boot.rb", force: true
|
|
56
|
+
template "rails/application.rb.erb", "#{dummy_path}/config/application.rb", force: true
|
|
57
|
+
template "rails/routes.rb", "#{dummy_path}/config/routes.rb", force: true
|
|
58
|
+
template "rails/storage.yml", "#{dummy_path}/config/storage.yml", force: true
|
|
59
|
+
template "rails/Rakefile", "#{dummy_path}/Rakefile", force: true
|
|
60
|
+
template "rails/application.js", "#{dummy_path}/app/assets/javascripts/application.js", force: true
|
|
61
|
+
template "rails/manifest.js", "#{dummy_path}/app/assets/config/manifest.js", force: true
|
|
62
|
+
template 'rails/blank.png', "#{dummy_path}/public/apple-touch-icon.png", force: true
|
|
63
|
+
template 'rails/blank.png', "#{dummy_path}/public/apple-touch-icon-precomposed.png", force: true
|
|
42
64
|
end
|
|
43
65
|
|
|
44
66
|
def test_dummy_clean
|
|
@@ -80,7 +102,7 @@ module Refinery
|
|
|
80
102
|
def application_definition
|
|
81
103
|
@application_definition ||= begin
|
|
82
104
|
dummy_application_path = File.expand_path("#{dummy_path}/config/application.rb", destination_root)
|
|
83
|
-
unless options[:pretend] || !File.
|
|
105
|
+
unless options[:pretend] || !File.exist?(dummy_application_path)
|
|
84
106
|
contents = File.read(dummy_application_path)
|
|
85
107
|
contents[(contents.index("module #{module_name}"))..-1]
|
|
86
108
|
end
|
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
require File.expand_path('../boot', __FILE__)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
begin
|
|
4
|
+
require 'rails/all'
|
|
5
|
+
rescue NameError => e
|
|
6
|
+
raise unless e.message.include?("ActiveSupport::LoggerThreadSafeLevel::Logger")
|
|
4
7
|
|
|
5
|
-
require
|
|
8
|
+
require "logger"
|
|
9
|
+
retry
|
|
10
|
+
end
|
|
11
|
+
require 'refinerycms/core'
|
|
6
12
|
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
|
|
10
|
-
Bundler.require *Rails.groups(:assets)
|
|
13
|
+
# Require the gems listed in Gemfile, including any gems
|
|
14
|
+
# you've limited to :test, :development, or :production.
|
|
15
|
+
Bundler.require(*Rails.groups(assets: %w(development test)))
|
|
11
16
|
|
|
12
|
-
|
|
17
|
+
module Dummy
|
|
18
|
+
class Application < Rails::Application
|
|
19
|
+
# Initialize configuration defaults for originally generated Rails version.
|
|
20
|
+
config.load_defaults 6.1
|
|
21
|
+
|
|
22
|
+
# Settings in config/environments/* take precedence over those specified here.
|
|
23
|
+
# Application configuration can go into files in config/initializers
|
|
24
|
+
# -- all .rb files in that directory are automatically loaded after loading
|
|
25
|
+
# the framework and any gems in your application.
|
|
26
|
+
|
|
27
|
+
if config.respond_to?(:assets)
|
|
28
|
+
config.assets.paths << File.expand_path('app/assets/javascripts', __dir__)
|
|
29
|
+
config.assets.paths << File.expand_path('app/assets/stylesheets', __dir__)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -1,34 +1,75 @@
|
|
|
1
|
-
login: &login
|
|
2
1
|
<% if /mysql$/ === @database %>
|
|
2
|
+
development:
|
|
3
3
|
adapter: mysql<%= '2' unless /jdbc/ === @database %>
|
|
4
|
-
encoding:
|
|
4
|
+
encoding: utf8mb4
|
|
5
5
|
reconnect: false
|
|
6
6
|
pool: 5
|
|
7
7
|
username: root
|
|
8
|
-
password:
|
|
9
|
-
|
|
8
|
+
password: <%%= ENV['MYSQL_PASSWORD'] %>
|
|
9
|
+
database: dummy_dev
|
|
10
|
+
|
|
11
|
+
test:
|
|
12
|
+
adapter: mysql<%= '2' unless /jdbc/ === @database %>
|
|
13
|
+
encoding: utf8mb4
|
|
14
|
+
reconnect: false
|
|
15
|
+
pool: 5
|
|
16
|
+
username: root
|
|
17
|
+
password: <%%= ENV['MYSQL_PASSWORD'] %>
|
|
18
|
+
database: dummy_test
|
|
19
|
+
|
|
20
|
+
production:
|
|
21
|
+
adapter: mysql<%= '2' unless /jdbc/ === @database %>
|
|
22
|
+
encoding: utf8mb4
|
|
23
|
+
reconnect: false
|
|
24
|
+
pool: 5
|
|
25
|
+
username: root
|
|
26
|
+
password: <%%= ENV['MYSQL_PASSWORD'] %>
|
|
27
|
+
database: dummy_prod
|
|
28
|
+
|
|
10
29
|
<% elsif /postgresql/ === @database %>
|
|
30
|
+
development:
|
|
11
31
|
adapter: postgresql
|
|
12
32
|
encoding: unicode
|
|
13
|
-
database: refinery_database_development
|
|
14
33
|
pool: 5
|
|
15
|
-
username: postgres
|
|
16
|
-
password: postgres
|
|
34
|
+
username: <%%= ENV.fetch('PGUSER', 'postgres') %>
|
|
35
|
+
password: <%%= ENV.fetch('PGPASSWORD', 'postgres') %>
|
|
17
36
|
min_messages: warning
|
|
37
|
+
database: dummy_dev
|
|
38
|
+
|
|
39
|
+
test:
|
|
40
|
+
adapter: postgresql
|
|
41
|
+
encoding: unicode
|
|
42
|
+
pool: 5
|
|
43
|
+
username: <%%= ENV.fetch('PGUSER', 'postgres') %>
|
|
44
|
+
password: <%%= ENV.fetch('PGPASSWORD', 'postgres') %>
|
|
45
|
+
min_messages: warning
|
|
46
|
+
database: dummy_test
|
|
47
|
+
|
|
48
|
+
production:
|
|
49
|
+
adapter: postgresql
|
|
50
|
+
encoding: unicode
|
|
51
|
+
pool: 5
|
|
52
|
+
username: <%%= ENV.fetch('PGUSER', 'postgres') %>
|
|
53
|
+
password: <%%= ENV.fetch('PGPASSWORD', 'postgres') %>
|
|
54
|
+
min_messages: warning
|
|
55
|
+
database: dummy_prod
|
|
56
|
+
|
|
18
57
|
<% else %>
|
|
58
|
+
development:
|
|
19
59
|
adapter: sqlite3
|
|
20
60
|
pool: 5
|
|
21
61
|
timeout: 5000
|
|
22
|
-
<% end %>
|
|
23
|
-
|
|
24
|
-
development:
|
|
25
|
-
<<: *login
|
|
26
62
|
database: dummy_dev
|
|
27
63
|
|
|
28
64
|
test:
|
|
29
|
-
|
|
65
|
+
adapter: sqlite3
|
|
66
|
+
pool: 5
|
|
67
|
+
timeout: 5000
|
|
30
68
|
database: dummy_test
|
|
31
69
|
|
|
32
70
|
production:
|
|
33
|
-
|
|
34
|
-
|
|
71
|
+
adapter: sqlite3
|
|
72
|
+
pool: 5
|
|
73
|
+
timeout: 5000
|
|
74
|
+
database: dummy_prod
|
|
75
|
+
<% end %>
|
|
@@ -20,7 +20,7 @@ end
|
|
|
20
20
|
|
|
21
21
|
platforms :ruby do
|
|
22
22
|
gem 'sqlite3'
|
|
23
|
-
gem 'mysql2'
|
|
23
|
+
gem 'mysql2', '~> 0.4.10'
|
|
24
24
|
gem 'pg'
|
|
25
25
|
end
|
|
26
26
|
|
|
@@ -38,6 +38,5 @@ end
|
|
|
38
38
|
# in production environments by default.
|
|
39
39
|
group :assets do
|
|
40
40
|
gem 'sass-rails'
|
|
41
|
-
gem 'coffee-rails'
|
|
42
41
|
gem 'uglifier'
|
|
43
42
|
end
|
|
@@ -8,11 +8,11 @@ end
|
|
|
8
8
|
ENGINE_PATH = File.dirname(__FILE__)
|
|
9
9
|
APP_RAKEFILE = File.expand_path "../spec/dummy/Rakefile", __FILE__
|
|
10
10
|
|
|
11
|
-
if File.
|
|
11
|
+
if File.exist? APP_RAKEFILE
|
|
12
12
|
load 'rails/tasks/engine.rake'
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
require "
|
|
15
|
+
require "refinery/testing"
|
|
16
16
|
Refinery::Testing::Railtie.load_dummy_tasks ENGINE_PATH
|
|
17
17
|
|
|
18
18
|
load File.expand_path('../tasks/testing.rake', __FILE__)
|
|
@@ -9,7 +9,7 @@ module Refinery
|
|
|
9
9
|
|
|
10
10
|
private
|
|
11
11
|
|
|
12
|
-
# Only allow a trusted parameter "
|
|
12
|
+
# Only allow a trusted parameter "permit list" through.
|
|
13
13
|
def <%= "#{singular_table_name}_params" %>
|
|
14
14
|
<%- if attributes_names.empty? -%>
|
|
15
15
|
params[:<%= singular_table_name %>]
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
<% if localized? -%>
|
|
11
11
|
<%%= render '/refinery/admin/locale_picker',
|
|
12
|
-
:current_locale =>
|
|
12
|
+
:current_locale => Mobility.locale %>
|
|
13
13
|
<% end -%>
|
|
14
14
|
<% attributes.each_with_index do |attribute, index| -%>
|
|
15
15
|
<% if attribute.refinery_type == :image -%>
|
data/lib/generators/refinery/engine/templates/db/migrate/1_create_namespace_plural_name.rb.erb
CHANGED
|
@@ -2,18 +2,30 @@ class Create<%= namespacing %><%= class_name.pluralize %> < ActiveRecord::Migrat
|
|
|
2
2
|
|
|
3
3
|
def up
|
|
4
4
|
create_table :refinery_<%= "#{namespacing.underscore}_" if table_name != namespacing.underscore.pluralize -%><%= table_name %> do |t|
|
|
5
|
-
<% attributes.each do |attribute| -%>
|
|
5
|
+
<% (attributes - localized_attributes).each do |attribute| -%>
|
|
6
6
|
t.<%= attribute.type %> :<%= attribute.column_name %>
|
|
7
7
|
<% end -%>
|
|
8
8
|
t.integer :position
|
|
9
9
|
|
|
10
10
|
t.timestamps
|
|
11
11
|
end
|
|
12
|
+
|
|
12
13
|
<% if localized? %>
|
|
13
|
-
|
|
14
|
+
create_table :<%= localized_table_name %> do |t|
|
|
15
|
+
<% localized_attributes.each do |attribute| -%>
|
|
16
|
+
t.<%= attribute.type %> :<%= attribute.column_name %>
|
|
17
|
+
<% end -%>
|
|
18
|
+
t.string :locale, null: false
|
|
19
|
+
t.integer :refinery_<%= singular_table_name %>_id, null: false
|
|
20
|
+
t.timestamps
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
add_index :<%= localized_table_name %>, :locale, name: :index_<%= localized_table_name %>_on_locale
|
|
24
|
+
add_index :<%= localized_table_name %>, [:refinery_<%= singular_table_name %>_id, :locale], name: :index_<%= Digest::SHA1.hexdigest(localized_table_name) %>, unique: true
|
|
14
25
|
<% end %>
|
|
15
26
|
end
|
|
16
27
|
|
|
28
|
+
|
|
17
29
|
def down
|
|
18
30
|
if defined?(::Refinery::UserPlugin)
|
|
19
31
|
::Refinery::UserPlugin.destroy_all({:name => "refinerycms-<%= namespacing.underscore %>"})
|
|
@@ -25,8 +37,7 @@ class Create<%= namespacing %><%= class_name.pluralize %> < ActiveRecord::Migrat
|
|
|
25
37
|
<% end %>
|
|
26
38
|
drop_table :refinery_<%= "#{namespacing.underscore}_" if table_name != namespacing.underscore.pluralize -%><%= table_name %>
|
|
27
39
|
<% if localized? %>
|
|
28
|
-
|
|
40
|
+
drop_table :<%= localized_table_name %>
|
|
29
41
|
<% end %>
|
|
30
42
|
end
|
|
31
|
-
|
|
32
43
|
end
|
|
@@ -6,7 +6,7 @@ module Refinery
|
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
def append_load_seed_data
|
|
9
|
-
create_file 'db/seeds.rb' unless File.
|
|
9
|
+
create_file 'db/seeds.rb' unless File.exist?(File.join(destination_root, 'db', 'seeds.rb'))
|
|
10
10
|
append_file 'db/seeds.rb', :verbose => true do
|
|
11
11
|
<<-EOH
|
|
12
12
|
|
|
@@ -40,11 +40,11 @@ module Refinery
|
|
|
40
40
|
authorisation_manager.authenticate!
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
-
def group_by_date(records)
|
|
43
|
+
def group_by_date(records, date_field = :created_at)
|
|
44
44
|
new_records = []
|
|
45
45
|
|
|
46
46
|
records.each do |record|
|
|
47
|
-
key = record.
|
|
47
|
+
key = record.send(date_field).strftime("%Y-%m-%d")
|
|
48
48
|
record_group = new_records.map{ |r| r.last if r.first == key }.flatten.compact << record
|
|
49
49
|
(new_records.delete_if { |i| i.first == key}) << [key, record_group]
|
|
50
50
|
end
|
|
@@ -31,8 +31,7 @@ module Refinery
|
|
|
31
31
|
# fallback to the default 404.html page.
|
|
32
32
|
file = Rails.root.join 'public', '404.html'
|
|
33
33
|
file = Refinery.roots('refinery/core').join('public', '404.html') unless file.exist?
|
|
34
|
-
render :file
|
|
35
|
-
:layout => false, :status => 404, :formats => [:html]
|
|
34
|
+
render file: file, format: :html, layout: false, status: 404
|
|
36
35
|
return false
|
|
37
36
|
end
|
|
38
37
|
|
data/lib/refinery/cli.rb
CHANGED
|
@@ -3,7 +3,8 @@ module Refinery
|
|
|
3
3
|
include ActiveSupport::Configurable
|
|
4
4
|
|
|
5
5
|
config_accessor :rescue_not_found, :base_cache_key, :site_name,
|
|
6
|
-
:google_analytics_page_code, :
|
|
6
|
+
:google_analytics_page_code, :matomo_analytics_server,
|
|
7
|
+
:matomo_analytics_site_id, :authenticity_token_on_frontend,
|
|
7
8
|
:javascripts, :stylesheets, :mounted_path,
|
|
8
9
|
:force_ssl, :backend_route,
|
|
9
10
|
:visual_editor_javascripts, :visual_editor_stylesheets,
|
|
@@ -13,6 +14,8 @@ module Refinery
|
|
|
13
14
|
self.base_cache_key = :refinery
|
|
14
15
|
self.site_name = "Company Name"
|
|
15
16
|
self.google_analytics_page_code = "UA-xxxxxx-x"
|
|
17
|
+
self.matomo_analytics_server = "analytics.example.org"
|
|
18
|
+
self.matomo_analytics_site_id = "123"
|
|
16
19
|
self.authenticity_token_on_frontend = false
|
|
17
20
|
self.javascripts = []
|
|
18
21
|
self.stylesheets = []
|
data/lib/refinery/core/engine.rb
CHANGED
|
@@ -44,6 +44,26 @@ module Refinery
|
|
|
44
44
|
WillPaginate.per_page = 20
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
+
initializer "refinery.mobility" do
|
|
48
|
+
Mobility.configure do
|
|
49
|
+
plugins do
|
|
50
|
+
backend :table
|
|
51
|
+
reader # Explicitly declare readers,
|
|
52
|
+
writer # writers, and
|
|
53
|
+
backend_reader # backend reader (post.title_backend, etc).
|
|
54
|
+
active_record # You must now also explicitly ask for ActiveRecord (or Sequel)
|
|
55
|
+
query # i18n is the default scope
|
|
56
|
+
cache # previously implicit
|
|
57
|
+
fallbacks
|
|
58
|
+
presence # previously implicit
|
|
59
|
+
default
|
|
60
|
+
attribute_methods # uncomment this to get methods like `translated_attributes`
|
|
61
|
+
dirty
|
|
62
|
+
end
|
|
63
|
+
# accessor_method not available in v1.0
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
47
67
|
before_inclusion do
|
|
48
68
|
Refinery::Plugin.register do |plugin|
|
|
49
69
|
plugin.pathname = root
|
data/lib/refinery/core.rb
CHANGED
data/lib/refinery/crud.rb
CHANGED
|
@@ -24,19 +24,21 @@ module Refinery
|
|
|
24
24
|
plural_name = singular_name.pluralize
|
|
25
25
|
|
|
26
26
|
{
|
|
27
|
-
:
|
|
28
|
-
:
|
|
29
|
-
:
|
|
30
|
-
:
|
|
31
|
-
:
|
|
32
|
-
:
|
|
33
|
-
:
|
|
34
|
-
:
|
|
35
|
-
:
|
|
36
|
-
:
|
|
37
|
-
:
|
|
38
|
-
:
|
|
39
|
-
:
|
|
27
|
+
conditions: '',
|
|
28
|
+
include: [],
|
|
29
|
+
order: ('position ASC' if this_class.connected? && this_class.table_exists? && this_class.column_names.include?('position')),
|
|
30
|
+
paging: true,
|
|
31
|
+
per_page: false,
|
|
32
|
+
redirect_to_url: "refinery.#{Refinery.route_for_model(class_name.constantize, :plural => true)}",
|
|
33
|
+
searchable: true,
|
|
34
|
+
search_conditions: '',
|
|
35
|
+
sortable: true,
|
|
36
|
+
title_attribute: "title",
|
|
37
|
+
class_name: class_name,
|
|
38
|
+
singular_name: singular_name,
|
|
39
|
+
plural_name: plural_name,
|
|
40
|
+
find_actions: [:update, :destroy, :edit, :show],
|
|
41
|
+
exclude_from_find: []
|
|
40
42
|
}
|
|
41
43
|
end
|
|
42
44
|
|
|
@@ -52,14 +54,14 @@ module Refinery
|
|
|
52
54
|
class_name = options[:class_name]
|
|
53
55
|
singular_name = options[:singular_name]
|
|
54
56
|
plural_name = options[:plural_name]
|
|
57
|
+
actions = [*options[:find_actions]] - [*options[:exclude_from_find]]
|
|
55
58
|
|
|
56
|
-
module_eval
|
|
59
|
+
module_eval <<-RUBY, __FILE__, __LINE__ + 1
|
|
57
60
|
def self.crudify_options
|
|
58
61
|
#{options.inspect}
|
|
59
62
|
end
|
|
60
63
|
|
|
61
|
-
prepend_before_action :find_#{singular_name},
|
|
62
|
-
:only => [:update, :destroy, :edit, :show]
|
|
64
|
+
prepend_before_action :find_#{singular_name}, only: #{actions}
|
|
63
65
|
prepend_before_action :merge_position_into_params!, :only => :create
|
|
64
66
|
|
|
65
67
|
def new
|
|
@@ -85,7 +87,7 @@ module Refinery
|
|
|
85
87
|
end
|
|
86
88
|
|
|
87
89
|
def update
|
|
88
|
-
if @#{singular_name}.
|
|
90
|
+
if @#{singular_name}.update(#{singular_name}_params)
|
|
89
91
|
flash.notice = t(
|
|
90
92
|
'refinery.crudify.updated',
|
|
91
93
|
:what => "'\#{@#{singular_name}.#{options[:title_attribute]}}'"
|
|
@@ -181,7 +183,7 @@ module Refinery
|
|
|
181
183
|
if request.xhr?
|
|
182
184
|
render :partial => '/refinery/message'
|
|
183
185
|
else
|
|
184
|
-
|
|
186
|
+
redirect_back(fallback_location: { action: 'edit' })
|
|
185
187
|
end
|
|
186
188
|
else
|
|
187
189
|
redirect_back_or_default redirect_url
|
|
@@ -227,21 +229,21 @@ module Refinery
|
|
|
227
229
|
:create_or_update_successful,
|
|
228
230
|
:create_or_update_unsuccessful,
|
|
229
231
|
:merge_position_into_params!
|
|
230
|
-
|
|
232
|
+
RUBY
|
|
231
233
|
|
|
232
234
|
# Methods that are only included when this controller is searchable.
|
|
233
235
|
if options[:searchable]
|
|
234
236
|
if options[:paging]
|
|
235
|
-
module_eval
|
|
237
|
+
module_eval <<-RUBY, __FILE__, __LINE__ + 1
|
|
236
238
|
def index
|
|
237
239
|
search_all_#{plural_name} if searching?
|
|
238
240
|
paginate_all_#{plural_name}
|
|
239
241
|
|
|
240
242
|
render_partial_response?
|
|
241
243
|
end
|
|
242
|
-
|
|
244
|
+
RUBY
|
|
243
245
|
else
|
|
244
|
-
module_eval
|
|
246
|
+
module_eval <<-RUBY, __FILE__, __LINE__ + 1
|
|
245
247
|
def index
|
|
246
248
|
if searching?
|
|
247
249
|
search_all_#{plural_name}
|
|
@@ -251,31 +253,31 @@ module Refinery
|
|
|
251
253
|
|
|
252
254
|
render_partial_response?
|
|
253
255
|
end
|
|
254
|
-
|
|
256
|
+
RUBY
|
|
255
257
|
end
|
|
256
258
|
|
|
257
259
|
else
|
|
258
260
|
if options[:paging]
|
|
259
|
-
module_eval
|
|
261
|
+
module_eval <<-RUBY, __FILE__, __LINE__ + 1
|
|
260
262
|
def index
|
|
261
263
|
paginate_all_#{plural_name}
|
|
262
264
|
|
|
263
265
|
render_partial_response?
|
|
264
266
|
end
|
|
265
|
-
|
|
267
|
+
RUBY
|
|
266
268
|
else
|
|
267
|
-
module_eval
|
|
269
|
+
module_eval <<-RUBY, __FILE__, __LINE__ + 1
|
|
268
270
|
def index
|
|
269
271
|
find_all_#{plural_name}
|
|
270
272
|
render_partial_response?
|
|
271
273
|
end
|
|
272
|
-
|
|
274
|
+
RUBY
|
|
273
275
|
end
|
|
274
276
|
|
|
275
277
|
end
|
|
276
278
|
|
|
277
279
|
if options[:sortable]
|
|
278
|
-
module_eval
|
|
280
|
+
module_eval <<-RUBY, __FILE__, __LINE__ + 1
|
|
279
281
|
def reorder
|
|
280
282
|
find_all_#{plural_name}
|
|
281
283
|
end
|
|
@@ -333,10 +335,10 @@ module Refinery
|
|
|
333
335
|
end
|
|
334
336
|
|
|
335
337
|
protected :after_update_positions
|
|
336
|
-
|
|
338
|
+
RUBY
|
|
337
339
|
end
|
|
338
340
|
|
|
339
|
-
module_eval
|
|
341
|
+
module_eval <<-RUBY, __FILE__, __LINE__ + 1
|
|
340
342
|
class << self
|
|
341
343
|
def pageable?
|
|
342
344
|
#{options[:paging]}
|
|
@@ -351,8 +353,7 @@ module Refinery
|
|
|
351
353
|
#{options[:searchable]}
|
|
352
354
|
end
|
|
353
355
|
end
|
|
354
|
-
|
|
355
|
-
|
|
356
|
+
RUBY
|
|
356
357
|
end
|
|
357
358
|
|
|
358
359
|
end
|