rao-component 0.0.49.pre → 0.0.50.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: 02e931642e12f52c763ab40e717aa1e411e9aae65bd4dd2647c870c913652fcd
4
- data.tar.gz: 970f0abf6d4ff790a9228cfd06d6699b555c9c1120b17b686dacee13e5dc1887
3
+ metadata.gz: 15a9292069f01adcac406f38d05fa59b1901d0f39f01d767d7bf7da21ac4e3e2
4
+ data.tar.gz: c2ec28c9799f9aa56cce9d2f00c7cffe52bba1a8cab72a8d3b87f229987d0e0c
5
5
  SHA512:
6
- metadata.gz: ff01eb5de50df98bb35e1c535ab5828e201a6439976668a515b6f104750c1f58cdd54d68532ad9c6e6c464d23ad534b0c4d0ba8a92ac0212a12eb3915b8be1c5
7
- data.tar.gz: 224ff8999ccfca7fdc21cee7337d2ca54ada244906ae333622909ad28583bcf9b58d09292b67881bdc01e37f9df0fbca911c80bd627b67f911b26095a4b32df4
6
+ metadata.gz: b3a0e7f21fcd9d15615a6a2fe398c7783e031102ef1d30c6dbcf94644daee4168076cc6fc61711b7e4364e1e9543699fc9d14d8ebada7f0003e2e58e8b264817
7
+ data.tar.gz: f6b06c9f9a0f8bf7db4943a794804d5cb7a7f8a0cb5009b5f3ec1eb26cc6719432848e87bf0f172264cfd7f827cbfddda0cf3c267d9ac1d689e6325727f03738
@@ -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.50.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-16 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.20
246
249
  signing_key:
247
250
  specification_version: 4
248
251
  summary: View Components for Ruby on Rails.