bulma_form_builder 0.1.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 93dc7a5a3da2b117075258e5d6e13c2edd96329443b456ecbd1dade6a59456db
4
- data.tar.gz: a8a03a1e51a1407195305e49976796636ac442db30ccb42db115e5a52b7ad740
3
+ metadata.gz: e97b36ef274989541d1b377752f60675c7ec1a20a87d4cdf2df667cd598f0097
4
+ data.tar.gz: f8a87aeecf30df6b5d8f10923224a002f1fc550dc5ef3696a8968005f552b05a
5
5
  SHA512:
6
- metadata.gz: ed585ec68ff443b33ba8b55147577fac46e67ed04edd407cd97404e12a810b0c3222f16d38eea4cb2b057470812e30c0faf144c3111f456573d116ecfb7038c2
7
- data.tar.gz: 2346c2105b2fd649da3b2ed4adbc3bf061d412b3a8dee839662c8b0bee9acbb7dff9e9eb44a82c4b86ab9fbe69e8b082ecd6938ba362a2c77f4b19852457ae7e
6
+ metadata.gz: 30f981a5f869a84b0955cdc310a4cc0dfeac9872f225162bbf8344667aab988421c54dae1ee015bd1fe6d073257154929f6d9ee7b4eeadc52361c3acb2ff6e32
7
+ data.tar.gz: bc0e67f7646e822cf4d221a33e740288794bdb3a7310adfccc490e6aecbff14539b6404b636e5a4b80645869bac776b1686d3930740630ce9401cd79127bd0ce
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+ Gemfile.lock
data/CHANGELOG.md ADDED
@@ -0,0 +1,25 @@
1
+ ## 0.3.1
2
+
3
+ - Update dependency
4
+ - Support for `tag` helper
5
+
6
+ ## 0.3.0
7
+
8
+ - Add url_field
9
+ - Update dependency
10
+
11
+ ## 0.2.1
12
+
13
+ - Support the check_box helpter option
14
+
15
+ ## 0.2.0
16
+
17
+ - Add collection_radio_buttons
18
+
19
+ ## 0.1.1
20
+
21
+ - Add wrapper_class option
22
+
23
+ ## 0.1.0
24
+
25
+ - First Release
@@ -22,9 +22,9 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ["lib"]
24
24
 
25
- spec.add_dependency "rails", ">= 5.2.0"
25
+ spec.add_dependency "rails", ">= 6.0.3.5"
26
26
 
27
27
  spec.add_development_dependency "bundler", "~> 2.0"
28
- spec.add_development_dependency "rake", "~> 10.0"
29
- spec.add_development_dependency "rspec", "~> 3.0"
28
+ spec.add_development_dependency "rake"
29
+ spec.add_development_dependency "rspec"
30
30
  end
@@ -16,6 +16,7 @@ module BulmaFormBuilder
16
16
 
17
17
  include BulmaFormBuilder::Inputs::Base
18
18
  include BulmaFormBuilder::Inputs::EmailField
19
+ include BulmaFormBuilder::Inputs::UrlField
19
20
  include BulmaFormBuilder::Inputs::DateField
20
21
  include BulmaFormBuilder::Inputs::TimeField
21
22
  include BulmaFormBuilder::Inputs::MonthField
@@ -26,8 +27,9 @@ module BulmaFormBuilder
26
27
  include BulmaFormBuilder::Inputs::TextArea
27
28
  include BulmaFormBuilder::Inputs::CheckBox
28
29
  include BulmaFormBuilder::Inputs::CollectionCheckBoxes
30
+ include BulmaFormBuilder::Inputs::CollectionRadioButtons
29
31
 
30
- delegate :content_tag, :capture, :concat, to: :@template
32
+ delegate :content_tag, :capture, :concat, :tag, to: :@template
31
33
 
32
34
  def initialize(object_name, object, template, options)
33
35
  @layout = options[:layout]
@@ -6,7 +6,7 @@ module BulmaFormBuilder
6
6
  name = args.first
7
7
  options = args.extract_options!
8
8
 
9
- content_tag(:div, class: 'field') do
9
+ content_tag(:div, class: form_field_classes(options)) do
10
10
  concat field_label(name, options) unless options[:hide_label]
11
11
  concat field_control(&block)
12
12
  concat field_help(name, options)
@@ -32,5 +32,11 @@ module BulmaFormBuilder
32
32
  classes << 'required' if options[:required]
33
33
  label(name, options[:label], class: classes)
34
34
  end
35
+
36
+ def form_field_classes(options)
37
+ classes = %w[field]
38
+ classes << options.delete(:wrapper_class) if options[:wrapper_class].present?
39
+ classes
40
+ end
35
41
  end
36
42
  end
@@ -1,8 +1,10 @@
1
1
  require 'bulma_form_builder/inputs/base'
2
2
  require 'bulma_form_builder/inputs/check_box'
3
3
  require 'bulma_form_builder/inputs/collection_check_boxes'
4
+ require 'bulma_form_builder/inputs/collection_radio_buttons'
4
5
  require 'bulma_form_builder/inputs/date_field'
5
6
  require 'bulma_form_builder/inputs/email_field'
7
+ require 'bulma_form_builder/inputs/url_field'
6
8
  require 'bulma_form_builder/inputs/month_field'
7
9
  require 'bulma_form_builder/inputs/number_field'
8
10
  require 'bulma_form_builder/inputs/password_field'
@@ -3,7 +3,7 @@ module BulmaFormBuilder
3
3
  module Base
4
4
  extend ActiveSupport::Concern
5
5
 
6
- ELEMENTS_WITH_INPUT_CLASS = %i[email_field number_field password_field text_field].freeze
6
+ ELEMENTS_WITH_INPUT_CLASS = %i[email_field url_field number_field password_field text_field].freeze
7
7
 
8
8
  class_methods do
9
9
  def bulma_field(field_name)
@@ -9,14 +9,21 @@ module BulmaFormBuilder
9
9
  def check_box_with_bulma(name, options = {}, checked_value = '1', unchecked_value = '0', &block)
10
10
  options = options.symbolize_keys!
11
11
  check_box_options = options.except(:class, :label, :label_class, :error_message, :help, :inline, :custom, :hide_label, :skip_label, :wrapper_class)
12
+ wrapper_class = ['field', options[:wrapper_class]].compact
12
13
 
13
- content_tag(:div, class: 'field') do
14
- content_tag(:label, class: 'checkbox') do
14
+ content_tag(:div, class: wrapper_class) do
15
+ checkbox = content_tag(:label, class: 'checkbox') do
15
16
  html = check_box_without_bulma(name, check_box_options, checked_value, unchecked_value)
16
17
  html.concat(check_box_label(name)) unless options[:skip_label]
17
18
  html.concat(generate_error(name)) if options[:error_message]
18
19
  html
19
20
  end
21
+
22
+ if options[:help].present?
23
+ checkbox.concat(content_tag(:p, options[:help], class: 'help'))
24
+ end
25
+
26
+ checkbox
20
27
  end
21
28
  end
22
29
 
@@ -0,0 +1,23 @@
1
+ module BulmaFormBuilder
2
+ module Inputs
3
+ module CollectionRadioButtons
4
+ extend ActiveSupport::Concern
5
+ include Base
6
+
7
+ included do
8
+ def collection_radio_buttons_with_bulma(method, collection, value_method, text_method, options = {}, html_options = {}) # rubocop:disable Metrics/ParameterLists
9
+ html = form_field_builder(method, options, html_options) do
10
+ collection_radio_buttons_without_bulma(method, collection, value_method, text_method, options, html_options) do |b|
11
+ content_tag(:label, class: 'radio') do
12
+ concat b.radio_button
13
+ concat content_tag(:span, class: 'control-label') { b.text }
14
+ end
15
+ end
16
+ end
17
+ end
18
+
19
+ bulma_alias :collection_radio_buttons
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,13 @@
1
+ module BulmaFormBuilder
2
+ module Inputs
3
+ module UrlField
4
+ extend ActiveSupport::Concern
5
+
6
+ include Base
7
+
8
+ included do
9
+ bulma_field(:url_field)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module BulmaFormBuilder
2
- VERSION = "0.1.0"
2
+ VERSION = '0.3.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bulma_form_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - aki77
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-08 00:00:00.000000000 Z
11
+ date: 2021-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 5.2.0
19
+ version: 6.0.3.5
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
- version: 5.2.0
26
+ version: 6.0.3.5
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -42,30 +42,30 @@ dependencies:
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '10.0'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '3.0'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '3.0'
68
+ version: '0'
69
69
  description: bulma_form_builder is a Rails form builder that makes it super easy to
70
70
  integrate Bulma style forms into your Rails application.
71
71
  email:
@@ -76,10 +76,9 @@ extra_rdoc_files: []
76
76
  files:
77
77
  - ".gitignore"
78
78
  - ".rspec"
79
- - ".travis.yml"
79
+ - CHANGELOG.md
80
80
  - CODE_OF_CONDUCT.md
81
81
  - Gemfile
82
- - Gemfile.lock
83
82
  - LICENSE.txt
84
83
  - README.md
85
84
  - Rakefile
@@ -98,6 +97,7 @@ files:
98
97
  - lib/bulma_form_builder/inputs/base.rb
99
98
  - lib/bulma_form_builder/inputs/check_box.rb
100
99
  - lib/bulma_form_builder/inputs/collection_check_boxes.rb
100
+ - lib/bulma_form_builder/inputs/collection_radio_buttons.rb
101
101
  - lib/bulma_form_builder/inputs/date_field.rb
102
102
  - lib/bulma_form_builder/inputs/email_field.rb
103
103
  - lib/bulma_form_builder/inputs/month_field.rb
@@ -107,6 +107,7 @@ files:
107
107
  - lib/bulma_form_builder/inputs/text_area.rb
108
108
  - lib/bulma_form_builder/inputs/text_field.rb
109
109
  - lib/bulma_form_builder/inputs/time_field.rb
110
+ - lib/bulma_form_builder/inputs/url_field.rb
110
111
  - lib/bulma_form_builder/railtie.rb
111
112
  - lib/bulma_form_builder/version.rb
112
113
  homepage: https://github.com/aki77/bulma_form_builder
@@ -128,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
129
  - !ruby/object:Gem::Version
129
130
  version: '0'
130
131
  requirements: []
131
- rubygems_version: 3.0.3
132
+ rubygems_version: 3.1.2
132
133
  signing_key:
133
134
  specification_version: 4
134
135
  summary: Rails form builder
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.6.3
7
- before_install: gem install bundler -v 2.0.2
data/Gemfile.lock DELETED
@@ -1,158 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- bulma_form_builder (0.1.0)
5
- rails (>= 5.2.0)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- actioncable (6.0.1)
11
- actionpack (= 6.0.1)
12
- nio4r (~> 2.0)
13
- websocket-driver (>= 0.6.1)
14
- actionmailbox (6.0.1)
15
- actionpack (= 6.0.1)
16
- activejob (= 6.0.1)
17
- activerecord (= 6.0.1)
18
- activestorage (= 6.0.1)
19
- activesupport (= 6.0.1)
20
- mail (>= 2.7.1)
21
- actionmailer (6.0.1)
22
- actionpack (= 6.0.1)
23
- actionview (= 6.0.1)
24
- activejob (= 6.0.1)
25
- mail (~> 2.5, >= 2.5.4)
26
- rails-dom-testing (~> 2.0)
27
- actionpack (6.0.1)
28
- actionview (= 6.0.1)
29
- activesupport (= 6.0.1)
30
- rack (~> 2.0)
31
- rack-test (>= 0.6.3)
32
- rails-dom-testing (~> 2.0)
33
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
34
- actiontext (6.0.1)
35
- actionpack (= 6.0.1)
36
- activerecord (= 6.0.1)
37
- activestorage (= 6.0.1)
38
- activesupport (= 6.0.1)
39
- nokogiri (>= 1.8.5)
40
- actionview (6.0.1)
41
- activesupport (= 6.0.1)
42
- builder (~> 3.1)
43
- erubi (~> 1.4)
44
- rails-dom-testing (~> 2.0)
45
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
46
- activejob (6.0.1)
47
- activesupport (= 6.0.1)
48
- globalid (>= 0.3.6)
49
- activemodel (6.0.1)
50
- activesupport (= 6.0.1)
51
- activerecord (6.0.1)
52
- activemodel (= 6.0.1)
53
- activesupport (= 6.0.1)
54
- activestorage (6.0.1)
55
- actionpack (= 6.0.1)
56
- activejob (= 6.0.1)
57
- activerecord (= 6.0.1)
58
- marcel (~> 0.3.1)
59
- activesupport (6.0.1)
60
- concurrent-ruby (~> 1.0, >= 1.0.2)
61
- i18n (>= 0.7, < 2)
62
- minitest (~> 5.1)
63
- tzinfo (~> 1.1)
64
- zeitwerk (~> 2.2)
65
- builder (3.2.3)
66
- concurrent-ruby (1.1.5)
67
- crass (1.0.5)
68
- diff-lcs (1.3)
69
- erubi (1.9.0)
70
- globalid (0.4.2)
71
- activesupport (>= 4.2.0)
72
- i18n (1.7.0)
73
- concurrent-ruby (~> 1.0)
74
- loofah (2.3.1)
75
- crass (~> 1.0.2)
76
- nokogiri (>= 1.5.9)
77
- mail (2.7.1)
78
- mini_mime (>= 0.1.1)
79
- marcel (0.3.3)
80
- mimemagic (~> 0.3.2)
81
- method_source (0.9.2)
82
- mimemagic (0.3.3)
83
- mini_mime (1.0.2)
84
- mini_portile2 (2.4.0)
85
- minitest (5.13.0)
86
- nio4r (2.5.2)
87
- nokogiri (1.10.5)
88
- mini_portile2 (~> 2.4.0)
89
- rack (2.0.7)
90
- rack-test (1.1.0)
91
- rack (>= 1.0, < 3)
92
- rails (6.0.1)
93
- actioncable (= 6.0.1)
94
- actionmailbox (= 6.0.1)
95
- actionmailer (= 6.0.1)
96
- actionpack (= 6.0.1)
97
- actiontext (= 6.0.1)
98
- actionview (= 6.0.1)
99
- activejob (= 6.0.1)
100
- activemodel (= 6.0.1)
101
- activerecord (= 6.0.1)
102
- activestorage (= 6.0.1)
103
- activesupport (= 6.0.1)
104
- bundler (>= 1.3.0)
105
- railties (= 6.0.1)
106
- sprockets-rails (>= 2.0.0)
107
- rails-dom-testing (2.0.3)
108
- activesupport (>= 4.2.0)
109
- nokogiri (>= 1.6)
110
- rails-html-sanitizer (1.3.0)
111
- loofah (~> 2.3)
112
- railties (6.0.1)
113
- actionpack (= 6.0.1)
114
- activesupport (= 6.0.1)
115
- method_source
116
- rake (>= 0.8.7)
117
- thor (>= 0.20.3, < 2.0)
118
- rake (10.5.0)
119
- rspec (3.9.0)
120
- rspec-core (~> 3.9.0)
121
- rspec-expectations (~> 3.9.0)
122
- rspec-mocks (~> 3.9.0)
123
- rspec-core (3.9.0)
124
- rspec-support (~> 3.9.0)
125
- rspec-expectations (3.9.0)
126
- diff-lcs (>= 1.2.0, < 2.0)
127
- rspec-support (~> 3.9.0)
128
- rspec-mocks (3.9.0)
129
- diff-lcs (>= 1.2.0, < 2.0)
130
- rspec-support (~> 3.9.0)
131
- rspec-support (3.9.0)
132
- sprockets (4.0.0)
133
- concurrent-ruby (~> 1.0)
134
- rack (> 1, < 3)
135
- sprockets-rails (3.2.1)
136
- actionpack (>= 4.0)
137
- activesupport (>= 4.0)
138
- sprockets (>= 3.0.0)
139
- thor (0.20.3)
140
- thread_safe (0.3.6)
141
- tzinfo (1.2.5)
142
- thread_safe (~> 0.1)
143
- websocket-driver (0.7.1)
144
- websocket-extensions (>= 0.1.0)
145
- websocket-extensions (0.1.4)
146
- zeitwerk (2.2.1)
147
-
148
- PLATFORMS
149
- ruby
150
-
151
- DEPENDENCIES
152
- bulma_form_builder!
153
- bundler (~> 2.0)
154
- rake (~> 10.0)
155
- rspec (~> 3.0)
156
-
157
- BUNDLED WITH
158
- 2.0.2