effective_bootstrap 1.14.11 → 1.14.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/effective/table_builder.rb +12 -0
- data/app/models/effective/table_rows/date_field.rb +30 -0
- data/app/models/effective/table_rows/datetime_field.rb +30 -0
- data/app/models/effective/table_rows/phone_field.rb +16 -0
- data/app/models/effective/table_rows/url_field.rb +1 -1
- data/lib/effective_bootstrap/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da449090f0915cf6fbf42994401f49056bcc5fe1e1f6e45130b885f138cee53d
|
4
|
+
data.tar.gz: 5a8b92d846eb7ab5d6c1cfe644cf38cde4bda42600f87d18ee4dff7d5dbe9a8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af6d95df0e83cb5dbb65a11f3666be5ef22a9f91797455e53343ceaecbdb4a2eb87ac9a2bcbdadbac9a20427bd55de0778829ca92859a02e74d7e2b905629dbf
|
7
|
+
data.tar.gz: 738864c3b53d675f58eef22f2ca32c72df0c628e59a25da0087c2f24ad4f62a95b51038ebf75e8a61a00bf7e3c740364fafafc9a6ad38a41c3d2ef86652063ed
|
@@ -119,6 +119,14 @@ module Effective
|
|
119
119
|
rows[name] = TableRows::BelongsTo.new(name, options, builder: self).to_html
|
120
120
|
end
|
121
121
|
|
122
|
+
def date_field(name, options = {})
|
123
|
+
rows[name] = TableRows::DateField.new(name, options, builder: self).to_html
|
124
|
+
end
|
125
|
+
|
126
|
+
def datetime_field(name, options = {})
|
127
|
+
rows[name] = TableRows::DatetimeField.new(name, options, builder: self).to_html
|
128
|
+
end
|
129
|
+
|
122
130
|
def email_field(name, options = {})
|
123
131
|
rows[name] = TableRows::EmailField.new(name, options, builder: self).to_html
|
124
132
|
end
|
@@ -152,6 +160,10 @@ module Effective
|
|
152
160
|
rows[name] = TableRows::PercentField.new(name, options, builder: self).to_html
|
153
161
|
end
|
154
162
|
|
163
|
+
def tel_field(name, options = {})
|
164
|
+
rows[name] = TableRows::PhoneField.new(name, options, builder: self).to_html
|
165
|
+
end
|
166
|
+
|
155
167
|
def price_field(name, options = {})
|
156
168
|
rows[name] = TableRows::PriceField.new(name, options, builder: self).to_html
|
157
169
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Effective
|
4
|
+
module TableRows
|
5
|
+
class DateField < Effective::TableRow
|
6
|
+
|
7
|
+
def content
|
8
|
+
nice_date(value)
|
9
|
+
end
|
10
|
+
|
11
|
+
def nice_date(value)
|
12
|
+
return unless value.respond_to?(:strftime)
|
13
|
+
|
14
|
+
label = value.strftime("%b %-d, %Y")
|
15
|
+
full = value.strftime("%A %b %-d, %Y %l:%M%P %z")
|
16
|
+
|
17
|
+
now = Time.zone.now
|
18
|
+
|
19
|
+
distance = if (now > value)
|
20
|
+
template.distance_of_time_in_words(now, value) + ' ago'
|
21
|
+
else
|
22
|
+
template.distance_of_time_in_words(value, now) + ' from now'
|
23
|
+
end
|
24
|
+
|
25
|
+
content_tag(:span, label, title: full + ' (' + distance + ')')
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Effective
|
4
|
+
module TableRows
|
5
|
+
class DatetimeField < Effective::TableRow
|
6
|
+
|
7
|
+
def content
|
8
|
+
nice_date_time(value)
|
9
|
+
end
|
10
|
+
|
11
|
+
def nice_date_time(value)
|
12
|
+
return unless value.respond_to?(:strftime)
|
13
|
+
|
14
|
+
label = value.strftime("%b %-d, %Y %l:%M%P")
|
15
|
+
full = value.strftime("%A %b %-d, %Y %l:%M%P %z")
|
16
|
+
|
17
|
+
now = Time.zone.now
|
18
|
+
|
19
|
+
distance = if (now > value)
|
20
|
+
template.distance_of_time_in_words(now, value) + ' ago'
|
21
|
+
else
|
22
|
+
template.distance_of_time_in_words(value, now) + ' from now'
|
23
|
+
end
|
24
|
+
|
25
|
+
content_tag(:span, label, title: full + ' (' + distance + ')')
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Effective
|
4
|
+
module TableRows
|
5
|
+
class PhoneField < Effective::TableRow
|
6
|
+
|
7
|
+
def content
|
8
|
+
return unless value.present?
|
9
|
+
|
10
|
+
digits = value.split('x').first.delete('^0-9')
|
11
|
+
link_to(value, "tel:+1#{digits}")
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_bootstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.14.
|
4
|
+
version: 1.14.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -700,10 +700,13 @@ files:
|
|
700
700
|
- app/models/effective/table_rows/boolean.rb
|
701
701
|
- app/models/effective/table_rows/collection.rb
|
702
702
|
- app/models/effective/table_rows/content_for.rb
|
703
|
+
- app/models/effective/table_rows/date_field.rb
|
704
|
+
- app/models/effective/table_rows/datetime_field.rb
|
703
705
|
- app/models/effective/table_rows/effective_address.rb
|
704
706
|
- app/models/effective/table_rows/email_field.rb
|
705
707
|
- app/models/effective/table_rows/file_field.rb
|
706
708
|
- app/models/effective/table_rows/percent_field.rb
|
709
|
+
- app/models/effective/table_rows/phone_field.rb
|
707
710
|
- app/models/effective/table_rows/price_field.rb
|
708
711
|
- app/models/effective/table_rows/text_area.rb
|
709
712
|
- app/models/effective/table_rows/url_field.rb
|