satis 2.1.3 → 2.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3100905fd0c0f9ab69fa8b367eb09bc2bd6f7b4c3a3dd1271517141417c9c667
4
- data.tar.gz: fc168ce7e22bc01baebec87fb632dca6acdfeebdbcc623f852119be34393b7b7
3
+ metadata.gz: ab24a057287e49bf11f24ca8f304df57020c3904a79160fa8b4a625e55380d5a
4
+ data.tar.gz: bdd35c925b3c002640195b642cd652719f24931b27fe4915f528d9800b27fb24
5
5
  SHA512:
6
- metadata.gz: d085a09e1de0e2ced5dd4d539d2aeb66510e4e6a4ba0857cd37081b6ad3e1734b80db6b388b4e3b07e5aa255c1496cce374c041f38ea02bc8ffa350bf93dc545
7
- data.tar.gz: ab57757fd34af527fed33856165bfb0d2cbe1487f43d16252f20373744ce8fb086209f995ed0814ca07e868075ba50dfbafecb3063f25ad584b352e7c2804607
6
+ metadata.gz: db13c90b7bf3e47ada1d6ee10d386c6bb135a183b4bb0f365f12fc42205dd25000e9da2210e8c5ea5e6245aafaf877584c2bec618144e9445b9eee44d98a072f
7
+ data.tar.gz: 729675b75520efe3b592af046c999dda0a59a58d55f25f80647f96bc28ce4debe2499918cb3719be2e39978fab353df24dd3e249ecad73886f5a854baf1a0b3d
@@ -1,4 +1,4 @@
1
- button.inline-flex.items-center.justify-center.rounded-full.bg-gray-500.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]
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
 
@@ -51,9 +51,12 @@ export default class FieldsForController extends ApplicationController {
51
51
 
52
52
  // Find template and add event listeners
53
53
  let templateElement = this.insertionPointTarget.querySelector(".template")
54
- templateElement.querySelectorAll("input,select").forEach((input) => {
55
- input.addEventListener("change", this.boundMonitorChanges)
56
- })
54
+ setTimeout(() => {
55
+ // add a delay so host can finish dom manipulation and everything is ready
56
+ templateElement.querySelectorAll("input,select").forEach((input) => {
57
+ input.addEventListener("change", this.boundMonitorChanges)
58
+ })
59
+ }, 500)
57
60
  }
58
61
 
59
62
  monitorChanges(event) {
data/lib/satis/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Satis
2
- VERSION = "2.1.3"
2
+ VERSION = "2.1.5"
3
3
  end
data/package.json CHANGED
@@ -5,5 +5,5 @@
5
5
  "postcss-mixins": "^9.0.4",
6
6
  "tailwindcss": "^3.4.1"
7
7
  },
8
- "version": "2.0.9"
8
+ "version": "2.1.4"
9
9
  }
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.3
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-05 00:00:00.000000000 Z
11
+ date: 2024-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: browser