satis 2.1.4 → 2.1.5
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab24a057287e49bf11f24ca8f304df57020c3904a79160fa8b4a625e55380d5a
|
4
|
+
data.tar.gz: bdd35c925b3c002640195b642cd652719f24931b27fe4915f528d9800b27fb24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db13c90b7bf3e47ada1d6ee10d386c6bb135a183b4bb0f365f12fc42205dd25000e9da2210e8c5ea5e6245aafaf877584c2bec618144e9445b9eee44d98a072f
|
7
|
+
data.tar.gz: 729675b75520efe3b592af046c999dda0a59a58d55f25f80647f96bc28ce4debe2499918cb3719be2e39978fab353df24dd3e249ecad73886f5a854baf1a0b3d
|
@@ -1,4 +1,4 @@
|
|
1
|
-
button.inline-flex.items-center.justify-center.rounded-full.
|
1
|
+
button.inline-flex.items-center.justify-center.rounded-full.focus:outline-none.focus:ring-2.focus:ring-offset-2.focus:ring-primary-500 aria-expanded="false" aria-haspopup="true" type="button" class=options[:class] style="background-color: #{background_color}"
|
2
2
|
- if photo&.attached?
|
3
3
|
img class="rounded-full" src=photo_url alt=name class=options[:class]
|
4
4
|
- elsif gravatar?
|
@@ -4,7 +4,7 @@ require 'net/http'
|
|
4
4
|
module Satis
|
5
5
|
module Avatar
|
6
6
|
class Component < Satis::ApplicationComponent
|
7
|
-
attr_reader :name, :photo, :email, :options
|
7
|
+
attr_reader :name, :photo, :email, :options, :color
|
8
8
|
|
9
9
|
def initialize(name: nil, email: nil, photo: nil, **options)
|
10
10
|
super
|
@@ -13,6 +13,8 @@ module Satis
|
|
13
13
|
@options = options
|
14
14
|
@options[:class] ||= 'w-8 h-8'
|
15
15
|
@email = email
|
16
|
+
@background_color = "#6b7280"
|
17
|
+
@color = options.fetch(:color, true)
|
16
18
|
end
|
17
19
|
|
18
20
|
def initials
|
@@ -23,10 +25,16 @@ module Satis
|
|
23
25
|
end
|
24
26
|
end
|
25
27
|
|
28
|
+
# Returns the hex-background color for the avatar based on the name or email
|
29
|
+
def background_color
|
30
|
+
return unless name || email || color
|
31
|
+
|
32
|
+
@background_color = "##{Digest::MD5.hexdigest(name || email).first(6)}"
|
33
|
+
end
|
34
|
+
|
26
35
|
def photo_url
|
27
36
|
return unless photo&.attached?
|
28
37
|
|
29
|
-
#helpers.main_app.url_for(photo)
|
30
38
|
Rails.application.routes.url_helpers.rails_blob_path(photo, only_path: true)
|
31
39
|
end
|
32
40
|
|
data/lib/satis/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: satis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom de Grunt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-04-
|
11
|
+
date: 2024-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: browser
|