formize 0.0.27 → 0.1.0
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.
- data/.document +5 -0
- data/{MIT-LICENSE → LICENSE} +0 -0
- data/VERSION +1 -1
- data/lib/formize/definition.rb +1 -0
- data/lib/formize/helpers/form_tag_helper.rb +4 -3
- data/lib/formize/helpers.rb +0 -1
- data/lib/formize/{engine.rb → rails/engine.rb} +0 -0
- data/lib/formize/{railtie.rb → rails/railtie.rb} +0 -1
- data/lib/formize.rb +2 -2
- data/{lib/tasks/formize.rake → test/helper.rb} +5 -7
- data/test/test_formize.rb +9 -0
- metadata +20 -45
- data/Gemfile +0 -9
- data/lib/formize/helpers/asset_tag_helper.rb +0 -46
- data/lib/generators/formize/install/USAGE +0 -1
- data/lib/generators/formize/install/install_generator.rb +0 -44
- data/lib/generators/formize/install/templates/initializer.rb +0 -17
data/.document
ADDED
data/{MIT-LICENSE → LICENSE}
RENAMED
File without changes
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/lib/formize/definition.rb
CHANGED
@@ -3,6 +3,7 @@ module Formize
|
|
3
3
|
module Definition
|
4
4
|
autoload :Form, 'formize/definition/form'
|
5
5
|
autoload :FormElement, 'formize/definition/form_element'
|
6
|
+
autoload :Group, 'formize/definition/field_set'
|
6
7
|
autoload :FieldSet, 'formize/definition/field_set'
|
7
8
|
autoload :Field, 'formize/definition/field'
|
8
9
|
end
|
@@ -10,10 +10,11 @@ module Formize
|
|
10
10
|
localized_value = I18n.localize(localized_value, :format=>format)
|
11
11
|
end
|
12
12
|
format = I18n.translate('date.formats.'+format.to_s)
|
13
|
-
Formize::DATE_FORMAT_TOKENS.each{|js, rb| format.gsub!(rb, js)}
|
13
|
+
Formize::DATE_FORMAT_TOKENS.each{|js, rb| format.gsub!(rb, js)}
|
14
|
+
name_id = name.gsub(/[^a-z]+/, '_')
|
14
15
|
html = ""
|
15
|
-
html << hidden_field_tag(name, (value.is_a?(Date) ? value.to_s(:db) : value.to_s))
|
16
|
-
html << tag(:input, :type=>:text, "data-datepicker"=>
|
16
|
+
html << hidden_field_tag(name, (value.is_a?(Date) ? value.to_s(:db) : value.to_s), :id => name_id)
|
17
|
+
html << tag(:input, :type=>:text, "data-datepicker" => name_id, "data-date-format" => format, :value => localized_value, "data-locale" => ::I18n.locale, :size => options.delete(:size)||10)
|
17
18
|
return html.html_safe
|
18
19
|
end
|
19
20
|
|
data/lib/formize/helpers.rb
CHANGED
@@ -21,7 +21,6 @@ module Formize
|
|
21
21
|
|
22
22
|
# @private
|
23
23
|
module Helpers
|
24
|
-
autoload :AssetTagHelper, 'formize/helpers/asset_tag_helper'
|
25
24
|
autoload :TagHelper, 'formize/helpers/tag_helper'
|
26
25
|
autoload :FormHelper, 'formize/helpers/form_helper'
|
27
26
|
autoload :FormTagHelper, 'formize/helpers/form_tag_helper'
|
File without changes
|
@@ -5,7 +5,6 @@ module Formize
|
|
5
5
|
class Railtie < Rails::Railtie
|
6
6
|
initializer 'formize.initialize' do
|
7
7
|
ActiveSupport.on_load(:action_view) do
|
8
|
-
include Formize::Helpers::AssetTagHelper
|
9
8
|
include Formize::Helpers::TagHelper
|
10
9
|
include Formize::Helpers::FormHelper
|
11
10
|
include Formize::Helpers::FormTagHelper
|
data/lib/formize.rb
CHANGED
@@ -14,14 +14,12 @@ require 'action_view'
|
|
14
14
|
require 'action_controller'
|
15
15
|
require 'action_dispatch'
|
16
16
|
|
17
|
-
|
18
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
|
17
|
+
require 'test/unit'
|
19
18
|
|
19
|
+
|
20
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
21
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
20
22
|
require 'formize'
|
21
23
|
|
22
|
-
|
23
|
-
desc "Generate formize.js"
|
24
|
-
task :compile do
|
25
|
-
Formize.compile!
|
26
|
-
end
|
24
|
+
class Test::Unit::TestCase
|
27
25
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: formize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-24 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &22320740 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '3'
|
21
|
+
version: '3.1'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *22320740
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: jquery-rails
|
27
|
-
requirement: &
|
27
|
+
requirement: &22320260 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,39 +32,18 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: jeweler
|
38
|
-
requirement: &18824540 !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
|
-
requirements:
|
41
|
-
- - ! '>='
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '0'
|
44
|
-
type: :development
|
45
|
-
prerelease: false
|
46
|
-
version_requirements: *18824540
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: rdoc
|
49
|
-
requirement: &18816840 !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
|
-
requirements:
|
52
|
-
- - ! '>='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 2.4.2
|
55
|
-
type: :development
|
56
|
-
prerelease: false
|
57
|
-
version_requirements: *18816840
|
35
|
+
version_requirements: *22320260
|
58
36
|
description: Like simple_form or formtastic, it aims to handle easily forms but taking
|
59
37
|
in account AJAX and HTML5 on depending fields mainly.
|
60
|
-
email:
|
38
|
+
email: burisu@oneiros.fr
|
61
39
|
executables: []
|
62
40
|
extensions: []
|
63
41
|
extra_rdoc_files:
|
42
|
+
- LICENSE
|
64
43
|
- README.rdoc
|
65
44
|
files:
|
66
|
-
-
|
67
|
-
-
|
45
|
+
- .document
|
46
|
+
- LICENSE
|
68
47
|
- README.rdoc
|
69
48
|
- VERSION
|
70
49
|
- lib/assets/images/ui-bg_flat_0_aaaaaa_40x100.png
|
@@ -160,18 +139,15 @@ files:
|
|
160
139
|
- lib/formize/definition/field_set.rb
|
161
140
|
- lib/formize/definition/form.rb
|
162
141
|
- lib/formize/definition/form_element.rb
|
163
|
-
- lib/formize/engine.rb
|
164
142
|
- lib/formize/generator.rb
|
165
143
|
- lib/formize/helpers.rb
|
166
|
-
- lib/formize/helpers/asset_tag_helper.rb
|
167
144
|
- lib/formize/helpers/form_helper.rb
|
168
145
|
- lib/formize/helpers/form_tag_helper.rb
|
169
146
|
- lib/formize/helpers/tag_helper.rb
|
170
|
-
- lib/formize/
|
171
|
-
- lib/
|
172
|
-
-
|
173
|
-
-
|
174
|
-
- lib/tasks/formize.rake
|
147
|
+
- lib/formize/rails/engine.rb
|
148
|
+
- lib/formize/rails/railtie.rb
|
149
|
+
- test/helper.rb
|
150
|
+
- test/test_formize.rb
|
175
151
|
homepage: http://github.com/burisu/formize
|
176
152
|
licenses:
|
177
153
|
- MIT
|
@@ -185,9 +161,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
185
161
|
- - ! '>='
|
186
162
|
- !ruby/object:Gem::Version
|
187
163
|
version: '0'
|
188
|
-
segments:
|
189
|
-
- 0
|
190
|
-
hash: -4207803932127150052
|
191
164
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
192
165
|
none: false
|
193
166
|
requirements:
|
@@ -196,8 +169,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
169
|
version: '0'
|
197
170
|
requirements: []
|
198
171
|
rubyforge_project:
|
199
|
-
rubygems_version: 1.8.
|
172
|
+
rubygems_version: 1.8.10
|
200
173
|
signing_key:
|
201
174
|
specification_version: 3
|
202
175
|
summary: Simple form DSL with dynamic interactions for Rails
|
203
|
-
test_files:
|
176
|
+
test_files:
|
177
|
+
- test/helper.rb
|
178
|
+
- test/test_formize.rb
|
data/Gemfile
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
module Formize
|
2
|
-
module Helpers
|
3
|
-
module AssetTagHelper
|
4
|
-
|
5
|
-
# Include all stylesheets, javascripts and locales.
|
6
|
-
# For Rails 3.0 only, not needed since Rails 3.1.
|
7
|
-
#
|
8
|
-
# @example Classic use
|
9
|
-
# <%= formize_include_tag -%>
|
10
|
-
#
|
11
|
-
# @example Classic use with a specified locale
|
12
|
-
# <%= formize_include_tag :locale=>:jp -%>
|
13
|
-
#
|
14
|
-
# @option options [Symbol, String] :locale
|
15
|
-
# Select locale file to use for jQuery UI datepickers. The locale must be
|
16
|
-
# specified using 2 or 5 characters, like `:en` or `"en-GB"`.
|
17
|
-
# By default, `I18n.locale` is used to determine the current locale.
|
18
|
-
#
|
19
|
-
# @option options [TrueClass, FalseClass] :skip_stylesheet
|
20
|
-
# Skip the inclusion of default stylesheet: formize.css
|
21
|
-
#
|
22
|
-
# @option options [TrueClass, FalseClass] :monolithic
|
23
|
-
# If +true+ includes a monolithic javascript formize.js else include
|
24
|
-
# choosen specific javascripts with little weight.
|
25
|
-
#
|
26
|
-
# @deprecated Will be removed when rails <= 3.0 support won't be effective in
|
27
|
-
# versions >= 0.1.0
|
28
|
-
def formize_include_tag(options={})
|
29
|
-
options[:locale] ||= ::I18n.locale
|
30
|
-
html = ""
|
31
|
-
if options[:monolithic]
|
32
|
-
html << javascript_include_tag('formize')
|
33
|
-
else
|
34
|
-
html << javascript_include_tag('locales/jquery.ui.datepicker-' + locale.to_s)
|
35
|
-
html << javascript_include_tag('jquery.ui.formize')
|
36
|
-
end
|
37
|
-
unless options[:skip_stylesheet]
|
38
|
-
html << stylesheet_link_tag('jquery-ui')
|
39
|
-
html << stylesheet_link_tag('formize')
|
40
|
-
end
|
41
|
-
return html.html_safe
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
Copies some CSS files to public/stylesheets/ and a config initializer to config/initializers/formtastic.rb
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'rails'
|
2
|
-
|
3
|
-
module Formize
|
4
|
-
|
5
|
-
class InstallGenerator < ::Rails::Generators::Base
|
6
|
-
source_root File.expand_path('../templates', __FILE__)
|
7
|
-
# class_option :no_ui, :type => :boolean, :default => false, :desc => "Do not include special jQuery-UI JavaScripts"
|
8
|
-
class_option :no_locales, :type => :boolean, :default => false, :desc => "Do not include locales for jQuery-UI date picker"
|
9
|
-
class_option :no_stylesheet, :type => :boolean, :default => false, :desc => "Do not include stylesheet of jQuery-UI"
|
10
|
-
|
11
|
-
unless ::Rails::VERSION::MAJOR == 3 && ::Rails::VERSION::MINOR >= 1
|
12
|
-
def copy_assets
|
13
|
-
copy_file '../../../../assets/javascripts/formize.js', 'public/javascripts/formize.js'
|
14
|
-
|
15
|
-
# unless options[:no_ui]
|
16
|
-
copy_file '../../../../assets/javascripts/jquery.ui.formize.js', 'public/javascripts/jquery.ui.formize.js'
|
17
|
-
# end
|
18
|
-
|
19
|
-
unless options[:no_locales]
|
20
|
-
for locale in Dir.glob(File.expand_path('../../../../assets/javascripts/locales/*datepicker*.js', __FILE__))
|
21
|
-
file = locale.split(/[\\\/]+/)[-1]
|
22
|
-
copy_file "../../../../assets/javascripts/locales/#{file}", "public/javascripts/locales/#{file}"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
copy_file '../../../../assets/stylesheets/formize.css', 'public/stylesheets/formize.css'
|
27
|
-
|
28
|
-
unless options[:no_stylesheet]
|
29
|
-
copy_file '../../../../assets/stylesheets/jquery-ui.css', 'public/stylesheets/jquery-ui.css'
|
30
|
-
for image in Dir.glob(File.expand_path('../../../../assets/images/*.png', __FILE__))
|
31
|
-
file = image.split(/[\\\/]+/)[-1]
|
32
|
-
copy_file "../../../../assets/images/#{file}", "public/images/#{file}"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def copy_initializer_file
|
40
|
-
template "initializer.rb", "config/initializers/formize.rb"
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
# Set the default source used by mono choices:
|
4
|
-
# - :foreign_class : Class of foreign object
|
5
|
-
# - :class : Class of object
|
6
|
-
# - "variable_name" or :variable_name : A variable (Class name is computed with the name
|
7
|
-
# of the variable. Example: "product" will have "Product" class_name. If class_name
|
8
|
-
# has to be different, use next possibility.
|
9
|
-
# - ["variable_name", "Class"] : Code used to select source with the
|
10
|
-
# class_name of the variable.
|
11
|
-
# Formize.default_source = <%=Formize.default_source.inspect%>
|
12
|
-
|
13
|
-
# How many radio can be displayed before to become a +select+
|
14
|
-
# Formize.radio_count_max = <%=Formize.radio_count_max%>
|
15
|
-
|
16
|
-
# How many select options can be displayed before to become a +unroll+
|
17
|
-
# Formize.select_count_max = <%=Formize.select_count_max%>
|