componeer 0.0.7a → 0.0.7b
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/components/componeer/base_component.rb +13 -0
- data/app/components/componeer/empty_states/empty_state_component.rb +4 -4
- data/app/components/componeer/tables/table_component.rb +3 -3
- data/app/components/componeer/tags/tag_component.rb +3 -5
- data/lib/componeer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f497c0538b1d0dadcb6e0784b88b9d649ef2670e7c62f37127e12d19dcdcb38
|
4
|
+
data.tar.gz: d362b552e3a1daf1b6a5e5bf439cc1dc9457ad969ec099b5ad02835768cbd542
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8a0678a20adeb1b42e62d4e4933095031047b7989e4d062564f9a2b8654637538c3a25540a83f99cbe59e554c8c23faa2c698ad712835e1a24e308b51982c29
|
7
|
+
data.tar.gz: ec3cd5cab6ced503afe8b739e42e68adb850a3fef1984720b0c6b935af5e720689ecc9ea8fa4a882444e0f917aa5292f03ff043710694f51fb51921dcb9b046e
|
@@ -40,5 +40,18 @@ module Componeer
|
|
40
40
|
def to_classes_string(array)
|
41
41
|
array.flatten.compact_blank.uniq.join(' ')
|
42
42
|
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def build_options(opts)
|
47
|
+
opts = opts.reverse_merge(self.class::DEFAULT_OPTIONS)
|
48
|
+
|
49
|
+
opts.each do |k, v|
|
50
|
+
instance_variable_set("@#{k}", v)
|
51
|
+
opts.delete(k)
|
52
|
+
end
|
53
|
+
|
54
|
+
@options = opts
|
55
|
+
end
|
43
56
|
end
|
44
57
|
end
|
@@ -5,11 +5,11 @@ module Componeer
|
|
5
5
|
|
6
6
|
renders_one :new_resource_action
|
7
7
|
|
8
|
-
|
8
|
+
DEFAULT_OPTIONS = { icon: :exclamation, new_resource_path: nil, description: nil }.freeze
|
9
|
+
|
10
|
+
def initialize(resource_name:, **options)
|
9
11
|
@resource_name = resource_name
|
10
|
-
|
11
|
-
@new_resource_path = new_resource_path
|
12
|
-
@description = description
|
12
|
+
build_options(options)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -19,11 +19,11 @@ module Componeer
|
|
19
19
|
|
20
20
|
attr_reader :records, :density, :striped, :options
|
21
21
|
|
22
|
+
DEFAULT_OPTIONS = { striped: true, density: :default }.freeze
|
23
|
+
|
22
24
|
def initialize(records: nil, **options)
|
23
25
|
@records = records
|
24
|
-
|
25
|
-
@density = options.delete(:density) || :default
|
26
|
-
@options = options
|
26
|
+
build_options(options)
|
27
27
|
end
|
28
28
|
|
29
29
|
def tr_classes(level = :body)
|
@@ -5,13 +5,11 @@ module Componeer
|
|
5
5
|
|
6
6
|
attr_reader :text, :type, :size, :color, :shape, :options
|
7
7
|
|
8
|
+
DEFAULT_OPTIONS = { type: :default, size: :default, color: :gray, shape: :rounded }.freeze
|
9
|
+
|
8
10
|
def initialize(text = nil, **options)
|
9
11
|
@text = text
|
10
|
-
|
11
|
-
@size = options.delete(:size) || :default
|
12
|
-
@color = options.delete(:color) || :gray
|
13
|
-
@shape = options.delete(:shape) || :rounded
|
14
|
-
@options = options
|
12
|
+
build_options(options)
|
15
13
|
end
|
16
14
|
|
17
15
|
def base_classes
|
data/lib/componeer/version.rb
CHANGED