simple_form-dojo 0.0.2 → 0.0.3
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 +8 -8
- data/README.markdown +3 -3
- data/lib/simple_form-dojo/form_builder.rb +5 -36
- data/lib/simple_form-dojo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTE4MTk4NmQ3ZWJlZGJkNTRkMWQwMzg4MjZhN2E4MjBiODcwZDA5ZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NWE4MzJhY2ZjNzAxOTEzMjljYzJlZTg1NGQ1MzkyYWM3OTY2ZGYyYw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZWIwN2YxMjQ1NWZjZDA3ZDg3NTI1MTgxOTJlNjI1NWM3YzA3ZWQxM2U4MmJm
|
10
|
+
Y2Y5MGI5NDNkZjQ1Mzg1NDJjYjFhYmZhNjE5MjllOGE2NWZkZTEyYjA0YmVk
|
11
|
+
YTVhNGM3YjdjMGQ5ZjBjZjc4YjQzN2U1M2RkMTNhZGU5YTk4YWU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTU3MzA0MzY1NmEzNjM2NGE5NDVhOTZlYzc5ODMxOWY5ZDYyNzYyODhkNDdm
|
14
|
+
ZmYzMWI4NmQ4NTg2NThlODhmYjk1MTczYjU5NDcyNWVjNTFjNjViNmEwODYx
|
15
|
+
YTFmODY2MzA4MDJkZGNiMjA3NzY1YmU0Y2JkMDE2MDc0NWY5YWE=
|
data/README.markdown
CHANGED
@@ -8,9 +8,9 @@ The TabsHelper was inspired by code from CodeOfficer's [JQuery UI Helpers](https
|
|
8
8
|
|
9
9
|
## Requirements
|
10
10
|
|
11
|
-
SimpleFormDojo is based on Dojo 1.
|
11
|
+
SimpleFormDojo is based on Dojo 1.9.0 and uses the newer data-dojo-type and data-dojo-props attributes in order to be more compliant with HTML 5. It is being developed against Rails 3.2 and SimpleForm 2.1.
|
12
12
|
|
13
|
-
|
13
|
+
The dojo toolkit files are not included in the repository. So, to run the dummy test rails environment you'll need to [grab a copy](http://download.dojotoolkit.org/) of the toolkit files and place them in the spec/dummy/public/javascripts/ directory to run the physical rails tests and see the generated markup correctly.
|
14
14
|
|
15
15
|
## SimpleFormDojo::FormBuilder
|
16
16
|
|
@@ -40,7 +40,7 @@ Documentation is TBD, but in general, it works the same way that simple_form wor
|
|
40
40
|
* dijit/form/TextBox
|
41
41
|
* dijit/form/ValidationTextBox
|
42
42
|
* dijit/form/MultiSelect (using option tags only - stores not implemented yet)
|
43
|
-
* dijit/form/FilteringSelect
|
43
|
+
* dijit/form/FilteringSelect
|
44
44
|
* dijit/form/Button
|
45
45
|
* dijit/form/CheckBox
|
46
46
|
* dijit/form/Form
|
@@ -134,53 +134,22 @@ module SimpleFormDojo
|
|
134
134
|
wrap_rendered_collection(rendered_collection, options)
|
135
135
|
end
|
136
136
|
|
137
|
-
# Adds support for Ajax remote FilteringSelect using a QueryReadStore
|
138
|
-
#
|
139
|
-
# == Example
|
140
|
-
#
|
141
|
-
# simple_form_for @user do |f|
|
142
|
-
# f.association :company, :remote_path => '/companies/qrs'
|
143
|
-
# end
|
144
|
-
# # Will create a QueryReadStore linked to a FilteringSelect
|
145
|
-
#
|
146
137
|
def association(association, options={}, &block)
|
147
138
|
options = options.dup
|
148
139
|
reflection = find_association_reflection(association)
|
149
140
|
raise "Association #{association.inspect} not found" unless reflection
|
150
|
-
store = ""
|
151
141
|
if reflection.macro == :belongs_to
|
152
142
|
options[:input_html] ||= {}
|
143
|
+
options[:dojo_html] ||= {}
|
153
144
|
attribute = (reflection.respond_to?(:options) && reflection.options[:foreign_key]) || :"#{reflection.name}_id"
|
154
145
|
options[:input_html][:value] ||= object.send(attribute)
|
155
|
-
|
156
|
-
|
157
|
-
options[:collection] = [] #Prevent collections from being loaded
|
158
|
-
qrs_id = "#{object_name.to_s.underscore}_#{object.id.to_s.gsub(/[^\w]/, "")}_#{association}_qrs"
|
159
|
-
path = options.delete(:remote_path)
|
160
|
-
options[:dojo_html][:store] = qrs_id
|
161
|
-
store = qrs(qrs_id, path)
|
162
|
-
end
|
146
|
+
#Prevent collections from being loaded if using a store
|
147
|
+
options[:collection] = [] if options[:dojo_html][:store]
|
163
148
|
end
|
164
|
-
|
165
|
-
store.html_safe + super(association, options, &block)
|
166
|
-
end
|
167
|
-
|
168
|
-
# Creates a Dojo QueryReadStore
|
169
|
-
#
|
170
|
-
# dojo_form_for @user do |f|
|
171
|
-
# f.qrs :company_qrs, '/companies/qrs'
|
172
|
-
# end
|
173
|
-
def qrs id, path, dojo_props = {}
|
174
|
-
dojo_props = dojo_props.dup
|
175
|
-
options = {:'data-dojo-type' => 'dojox/data/QueryReadStore'}
|
176
|
-
dojo_props[:url] = "'#{path}'"
|
177
|
-
options[:'data-dojo-props'] = SimpleFormDojo::FormBuilder.encode_as_dojo_props(dojo_props)
|
178
|
-
options[:'data-dojo-id'] = id
|
179
|
-
options[:style] ||= "display: none;"
|
180
|
-
template.content_tag(:span, nil, options)
|
149
|
+
super(association, options, &block)
|
181
150
|
end
|
182
151
|
|
183
|
-
##
|
152
|
+
##
|
184
153
|
# The dojo props string is evaluated as javascript,
|
185
154
|
# can therefore contain any valid javascript object
|
186
155
|
# and cannot be encoded as JSON
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_form-dojo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Giouzenis
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-06-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: simple_form
|