releaf-core 3.0.3 → 4.0.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/releaf/include/field.type_richtext.js +2 -18
- data/app/assets/javascripts/releaf/include/remote_validator.js +2 -12
- data/app/assets/stylesheets/releaf/environment/mixins/blocks.scss +1 -1
- data/app/assets/stylesheets/releaf/layout/fields.scss +1 -2
- data/app/assets/stylesheets/releaf/layout.scss +0 -1
- data/app/builders/releaf/builders/form_builder/fields.rb +0 -1
- data/app/builders/releaf/builders/form_builder/richtext_fields.rb +1 -3
- data/app/builders/releaf/builders/utilities/resolve_attribute_field_method_name.rb +2 -7
- data/app/controllers/releaf/action_controller.rb +0 -1
- data/app/helpers/releaf/button_helper.rb +1 -1
- data/app/lib/releaf/default_searchable_fields.rb +1 -12
- data/app/lib/releaf/resource_base.rb +1 -9
- data/app/lib/releaf/resource_params.rb +0 -12
- data/app/lib/releaf/resource_table_fields.rb +1 -1
- data/app/lib/releaf/search.rb +1 -8
- data/lib/generators/dummy/templates/config/routes.rb +0 -37
- data/lib/generators/dummy/templates/initializers/releaf.rb +1 -26
- data/lib/generators/dummy/templates/migrations/create_books.rb +1 -2
- data/lib/generators/dummy/templates/models/book.rb +0 -3
- data/lib/generators/releaf/templates/initializers/releaf.rb +1 -3
- data/lib/generators/releaf/templates/seeds/seeds.rb +0 -10
- data/lib/releaf/humanize_missing_translations.rb +13 -0
- data/lib/releaf/route_mapper.rb +0 -3
- data/lib/releaf-core.rb +2 -3
- metadata +16 -75
- data/app/assets/javascripts/ckeditor/plugins/mediaembed/icons/hidpi/mediaembed.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/mediaembed/icons/mediaembed.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/mediaembed/lang/en.js +0 -12
- data/app/assets/javascripts/ckeditor/plugins/mediaembed/lang/es.js +0 -12
- data/app/assets/javascripts/ckeditor/plugins/mediaembed/plugin.js +0 -63
- data/app/assets/javascripts/releaf/include/localization.js +0 -208
- data/app/assets/stylesheets/releaf/layout/localization.scss +0 -79
- data/app/builders/releaf/builders/form_builder/i18n_fields.rb +0 -75
- data/app/lib/releaf/action_controller/richtext_attachments.rb +0 -20
- data/app/models/releaf/richtext_attachment.rb +0 -6
- data/lib/generators/dummy/templates/assets/javascripts/controllers/admin/nodes.js +0 -1
- data/lib/generators/dummy/templates/assets/javascripts/controllers/admin/other_site/other_nodes.js +0 -1
- data/lib/generators/dummy/templates/assets/stylesheets/controllers/admin/nodes.scss +0 -1
- data/lib/generators/dummy/templates/assets/stylesheets/controllers/admin/other_site/other_nodes.scss +0 -1
- data/lib/generators/dummy/templates/builders/admin/nodes/form_builder.rb +0 -7
- data/lib/generators/dummy/templates/controllers/admin/nodes_controller.rb +0 -3
- data/lib/generators/dummy/templates/controllers/admin/other_site/other_nodes_controller.rb +0 -3
- data/lib/generators/dummy/templates/controllers/application_controller.rb +0 -61
- data/lib/generators/dummy/templates/controllers/concerns/node_controller.rb +0 -47
- data/lib/generators/dummy/templates/controllers/contacts_controller.rb +0 -5
- data/lib/generators/dummy/templates/controllers/home_pages_controller.rb +0 -3
- data/lib/generators/dummy/templates/controllers/text_pages_controller.rb +0 -3
- data/lib/generators/dummy/templates/migrations/create_banner_pages.rb +0 -11
- data/lib/generators/dummy/templates/migrations/create_bundles.rb +0 -7
- data/lib/generators/dummy/templates/migrations/create_home_pages.rb +0 -9
- data/lib/generators/dummy/templates/migrations/create_node_extra_fields.rb +0 -5
- data/lib/generators/dummy/templates/migrations/create_other_nodes.rb +0 -29
- data/lib/generators/dummy/templates/migrations/create_text_pages.rb +0 -9
- data/lib/generators/dummy/templates/models/banner_page.rb +0 -7
- data/lib/generators/dummy/templates/models/bundle.rb +0 -17
- data/lib/generators/dummy/templates/models/home_page.rb +0 -3
- data/lib/generators/dummy/templates/models/node.rb +0 -10
- data/lib/generators/dummy/templates/models/other_site/other_node.rb +0 -7
- data/lib/generators/dummy/templates/models/text_page.rb +0 -4
- data/lib/generators/dummy/templates/views/contacts/show.html.haml +0 -1
- data/lib/generators/dummy/templates/views/home_pages/show.haml +0 -1
- data/lib/generators/dummy/templates/views/layouts/application.html.haml +0 -30
- data/lib/generators/dummy/templates/views/text_pages/show.haml +0 -1
- data/lib/generators/releaf/templates/migrations/create_releaf_nodes.rb +0 -28
- data/lib/generators/releaf/templates/migrations/create_releaf_richtext_attachments.rb +0 -12
- data/lib/generators/releaf/templates/migrations/create_releaf_translations.rb +0 -20
- data/lib/generators/releaf/templates/models/node.rb +0 -3
- data/lib/releaf/rails_ext/globalize-accessors.rb +0 -64
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d97b42910cad359be7da883a5c2c5d47e8a047df8d141d35aeae39d087e401b2
|
|
4
|
+
data.tar.gz: 8f9a5c69781136512448cb5bf42bd45d1edeefaed550c509f1c0dae5fedae7fa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 743464b89a99b1046320f0d87559a8154f93c469c4267a420b29e5e8b8f9ea6e3c92422d89f45a10e0de38782365824babefcae2fd3fe8c4804dc76fe431880d
|
|
7
|
+
data.tar.gz: b09d84e130f9263b21d3ed93e51d6f77c4801e2d5a37bd6f710772606ae3271b4579f4183e4eefea68b9a85d09a2386ba4d25e373eb14894465f56a97a62fa40
|
|
@@ -13,9 +13,8 @@ window.ckeditor_configuration = {
|
|
|
13
13
|
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
|
|
14
14
|
['Subscript', 'Superscript'],
|
|
15
15
|
['NumberedList', 'BulletedList'],
|
|
16
|
-
['Link', 'Unlink', 'Anchor', 'Image'
|
|
16
|
+
['Link', 'Unlink', 'Anchor', 'Image'],
|
|
17
17
|
['Source', 'Maximize', 'ShowBlocks']],
|
|
18
|
-
extraPlugins: 'mediaembed'
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
};
|
|
@@ -85,22 +84,7 @@ jQuery(function()
|
|
|
85
84
|
textarea.attr( 'id', 'richtext_' + String((new Date()).getTime()).replace(/\D/gi,'') );
|
|
86
85
|
}
|
|
87
86
|
|
|
88
|
-
|
|
89
|
-
{
|
|
90
|
-
if (textarea.data('attachment-browse-url'))
|
|
91
|
-
{
|
|
92
|
-
config.filebrowserBrowseUrl = textarea.data('attachment-browse-url');
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (textarea.data('attachment-upload-url'))
|
|
96
|
-
{
|
|
97
|
-
config.filebrowserUploadUrl = textarea.data('attachment-upload-url');
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
else
|
|
101
|
-
{
|
|
102
|
-
remove_toolbar_item(config.toolbar, 'Image');
|
|
103
|
-
}
|
|
87
|
+
remove_toolbar_item(config.toolbar, 'Image');
|
|
104
88
|
|
|
105
89
|
if (textarea.data('external-stylesheet'))
|
|
106
90
|
{
|
|
@@ -161,7 +161,7 @@ var RemoteValidator = function( form )
|
|
|
161
161
|
return;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
var wrap =
|
|
164
|
+
var wrap = field_box;
|
|
165
165
|
|
|
166
166
|
var error_box = wrap.find('.error-box');
|
|
167
167
|
|
|
@@ -177,11 +177,6 @@ var RemoteValidator = function( form )
|
|
|
177
177
|
error_node.text( error.message );
|
|
178
178
|
|
|
179
179
|
field_box.addClass('has-error');
|
|
180
|
-
|
|
181
|
-
if (field_box.is('.i18n'))
|
|
182
|
-
{
|
|
183
|
-
wrap.addClass('has-error');
|
|
184
|
-
}
|
|
185
180
|
}
|
|
186
181
|
else if (target.is('form'))
|
|
187
182
|
{
|
|
@@ -255,9 +250,8 @@ var RemoteValidator = function( form )
|
|
|
255
250
|
// if error fields still exist, focus to first visible
|
|
256
251
|
|
|
257
252
|
// locate first input inside visible error fields,
|
|
258
|
-
// but for i18n fields exclude inputs inside .localization without .has-error
|
|
259
253
|
|
|
260
|
-
var focus_target = form.find('.field.has-error').filter(':visible').find(input_selector).
|
|
254
|
+
var focus_target = form.find('.field.has-error').filter(':visible').find(input_selector).first();
|
|
261
255
|
|
|
262
256
|
focus_target.trigger('focusprepare');
|
|
263
257
|
|
|
@@ -291,10 +285,6 @@ var RemoteValidator = function( form )
|
|
|
291
285
|
|
|
292
286
|
if (!except_validation_id || error_node.attr('data-validation-id') !== except_validation_id)
|
|
293
287
|
{
|
|
294
|
-
if (field.is('.i18n'))
|
|
295
|
-
{
|
|
296
|
-
error_box.closest('.localization').removeClass('has-error');
|
|
297
|
-
}
|
|
298
288
|
error_box.remove();
|
|
299
289
|
}
|
|
300
290
|
});
|
|
@@ -2,7 +2,6 @@ module Releaf::Builders::FormBuilder::Fields
|
|
|
2
2
|
include Releaf::Builders::FormBuilder::TextFields
|
|
3
3
|
include Releaf::Builders::FormBuilder::AssociatedSetField
|
|
4
4
|
include Releaf::Builders::FormBuilder::DateFields
|
|
5
|
-
include Releaf::Builders::FormBuilder::I18nFields
|
|
6
5
|
include Releaf::Builders::FormBuilder::RichtextFields
|
|
7
6
|
include Releaf::Builders::FormBuilder::NumberFields
|
|
8
7
|
include Releaf::Builders::FormBuilder::FileFields
|
|
@@ -16,9 +16,7 @@ module Releaf::Builders::FormBuilder::RichtextFields
|
|
|
16
16
|
rows: 5,
|
|
17
17
|
cols: 50,
|
|
18
18
|
class: "richtext",
|
|
19
|
-
data: {
|
|
20
|
-
"attachment-upload-url" => (controller.respond_to?(:releaf_richtext_attachment_upload_url) ? controller.releaf_richtext_attachment_upload_url : '')
|
|
21
|
-
},
|
|
19
|
+
data: {},
|
|
22
20
|
}
|
|
23
21
|
end
|
|
24
22
|
|
|
@@ -17,7 +17,7 @@ module Releaf::Builders::Utilities
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
def call
|
|
20
|
-
"releaf_#{field_type}
|
|
20
|
+
"releaf_#{field_type}_field"
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def field_type
|
|
@@ -29,12 +29,7 @@ module Releaf::Builders::Utilities
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def columns_class
|
|
32
|
-
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def localized_attribute?
|
|
36
|
-
@localized_attribute ||= (object.class.respond_to?(:translates?) && object.class.translates? &&
|
|
37
|
-
object.class.translated_attribute_names.include?(attribute_name.to_sym))
|
|
32
|
+
object.class
|
|
38
33
|
end
|
|
39
34
|
|
|
40
35
|
def column_field_type_resolvers
|
|
@@ -11,7 +11,6 @@ class Releaf::ActionController < ActionController::Base
|
|
|
11
11
|
include Releaf::ActionController::Ajax
|
|
12
12
|
include Releaf::ActionController::Urls
|
|
13
13
|
include Releaf::ActionController::Breadcrumbs
|
|
14
|
-
include Releaf::ActionController::RichtextAttachments
|
|
15
14
|
include Releaf::ActionController::Views
|
|
16
15
|
include Releaf::ActionController::Layout
|
|
17
16
|
include Releaf::ActionController::Exceptions
|
|
@@ -7,24 +7,13 @@ module Releaf
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
def find
|
|
10
|
-
|
|
11
|
-
search_columns << { translations: searchable_translated_string_columns } if has_searchable_translated_string_columns?
|
|
12
|
-
search_columns
|
|
10
|
+
possible_field_names & string_columns
|
|
13
11
|
end
|
|
14
12
|
|
|
15
13
|
def string_columns
|
|
16
14
|
klass.columns.select { |column| column.type == :string }.map(&:name)
|
|
17
15
|
end
|
|
18
16
|
|
|
19
|
-
def searchable_translated_string_columns
|
|
20
|
-
@searchable_translated_string_columns ||= self.class.new(klass::Translation).find
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def has_searchable_translated_string_columns?
|
|
24
|
-
return false unless klass.translates?
|
|
25
|
-
searchable_translated_string_columns.present?
|
|
26
|
-
end
|
|
27
|
-
|
|
28
17
|
def possible_field_names
|
|
29
18
|
%w[
|
|
30
19
|
email
|
|
@@ -9,20 +9,12 @@ class Releaf::ResourceBase
|
|
|
9
9
|
%w{id created_at updated_at}
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
def localized_attributes?
|
|
13
|
-
resource_class.translates?
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def localized_attributes
|
|
17
|
-
@localized_attributes ||= localized_attributes? ? resource_class.translated_attribute_names.map(&:to_s) : []
|
|
18
|
-
end
|
|
19
|
-
|
|
20
12
|
def base_attributes
|
|
21
13
|
resource_class.column_names
|
|
22
14
|
end
|
|
23
15
|
|
|
24
16
|
def values(include_associations: true)
|
|
25
|
-
list = base_attributes
|
|
17
|
+
list = base_attributes - excluded_attributes
|
|
26
18
|
list += associations_attributes if include_associations
|
|
27
19
|
list
|
|
28
20
|
end
|
|
@@ -23,18 +23,6 @@ class Releaf::ResourceParams < Releaf::ResourceBase
|
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
def localized_attributes
|
|
27
|
-
super.inject([]) do |list, column|
|
|
28
|
-
list + localized_attribute_params(column)
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def localized_attribute_params(column)
|
|
33
|
-
resource_class.globalize_locales.collect do|locale|
|
|
34
|
-
"#{column}_#{locale}"
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
26
|
def associations_attributes
|
|
39
27
|
associations.collect do |association|
|
|
40
28
|
{"#{association.name}_attributes" => association_attributes(association)}
|
data/app/lib/releaf/search.rb
CHANGED
|
@@ -94,11 +94,6 @@ module Releaf
|
|
|
94
94
|
join_condition = join_condition.and(where_scope) if where_scope.present?
|
|
95
95
|
end
|
|
96
96
|
|
|
97
|
-
if other_class.ancestors.include?(Globalize::ActiveRecord::Translation)
|
|
98
|
-
# only search in current locale
|
|
99
|
-
join_condition = join_condition.and(table2[:locale].eq(I18n.locale.to_s))
|
|
100
|
-
end
|
|
101
|
-
|
|
102
97
|
self.relation = relation.joins(arel_join(table1, table2, join_condition))
|
|
103
98
|
table2
|
|
104
99
|
end
|
|
@@ -106,8 +101,6 @@ module Releaf
|
|
|
106
101
|
def extract_where_condition_from_scope(reflection, table_alias)
|
|
107
102
|
tmp_relation = build_tmp_relation(reflection, table_alias)
|
|
108
103
|
|
|
109
|
-
return nil if tmp_relation.where_values_hash.blank?
|
|
110
|
-
|
|
111
104
|
tmp_relation.arel.ast.cores.first.wheres
|
|
112
105
|
end
|
|
113
106
|
|
|
@@ -115,7 +108,7 @@ module Releaf
|
|
|
115
108
|
# Need to create tmp relation since setting table alias for actual klass
|
|
116
109
|
# is a bad idea.
|
|
117
110
|
klass = Class.new(reflection.klass) do
|
|
118
|
-
self.arel_table.
|
|
111
|
+
self.arel_table.name = table_alias
|
|
119
112
|
end
|
|
120
113
|
|
|
121
114
|
klass.instance_exec(&reflection.scope)
|
|
@@ -4,41 +4,4 @@ Dummy::Application.routes.draw do
|
|
|
4
4
|
releaf_resources :books, :authors, :chapters, :publishers
|
|
5
5
|
releaf_resources :banners, only: [:index, :show]
|
|
6
6
|
end
|
|
7
|
-
|
|
8
|
-
# SINGLE NODE CLASS CASE:
|
|
9
|
-
|
|
10
|
-
# node_routes_for(HomePage) do
|
|
11
|
-
# get 'show', as: "home_page"
|
|
12
|
-
# end
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
# MULTIPLE NODE CLASSES CASE:
|
|
16
|
-
|
|
17
|
-
# automatic hostname constraints for all defined nodes/sites:
|
|
18
|
-
node_routing( Releaf::Content.routing ) do
|
|
19
|
-
|
|
20
|
-
node_routes_for(HomePage) do
|
|
21
|
-
get 'show', as: "home_page"
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
node_routes_for(TextPage) do
|
|
25
|
-
get 'show'
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
# manual hostname constraint blocks for nodes specific to a single site:
|
|
31
|
-
constraints Releaf::Content.routing['Node'][:constraints] do
|
|
32
|
-
|
|
33
|
-
# contacts page route will be only on main site
|
|
34
|
-
node_routes_for(ContactsController, node_class: 'Node') do
|
|
35
|
-
get 'show', as: "contacts_page"
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
root to: 'application#redirect_to_locale_root'
|
|
41
|
-
|
|
42
|
-
match "*not_found_path", to: "application#render_404", via: [:get, :post], format: false
|
|
43
|
-
|
|
44
7
|
end
|
|
@@ -3,39 +3,14 @@ Releaf.application.configure do
|
|
|
3
3
|
|
|
4
4
|
### setup menu items and therefore available controllers
|
|
5
5
|
config.menu = [
|
|
6
|
-
"admin/nodes",
|
|
7
6
|
{name: "inventory", items: %w[admin/books admin/authors admin/publishers admin/banners]},
|
|
8
7
|
{name: "permissions", items: %w[releaf/permissions/users releaf/permissions/roles]},
|
|
9
8
|
"releaf/settings",
|
|
10
|
-
"releaf/i18n_database/translations"
|
|
11
9
|
]
|
|
12
10
|
|
|
13
11
|
config.additional_controllers = %w[admin/chapters]
|
|
14
|
-
config.components = [Releaf::Core, Releaf::
|
|
12
|
+
config.components = [Releaf::Core, Releaf::Permissions]
|
|
15
13
|
config.available_locales = ["en", "lv"]
|
|
16
14
|
# conf.layout_builder_class_name = "CustomLayoutBuilder"
|
|
17
15
|
# conf.permissions.devise_for 'releaf/admin'
|
|
18
|
-
|
|
19
|
-
config.content.resources = { 'Node' => { controller: 'Admin::NodesController' } }
|
|
20
|
-
|
|
21
|
-
# MULTIPLE NODES CASE:
|
|
22
|
-
# config.content.resources = {
|
|
23
|
-
# 'Node' => {
|
|
24
|
-
# controller: 'Releaf::Content::NodesController',
|
|
25
|
-
# routing: {
|
|
26
|
-
# site: "main_site",
|
|
27
|
-
# constraints: { host: /^(www\.)?releaf\.local$/ }
|
|
28
|
-
# }
|
|
29
|
-
# },
|
|
30
|
-
# 'OtherSite::OtherNode' => {
|
|
31
|
-
# controller: 'Admin::OtherSite::OtherNodesController',
|
|
32
|
-
# routing: {
|
|
33
|
-
# site: "other_site",
|
|
34
|
-
# constraints: { host: /^(www\.)?other\.releaf\.local$/ }
|
|
35
|
-
# }
|
|
36
|
-
# }
|
|
37
|
-
# }
|
|
38
|
-
|
|
39
|
-
# DEFAULT SINGLE NODE CASE:
|
|
40
|
-
# config.content.resources = { 'Node' => { controller: 'Releaf::Content::NodesController' } }
|
|
41
16
|
end
|
|
@@ -5,6 +5,7 @@ class CreateBooks < ActiveRecord::Migration[5.0]
|
|
|
5
5
|
t.integer :year
|
|
6
6
|
t.integer :author_id
|
|
7
7
|
t.string :genre
|
|
8
|
+
t.string :description
|
|
8
9
|
t.text :summary_html
|
|
9
10
|
t.boolean :active
|
|
10
11
|
t.datetime :published_at
|
|
@@ -16,8 +17,6 @@ class CreateBooks < ActiveRecord::Migration[5.0]
|
|
|
16
17
|
end
|
|
17
18
|
|
|
18
19
|
add_index :books, :author_id
|
|
19
|
-
|
|
20
|
-
Book.create_translation_table! description: :string
|
|
21
20
|
end
|
|
22
21
|
|
|
23
22
|
def down
|
|
@@ -3,15 +3,13 @@ Releaf.application.configure do
|
|
|
3
3
|
|
|
4
4
|
### setup menu items and therefore available controllers
|
|
5
5
|
config.menu = [
|
|
6
|
-
"releaf/content/nodes",
|
|
7
6
|
{name: "permissions", items: %w[releaf/permissions/users releaf/permissions/roles]},
|
|
8
|
-
"releaf/i18n_database/translations"
|
|
9
7
|
]
|
|
10
8
|
|
|
11
9
|
# controllers that must be accessible by user, but are not visible in menu
|
|
12
10
|
# should be added to this list
|
|
13
11
|
# config.additional_controllers = %w[admin/chapters]
|
|
14
|
-
config.components = [Releaf::Core, Releaf::
|
|
12
|
+
config.components = [Releaf::Core, Releaf::Permissions]
|
|
15
13
|
|
|
16
14
|
config.available_locales = ["en"]
|
|
17
15
|
# config.layout_builder_class_name = 'CustomLayoutBuilder'
|
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
Releaf::Permissions::User,
|
|
6
6
|
Releaf::Permissions::Role,
|
|
7
7
|
Releaf::Permissions::Permission,
|
|
8
|
-
Releaf::I18nDatabase::I18nEntry,
|
|
9
|
-
Releaf::I18nDatabase::I18nEntryTranslation
|
|
10
8
|
].each do |descendant|
|
|
11
9
|
descendant.unscoped.delete_all
|
|
12
10
|
end
|
|
@@ -37,14 +35,6 @@ Releaf::Permissions::User.create!(
|
|
|
37
35
|
|
|
38
36
|
|
|
39
37
|
|
|
40
|
-
# }}}
|
|
41
|
-
# Translations {{{
|
|
42
|
-
|
|
43
|
-
puts "Importing translations"
|
|
44
|
-
import_file_path = File.join(Gem.loaded_specs["releaf-i18n_database"].full_gem_path, "misc", "translations.xlsx")
|
|
45
|
-
translations = Releaf::I18nDatabase::ParseSpreadsheetTranslations.call(file_path: import_file_path, extension: "xlsx")
|
|
46
|
-
translations.each{|translation| translation.save! }
|
|
47
|
-
|
|
48
38
|
# }}}
|
|
49
39
|
|
|
50
40
|
# vim: set fdm=marker:
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Releaf::HumanizeMissingTranslations
|
|
2
|
+
def call(exception, locale, key, options)
|
|
3
|
+
if key.present? && exception.is_a?(I18n::MissingTranslation)
|
|
4
|
+
key.to_s.split('.').last.humanize
|
|
5
|
+
else
|
|
6
|
+
super
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def self.initialize_component
|
|
11
|
+
I18n.exception_handler.extend(self)
|
|
12
|
+
end
|
|
13
|
+
end
|
data/lib/releaf/route_mapper.rb
CHANGED
|
@@ -8,9 +8,6 @@ module Releaf::RouteMapper
|
|
|
8
8
|
get :confirm_destroy if route_enabled?(:destroy, args.last)
|
|
9
9
|
get :toolbox if route_enabled?(:toolbox, args.last)
|
|
10
10
|
end
|
|
11
|
-
collection do
|
|
12
|
-
post :create_releaf_richtext_attachment if route_enabled?(:releaf_richtext_attachments, args.last)
|
|
13
|
-
end
|
|
14
11
|
end
|
|
15
12
|
end
|
|
16
13
|
|
data/lib/releaf-core.rb
CHANGED
|
@@ -9,7 +9,6 @@ require 'jquery-ui-rails'
|
|
|
9
9
|
require 'vanilla-ujs'
|
|
10
10
|
require 'acts_as_list'
|
|
11
11
|
require 'dragonfly'
|
|
12
|
-
require 'globalize'
|
|
13
12
|
require 'virtus'
|
|
14
13
|
require 'sassc-rails'
|
|
15
14
|
|
|
@@ -34,10 +33,10 @@ module Releaf
|
|
|
34
33
|
require 'releaf/route_mapper'
|
|
35
34
|
require 'releaf/exceptions'
|
|
36
35
|
require 'releaf/core_ext/array/reorder'
|
|
37
|
-
require 'releaf/
|
|
36
|
+
require 'releaf/humanize_missing_translations'
|
|
38
37
|
|
|
39
38
|
def self.components
|
|
40
|
-
[Releaf::SettingsUI, Releaf::Root]
|
|
39
|
+
[Releaf::SettingsUI, Releaf::Root, Releaf::HumanizeMissingTranslations]
|
|
41
40
|
end
|
|
42
41
|
end
|
|
43
42
|
|