rao-component 0.0.47.pre → 0.0.48.pre

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: 065bf20df7085dc313a9effc1e2b6fb94e1a178d35e832b74dbf38b4319ae53d
4
- data.tar.gz: f6ff1776e565c3abe7463629502946eaa9f892ee3dc4bef49ac568e1b70b0ad2
3
+ metadata.gz: 8f4ac5d5ed82bac75905e6823feb4739e79342826e41db0fe703b8289edd8ab1
4
+ data.tar.gz: c14f34f46df0809f913f87f192fbd297e1a0e9e1ae336b4dcdca18f9aa3b0645
5
5
  SHA512:
6
- metadata.gz: 32362d8f3cd08fff8b77cc98c066c3c9af9a269d653c93d169f868eb527cccefd97c26dfae493a338df01353df4b41c596b124368d5994f1242c3aeed539d357
7
- data.tar.gz: e6ef6848a88c691665ea76873a276812f0eb67022139a1959ebd2aef9c6ec766f31e1ef62003088a77f0b5987c57be594406ce33a1f10c2d14e20d53f2a58090
6
+ metadata.gz: 4fbd5608daee90d8fc4ed7c7b9a7e95baccffa4460b5b1bba4d84b78a5879223f575005c46a52fd03e3d15228afc98d46a388b52d01ef1c00a1d6ff7fe726598
7
+ data.tar.gz: 7e3e83a2c6bf33b1b054c62684bad5d86067d7228e38c1e0bfd815bbfd8456f81e97aa20c42ff9b73286354b0e4919ea4dddec0223ec5c933e866f62276535f6
@@ -38,6 +38,10 @@ module Rao
38
38
  @resource_class = @options.delete(:resource_class) || @collection.first.class
39
39
  end
40
40
 
41
+ def tr_html=(value)
42
+ @tr_html = value
43
+ end
44
+
41
45
  def column(name, options = {}, &block)
42
46
  options.reverse_merge!(render_as: :default)
43
47
  options.reverse_merge!(block: block) if block_given?
@@ -79,7 +83,8 @@ module Rao
79
83
  collection: @collection,
80
84
  resource_class: @resource_class,
81
85
  table_css_classes: table_css_classes,
82
- show_header: show_header
86
+ show_header: show_header,
87
+ tr_html: @tr_html || {}
83
88
  }
84
89
  end
85
90
 
@@ -124,7 +129,7 @@ module Rao
124
129
  end
125
130
 
126
131
  def t(key, options = {})
127
- I18n.t("#{self.class.name.underscore.gsub('/', '.')}#{key}", options)
132
+ I18n.t("#{self.class.name.underscore.gsub('/', '.')}#{key}", **options)
128
133
  end
129
134
  end
130
135
  end
@@ -12,19 +12,24 @@
12
12
  - elsif title === false
13
13
  - title = nil
14
14
  - if options.has_key?(:sort)
15
- %td= sort_link(name, title, options[:sort])
15
+ %th= sort_link(name, title, options[:sort])
16
16
  - else
17
- %td= title
17
+ %th= title
18
18
  %tbody
19
- - collection.each do |resource|
19
+ - collection.each_with_index do |resource, index|
20
20
  - tr_options = { class: resource_class.name.underscore.gsub('/', '-') }
21
21
  - if resource.respond_to?(:model_name)
22
22
  - tr_options[:id] = dom_id(resource)
23
23
  - else
24
24
  - tr_options[:id] = "#{resource.class.name.underscore.gsub('/', '-')}-#{resource.object_id}"
25
- %tr{ tr_options }
25
+
26
+ %tr{ tr_options.merge(tr_html.respond_to?(:call) ? (tr_html.call(resource, index) || {}) : (tr_html || {})) }
26
27
  - columns.each do |name, options|
27
- - td_options = { class: "attribute-#{name}", id: "#{tr_options[:id]}-#{name}"}
28
+ - td_html = if options[:td_html].respond_to?(:call)
29
+ - options[:td_html].call(resource) || {}
30
+ - else
31
+ - options[:td_html] || {}
32
+ - td_options = { class: ["attribute-#{name}", td_html.delete(:class)].compact.join(" "), id: "#{tr_options[:id]}-#{name}" }.merge(td_html)
28
33
  - if options[:block].present?
29
34
  %td{ td_options }= options[:block].call(resource)
30
35
  - else
@@ -13,8 +13,12 @@ de:
13
13
  download: Download
14
14
  visit: Öffnen
15
15
  resource_table:
16
+ destroy: Löschen
16
17
  destroy_confirmation: Sind Sie sicher?
18
+ edit: Bearbeiten
19
+ show: Anzeigen
17
20
  download: Download
21
+ visit: Öffnen
18
22
  table:
19
23
  body_cells:
20
24
  boolean:
@@ -13,8 +13,12 @@ en:
13
13
  download: Download
14
14
  visit: Open
15
15
  resource_table:
16
+ destroy: Delete
16
17
  destroy_confirmation: Are you sure?
18
+ edit: Edit
19
+ show: Show
17
20
  download: Download
21
+ visit: Open
18
22
  table:
19
23
  body_cells:
20
24
  boolean:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rao-component
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.47.pre
4
+ version: 0.0.48.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Vasquez Angel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-25 00:00:00.000000000 Z
11
+ date: 2021-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '6.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '6.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rao
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.3.6
61
+ version: '1.4'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.3.6
68
+ version: '1.4'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec-rails
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -211,7 +211,6 @@ files:
211
211
  - app/views/rao/component/table/body_cells/_default.html.haml
212
212
  - app/views/rao/component/table/body_cells/_email.html.haml
213
213
  - app/views/rao/component/table/body_cells/_thumbnail.html.haml
214
- - app/views/rao/component/table/body_cells/_thumbnail.html.haml~
215
214
  - app/views/rao/component/table/body_cells/_timestamp.html.haml
216
215
  - app/views/rao/component/table/header_cells/_batch_actions.html.haml
217
216
  - config/initializers/assets.rb
@@ -236,14 +235,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
236
235
  requirements:
237
236
  - - ">="
238
237
  - !ruby/object:Gem::Version
239
- version: '0'
238
+ version: 2.6.0
240
239
  required_rubygems_version: !ruby/object:Gem::Requirement
241
240
  requirements:
242
241
  - - ">"
243
242
  - !ruby/object:Gem::Version
244
243
  version: 1.3.1
245
244
  requirements: []
246
- rubygems_version: 3.1.4
245
+ rubygems_version: 3.2.24
247
246
  signing_key:
248
247
  specification_version: 4
249
248
  summary: View Components for Ruby on Rails.
@@ -1,6 +0,0 @@
1
- - if resource.send(name).present? && resource.send(name).respond_to?(:variant)
2
- - begin
3
- - image_html = options[:image_html] || { src: main_app.url_for(resource.send(name).variant(options[:variant_options])) }
4
- - rescue ActiveStorage::InvariableError => e
5
- - image_html = { src: main_app.url_for(resource.send(name)) }
6
- %img{ image_html }