admino 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/admino/table/head_row.rb +5 -1
- data/lib/admino/table/row.rb +1 -1
- data/lib/admino/version.rb +1 -1
- data/spec/admino/table/head_row_spec.rb +29 -12
- data/spec/admino/table/row_spec.rb +6 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8452d6a30488e570a6db66b94321de492c261337
|
4
|
+
data.tar.gz: d45d064082c74e72675f15c85b0a1c2fbf1c2771
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 264b1621f826d1b0dd33020edb46e16b1228d5c788b2029315b524fd9f33e1e972e330968410e6518f0e6e89a1c0221e8faa55acef880b0b857338941e9c2f2f
|
7
|
+
data.tar.gz: 22ed8914aa029593876190c46ac5991155026e5bdbd4ef393ed2ec828db2e6e37d10365981347042e1704780959194aef68c291aa719d344bcae2399ae38394a
|
data/CHANGELOG.md
CHANGED
@@ -32,7 +32,11 @@ module Admino
|
|
32
32
|
def column(*args, &block)
|
33
33
|
attribute_name, label, html_options = parse_column_args(args)
|
34
34
|
|
35
|
-
label
|
35
|
+
if label.nil?
|
36
|
+
label = column_label(attribute_name)
|
37
|
+
elsif label.is_a? Symbol
|
38
|
+
label = column_label(label)
|
39
|
+
end
|
36
40
|
|
37
41
|
html_options = complete_column_html_options(
|
38
42
|
attribute_name,
|
data/lib/admino/table/row.rb
CHANGED
data/lib/admino/version.rb
CHANGED
@@ -17,7 +17,7 @@ module Admino
|
|
17
17
|
subject { row.to_html }
|
18
18
|
|
19
19
|
context 'text' do
|
20
|
-
context 'with label' do
|
20
|
+
context 'with string label' do
|
21
21
|
before do
|
22
22
|
row.column(:title, 'This is a title')
|
23
23
|
end
|
@@ -27,26 +27,43 @@ module Admino
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
+
context 'with symbol label and I18n set up' do
|
31
|
+
before do
|
32
|
+
I18n.backend.store_translations(
|
33
|
+
:en,
|
34
|
+
activemodel: { attributes: { post: { foo: 'This is foo' } } }
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
before do
|
39
|
+
row.column(:title, :foo)
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'generates a label with the human attribute name' do
|
43
|
+
should have_tag(:th, text: 'This is foo')
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
30
47
|
context 'with no label' do
|
31
48
|
before { row.column(:title) }
|
32
49
|
|
33
50
|
it 'generates a label with the titleized attribute name' do
|
34
51
|
should have_tag(:th, text: 'Title')
|
35
52
|
end
|
36
|
-
end
|
37
53
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
54
|
+
context 'with I18n set up' do
|
55
|
+
before do
|
56
|
+
I18n.backend.store_translations(
|
57
|
+
:en,
|
58
|
+
activemodel: { attributes: { post: { title: 'Post title' } } }
|
59
|
+
)
|
60
|
+
end
|
45
61
|
|
46
|
-
|
62
|
+
before { row.column(:title) }
|
47
63
|
|
48
|
-
|
49
|
-
|
64
|
+
it 'generates a label with the human attribute name' do
|
65
|
+
should have_tag(:th, text: 'Post title')
|
66
|
+
end
|
50
67
|
end
|
51
68
|
end
|
52
69
|
end
|
@@ -29,11 +29,16 @@ module Admino
|
|
29
29
|
it { should eq [nil, 'Title', {}] }
|
30
30
|
end
|
31
31
|
|
32
|
-
context 'with a
|
32
|
+
context 'with a symbol and string param' do
|
33
33
|
let(:arguments) { [:title, 'Title'] }
|
34
34
|
it { should eq [:title, 'Title', {}] }
|
35
35
|
end
|
36
36
|
|
37
|
+
context 'with two symbol params' do
|
38
|
+
let(:arguments) { [:title, :foo] }
|
39
|
+
it { should eq [:title, :foo, {}] }
|
40
|
+
end
|
41
|
+
|
37
42
|
context 'with options' do
|
38
43
|
let(:arguments) { [{ foo: 'bar' }] }
|
39
44
|
it { should eq [nil, nil, { foo: 'bar' }] }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: admino
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefano Verna
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: showcase
|