formie 0.9.16 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-gemset +1 -1
- data/.ruby-version +1 -1
- data/.travis.yml +5 -2
- data/.watchr +3 -3
- data/Appraisals +4 -0
- data/Gemfile +0 -2
- data/MIT-LICENSE +1 -1
- data/README.md +15 -7
- data/Rakefile +0 -17
- data/formie.gemspec +1 -1
- data/gemfiles/rails_6.0.gemfile +14 -0
- data/lib/formie.rb +15 -4
- data/lib/formie/version.rb +2 -1
- data/test/integration/order_test.rb +7 -0
- data/test/internal/app/formies/templates/hello.slim +2 -0
- data/test/internal/app/views/formies/application/copyright.html.erb +3 -0
- data/test/internal/app/views/formies/forms/builtins.html.erb +7 -0
- data/test/internal/app/views/formies/forms/l_text_field.html.erb +4 -0
- data/test/internal/app/views/formies/templates/hello.slim +3 -0
- data/test/internal/app/views/formies/templates/l_text_field.html.erb +2 -0
- data/test/internal/app/views/formies/templates/labelled.html.erb +4 -0
- metadata +18 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f549e073b8de681eddff1ad40c41872f63ed92f69ee365a8425a64438837ed7b
|
4
|
+
data.tar.gz: 89061cdce94b4f76ff3c10c2a814a6a7f66e4d2ee88c53364d1f7999c1c54eaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 458c621e7acb2413926cc3070a77edf58d0d96e418e800553ab9f1d5215a7bf89b3af28e0d1ade853ad400945986d64902f403828bcbb0a3dda410b7b5d05846
|
7
|
+
data.tar.gz: 02f57fe42549d4e63359b17e2f519d299fd94e0f5216fc30f88101540057fdf4fa2b2315d8062b98c7fc98a6024fad900745fb0643137b29904116e9d8263923
|
data/.ruby-gemset
CHANGED
@@ -1 +1 @@
|
|
1
|
-
rails-
|
1
|
+
rails-6.0
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.6.
|
1
|
+
ruby-2.6.4
|
data/.travis.yml
CHANGED
@@ -6,7 +6,9 @@ bundler_args: --without production
|
|
6
6
|
script: 'bundle exec rake test'
|
7
7
|
|
8
8
|
rvm:
|
9
|
-
- 2.6.
|
9
|
+
- 2.6.4
|
10
|
+
# - 2.6.3
|
11
|
+
# - 2.6.1
|
10
12
|
# - 2.5.1
|
11
13
|
# - 2.5.0
|
12
14
|
# - 2.4.1 # tested
|
@@ -15,7 +17,8 @@ rvm:
|
|
15
17
|
# - 2.2.6 # tested
|
16
18
|
|
17
19
|
gemfile:
|
18
|
-
- gemfiles/
|
20
|
+
- gemfiles/rails_6.0.gemfile
|
21
|
+
# - gemfiles/rails_5.2.gemfile
|
19
22
|
# - gemfiles/rails_5.1.gemfile
|
20
23
|
# - gemfiles/rails_5.0.gemfile
|
21
24
|
|
data/.watchr
CHANGED
@@ -16,9 +16,9 @@ end
|
|
16
16
|
|
17
17
|
def run_it(type, file)
|
18
18
|
case type
|
19
|
-
|
20
|
-
when 'test'; run %Q{rails test #{file}}
|
21
|
-
when 'spec'; run %Q{rspec -X #{file}}
|
19
|
+
when 'test'; run %Q{ruby -I"lib:test" -r rubygems #{file}}
|
20
|
+
# when 'test'; run %Q{rails test #{file}}
|
21
|
+
# when 'spec'; run %Q{rspec -X #{file}}
|
22
22
|
else; puts "#{H} unknown type: #{type}, file: #{file}"
|
23
23
|
end
|
24
24
|
end
|
data/Appraisals
CHANGED
data/Gemfile
CHANGED
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -4,8 +4,9 @@ Formie
|
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/formie.svg)](https://badge.fury.io/rb/formie)
|
5
5
|
[![Build Status](https://travis-ci.org/matique/formie.png?branch=master)](https://travis-ci.org/matique/formie)
|
6
6
|
|
7
|
-
Tired of programming each HTML tag?
|
8
|
-
|
7
|
+
Tired of programming each HTML tag?
|
8
|
+
Are you in search of DRYness for Rails views?
|
9
|
+
May be Formie can help you.
|
9
10
|
|
10
11
|
Formie implements low level template-based helpers.
|
11
12
|
It injects the formies into the ActionView module.
|
@@ -35,9 +36,12 @@ Use 'gem install formie -v 0.7.1' for Rails 3.2.
|
|
35
36
|
|
36
37
|
Templates for Formie are hosted in:
|
37
38
|
|
38
|
-
-
|
39
|
-
-
|
40
|
-
-
|
39
|
+
- <formie_path>/forms (bounded to form)
|
40
|
+
- <formie_path>/application (free standing)
|
41
|
+
- <formie_path>/templates (free standing)
|
42
|
+
|
43
|
+
Till Rails 5 <formie_path> is 'app/formies'.
|
44
|
+
Starting at Rails 6 <formie_path> is 'app/views/formies'.
|
41
45
|
|
42
46
|
Inside a formie the following locals (as delivered by the
|
43
47
|
controller) are available:
|
@@ -75,7 +79,7 @@ To avoid a server restart during development of formies you may add to:
|
|
75
79
|
<%= f.l_text_field :amount %>
|
76
80
|
<% end %>
|
77
81
|
|
78
|
-
In directory
|
82
|
+
In directory <formie_path> :
|
79
83
|
|
80
84
|
# application/copyright.html.erb
|
81
85
|
<div class="copyright"> Copyright (c) 2009 </div>
|
@@ -93,4 +97,8 @@ In directory app/formies :
|
|
93
97
|
<%= form.text_field field %>
|
94
98
|
</p>
|
95
99
|
|
96
|
-
|
100
|
+
# templates/hello.slim
|
101
|
+
span Hello Slim
|
102
|
+
# a comment
|
103
|
+
|
104
|
+
Copyright (c) 2009-2019 Dittmar Krall, released under the MIT license.
|
data/Rakefile
CHANGED
@@ -1,23 +1,6 @@
|
|
1
1
|
require 'bundler/setup'
|
2
2
|
Bundler::GemHelper.install_tasks
|
3
3
|
|
4
|
-
|
5
|
-
=begin
|
6
|
-
## in particular, make db task available, but in vane
|
7
|
-
# https://github.com/pat/combustion/issues/13
|
8
|
-
require "rails"
|
9
|
-
require "combustion"
|
10
|
-
require "active_record/railtie"
|
11
|
-
#Bundler.require :default, Rails.env
|
12
|
-
|
13
|
-
|
14
|
-
Bundler.require
|
15
|
-
#require "combustion"
|
16
|
-
#Combustion.initialize!
|
17
|
-
Combustion::Application.load_tasks
|
18
|
-
=end
|
19
|
-
|
20
|
-
|
21
4
|
require 'rake/testtask'
|
22
5
|
|
23
6
|
Rake::TestTask.new(:test) do |t|
|
data/formie.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.add_development_dependency 'bundler'
|
27
27
|
s.add_development_dependency 'rake', '~> 12'
|
28
28
|
s.add_development_dependency 'appraisal', '~> 2'
|
29
|
-
s.add_development_dependency 'combustion', '~>
|
29
|
+
s.add_development_dependency 'combustion', '~> 1.1'
|
30
30
|
|
31
31
|
s.add_development_dependency 'minitest'
|
32
32
|
s.add_development_dependency 'simplecov'
|
data/lib/formie.rb
CHANGED
@@ -2,12 +2,19 @@ require 'formie/engine.rb'
|
|
2
2
|
|
3
3
|
module Formie
|
4
4
|
|
5
|
+
Rails6 = Rails.version.to_f >= 6.0
|
6
|
+
PATH = Rails6 ? 'app/views/formies' : 'app/formies'
|
7
|
+
|
5
8
|
def self.reload
|
9
|
+
if Rails6 && !File.directory?("#{Rails.root}/app/views/formies")
|
10
|
+
raise 'Formies must be located in "app/views/formies" since Rails 6'
|
11
|
+
end
|
12
|
+
|
6
13
|
now = Time.now
|
7
14
|
@last_update ||= Time.new(0)
|
8
|
-
self.load_formies(::ActionView::Helpers::FormBuilder,
|
9
|
-
self.load_formies(::ActionView::Helpers::TextHelper,
|
10
|
-
self.load_formies(::ActionView::Helpers::TextHelper,
|
15
|
+
self.load_formies(::ActionView::Helpers::FormBuilder, "#{PATH}/forms")
|
16
|
+
self.load_formies(::ActionView::Helpers::TextHelper, "#{PATH}/application")
|
17
|
+
self.load_formies(::ActionView::Helpers::TextHelper, "#{PATH}/templates")
|
11
18
|
@last_update = now
|
12
19
|
end
|
13
20
|
|
@@ -18,7 +25,11 @@ module Formie
|
|
18
25
|
#p "** called #{where} #{formiename}", args, block
|
19
26
|
params = args.extract_options!
|
20
27
|
options = {}
|
21
|
-
|
28
|
+
unless Rails6
|
29
|
+
options[:file] = path
|
30
|
+
else
|
31
|
+
options[:template] = path.sub("#{Rails.root}/app/views", "")
|
32
|
+
end
|
22
33
|
options[:locals] = {}
|
23
34
|
options[:locals].update params
|
24
35
|
options[:locals].update :formiename => formiename,
|
data/lib/formie/version.rb
CHANGED
@@ -23,6 +23,13 @@ describe "Formie" do
|
|
23
23
|
assert_equal 'Hello Slim', page.find('form span').text
|
24
24
|
end
|
25
25
|
|
26
|
+
it 'should remove comments in Slim testing full stack' do
|
27
|
+
order = Order.all.first
|
28
|
+
|
29
|
+
visit "/orders/#{order.id}"
|
30
|
+
refute page.has_content?("a comment")
|
31
|
+
end
|
32
|
+
|
26
33
|
it 'builtins' do
|
27
34
|
visit "/orders/new"
|
28
35
|
assert page.has_content?("action_name new")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: formie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dittmar Krall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '1.1'
|
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: '
|
68
|
+
version: '1.1'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: minitest
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,6 +136,7 @@ files:
|
|
136
136
|
- gemfiles/rails_5.0.gemfile
|
137
137
|
- gemfiles/rails_5.1.gemfile
|
138
138
|
- gemfiles/rails_5.2.gemfile
|
139
|
+
- gemfiles/rails_6.0.gemfile
|
139
140
|
- lib/formie.rb
|
140
141
|
- lib/formie/engine.rb
|
141
142
|
- lib/formie/version.rb
|
@@ -151,6 +152,12 @@ files:
|
|
151
152
|
- test/internal/app/formies/templates/labelled.html.erb
|
152
153
|
- test/internal/app/models/application_record.rb
|
153
154
|
- test/internal/app/models/order.rb
|
155
|
+
- test/internal/app/views/formies/application/copyright.html.erb
|
156
|
+
- test/internal/app/views/formies/forms/builtins.html.erb
|
157
|
+
- test/internal/app/views/formies/forms/l_text_field.html.erb
|
158
|
+
- test/internal/app/views/formies/templates/hello.slim
|
159
|
+
- test/internal/app/views/formies/templates/l_text_field.html.erb
|
160
|
+
- test/internal/app/views/formies/templates/labelled.html.erb
|
154
161
|
- test/internal/app/views/layouts/application.html.erb
|
155
162
|
- test/internal/app/views/orders/_form.html.erb
|
156
163
|
- test/internal/app/views/orders/_new.html.erb
|
@@ -182,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
189
|
- !ruby/object:Gem::Version
|
183
190
|
version: '0'
|
184
191
|
requirements: []
|
185
|
-
rubygems_version: 3.0.
|
192
|
+
rubygems_version: 3.0.6
|
186
193
|
signing_key:
|
187
194
|
specification_version: 4
|
188
195
|
summary: Formie is like a Rails helper, but uses the notation of a partial.
|
@@ -199,6 +206,12 @@ test_files:
|
|
199
206
|
- test/internal/app/formies/templates/labelled.html.erb
|
200
207
|
- test/internal/app/models/application_record.rb
|
201
208
|
- test/internal/app/models/order.rb
|
209
|
+
- test/internal/app/views/formies/application/copyright.html.erb
|
210
|
+
- test/internal/app/views/formies/forms/builtins.html.erb
|
211
|
+
- test/internal/app/views/formies/forms/l_text_field.html.erb
|
212
|
+
- test/internal/app/views/formies/templates/hello.slim
|
213
|
+
- test/internal/app/views/formies/templates/l_text_field.html.erb
|
214
|
+
- test/internal/app/views/formies/templates/labelled.html.erb
|
202
215
|
- test/internal/app/views/layouts/application.html.erb
|
203
216
|
- test/internal/app/views/orders/_form.html.erb
|
204
217
|
- test/internal/app/views/orders/_new.html.erb
|