rao-component 0.0.12.pre → 0.0.13.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/app/components/rao/component/collection_table.rb +5 -0
- data/app/components/rao/component/resource_table.rb +3 -0
- data/app/concerns/rao/component/collection_table/date_concern.rb +12 -0
- data/app/concerns/rao/component/collection_table/email_concern.rb +12 -0
- data/app/concerns/rao/component/collection_table/thumbnail_concern.rb +12 -0
- data/app/concerns/rao/component/resource_table/date_concern.rb +12 -0
- data/app/concerns/rao/component/resource_table/email_concern.rb +12 -0
- data/app/concerns/rao/component/resource_table/thumbnail_concern.rb +12 -0
- data/app/views/rao/component/table/body_cells/_acts_as_published.html.haml +2 -3
- data/app/views/rao/component/table/body_cells/_association.html.haml +18 -17
- data/app/views/rao/component/table/body_cells/_date.html.haml +7 -0
- data/app/views/rao/component/table/body_cells/_email.html.haml +1 -0
- data/app/views/rao/component/table/body_cells/_thumbnail.html.haml +2 -0
- data/config/locales/de.yml +10 -1
- data/config/locales/en.yml +10 -1
- data/lib/generators/rao/component/templates/initializer.rb +21 -0
- data/lib/rao/component/configuration.rb +7 -0
- data/lib/rao/component.rb +3 -1
- data/lib/rao-component.rb +1 -1
- metadata +12 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c0613885c558246bc228999d7f7d3a91444b77a76731257393fd8c8991b3b318
|
4
|
+
data.tar.gz: 0014e3e575b034b41cd3b4a5d34734ab666017c797c236532369fec1b76126a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d606c60b4a3ddeb307279fbab0bf9d0f2fe9f9ea3b942a8443704b82b307ce9538a0713d082938e6a0224cf44b4c691cd06bc68f552a3effc91b668d090257bb
|
7
|
+
data.tar.gz: e70869a49f4b2548acd9e8ded0385b63ec2a9eefaf4ce3605f0f165078ecb61bae5ead63eef11819b9161e3609a892ba08e30740904a71c440ed65ca548e5de7
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Rao
|
2
|
+
module Component
|
3
|
+
module CollectionTable::DateConcern
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
def date(name, options = {}, &block)
|
7
|
+
options.reverse_merge!(render_as: :date, format: Rao::Component::Configuration.table_default_date_format)
|
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 CollectionTable::ThumbnailConcern
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
def thumbnail(name, options = {}, &block)
|
7
|
+
options.reverse_merge!(render_as: :thumbnail, variant_options: Rao::Component::Configuration.image_variant_options[:collection])
|
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::DateConcern
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
def date(name, options = {}, &block)
|
7
|
+
options.reverse_merge!(render_as: :date, format: Rao::Component::Configuration.table_default_date_format)
|
8
|
+
row(name, options, &block)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Rao
|
2
|
+
module Component
|
3
|
+
module ResourceTable::ThumbnailConcern
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
def thumbnail(name, options = {}, &block)
|
7
|
+
options.reverse_merge!(render_as: :thumbnail, variant_options: Rao::Component::Configuration.image_variant_options[:resource])
|
8
|
+
row(name, options, &block)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -1,11 +1,10 @@
|
|
1
|
-
- link_path = controller.url_for(action: :toggle_published, id: resource.to_param)
|
2
1
|
- if resource.published?
|
3
|
-
= button_to(
|
2
|
+
= button_to([:toggle_published, resource], class: 'btn btn-sm btn-xs btn-danger btn-responsive', method: :post) do
|
4
3
|
%i.fas.fa-eye-slash
|
5
4
|
%span.glyphicon.glyphicon-eye-close
|
6
5
|
%span.btn-text= t('.unpublish', default: t('acts_as_published.actions.unpublish'))
|
7
6
|
- else
|
8
|
-
= button_to(
|
7
|
+
= button_to([:toggle_published, resource], class: 'btn btn-sm btn-xs btn-success btn-responsive', method: :post) do
|
9
8
|
%i.fas.fa-eye
|
10
9
|
%span.glyphicon.glyphicon-eye-open
|
11
10
|
%span.btn-text= t('.publish', default: t('acts_as_published.actions.publish'))
|
@@ -1,18 +1,19 @@
|
|
1
|
-
-
|
2
|
-
-
|
1
|
+
- if resource.send(name).present?
|
2
|
+
- label = if options[:label_method].present?
|
3
|
+
- case options[:label_method]
|
4
|
+
- when Proc
|
5
|
+
- options[:label_method].call(resource.send(name))
|
6
|
+
- else
|
7
|
+
- resource.send(name).try(options[:label_method])
|
8
|
+
- else
|
9
|
+
- resource.send(name)
|
10
|
+
- link_to = options[:link_to]
|
11
|
+
- case link_to
|
3
12
|
- when Proc
|
4
|
-
|
5
|
-
-
|
6
|
-
|
7
|
-
-
|
8
|
-
|
9
|
-
-
|
10
|
-
|
11
|
-
- when Proc
|
12
|
-
= link_to(label, link_to.call(resource))
|
13
|
-
- when String
|
14
|
-
= link_to(label, link_to)
|
15
|
-
- when Symbol
|
16
|
-
= link_to(label, send(link_to))
|
17
|
-
- when nil
|
18
|
-
= label
|
13
|
+
= link_to(label, link_to.call(resource))
|
14
|
+
- when String
|
15
|
+
= link_to(label, link_to)
|
16
|
+
- when Symbol
|
17
|
+
= link_to(label, send(link_to))
|
18
|
+
- when nil
|
19
|
+
= label
|
@@ -0,0 +1 @@
|
|
1
|
+
= mail_to(resource.send(name))
|
data/config/locales/de.yml
CHANGED
@@ -10,6 +10,7 @@ de:
|
|
10
10
|
edit: Bearbeiten
|
11
11
|
show: Anzeigen
|
12
12
|
download: Download
|
13
|
+
visit: Öffnen
|
13
14
|
table:
|
14
15
|
body_cells:
|
15
16
|
boolean:
|
@@ -18,4 +19,12 @@ de:
|
|
18
19
|
header_cells:
|
19
20
|
batch_actions:
|
20
21
|
title: Stapelverarbeitung
|
21
|
-
destroy: Löschen
|
22
|
+
destroy: Löschen
|
23
|
+
publish: Veröffentlichen
|
24
|
+
unpublish: Zurückziehen
|
25
|
+
date:
|
26
|
+
formats:
|
27
|
+
short_with_year: "%d.%m.%Y"
|
28
|
+
time:
|
29
|
+
formats:
|
30
|
+
short_with_year: "%d.%m.%Y %H:%M:%S"
|
data/config/locales/en.yml
CHANGED
@@ -10,6 +10,7 @@ en:
|
|
10
10
|
edit: Edit
|
11
11
|
show: Show
|
12
12
|
download: Download
|
13
|
+
visit: Open
|
13
14
|
table:
|
14
15
|
body_cells:
|
15
16
|
boolean:
|
@@ -18,4 +19,12 @@ en:
|
|
18
19
|
header_cells:
|
19
20
|
batch_actions:
|
20
21
|
title: Batch actions
|
21
|
-
destroy: Delete
|
22
|
+
destroy: Delete
|
23
|
+
publish: Publish
|
24
|
+
unpublish: Unpublish
|
25
|
+
date:
|
26
|
+
formats:
|
27
|
+
short_with_year: "%Y-%m-%d"
|
28
|
+
time:
|
29
|
+
formats:
|
30
|
+
short_with_year: "%Y-%m-%d %I:%M:%S %p"
|
@@ -4,4 +4,25 @@ Rao::Component.configure do |config|
|
|
4
4
|
# Default: config.table_default_timestamp_format = nil
|
5
5
|
#
|
6
6
|
config.table_default_timestamp_format = nil
|
7
|
+
|
8
|
+
# Set the default format for dates in tables.
|
9
|
+
#
|
10
|
+
# Default: config.table_default_date_format = nil
|
11
|
+
#
|
12
|
+
config.table_default_date_format = nil
|
13
|
+
|
14
|
+
|
15
|
+
# Image variant options for images in tables
|
16
|
+
#
|
17
|
+
# default:
|
18
|
+
#
|
19
|
+
# config.image_variant_options = {
|
20
|
+
# collection: { resize: "160x120" },
|
21
|
+
# resource: { resize: "320x240" }
|
22
|
+
# }
|
23
|
+
#
|
24
|
+
config.image_variant_options = {
|
25
|
+
collection: { resize: "160x120" },
|
26
|
+
resource: { resize: "320x240" }
|
27
|
+
}
|
7
28
|
end
|
@@ -6,6 +6,13 @@ module Rao
|
|
6
6
|
end
|
7
7
|
|
8
8
|
mattr_accessor(:table_default_timestamp_format) { nil }
|
9
|
+
mattr_accessor(:table_default_date_format) { nil }
|
10
|
+
mattr_accessor(:image_variant_options) {
|
11
|
+
{
|
12
|
+
collection: { resize: "160x120" },
|
13
|
+
resource: { resize: "320x240" }
|
14
|
+
}
|
15
|
+
}
|
9
16
|
end
|
10
17
|
end
|
11
18
|
end
|
data/lib/rao/component.rb
CHANGED
data/lib/rao-component.rb
CHANGED
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.
|
4
|
+
version: 0.0.13.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: 2019-
|
11
|
+
date: 2019-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -183,7 +183,13 @@ files:
|
|
183
183
|
- app/concerns/rao/component/collection_table/awesome_nested_set_concern.rb
|
184
184
|
- app/concerns/rao/component/collection_table/batch_actions_concern.rb
|
185
185
|
- app/concerns/rao/component/collection_table/boolean_concern.rb
|
186
|
+
- app/concerns/rao/component/collection_table/date_concern.rb
|
187
|
+
- app/concerns/rao/component/collection_table/email_concern.rb
|
188
|
+
- app/concerns/rao/component/collection_table/thumbnail_concern.rb
|
186
189
|
- app/concerns/rao/component/resource_table/boolean_concern.rb
|
190
|
+
- app/concerns/rao/component/resource_table/date_concern.rb
|
191
|
+
- app/concerns/rao/component/resource_table/email_concern.rb
|
192
|
+
- app/concerns/rao/component/resource_table/thumbnail_concern.rb
|
187
193
|
- app/helpers/rao/component/application_helper.rb
|
188
194
|
- app/views/rao/component/_collection_table.html.haml
|
189
195
|
- app/views/rao/component/_resource_table.html.haml
|
@@ -193,7 +199,10 @@ files:
|
|
193
199
|
- app/views/rao/component/table/body_cells/_awesome_nested_set.html.haml
|
194
200
|
- app/views/rao/component/table/body_cells/_batch_actions.html.haml
|
195
201
|
- app/views/rao/component/table/body_cells/_boolean.html.haml
|
202
|
+
- app/views/rao/component/table/body_cells/_date.html.haml
|
196
203
|
- app/views/rao/component/table/body_cells/_default.html.haml
|
204
|
+
- app/views/rao/component/table/body_cells/_email.html.haml
|
205
|
+
- app/views/rao/component/table/body_cells/_thumbnail.html.haml
|
197
206
|
- app/views/rao/component/table/body_cells/_timestamp.html.haml
|
198
207
|
- app/views/rao/component/table/header_cells/_batch_actions.html.haml
|
199
208
|
- config/locales/de.yml
|
@@ -224,8 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
224
233
|
- !ruby/object:Gem::Version
|
225
234
|
version: 1.3.1
|
226
235
|
requirements: []
|
227
|
-
|
228
|
-
rubygems_version: 2.6.14
|
236
|
+
rubygems_version: 3.0.2
|
229
237
|
signing_key:
|
230
238
|
specification_version: 4
|
231
239
|
summary: View Components for Ruby on Rails.
|