rao-component 0.0.49.pre → 0.0.51.pre

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: 02e931642e12f52c763ab40e717aa1e411e9aae65bd4dd2647c870c913652fcd
4
- data.tar.gz: 970f0abf6d4ff790a9228cfd06d6699b555c9c1120b17b686dacee13e5dc1887
3
+ metadata.gz: a1915f0837604520a6f488ac97370e9470ddd423f8418799d6781cb258a6a4d3
4
+ data.tar.gz: c59ff2dd3090293f436ed16c7ef41d5c513de9a5d3621025f443add587b34732
5
5
  SHA512:
6
- metadata.gz: ff01eb5de50df98bb35e1c535ab5828e201a6439976668a515b6f104750c1f58cdd54d68532ad9c6e6c464d23ad534b0c4d0ba8a92ac0212a12eb3915b8be1c5
7
- data.tar.gz: 224ff8999ccfca7fdc21cee7337d2ca54ada244906ae333622909ad28583bcf9b58d09292b67881bdc01e37f9df0fbca911c80bd627b67f911b26095a4b32df4
6
+ metadata.gz: c355081354e2ea9a2329ce688c19df2958515a31b688c971ae307cdb79907c7d78c9434e42e173f72a3bfbc3fe2fe53cd53c05320d7590051df1d263b09a3418
7
+ data.tar.gz: c167915645cd76eeae8871b52456ca5e8f97f8fd87fb4fc1876202cb1b41ee57f2c7f009cc24d03cc1f9f6016d068a5e01904a2725957395fec82c456ceac6ed
@@ -12,13 +12,14 @@ module Rao
12
12
  class CollectionTable < Base
13
13
  include AasmConcern
14
14
  include ActiveStorageConcern
15
- include AwesomeNestedSetConcern
16
- include ActsAsPublishedConcern
17
15
  include ActsAsListConcern
16
+ include ActsAsPublishedConcern
17
+ include AwesomeNestedSetConcern
18
18
  include BatchActionsConcern
19
19
  include BooleanConcern
20
- include EmailConcern
21
20
  include DateConcern
21
+ include EmailConcern
22
+ include MoneyConcern
22
23
  include ThumbnailConcern
23
24
 
24
25
  attr_reader :collection
@@ -15,6 +15,7 @@ module Rao
15
15
  include BooleanConcern
16
16
  include DateConcern
17
17
  include EmailConcern
18
+ include MoneyConcern
18
19
  include ThumbnailConcern
19
20
 
20
21
  SIZE_MAP = {
@@ -13,7 +13,8 @@ module Rao
13
13
  #
14
14
  # # app/carts/index.html.haml
15
15
  # = collection_table(collection: @carts) do |table|
16
- # = table.aasm :default
16
+ # = table.aasm_state :default
17
+ # = table.aasm_actions :default
17
18
  #
18
19
  # You will have to add a event triggering route to your resource:
19
20
  #
@@ -0,0 +1,12 @@
1
+ module Rao
2
+ module Component
3
+ module CollectionTable::MoneyConcern
4
+ extend ActiveSupport::Concern
5
+
6
+ def money(name, options = {}, &block)
7
+ options.reverse_merge!(render_as: :money)
8
+ column(name, options, &block)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ module Rao
2
+ module Component
3
+ module ResourceTable::MoneyConcern
4
+ extend ActiveSupport::Concern
5
+
6
+ def money(name, options = {}, &block)
7
+ options.reverse_merge!(render_as: :money)
8
+ row(name, options, &block)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -6,10 +6,18 @@
6
6
  end
7
7
  %table{ class: table_css_classes, id: "#{tr_prefix}-resource-table" }
8
8
  - rows.each do |name, options|
9
+ - title = options.delete(:title)
10
+ - if title.nil?
11
+ - if resource_class.respond_to?(:human_attribute_name)
12
+ - title = resource_class.human_attribute_name(name)
13
+ - else
14
+ - title = name
15
+ - elsif title === false
16
+ - title = nil
9
17
  %tr{ class: "attribute-#{name}", id: "#{tr_prefix}-#{name}"}
10
18
  - if resource_class.respond_to? :human_attribute_name
11
19
  %th{ class: 'attribute-name' }
12
- = resource_class.human_attribute_name(name)
20
+ = title
13
21
  - else
14
22
  %th{ class: 'attribute-name' }
15
23
  = name
@@ -1,4 +1,4 @@
1
- - if resource.send(name).attached?
1
+ - if resource.send(name)&.attached?
2
2
  = capture_haml do
3
3
  = link_to(main_app.url_for(resource.send(name)), class: 'btn btn-xs btn-primary btn-responsive') do
4
4
  %i.fas.fa-download
@@ -0,0 +1,3 @@
1
+
2
+ = capture_haml do
3
+ = humanized_money_with_symbol(resource.send(name))
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.49.pre
4
+ version: 0.0.51.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: 2023-04-11 00:00:00.000000000 Z
11
+ date: 2023-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -188,12 +188,14 @@ files:
188
188
  - app/concerns/rao/component/collection_table/boolean_concern.rb
189
189
  - app/concerns/rao/component/collection_table/date_concern.rb
190
190
  - app/concerns/rao/component/collection_table/email_concern.rb
191
+ - app/concerns/rao/component/collection_table/money_concern.rb
191
192
  - app/concerns/rao/component/collection_table/thumbnail_concern.rb
192
193
  - app/concerns/rao/component/resource_table/aasm_concern.rb
193
194
  - app/concerns/rao/component/resource_table/active_storage_concern.rb
194
195
  - app/concerns/rao/component/resource_table/boolean_concern.rb
195
196
  - app/concerns/rao/component/resource_table/date_concern.rb
196
197
  - app/concerns/rao/component/resource_table/email_concern.rb
198
+ - app/concerns/rao/component/resource_table/money_concern.rb
197
199
  - app/concerns/rao/component/resource_table/thumbnail_concern.rb
198
200
  - app/helpers/rao/component/application_helper.rb
199
201
  - app/views/rao/component/_collection_table.html.haml
@@ -210,6 +212,7 @@ files:
210
212
  - app/views/rao/component/table/body_cells/_date.html.haml
211
213
  - app/views/rao/component/table/body_cells/_default.html.haml
212
214
  - app/views/rao/component/table/body_cells/_email.html.haml
215
+ - app/views/rao/component/table/body_cells/_money.html.haml
213
216
  - app/views/rao/component/table/body_cells/_thumbnail.html.haml
214
217
  - app/views/rao/component/table/body_cells/_timestamp.html.haml
215
218
  - app/views/rao/component/table/header_cells/_batch_actions.html.haml
@@ -242,7 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
242
245
  - !ruby/object:Gem::Version
243
246
  version: 1.3.1
244
247
  requirements: []
245
- rubygems_version: 3.4.11
248
+ rubygems_version: 3.4.21
246
249
  signing_key:
247
250
  specification_version: 4
248
251
  summary: View Components for Ruby on Rails.