thecore_ui_rails_admin 3.2.14 → 3.2.16
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/views/layouts/rails_admin/application.html.erb +1 -0
- data/config/initializers/after_initialize.rb +3 -1
- data/config/initializers/concern_r_a_application_controller.rb +9 -6
- data/config/initializers/concern_user.rb +8 -0
- data/config/locales/en.rails_admin.yml +1 -1
- data/config/locales/it.main.yml +1 -1
- data/config/locales/it.rails_admin.yml +4 -4
- data/db/migrate/20250206222412_add_locale_to_user.rb +6 -0
- data/lib/member_actions/change_password.rb +3 -2
- data/lib/rails_admin_abstract_controller.rb +9 -0
- data/lib/thecore_ui_rails_admin/version.rb +1 -1
- data/lib/thecore_ui_rails_admin.rb +0 -5
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1fe9b6993cff6a3c3d8ee78aed6cd6d1bd98aeaeabf257860a50e9382f52d389
|
4
|
+
data.tar.gz: e525e46b1a3b393084995a69c7d5acd211508966fe32affb126f09b46a31a0ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c614b3909fb97866672972fb3ac944f688e82d869ac1fe9fd49004a43e1d78d2f8bad232b5428778fe9aa63972c20ed41afd9341e23eadb3b605c64d519f056c
|
7
|
+
data.tar.gz: a4ae887f09b03705cc39e87b6a630ce901634c3bb4dfd6fdc91c397c505c7a08eae3bf8446f16535dcc1a15445d205f050383b9a369544612ec80ba12035e593
|
@@ -6,6 +6,8 @@ Rails.application.configure do
|
|
6
6
|
ApplicationController.send(:include, ConcernRAApplicationController)
|
7
7
|
RailsAdmin::ApplicationController.send(:include, ConcernRAApplicationController)
|
8
8
|
## Rails Admin
|
9
|
+
require 'rails_admin_abstract_controller'
|
10
|
+
RailsAdmin::Config.parent_controller = '::RailsAdminAbstractController'
|
9
11
|
### More at https://github.com/sferik/rails_admin/wiki/Base-configuration
|
10
12
|
## == Devise ==
|
11
13
|
RailsAdmin::Config.authenticate_with do
|
@@ -18,7 +20,7 @@ Rails.application.configure do
|
|
18
20
|
|
19
21
|
# RailsAdmin::Config.sidescroll = { num_frozen_columns: 2 }
|
20
22
|
|
21
|
-
RailsAdmin::Config.main_app_name = Proc.new { |controller| [ ((ENV["APP_NAME"]
|
23
|
+
RailsAdmin::Config.main_app_name = Proc.new { |controller| [ ((ThecoreSettings::Setting.where(ns: :main, key: :app_name).pluck(:raw).first.presence || ENV["APP_NAME"]) rescue "Thecore"), "" ] }
|
22
24
|
|
23
25
|
RailsAdmin::Config.show_gravatar = false
|
24
26
|
|
@@ -7,12 +7,15 @@ module ConcernRAApplicationController
|
|
7
7
|
included do
|
8
8
|
# Redirects on successful sign in
|
9
9
|
def after_sign_in_path_for resource
|
10
|
-
|
10
|
+
# Setting locale from user if locale field exists in the model, otherwise set it from the Settings in the end, use the default locale
|
11
|
+
I18n.locale = resource.is_a?(User) && resource.respond_to?(:locale) && !resource.locale.blank? ? resource.locale.to_sym : I18n.default_locale
|
12
|
+
|
13
|
+
Rails.logger.debug "after_sign_in_path_for #{resource}"
|
11
14
|
root_actions = RailsAdmin::Config::Actions.all(:root).select {|action| can? :read, action.action_name }.collect(&:action_name)
|
12
15
|
|
13
16
|
# Default root action as landing page: the first to which I have authorization to read
|
14
17
|
action = root_actions.first
|
15
|
-
|
18
|
+
Rails.logger.debug "after_sign_in_path_for action: #{action}"
|
16
19
|
# Otherwise, if I set a Manual override for landing actions in config, I can test if I'm authorized to see it
|
17
20
|
override_landing_page = Settings.ns(:main).after_sign_in_redirect_to_root_action
|
18
21
|
action = override_landing_page.to_sym if !override_landing_page.blank? && root_actions.include?(override_landing_page.to_sym)
|
@@ -20,17 +23,17 @@ module ConcernRAApplicationController
|
|
20
23
|
# If I ask for a specific page, Let's try to go back there if I need to login or re-login
|
21
24
|
# This takes precedence on automatic computed action
|
22
25
|
stored_location = stored_location_for(resource)
|
23
|
-
|
26
|
+
Rails.logger.debug "after_sign_in_path_for stored_location: #{stored_location}"
|
24
27
|
if !stored_location.blank? && can?(resource, :all)
|
25
28
|
# Go to the latest navigated page
|
26
|
-
|
29
|
+
Rails.logger.debug "after_sign_in_path_for Redirect to stored_location"
|
27
30
|
return stored_location
|
28
31
|
elsif action
|
29
32
|
path = rails_admin.send("#{action}_path").sub("#{ENV['RAILS_RELATIVE_URL_ROOT']}#{ENV['RAILS_RELATIVE_URL_ROOT']}", "#{ENV['RAILS_RELATIVE_URL_ROOT']}")
|
30
|
-
|
33
|
+
Rails.logger.debug "after_sign_in_path_for Redirect to action #{path}"
|
31
34
|
return path
|
32
35
|
else
|
33
|
-
|
36
|
+
Rails.logger.debug "after_sign_in_path_for ERROR! Signing out user :-("
|
34
37
|
sign_out current_user
|
35
38
|
user_session = nil
|
36
39
|
current_user = nil
|
@@ -13,6 +13,14 @@ module ThecoreUiRailsAdminUserConcern
|
|
13
13
|
# def locked_enum
|
14
14
|
# [["✔",true],['✘',false]]
|
15
15
|
# end
|
16
|
+
#
|
17
|
+
|
18
|
+
# locale field is a string which can be chosen from the list of available locales: it and en
|
19
|
+
# The default locale is the one set in the I18n.default_locale
|
20
|
+
# The locale is used to set the language of the user
|
21
|
+
def locale_enum
|
22
|
+
[['Italiano', 'it'], ['English', 'en']]
|
23
|
+
end
|
16
24
|
|
17
25
|
rails_admin do
|
18
26
|
navigation_label I18n.t("admin.settings.label")
|
data/config/locales/it.main.yml
CHANGED
@@ -6,14 +6,14 @@ it:
|
|
6
6
|
index:
|
7
7
|
no_records: Nessun record da mostrare
|
8
8
|
active_job_monitor:
|
9
|
-
menu:
|
10
|
-
title:
|
11
|
-
breadcrumb:
|
9
|
+
menu: Monitoraggio Servizi
|
10
|
+
title: Monitoraggio Servizi
|
11
|
+
breadcrumb: Monitoraggio Servizi
|
12
12
|
change_password:
|
13
13
|
title: Cambia Password
|
14
14
|
breadcrumb: Cambia Password
|
15
15
|
menu: Cambia Password
|
16
16
|
success: La tua password è stata cambiata con successo
|
17
|
-
error:
|
17
|
+
error: Attenzione! %{errors}
|
18
18
|
scopes:
|
19
19
|
_all: Tutti
|
@@ -13,11 +13,12 @@ RailsAdmin::Config::Actions.add_action "change_password", :base, :member do
|
|
13
13
|
proc do
|
14
14
|
# if it's a form submission, then update the password
|
15
15
|
if request.patch?
|
16
|
-
|
16
|
+
u = ::User.find(@object.id)
|
17
|
+
if u.update(password: params[:user][:password], password_confirmation: params[:user][:password_confirmation])
|
17
18
|
flash[:success] = I18n.t("admin.actions.change_password.success")
|
18
19
|
else
|
19
20
|
# Add errors to the object
|
20
|
-
flash[:error] = I18n.t("admin.actions.change_password.error")
|
21
|
+
flash[:error] = I18n.t("admin.actions.change_password.error", errors: u.errors.full_messages.join(', '))
|
21
22
|
end
|
22
23
|
# Redirect to the object
|
23
24
|
redirect_to index_path(model_name: @abstract_model.to_param)
|
@@ -1,11 +1,6 @@
|
|
1
1
|
require "thecore_ui_commons"
|
2
|
-
# https://github.com/dalpo/rails_admin_clone
|
3
|
-
# require "rails_admin_clone"
|
4
2
|
require "rails_admin"
|
5
3
|
require "rails_admin-i18n"
|
6
|
-
# require "rails_admin_toggleable"
|
7
|
-
# https://github.com/stephskardal/rails_admin_import
|
8
|
-
# require "rails_admin_import"
|
9
4
|
|
10
5
|
require "thecore_ui_rails_admin/engine"
|
11
6
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thecore_ui_rails_admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriele Tassoni
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-02-
|
10
|
+
date: 2025-02-12 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: thecore_ui_commons
|
@@ -107,8 +107,10 @@ files:
|
|
107
107
|
- config/locales/it.rails_admin.yml
|
108
108
|
- config/locales/it.rollincode.yml
|
109
109
|
- config/routes.rb
|
110
|
+
- db/migrate/20250206222412_add_locale_to_user.rb
|
110
111
|
- db/seeds.rb
|
111
112
|
- lib/member_actions/change_password.rb
|
113
|
+
- lib/rails_admin_abstract_controller.rb
|
112
114
|
- lib/root_actions/active_job_monitor.rb
|
113
115
|
- lib/tasks/thecore_ui_rails_admin_tasks.rake
|
114
116
|
- lib/thecore_ui_rails_admin.rb
|