h2ocube_rails_helper 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/h2ocube_rails_helper.gemspec +1 -1
- data/lib/h2ocube_rails_helper.rb +4 -6
- data/test/render_html_class_test.rb +1 -1
- data/test/render_title_test.rb +21 -5
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6346f74f2f95a7d17d06881352fe5eb1b187a8f
|
4
|
+
data.tar.gz: ac1947c454d034146e3767acd706f4de4a8320dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c79e6db11803c7e4e3c1783afeacd6df37730567a5f06d0f5d40b281caf947f0df021036cfb5d8a18842c4f76a97049988909d18830600565cc60675f1327c68
|
7
|
+
data.tar.gz: f59b0f35fcdf60dac4c6146ed63b48ecea9f1cd431510153b0955fe045ea9fbd64ed7b0d1793ae745181ade9fa6977496ad8b6e4be4c896f1f426fece55a9f56
|
data/.travis.yml
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.name = 'h2ocube_rails_helper'
|
7
|
-
gem.version = '0.0.
|
7
|
+
gem.version = '0.0.16'
|
8
8
|
gem.authors = ['Ben']
|
9
9
|
gem.email = ['ben@h2ocube.com']
|
10
10
|
gem.description = %q{Just an helper collection}
|
data/lib/h2ocube_rails_helper.rb
CHANGED
@@ -38,16 +38,14 @@ end
|
|
38
38
|
def _title opts = {}
|
39
39
|
return [@_title] if defined?(@_title)
|
40
40
|
if defined?(@title)
|
41
|
-
title = @title.
|
41
|
+
title = @title.is_a?(Array) ? @title : [ @title.to_s ]
|
42
42
|
else
|
43
|
-
if defined?(
|
44
|
-
if
|
45
|
-
title = @item.title
|
46
|
-
end
|
43
|
+
if defined?(resource)
|
44
|
+
title = [resource.title, resource.class.model_name.human] if resource.respond_to?(:title) && resource.class.respond_to?(:model_name)
|
47
45
|
end
|
48
46
|
title ||= []
|
49
47
|
end
|
50
|
-
|
48
|
+
|
51
49
|
if opts.has_key? :title
|
52
50
|
title.push opts[:title]
|
53
51
|
else
|
data/test/render_title_test.rb
CHANGED
@@ -2,6 +2,9 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class RenderTitleClass < ActionView::TestCase
|
4
4
|
test 'simple' do
|
5
|
+
self.class_eval do
|
6
|
+
undef_method :resource
|
7
|
+
end
|
5
8
|
assert_equal render_title, '<title>title</title>'
|
6
9
|
end
|
7
10
|
|
@@ -12,9 +15,12 @@ class RenderTitleClass < ActionView::TestCase
|
|
12
15
|
assert_equal render_title, '<title>@title - title</title>'
|
13
16
|
end
|
14
17
|
|
15
|
-
test '
|
16
|
-
|
17
|
-
|
18
|
+
test 'resource' do
|
19
|
+
def resource
|
20
|
+
Resource.new
|
21
|
+
end
|
22
|
+
|
23
|
+
assert_equal render_title, '<title>Resource Name - Class Name - title</title>'
|
18
24
|
end
|
19
25
|
|
20
26
|
test '@_title' do
|
@@ -33,8 +39,18 @@ class HelperSettings
|
|
33
39
|
end
|
34
40
|
end
|
35
41
|
|
36
|
-
class
|
42
|
+
class ResourceModelName
|
43
|
+
def human
|
44
|
+
'Class Name'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
class Resource
|
37
49
|
def title
|
38
|
-
'
|
50
|
+
'Resource Name'
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.model_name
|
54
|
+
ResourceModelName.new
|
39
55
|
end
|
40
56
|
end
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: h2ocube_rails_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: settingslogic
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: browser
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
description: Just an helper collection
|
@@ -45,8 +45,8 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
-
- .gitignore
|
49
|
-
- .travis.yml
|
48
|
+
- ".gitignore"
|
49
|
+
- ".travis.yml"
|
50
50
|
- Gemfile
|
51
51
|
- LICENSE.txt
|
52
52
|
- README.md
|
@@ -93,17 +93,17 @@ require_paths:
|
|
93
93
|
- lib
|
94
94
|
required_ruby_version: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
|
-
- -
|
96
|
+
- - ">="
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '0'
|
99
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
105
|
rubyforge_project:
|
106
|
-
rubygems_version: 2.
|
106
|
+
rubygems_version: 2.2.1
|
107
107
|
signing_key:
|
108
108
|
specification_version: 4
|
109
109
|
summary: Just an helper collection
|