web47core 3.2.19 → 3.2.21

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 295c70f1220ae3e566fc003d76204e5baefdaee83abef6fc9b43cccc9de93e12
4
- data.tar.gz: aafcd956bedf3d1f032ef4f00115c8eae0d195306de03185c8b8cdff77a586d3
3
+ metadata.gz: 0123e29aefa461243ba7ffcffe6749dfa5360a17a46491e3cecaf909def4d677
4
+ data.tar.gz: 017e627f7e1250a00841b5b2f2ca921639813500fa5a80321c43000a56070934
5
5
  SHA512:
6
- metadata.gz: 40028db7e156aa29352a048236834661b6b527fe8e4bc0efccdc2add5ccc42ad92551eef6d9ff6a6d02ffdc31840c8b207e21fac789d61a007fa68a64fb7290b
7
- data.tar.gz: e9f1098e8fb8689a472c17fe81e83129554a3e2abd825330c3d0cf6ee9ced2ca998ac567869db4595120ac625624711d6e66d16123fd064712d5524673229d40
6
+ metadata.gz: 644a506ecf3fb112ee4517e5612e3b678292c623494204730b37a06d34ab4c0d5d77f939a63fd4d23ae736de59863a6c318a9682c8c0d38a662cb1930dfecaa9
7
+ data.tar.gz: 3a7e1d9aa54e711f70a8c1cdee6b0c83a541efe74ac5b8c368866d9f4a2d257d9aed0f7ea0bac258c4355a96a68634830b6c5ad93c0ee6be74ab093bbc8688e4
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # Helpers for the application itself
5
+ #
6
+ module CoreApplicationHelper
7
+ # @abstract Return the current user
8
+ # @return [User] - The current user that is logged in
9
+ def current_user
10
+ @current_user
11
+ end
12
+
13
+ # @abstract Return the current member
14
+ # @return [Member] - The current user that is logged in
15
+ def current_member
16
+ @current_member
17
+ end
18
+
19
+ # @abstract Return the referrer url without deleting it out of the session
20
+ # @param [String] default_url - The URL to use if the referrer session is not there
21
+ # @return [String] the session[:referrer] or the default_url if not found
22
+ def referrer_url(default_url)
23
+ session[:referrer] || default_url
24
+ end
25
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Helper methods for rendering the flash information received from the server and displaying it as toast messages
4
- module CoreFlashToasterHelper
4
+ module CoreFlashToastHelper
5
5
  # @abstract render the whole toast container if there are toast messages to render
6
6
  # @return HTML - To render in the page
7
7
  def toast_container
@@ -0,0 +1,80 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # Helpful methods for menu bar on the side
5
+ #
6
+ module CoreMenuHelper
7
+ #
8
+ # @abstract Determines which css attributes should be assigned to the current menu, options are
9
+ # @param [Array, String, Symbol] names - make active it the current controller matches
10
+ # @param [Boolean] read_only - the menu is greyed out and disabled
11
+ # @param [Boolean] enabled - a lock icon appears
12
+ # @param [Boolean] visible - If this menu should be visible at all
13
+ #
14
+ def menu_css(names, read_only: false, enabled: true, visible: true)
15
+ states = []
16
+ states << 'read-only' if read_only
17
+ states << 'locked' unless enabled
18
+ states << 'd-none' unless visible
19
+ case names
20
+ when String
21
+ states << 'active' if names.eql?(controller.controller_name)
22
+ when Array
23
+ states << 'active' if names.include?(controller.controller_name)
24
+ else
25
+ states << 'active' if names.to_s.eql?(controller.controller_name)
26
+ end
27
+ states
28
+ end
29
+
30
+ def menu_name(name)
31
+ content_tag(:div, data: { i18n: name }) { name }
32
+ end
33
+
34
+ def menu_link(name, action_path, classes: [], badge_count: 0, icon_name: '')
35
+ classes << 'menu-link'
36
+ content_tag(:a, href: action_path, class: classes.join(' ')) do
37
+ concat(menu_remix_icon(icon_name)) if icon_name.present?
38
+ concat(menu_name(name))
39
+ concat(menu_count_badge(name, badge_count)) if badge_count.positive?
40
+ end
41
+ end
42
+
43
+ #
44
+ # @abstract Produce a new navigational link The name and action path are required, additional options are
45
+ # * icon_name - name of the icon to add to the link
46
+ # * classes - css styles to apply to the navigational link
47
+ # * new_count_badge - Content for badge
48
+ #
49
+ def menu_item(name, action_path, classes: [], icon_name: '', badge_count: 0)
50
+ classes << 'menu-item'
51
+ content_tag(:li, class: classes.join(' ')) do
52
+ menu_link(name, action_path, badge_count: badge_count, icon_name: icon_name)
53
+ end
54
+ end
55
+
56
+ def expandable_menu_item(name, classes: [], icon_name: '', badge_count: 0, &block)
57
+ classes << 'menu-item'
58
+ classes << 'open' if classes.include?('active')
59
+ content_tag(:li, class: classes.join(' ')) do
60
+ classes << 'menu-toggle'
61
+ concat(menu_link(name, '#', classes: ['menu-toggle'], badge_count: badge_count, icon_name: icon_name))
62
+ concat(content_tag(:ul, class: 'menu-sub') { yield block })
63
+ end
64
+ end
65
+
66
+ def main_menu(&block)
67
+ content_tag(:div, id: 'main-menu') do
68
+ concat(content_tag(:ul, class: 'menu-inner py-1') do
69
+ yield block
70
+ end)
71
+ end
72
+ end
73
+
74
+ # @abstract Add a badge to the current element
75
+ def menu_count_badge(name, badge_count)
76
+ content_tag(:span,
77
+ class: 'badge badge-center bg-white text-primary rounded-pill ms-1',
78
+ title: "#{badge_count} New #{name.to_s.pluralize}") { badge_count.to_s }
79
+ end
80
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # Helper methods for SSO Servers
5
+ #
6
+ module CoreSsoServersHelper
7
+ # @abstract Send the user to the correct SSO Server edit path
8
+ def edit_sso_server_path(server)
9
+ send "edit_#{server.class_name_underscored}_path", server
10
+ end
11
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # The Base User
5
+ #
6
+ module CoreUser
7
+ extend ActiveSupport::Concern
8
+
9
+ def self.included(base)
10
+ base.class_eval do
11
+ # Fields
12
+ field :name, type: String
13
+ field :avatar, type: String, default: '1'
14
+ field :theme, type: String, default: 'default'
15
+ field :style, type: String, default: 'light'
16
+
17
+
18
+ # @abstract Return the display name for the user
19
+ # 1. If :name is blank, then just return the email
20
+ # 2. If :name is NOT blank, then use "Name (email)"
21
+ # @return [String] - the name of the user
22
+ def display_name
23
+ name.blank? ? email : "#{name} (#{email})"
24
+ end
25
+
26
+ # @abstract the initials for the user
27
+ # @return [String]
28
+ def initials
29
+ if name.blank?
30
+ [email[0], email[1]].join
31
+ else
32
+ name.split.map { |n| n.first.upcase }.join
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # The Base User
5
+ #
6
+ module CoreUser
7
+ extend ActiveSupport::Concern
8
+
9
+ def self.included(base)
10
+ base.class_eval do
11
+ # Fields
12
+ devise :trackable, :timeoutable
13
+ field :sign_in_count, type: Integer
14
+ field :current_sign_in_at, type: Time
15
+ field :last_sign_in_at, type: Time
16
+ field :current_sign_in_ip, type: String
17
+ field :last_sign_in_ip, type: String
18
+ end
19
+ end
20
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Web47core
4
- VERSION = '3.2.19'
4
+ VERSION = '3.2.21'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web47core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.19
4
+ version: 3.2.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Schroeder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-21 00:00:00.000000000 Z
11
+ date: 2025-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -564,6 +564,7 @@ files:
564
564
  - app/controllers/exceptions_controller.rb
565
565
  - app/controllers/notifications_controller.rb
566
566
  - app/controllers/status_controller.rb
567
+ - app/helpers/core_application_helper.rb
567
568
  - app/helpers/core_avatar_helper.rb
568
569
  - app/helpers/core_breadcrumb_helper.rb
569
570
  - app/helpers/core_card_nav_items_helper.rb
@@ -575,9 +576,11 @@ files:
575
576
  - app/helpers/core_html5_form_helper.rb
576
577
  - app/helpers/core_job_state_helper.rb
577
578
  - app/helpers/core_link_helper.rb
579
+ - app/helpers/core_menu_helper.rb
578
580
  - app/helpers/core_nav_bar_helper.rb
579
581
  - app/helpers/core_remix_icon_helper.rb
580
582
  - app/helpers/core_select_two_helper.rb
583
+ - app/helpers/core_sso_servers_helper.rb
581
584
  - app/helpers/core_table_helper.rb
582
585
  - app/helpers/model_modal_helper.rb
583
586
  - app/views/common/_create_actions.html.haml
@@ -645,7 +648,9 @@ files:
645
648
  - lib/app/models/concerns/core_account.rb
646
649
  - lib/app/models/concerns/core_smtp_configuration.rb
647
650
  - lib/app/models/concerns/core_system_configuration.rb
651
+ - lib/app/models/concerns/core_user.rb
648
652
  - lib/app/models/concerns/delayed_job_configuration.rb
653
+ - lib/app/models/concerns/devise_able.rb
649
654
  - lib/app/models/concerns/email_able.rb
650
655
  - lib/app/models/concerns/encrypted_password.rb
651
656
  - lib/app/models/concerns/google_sso_configuration.rb