bsforforms 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0cd75baecfa293addd070769b89a79f5e0d314ac
4
- data.tar.gz: 239a352a76ffb134ed2394a5815eab6f219735b5
3
+ metadata.gz: 2909e153a11ec89fba6512f018a93c9f0eb25260
4
+ data.tar.gz: 849c43eb6c45daab92a102da232c61c77e3d6a1c
5
5
  SHA512:
6
- metadata.gz: b4ac6ffb776faea72de58bfb34b51d09682882d86ac8692381af93db461951892462600e5b8ffefe55319a107e77dc534ab5228fc79ac649f85339f3efd1a0b8
7
- data.tar.gz: 007929ee077653281bdbf47008093402e883b97bba997e3aa38ce28d617760a0152578ed97722dfc7135c513cb47f6072ea8047e47c0208b3b07625d5b35e964
6
+ metadata.gz: 01dd84a980844f6cd47a3649843a9246851a8e838fde997a256f9a87868b132bae4d95f2e615f51cdee54a2fb7aeb702450f8399353299cc828293ccaadc963b
7
+ data.tar.gz: 7c34d4ee565e126bb76d2adca9434d59c975947f732fb45da0936f710674e328386ceb7c4f47aa84f146f849f84f561cb1693199c1ef472a4c182cf888b9f6ef
data/lib/bsforforms.rb CHANGED
@@ -1,5 +1,63 @@
1
1
  require "bsforforms/version"
2
2
 
3
3
  module Bsforforms
4
+
5
+
6
+ class BsFormBuilder < ActionView::Helpers::FormBuilder
7
+ include ActionView::Helpers::TagHelper
8
+ include ActionView::Helpers::CaptureHelper
9
+ include ActionView::Helpers::TextHelper
10
+
11
+ attr_accessor :output_buffer
12
+
13
+ #TEXT FIELD
14
+ def text_field(attribute, options={})
15
+ #metemos un label que lo sacamos del formulario
16
+ options[:label] ||=attribute
17
+ #Componemos nosotros un label si no lo tiene
18
+ label_text ||= options.delete(:label).to_s.titleize
19
+ #Ponemos una clase por defecto
20
+ options[:class] ||= "form-control"
21
+ #ponemos el small que sea
22
+ options[:small]
23
+
24
+ #Componemos el div a la Bootstrap
25
+ todoslosfields do
26
+
27
+ label(attribute, label_text) +
28
+ super(attribute, options) +
29
+ content_tag(:small, options[:small])
30
+ end
31
+ end
32
+
33
+ #NUMBER FIELD
34
+ def number_field(attribute, options={})
35
+ options[:label] ||=attribute
36
+ label_text ||= options.delete(:label).to_s.titleize
37
+ options[:class] ||= "form-control"
38
+ options[:small]
39
+
40
+ todoslosfields do
41
+
42
+ label(attribute, label_text) +
43
+ super(attribute, options) +
44
+ content_tag(:small, options[:small])
45
+ end
46
+ end
47
+
48
+ def todoslosfields(options={}, &block)
49
+ content_tag(:div, capture(&block), class: "form-group")
50
+ end
51
+
52
+
53
+ #BUTTON SUBMIT
54
+
55
+ def submit(text, options={})
56
+ options[:class] ||= "btn btn-primary"
57
+ super(text, options)
58
+ end
59
+
60
+
61
+ end
4
62
 
5
63
  end
@@ -1,3 +1,3 @@
1
1
  module Bsforforms
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bsforforms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David