brhelper 3.0.4 → 3.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/brhelper.rb +2 -2
- data/lib/brhelper/br_form_helper.rb +4 -4
- data/lib/brhelper/br_form_options_helper.rb +6 -6
- data/lib/brhelper/version.rb +1 -1
- data/test/br_form_helper_test.rb +2 -2
- data/test/test_helper.rb +2 -2
- metadata +30 -8
data/Rakefile
CHANGED
data/lib/brhelper.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
$:.unshift(File.dirname(__FILE__)) unless
|
2
2
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
3
|
|
4
|
-
require 'rubygems'
|
4
|
+
require 'rubygems'
|
5
5
|
require 'action_controller'
|
6
6
|
require 'active_support'
|
7
7
|
require 'action_view'
|
8
8
|
|
9
|
-
|
9
|
+
|
10
10
|
%w(version
|
11
11
|
br_form_options_helper
|
12
12
|
br_form_helper).each {|req| require File.dirname(__FILE__) + "/brhelper/#{req}"}
|
@@ -1,13 +1,13 @@
|
|
1
1
|
module ActionView::Helpers::FormHelper
|
2
|
-
|
2
|
+
|
3
3
|
# Helper para seleção de sexo com radio_buttom.
|
4
4
|
def radio_button_sexo(object, method, options_radio_male = {}, options_radio_female = {})
|
5
5
|
options_male = { }.update(options_radio_male.stringify_keys)
|
6
6
|
options_female = { }.update(options_radio_female.stringify_keys)
|
7
|
-
|
7
|
+
|
8
8
|
op1= radio_button(object, method, 'M', options_male)
|
9
9
|
op2 = radio_button(object, method, 'F', options_female)
|
10
|
-
|
10
|
+
|
11
11
|
"#{op1} Masculino\n#{op2} Feminino"
|
12
|
-
end
|
12
|
+
end
|
13
13
|
end
|
@@ -18,7 +18,7 @@ module ActionView::Helpers::FormOptionsHelper
|
|
18
18
|
["Paraná", "PR"],
|
19
19
|
["Pernambuco", "PE"],
|
20
20
|
["Piauí", "PI"],
|
21
|
-
["Rio de Janeiro", "RJ"],
|
21
|
+
["Rio de Janeiro", "RJ"],
|
22
22
|
["Rio Grande do Norte", "RN"],
|
23
23
|
["Rio Grande do Sul", "RS"],
|
24
24
|
["Rondônia", "RO"],
|
@@ -28,13 +28,13 @@ module ActionView::Helpers::FormOptionsHelper
|
|
28
28
|
["Sergipe", "SE"],
|
29
29
|
["Tocantins", "TO"]
|
30
30
|
] unless const_defined?("ESTADOS_BRASILEIROS")
|
31
|
-
|
31
|
+
|
32
32
|
# Helper para montar um select para seleção de estados brasileiros por nome,
|
33
33
|
# mas com armazenamento da sigla.
|
34
34
|
def select_estado(object, method, options = {}, html_options = {})
|
35
35
|
select object, method, ESTADOS_BRASILEIROS, options, html_options
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
# Helper para montar um select para seleção de estados brasileiros por sigla.
|
39
39
|
def select_uf(object, method, options = {}, html_options = {})
|
40
40
|
select object, method, ESTADOS_BRASILEIROS.collect {|estado, sigla| sigla}, options, html_options
|
@@ -45,14 +45,14 @@ module ActionView::Helpers::FormOptionsHelper
|
|
45
45
|
def option_estados_for_select
|
46
46
|
options_for_select ESTADOS_BRASILEIROS
|
47
47
|
end
|
48
|
-
|
48
|
+
|
49
49
|
# Retorna uma string com a lista de estados brasileiros para usar em uma tag select,
|
50
50
|
# com exibição e armazenamento a sigla.
|
51
51
|
def option_uf_for_select
|
52
52
|
options_for_select ESTADOS_BRASILEIROS.collect {|nome,sigla| sigla}
|
53
53
|
end
|
54
|
-
|
55
|
-
# Helper para montar um select para seleção de sexo, armazenando apenas a
|
54
|
+
|
55
|
+
# Helper para montar um select para seleção de sexo, armazenando apenas a
|
56
56
|
# inicial.
|
57
57
|
def select_sexo(object, method, options = {}, html_options = {})
|
58
58
|
select object, method, [['Masculino', 'M'], ['Feminino', 'F']], options, html_options
|
data/lib/brhelper/version.rb
CHANGED
data/test/br_form_helper_test.rb
CHANGED
@@ -4,9 +4,9 @@ require 'net/http'
|
|
4
4
|
require 'mocha'
|
5
5
|
|
6
6
|
class BrFormHelperTest < Test::Unit::TestCase
|
7
|
-
|
7
|
+
|
8
8
|
include ActionView::Helpers::FormHelper
|
9
|
-
|
9
|
+
|
10
10
|
def test_radios_sexo
|
11
11
|
radio_m = '<input id="lancamento_sexo_m" name="lancamento[sexo]" type="radio" value="M" /> Masculino'
|
12
12
|
radio_f = '<input id="lancamento_sexo_f" name="lancamento[sexo]" type="radio" value="F" /> Feminino'
|
data/test/test_helper.rb
CHANGED
@@ -4,8 +4,8 @@ require File.dirname(__FILE__) + '/../lib/brhelper'
|
|
4
4
|
def tornar_metodos_publicos(clazz)
|
5
5
|
clazz.class_eval do
|
6
6
|
private_instance_methods.each { |instance_method| public instance_method }
|
7
|
-
private_methods.each { |method| public_class_method method }
|
8
|
-
end
|
7
|
+
private_methods.each { |method| public_class_method method }
|
8
|
+
end
|
9
9
|
end
|
10
10
|
|
11
11
|
def p80 text
|
metadata
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brhelper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 3
|
7
|
+
- 0
|
8
|
+
- 5
|
9
|
+
version: 3.0.5
|
6
10
|
platform: ruby
|
7
11
|
authors:
|
8
12
|
- "Marcos Tapaj\xC3\xB3s"
|
@@ -16,52 +20,64 @@ autorequire:
|
|
16
20
|
bindir: bin
|
17
21
|
cert_chain: []
|
18
22
|
|
19
|
-
date:
|
23
|
+
date: 2012-01-02 00:00:00 -02:00
|
20
24
|
default_executable:
|
21
25
|
dependencies:
|
22
26
|
- !ruby/object:Gem::Dependency
|
23
27
|
name: actionpack
|
24
|
-
prerelease: false
|
25
28
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
29
|
none: false
|
27
30
|
requirements:
|
28
31
|
- - ">="
|
29
32
|
- !ruby/object:Gem::Version
|
33
|
+
segments:
|
34
|
+
- 3
|
35
|
+
- 0
|
36
|
+
- 0
|
30
37
|
version: 3.0.0
|
31
38
|
type: :runtime
|
39
|
+
prerelease: false
|
32
40
|
version_requirements: *id001
|
33
41
|
- !ruby/object:Gem::Dependency
|
34
42
|
name: activesupport
|
35
|
-
prerelease: false
|
36
43
|
requirement: &id002 !ruby/object:Gem::Requirement
|
37
44
|
none: false
|
38
45
|
requirements:
|
39
46
|
- - ">="
|
40
47
|
- !ruby/object:Gem::Version
|
48
|
+
segments:
|
49
|
+
- 3
|
50
|
+
- 0
|
51
|
+
- 0
|
41
52
|
version: 3.0.0
|
42
53
|
type: :runtime
|
54
|
+
prerelease: false
|
43
55
|
version_requirements: *id002
|
44
56
|
- !ruby/object:Gem::Dependency
|
45
57
|
name: rake
|
46
|
-
prerelease: false
|
47
58
|
requirement: &id003 !ruby/object:Gem::Requirement
|
48
59
|
none: false
|
49
60
|
requirements:
|
50
61
|
- - ">="
|
51
62
|
- !ruby/object:Gem::Version
|
63
|
+
segments:
|
64
|
+
- 0
|
52
65
|
version: "0"
|
53
66
|
type: :development
|
67
|
+
prerelease: false
|
54
68
|
version_requirements: *id003
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: mocha
|
57
|
-
prerelease: false
|
58
71
|
requirement: &id004 !ruby/object:Gem::Requirement
|
59
72
|
none: false
|
60
73
|
requirements:
|
61
74
|
- - ">="
|
62
75
|
- !ruby/object:Gem::Version
|
76
|
+
segments:
|
77
|
+
- 0
|
63
78
|
version: "0"
|
64
79
|
type: :development
|
80
|
+
prerelease: false
|
65
81
|
version_requirements: *id004
|
66
82
|
description: "brhelper \xC3\xA9 uma das gems que compoem o Brazilian Rails"
|
67
83
|
email:
|
@@ -104,17 +120,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
104
120
|
requirements:
|
105
121
|
- - ">="
|
106
122
|
- !ruby/object:Gem::Version
|
123
|
+
hash: -3217744503147915179
|
124
|
+
segments:
|
125
|
+
- 0
|
107
126
|
version: "0"
|
108
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
128
|
none: false
|
110
129
|
requirements:
|
111
130
|
- - ">="
|
112
131
|
- !ruby/object:Gem::Version
|
132
|
+
hash: -3217744503147915179
|
133
|
+
segments:
|
134
|
+
- 0
|
113
135
|
version: "0"
|
114
136
|
requirements:
|
115
137
|
- none
|
116
138
|
rubyforge_project: brhelper
|
117
|
-
rubygems_version: 1.
|
139
|
+
rubygems_version: 1.3.7
|
118
140
|
signing_key:
|
119
141
|
specification_version: 3
|
120
142
|
summary: "brhelper \xC3\xA9 uma das gems que compoem o Brazilian Rails"
|