eac_rails_base0 0.48.1 → 0.49.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/controllers/eac_rails_base0/application_controller.rb +2 -0
- data/app/helpers/eac_rails_base0/layout_helper.rb +0 -57
- data/app/helpers/eac_rails_base0/main_menu_helper.rb +63 -0
- data/app/helpers/eac_rails_base0/user_menu_helper.rb +18 -0
- data/app/views/layouts/eac_rails_base0/_navbar_user.html.erb +1 -10
- data/lib/eac_rails_base0/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6af95bb6d865ba96bce913db79e8de93b2ec99edb2b0b89377e212f6bc596524
|
4
|
+
data.tar.gz: a482b176d1508063b16bc6c6feab3c927bc3637dacb5c7332f3bf04ab56b619b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3afaf64af256027d1a6f97e48563b33918faf9b67466f2a10a6dca55c061d8ffe9d596bdbd370700b485b1dfb4d6a84ee4e5fec6815a36767bae7501dc92957a
|
7
|
+
data.tar.gz: 3e2872006a5a534968958c2955a34531596d673d7a455a5461486d61c60e46d021e8021aa8969321fb751fa77b4c938aa4ecbb8e5dc37e3b957fa3e388d5d271
|
@@ -7,9 +7,11 @@ module EacRailsBase0
|
|
7
7
|
layout 'eac_rails_base0/application'
|
8
8
|
helper ::EacRailsBase0::AppVersionHelper
|
9
9
|
helper ::EacRailsBase0::LayoutHelper
|
10
|
+
helper ::EacRailsBase0::MainMenuHelper
|
10
11
|
helper ::EacRailsUtils::FormatterHelper
|
11
12
|
helper ::EacRailsUtils::LinksHelper
|
12
13
|
helper ::EacRailsUtils::OpenGraphProtocolHelper
|
14
|
+
helper ::EacRailsBase0::UserMenuHelper
|
13
15
|
|
14
16
|
# Prevent CSRF attacks by raising an exception.
|
15
17
|
# For APIs, you may want to use :null_session instead.
|
@@ -3,8 +3,6 @@
|
|
3
3
|
module EacRailsBase0
|
4
4
|
module LayoutHelper
|
5
5
|
APP_TITLE_METHOD = 'app_title'
|
6
|
-
APP_MAIN_MENU_ENTRIES_METHOD = 'app_main_menu_entries'
|
7
|
-
ADMIN_ENTRIES = %w[eac_users_support tasks_scheduler aranha br_railties mailer].freeze
|
8
6
|
|
9
7
|
def base0_app_title
|
10
8
|
if respond_to?(APP_TITLE_METHOD)
|
@@ -13,60 +11,5 @@ module EacRailsBase0
|
|
13
11
|
"Implement the helper method \"#{APP_TITLE_METHOD}\""
|
14
12
|
end
|
15
13
|
end
|
16
|
-
|
17
|
-
def base0_app_main_menu_entries
|
18
|
-
if respond_to?(APP_MAIN_MENU_ENTRIES_METHOD)
|
19
|
-
send(APP_MAIN_MENU_ENTRIES_METHOD, base0_app_main_menu_default_entries)
|
20
|
-
else
|
21
|
-
base0_app_main_menu_default_entries
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def base0_app_main_menu_default_entries
|
26
|
-
{
|
27
|
-
'Administração' => base0_app_main_menu_admin_entries
|
28
|
-
}
|
29
|
-
end
|
30
|
-
|
31
|
-
def base0_app_main_menu_admin_entries
|
32
|
-
ADMIN_ENTRIES.map do |identifier|
|
33
|
-
[::I18n.t("eac_rails_base0.main_menu.admin.#{identifier}"),
|
34
|
-
send("#{identifier}_main_menu_admin_entries")]
|
35
|
-
end.to_h
|
36
|
-
end
|
37
|
-
|
38
|
-
def mailer_main_menu_admin_entries
|
39
|
-
%w[info send_test].map do |action|
|
40
|
-
[
|
41
|
-
t("eac_rails_base0.mailer.#{action}"),
|
42
|
-
main_app.send("#{action}_eac_rails_base0_mailer_index_path")
|
43
|
-
]
|
44
|
-
end.to_h
|
45
|
-
end
|
46
|
-
|
47
|
-
def eac_users_support_main_menu_admin_entries
|
48
|
-
{
|
49
|
-
::EacUsersSupport::User.model_name.human(count: 2) => [eac_users_support.admin_users_path]
|
50
|
-
}
|
51
|
-
end
|
52
|
-
|
53
|
-
def tasks_scheduler_main_menu_admin_entries
|
54
|
-
{
|
55
|
-
t('activerecord.models.scheduled_task.other') => [main_app.status_scheduled_tasks_path]
|
56
|
-
}
|
57
|
-
end
|
58
|
-
|
59
|
-
def aranha_main_menu_admin_entries
|
60
|
-
{
|
61
|
-
::Aranha::Address.model_name.human(count: 2) => [aranha.addresses_path]
|
62
|
-
}
|
63
|
-
end
|
64
|
-
|
65
|
-
def br_railties_main_menu_admin_entries
|
66
|
-
{
|
67
|
-
::BrRailties::FederalUnit.model_name.human(count: 2) => [br_railties.federal_units_path],
|
68
|
-
::BrRailties::Municipality.model_name.human(count: 2) => [br_railties.municipalities_path]
|
69
|
-
}
|
70
|
-
end
|
71
14
|
end
|
72
15
|
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacRailsBase0
|
4
|
+
module MainMenuHelper
|
5
|
+
APP_MAIN_MENU_ENTRIES_METHOD = 'app_main_menu_entries'
|
6
|
+
ADMIN_ENTRIES = %w[eac_users_support tasks_scheduler aranha br_railties mailer].freeze
|
7
|
+
|
8
|
+
def base0_app_main_menu_entries
|
9
|
+
if respond_to?(APP_MAIN_MENU_ENTRIES_METHOD)
|
10
|
+
send(APP_MAIN_MENU_ENTRIES_METHOD, base0_app_main_menu_default_entries)
|
11
|
+
else
|
12
|
+
base0_app_main_menu_default_entries
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def base0_app_main_menu_default_entries
|
17
|
+
{
|
18
|
+
'Administração' => base0_app_main_menu_admin_entries
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
def base0_app_main_menu_admin_entries
|
23
|
+
ADMIN_ENTRIES.map do |identifier|
|
24
|
+
[::I18n.t("eac_rails_base0.main_menu.admin.#{identifier}"),
|
25
|
+
send("#{identifier}_main_menu_admin_entries")]
|
26
|
+
end.to_h
|
27
|
+
end
|
28
|
+
|
29
|
+
def mailer_main_menu_admin_entries
|
30
|
+
%w[info send_test].map do |action|
|
31
|
+
[
|
32
|
+
t("eac_rails_base0.mailer.#{action}"),
|
33
|
+
main_app.send("#{action}_eac_rails_base0_mailer_index_path")
|
34
|
+
]
|
35
|
+
end.to_h
|
36
|
+
end
|
37
|
+
|
38
|
+
def eac_users_support_main_menu_admin_entries
|
39
|
+
{
|
40
|
+
::EacUsersSupport::User.model_name.human(count: 2) => [eac_users_support.admin_users_path]
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
def tasks_scheduler_main_menu_admin_entries
|
45
|
+
{
|
46
|
+
t('activerecord.models.scheduled_task.other') => [main_app.status_scheduled_tasks_path]
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
def aranha_main_menu_admin_entries
|
51
|
+
{
|
52
|
+
::Aranha::Address.model_name.human(count: 2) => [aranha.addresses_path]
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
def br_railties_main_menu_admin_entries
|
57
|
+
{
|
58
|
+
::BrRailties::FederalUnit.model_name.human(count: 2) => [br_railties.federal_units_path],
|
59
|
+
::BrRailties::Municipality.model_name.human(count: 2) => [br_railties.municipalities_path]
|
60
|
+
}
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacRailsBase0
|
4
|
+
module UserMenuHelper
|
5
|
+
def base0_user_menu_entries
|
6
|
+
r = {}
|
7
|
+
if current_user
|
8
|
+
r[current_user.to_s] = {
|
9
|
+
'Alterar senha' => [eac_users_support.edit_user_registration_path]
|
10
|
+
}
|
11
|
+
r['Sair'] = [eac_users_support.destroy_user_session_path, link_method: :delete]
|
12
|
+
else
|
13
|
+
r['Entrar'] = [eac_users_support.new_user_session_path]
|
14
|
+
end
|
15
|
+
r
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -1,10 +1 @@
|
|
1
|
-
|
2
|
-
user_menu = {}
|
3
|
-
if current_user
|
4
|
-
user_menu[current_user.to_s] = [main_app.root_path]
|
5
|
-
user_menu['Sair'] = [eac_users_support.destroy_user_session_path, link_method: :delete]
|
6
|
-
else
|
7
|
-
user_menu['Entrar'] = [eac_users_support.new_user_session_path]
|
8
|
-
end
|
9
|
-
%>
|
10
|
-
<%= bootstrap_dropdown_menu(user_menu, class: 'navbar-right') %>
|
1
|
+
<%= bootstrap_dropdown_menu(base0_user_menu_entries, class: 'navbar-right') %>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eac_rails_base0
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.49.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
@@ -580,7 +580,9 @@ files:
|
|
580
580
|
- app/controllers/eac_rails_base0/mailer_controller.rb
|
581
581
|
- app/helpers/eac_rails_base0/app_version_helper.rb
|
582
582
|
- app/helpers/eac_rails_base0/layout_helper.rb
|
583
|
+
- app/helpers/eac_rails_base0/main_menu_helper.rb
|
583
584
|
- app/helpers/eac_rails_base0/panel_default_helper.rb
|
585
|
+
- app/helpers/eac_rails_base0/user_menu_helper.rb
|
584
586
|
- app/mailers/eac_rails_base0/application_mailer.rb
|
585
587
|
- app/mailers/eac_rails_base0/send_test_mailer.rb
|
586
588
|
- app/models/eac_rails_base0/application_record.rb
|