active_scaffold 3.4.17 → 3.4.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +12 -1
- data/README.md +8 -4
- data/app/assets/javascripts/jquery/active_scaffold.js +82 -67
- data/app/assets/stylesheets/active_scaffold.scss +1 -1
- data/app/assets/stylesheets/active_scaffold_colors.scss +1 -1
- data/app/assets/stylesheets/blue-theme.css +1 -1
- data/app/views/active_scaffold_overrides/_form_association.html.erb +3 -3
- data/app/views/active_scaffold_overrides/_form_association_record.html.erb +3 -3
- data/app/views/active_scaffold_overrides/_show_columns.html.erb +1 -1
- data/lib/active_scaffold.rb +16 -16
- data/lib/active_scaffold/actions/common_search.rb +13 -11
- data/lib/active_scaffold/actions/core.rb +85 -78
- data/lib/active_scaffold/actions/create.rb +29 -28
- data/lib/active_scaffold/actions/delete.rb +17 -17
- data/lib/active_scaffold/actions/field_search.rb +18 -19
- data/lib/active_scaffold/actions/list.rb +30 -22
- data/lib/active_scaffold/actions/mark.rb +1 -1
- data/lib/active_scaffold/actions/nested.rb +78 -65
- data/lib/active_scaffold/actions/search.rb +13 -10
- data/lib/active_scaffold/actions/show.rb +10 -6
- data/lib/active_scaffold/actions/subform.rb +1 -2
- data/lib/active_scaffold/actions/update.rb +39 -31
- data/lib/active_scaffold/active_record_permissions.rb +14 -15
- data/lib/active_scaffold/attribute_params.rb +42 -43
- data/lib/active_scaffold/bridges.rb +22 -12
- data/lib/active_scaffold/bridges/ancestry.rb +1 -1
- data/lib/active_scaffold/bridges/ancestry/ancestry_bridge.rb +6 -6
- data/lib/active_scaffold/bridges/bitfields.rb +1 -1
- data/lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb +12 -13
- data/lib/active_scaffold/bridges/calendar_date_select.rb +5 -5
- data/lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb +17 -20
- data/lib/active_scaffold/bridges/cancan.rb +1 -1
- data/lib/active_scaffold/bridges/cancan/cancan_bridge.rb +8 -9
- data/lib/active_scaffold/bridges/carrierwave.rb +4 -4
- data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb +9 -8
- data/lib/active_scaffold/bridges/carrierwave/form_ui.rb +11 -10
- data/lib/active_scaffold/bridges/carrierwave/list_ui.rb +7 -6
- data/lib/active_scaffold/bridges/chosen.rb +1 -1
- data/lib/active_scaffold/bridges/chosen/helpers.rb +4 -4
- data/lib/active_scaffold/bridges/country_helper.rb +1 -1
- data/lib/active_scaffold/bridges/country_helper/country_helper_bridge.rb +259 -260
- data/lib/active_scaffold/bridges/date_picker.rb +2 -2
- data/lib/active_scaffold/bridges/date_picker/ext.rb +9 -11
- data/lib/active_scaffold/bridges/date_picker/helper.rb +61 -67
- data/lib/active_scaffold/bridges/dragonfly.rb +4 -4
- data/lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb +9 -8
- data/lib/active_scaffold/bridges/dragonfly/form_ui.rb +11 -10
- data/lib/active_scaffold/bridges/dragonfly/list_ui.rb +6 -5
- data/lib/active_scaffold/bridges/file_column.rb +5 -5
- data/lib/active_scaffold/bridges/file_column/as_file_column_bridge.rb +20 -23
- data/lib/active_scaffold/bridges/file_column/file_column_helpers.rb +20 -23
- data/lib/active_scaffold/bridges/file_column/form_ui.rb +13 -14
- data/lib/active_scaffold/bridges/file_column/list_ui.rb +7 -8
- data/lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb +18 -22
- data/lib/active_scaffold/bridges/file_column/test/mock_model.rb +5 -4
- data/lib/active_scaffold/bridges/file_column/test/test_helper.rb +2 -10
- data/lib/active_scaffold/bridges/paper_trail.rb +7 -5
- data/lib/active_scaffold/bridges/paper_trail/paper_trail_bridge.rb +4 -3
- data/lib/active_scaffold/bridges/paperclip.rb +5 -5
- data/lib/active_scaffold/bridges/paperclip/form_ui.rb +11 -10
- data/lib/active_scaffold/bridges/paperclip/list_ui.rb +6 -5
- data/lib/active_scaffold/bridges/paperclip/paperclip_bridge.rb +10 -9
- data/lib/active_scaffold/bridges/record_select.rb +1 -1
- data/lib/active_scaffold/bridges/record_select/helpers.rb +28 -28
- data/lib/active_scaffold/bridges/semantic_attributes.rb +1 -1
- data/lib/active_scaffold/bridges/semantic_attributes/column.rb +1 -1
- data/lib/active_scaffold/bridges/shared/date_bridge.rb +58 -52
- data/lib/active_scaffold/bridges/tiny_mce.rb +2 -2
- data/lib/active_scaffold/bridges/tiny_mce/helpers.rb +3 -3
- data/lib/active_scaffold/config/base.rb +9 -10
- data/lib/active_scaffold/config/core.rb +24 -29
- data/lib/active_scaffold/config/create.rb +0 -1
- data/lib/active_scaffold/config/field_search.rb +8 -10
- data/lib/active_scaffold/config/form.rb +5 -5
- data/lib/active_scaffold/config/list.rb +21 -20
- data/lib/active_scaffold/config/mark.rb +3 -3
- data/lib/active_scaffold/config/nested.rb +11 -10
- data/lib/active_scaffold/config/search.rb +2 -3
- data/lib/active_scaffold/config/show.rb +1 -1
- data/lib/active_scaffold/config/update.rb +1 -2
- data/lib/active_scaffold/configurable.rb +9 -11
- data/lib/active_scaffold/constraints.rb +9 -8
- data/lib/active_scaffold/core.rb +72 -84
- data/lib/active_scaffold/data_structures/action_columns.rb +26 -25
- data/lib/active_scaffold/data_structures/action_link.rb +43 -43
- data/lib/active_scaffold/data_structures/action_links.rb +17 -15
- data/lib/active_scaffold/data_structures/actions.rb +5 -5
- data/lib/active_scaffold/data_structures/bridge.rb +6 -3
- data/lib/active_scaffold/data_structures/column.rb +110 -89
- data/lib/active_scaffold/data_structures/columns.rb +3 -3
- data/lib/active_scaffold/data_structures/error_message.rb +4 -6
- data/lib/active_scaffold/data_structures/nested_info.rb +43 -48
- data/lib/active_scaffold/data_structures/set.rb +7 -8
- data/lib/active_scaffold/data_structures/sorting.rb +38 -33
- data/lib/active_scaffold/delayed_setup.rb +5 -6
- data/lib/active_scaffold/engine.rb +4 -4
- data/lib/active_scaffold/extensions/action_controller_rendering.rb +3 -4
- data/lib/active_scaffold/extensions/action_controller_rescueing.rb +1 -1
- data/lib/active_scaffold/extensions/action_view_rendering.rb +5 -6
- data/lib/active_scaffold/extensions/left_outer_joins.rb +11 -11
- data/lib/active_scaffold/extensions/localize.rb +1 -1
- data/lib/active_scaffold/extensions/name_option_for_datetime.rb +1 -1
- data/lib/active_scaffold/extensions/paginator_extensions.rb +2 -5
- data/lib/active_scaffold/extensions/reverse_associations.rb +13 -13
- data/lib/active_scaffold/extensions/routing_mapper.rb +9 -9
- data/lib/active_scaffold/extensions/unsaved_associated.rb +9 -9
- data/lib/active_scaffold/finder.rb +90 -93
- data/lib/active_scaffold/helpers/association_helpers.rb +5 -5
- data/lib/active_scaffold/helpers/controller_helpers.rb +22 -19
- data/lib/active_scaffold/helpers/form_column_helpers.rb +115 -105
- data/lib/active_scaffold/helpers/human_condition_helpers.rb +62 -35
- data/lib/active_scaffold/helpers/id_helpers.rb +6 -6
- data/lib/active_scaffold/helpers/list_column_helpers.rb +89 -94
- data/lib/active_scaffold/helpers/pagination_helpers.rb +9 -9
- data/lib/active_scaffold/helpers/search_column_helpers.rb +47 -44
- data/lib/active_scaffold/helpers/show_column_helpers.rb +2 -2
- data/lib/active_scaffold/helpers/view_helpers.rb +86 -91
- data/lib/active_scaffold/marked_model.rb +10 -10
- data/lib/active_scaffold/paginator.rb +30 -34
- data/lib/active_scaffold/responds_to_parent.rb +27 -28
- data/lib/active_scaffold/tableless.rb +20 -15
- data/lib/active_scaffold/version.rb +1 -1
- data/lib/generators/active_scaffold/active_scaffold_generator.rb +8 -8
- data/lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb +9 -9
- data/shoulda_macros/macros.rb +27 -22
- data/test/bridges/bridge_test.rb +38 -29
- data/test/bridges/date_picker_test.rb +1 -1
- data/test/bridges/paper_trail_test.rb +17 -0
- data/test/bridges/paperclip_test.rb +3 -2
- data/test/bridges/tiny_mce_test.rb +5 -2
- data/test/company.rb +25 -30
- data/test/config/base_test.rb +1 -1
- data/test/config/core_test.rb +9 -9
- data/test/config/create_test.rb +14 -8
- data/test/config/delete_test.rb +4 -4
- data/test/config/field_search_test.rb +6 -6
- data/test/config/list_test.rb +16 -16
- data/test/config/nested_test.rb +4 -4
- data/test/config/search_test.rb +8 -8
- data/test/config/show_test.rb +6 -6
- data/test/config/subform_test.rb +1 -1
- data/test/config/update_test.rb +5 -5
- data/test/const_mocker.rb +4 -4
- data/test/data_structures/action_columns_test.rb +4 -5
- data/test/data_structures/action_link_test.rb +1 -0
- data/test/data_structures/action_links_test.rb +5 -5
- data/test/data_structures/column_test.rb +9 -9
- data/test/data_structures/columns_test.rb +2 -2
- data/test/data_structures/error_message_test.rb +4 -5
- data/test/data_structures/set_test.rb +1 -2
- data/test/data_structures/sorting_test.rb +10 -10
- data/test/data_structures/validation_reflection_test.rb +8 -0
- data/test/extensions/routing_mapper_test.rb +2 -2
- data/test/helpers/list_column_helpers_test.rb +3 -2
- data/test/helpers/pagination_helpers_test.rb +5 -4
- data/test/helpers/search_column_helpers_test.rb +1 -1
- data/test/misc/active_record_permissions_test.rb +63 -50
- data/test/misc/attribute_params_test.rb +28 -26
- data/test/misc/calculation_test.rb +10 -3
- data/test/misc/configurable_test.rb +12 -13
- data/test/misc/constraints_test.rb +6 -6
- data/test/misc/convert_numbers_format_test.rb +7 -6
- data/test/misc/finder_test.rb +17 -12
- data/test/misc/lang_test.rb +3 -4
- data/test/misc/tableless_test.rb +2 -3
- data/test/mock_app/app/controllers/addresses_controller.rb +1 -1
- data/test/mock_app/app/controllers/buildings_controller.rb +1 -1
- data/test/mock_app/app/controllers/cars_controller.rb +1 -1
- data/test/mock_app/app/controllers/contacts_controller.rb +1 -1
- data/test/mock_app/app/controllers/people_controller.rb +1 -1
- data/test/mock_app/app/models/file_model.rb +2 -2
- data/test/mock_app/app/models/person.rb +1 -1
- data/test/mock_app/config/application.rb +3 -3
- data/test/mock_app/config/boot.rb +1 -1
- data/test/mock_app/config/environment.rb +1 -0
- data/test/mock_app/config/environments/development.rb +0 -1
- data/test/mock_app/config/environments/production.rb +1 -1
- data/test/mock_app/db/schema.rb +14 -15
- data/test/model_stub.rb +13 -16
- data/test/run_all.rb +5 -7
- data/test/test_helper.rb +12 -9
- metadata +19 -3
@@ -13,13 +13,13 @@ class ActiveScaffold::Bridges::Chosen
|
|
13
13
|
html_options[:class] << ' chosen'
|
14
14
|
if column.plural_association?
|
15
15
|
associated_options, select_options = active_scaffold_plural_association_options(column)
|
16
|
-
options = {:selected => associated_options.collect
|
16
|
+
options = {:selected => associated_options.collect(&:id), :include_blank => as_(:_select_)}
|
17
17
|
|
18
18
|
html_options.update(:multiple => true).update(column.options[:html_options] || {})
|
19
19
|
options.update(column.options)
|
20
|
-
html_options[:name] = "#{html_options[:name]}[]" if html_options[:multiple] == true && !html_options[:name].to_s.ends_with?(
|
20
|
+
html_options[:name] = "#{html_options[:name]}[]" if html_options[:multiple] == true && !html_options[:name].to_s.ends_with?('[]')
|
21
21
|
|
22
|
-
if optgroup = options.delete(:optgroup)
|
22
|
+
if (optgroup = options.delete(:optgroup))
|
23
23
|
select(:record, column.name, active_scaffold_grouped_options(column, select_options, optgroup), options, html_options)
|
24
24
|
else
|
25
25
|
collection_select(:record, column.name, select_options, :id, column.options[:label_method] || :to_label, options, html_options)
|
@@ -35,7 +35,7 @@ class ActiveScaffold::Bridges::Chosen
|
|
35
35
|
options[:class] << ' chosen'
|
36
36
|
active_scaffold_search_select(column, options)
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
def active_scaffold_search_multi_chosen(column, options)
|
40
40
|
options[:class] << ' chosen'
|
41
41
|
options[:multiple] = true
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class ActiveScaffold::Bridges::CountryHelper < ActiveScaffold::DataStructures::Bridge
|
2
2
|
def self.install
|
3
|
-
require File.join(File.dirname(__FILE__),
|
3
|
+
require File.join(File.dirname(__FILE__), 'country_helper/country_helper_bridge.rb')
|
4
4
|
end
|
5
5
|
|
6
6
|
def self.install?
|
@@ -22,16 +22,16 @@ module ActiveScaffold::Bridges
|
|
22
22
|
# NOTE: Only the option tags are returned, you have to wrap this call in a regular HTML select tag.
|
23
23
|
def country_options_for_select(selected = nil, priority_countries = nil)
|
24
24
|
if priority_countries
|
25
|
-
country_options = options_for_select(priority_countries.collect {|country| [I18n.t("countries.#{country}", :default => country.to_s.titleize), country.to_s]} + [['-------------', '']], :selected => selected, :disabled => '')
|
25
|
+
country_options = options_for_select(priority_countries.collect { |country| [I18n.t("countries.#{country}", :default => country.to_s.titleize), country.to_s] } + [['-------------', '']], :selected => selected, :disabled => '')
|
26
26
|
else
|
27
27
|
country_options = options_for_select([])
|
28
28
|
end
|
29
29
|
|
30
|
-
|
30
|
+
country_options + options_for_select(COUNTRIES.collect { |country| [I18n.t("countries.#{country}", :default => country.to_s.titleize), country.to_s] }, :selected => selected)
|
31
31
|
end
|
32
32
|
|
33
33
|
# Returns a string of option tags for the states in the United States. Supply a state name as +selected to
|
34
|
-
# have it marked as the selected option tag. Included also is the option to set a couple of +priority_states+
|
34
|
+
# have it marked as the selected option tag. Included also is the option to set a couple of +priority_states+
|
35
35
|
# in case you want to highligh a local area
|
36
36
|
# NOTE: Only the option tags are returned from this method, wrap it in a <select>
|
37
37
|
def usa_state_options_for_select(selected = nil, priority_states = nil)
|
@@ -47,258 +47,257 @@ module ActiveScaffold::Bridges
|
|
47
47
|
state_options += options_for_select(USASTATES, :selected => selected)
|
48
48
|
end
|
49
49
|
|
50
|
-
|
50
|
+
state_options
|
51
51
|
end
|
52
|
-
|
52
|
+
# All the countries included in the country_options output.
|
53
53
|
COUNTRIES = [
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
54
|
+
:afghanistan,
|
55
|
+
:aland_islands,
|
56
|
+
:albania,
|
57
|
+
:algeria,
|
58
|
+
:american_samoa,
|
59
|
+
:andorra,
|
60
|
+
:angola,
|
61
|
+
:anguilla,
|
62
|
+
:antarctica,
|
63
|
+
:antigua_and_barbuda,
|
64
|
+
:argentina,
|
65
|
+
:armenia,
|
66
|
+
:aruba,
|
67
|
+
:australia,
|
68
|
+
:austria,
|
69
|
+
:azerbaijan,
|
70
|
+
:bahamas,
|
71
|
+
:bahrain,
|
72
|
+
:bangladesh,
|
73
|
+
:barbados,
|
74
|
+
:belarus,
|
75
|
+
:belgium,
|
76
|
+
:belize,
|
77
|
+
:benin,
|
78
|
+
:bermuda,
|
79
|
+
:bhutan,
|
80
|
+
:bolivia,
|
81
|
+
:bosnia_and_herzegowina,
|
82
|
+
:botswana,
|
83
|
+
:bouvet_island,
|
84
|
+
:brazil,
|
85
|
+
:british_indian_ocean_territory,
|
86
|
+
:brunei_darussalam,
|
87
|
+
:bulgaria,
|
88
|
+
:burkina_faso,
|
89
|
+
:burundi,
|
90
|
+
:cambodia,
|
91
|
+
:cameroon,
|
92
|
+
:canada,
|
93
|
+
:cape_verde,
|
94
|
+
:cayman_islands,
|
95
|
+
:central_african_republic,
|
96
|
+
:chad,
|
97
|
+
:chile,
|
98
|
+
:china,
|
99
|
+
:christmas_island,
|
100
|
+
:cocos_keeling_islands,
|
101
|
+
:colombia,
|
102
|
+
:comoros,
|
103
|
+
:congo,
|
104
|
+
:congo_the_democratic_republic_of_the,
|
105
|
+
:cook_islands,
|
106
|
+
:costa_rica,
|
107
|
+
:cote_divoire,
|
108
|
+
:croatia,
|
109
|
+
:cuba,
|
110
|
+
:cyprus,
|
111
|
+
:czech_republic,
|
112
|
+
:denmark,
|
113
|
+
:djibouti,
|
114
|
+
:dominica,
|
115
|
+
:dominican_republic,
|
116
|
+
:ecuador,
|
117
|
+
:egypt,
|
118
|
+
:el_salvador,
|
119
|
+
:equatorial_guinea,
|
120
|
+
:eritrea,
|
121
|
+
:estonia,
|
122
|
+
:ethiopia,
|
123
|
+
:falkland_islands_malvinas,
|
124
|
+
:faroe_islands,
|
125
|
+
:fiji,
|
126
|
+
:finland,
|
127
|
+
:france,
|
128
|
+
:french_guiana,
|
129
|
+
:french_polynesia,
|
130
|
+
:french_southern_territories,
|
131
|
+
:gabon,
|
132
|
+
:gambia,
|
133
|
+
:georgia,
|
134
|
+
:germany,
|
135
|
+
:ghana,
|
136
|
+
:gibraltar,
|
137
|
+
:greece,
|
138
|
+
:greenland,
|
139
|
+
:grenada,
|
140
|
+
:guadeloupe,
|
141
|
+
:guam,
|
142
|
+
:guatemala,
|
143
|
+
:guernsey,
|
144
|
+
:guinea,
|
145
|
+
:guinea_bissau,
|
146
|
+
:guyana,
|
147
|
+
:haiti,
|
148
|
+
:heard_and_mcdonald_islands,
|
149
|
+
:holy_see_vatican_city_state,
|
150
|
+
:honduras,
|
151
|
+
:hong_kong,
|
152
|
+
:hungary,
|
153
|
+
:iceland,
|
154
|
+
:india,
|
155
|
+
:indonesia,
|
156
|
+
:iran_islamic_republic_of,
|
157
|
+
:iraq,
|
158
|
+
:ireland,
|
159
|
+
:isle_of_man,
|
160
|
+
:israel,
|
161
|
+
:italy,
|
162
|
+
:jamaica,
|
163
|
+
:japan,
|
164
|
+
:jersey,
|
165
|
+
:jordan,
|
166
|
+
:kazakhstan,
|
167
|
+
:kenya,
|
168
|
+
:kiribati,
|
169
|
+
:korea_democratic_peoples_republic_of,
|
170
|
+
:korea_republic_of,
|
171
|
+
:kuwait,
|
172
|
+
:kyrgyzstan,
|
173
|
+
:lao_peoples_democratic_republic,
|
174
|
+
:latvia,
|
175
|
+
:lebanon,
|
176
|
+
:lesotho,
|
177
|
+
:liberia,
|
178
|
+
:libyan_arab_jamahiriya,
|
179
|
+
:liechtenstein,
|
180
|
+
:lithuania,
|
181
|
+
:luxembourg,
|
182
|
+
:macao,
|
183
|
+
:macedonia_the_former_yugoslav_republic_of,
|
184
|
+
:madagascar,
|
185
|
+
:malawi,
|
186
|
+
:malaysia,
|
187
|
+
:maldives,
|
188
|
+
:mali,
|
189
|
+
:malta,
|
190
|
+
:marshall_islands,
|
191
|
+
:martinique,
|
192
|
+
:mauritania,
|
193
|
+
:mauritius,
|
194
|
+
:mayotte,
|
195
|
+
:mexico,
|
196
|
+
:micronesia_federated_states_of,
|
197
|
+
:moldova_republic_of,
|
198
|
+
:monaco,
|
199
|
+
:mongolia,
|
200
|
+
:montenegro,
|
201
|
+
:montserrat,
|
202
|
+
:morocco,
|
203
|
+
:mozambique,
|
204
|
+
:myanmar,
|
205
|
+
:namibia,
|
206
|
+
:nauru,
|
207
|
+
:nepal,
|
208
|
+
:netherlands,
|
209
|
+
:netherlands_antilles,
|
210
|
+
:new_caledonia,
|
211
|
+
:new_zealand,
|
212
|
+
:nicaragua,
|
213
|
+
:niger,
|
214
|
+
:nigeria,
|
215
|
+
:niue,
|
216
|
+
:norfolk_island,
|
217
|
+
:northern_mariana_islands,
|
218
|
+
:norway,
|
219
|
+
:oman,
|
220
|
+
:pakistan,
|
221
|
+
:palau,
|
222
|
+
:palestinian_territory_occupied,
|
223
|
+
:panama,
|
224
|
+
:papua_new_guinea,
|
225
|
+
:paraguay,
|
226
|
+
:peru,
|
227
|
+
:philippines,
|
228
|
+
:pitcairn,
|
229
|
+
:poland,
|
230
|
+
:portugal,
|
231
|
+
:puerto_rico,
|
232
|
+
:qatar,
|
233
|
+
:reunion,
|
234
|
+
:romania,
|
235
|
+
:russian_federation,
|
236
|
+
:rwanda,
|
237
|
+
:saint_barthelemy,
|
238
|
+
:saint_helena,
|
239
|
+
:saint_kitts_and_nevis,
|
240
|
+
:saint_lucia,
|
241
|
+
:saint_pierre_and_miquelon,
|
242
|
+
:saint_vincent_and_the_grenadines,
|
243
|
+
:samoa,
|
244
|
+
:san_marino,
|
245
|
+
:sao_tome_and_principe,
|
246
|
+
:saudi_arabia,
|
247
|
+
:senegal,
|
248
|
+
:serbia,
|
249
|
+
:seychelles,
|
250
|
+
:sierra_leone,
|
251
|
+
:singapore,
|
252
|
+
:slovakia,
|
253
|
+
:slovenia,
|
254
|
+
:solomon_islands,
|
255
|
+
:somalia,
|
256
|
+
:south_africa,
|
257
|
+
:south_georgia_and_the_south_sandwich_islands,
|
258
|
+
:spain,
|
259
|
+
:sri_lanka,
|
260
|
+
:sudan,
|
261
|
+
:suriname,
|
262
|
+
:svalbard_and_jan_mayen,
|
263
|
+
:swaziland,
|
264
|
+
:sweden,
|
265
|
+
:switzerland,
|
266
|
+
:syrian_arab_republic,
|
267
|
+
:taiwan_province_of_china,
|
268
|
+
:tajikistan,
|
269
|
+
:tanzania_united_republic_of,
|
270
|
+
:thailand,
|
271
|
+
:timor_leste,
|
272
|
+
:togo,
|
273
|
+
:tokelau,
|
274
|
+
:tonga,
|
275
|
+
:trinidad_and_tobago,
|
276
|
+
:tunisia,
|
277
|
+
:turkey,
|
278
|
+
:turkmenistan,
|
279
|
+
:turks_and_caicos_islands,
|
280
|
+
:tuvalu,
|
281
|
+
:uganda,
|
282
|
+
:ukraine,
|
283
|
+
:united_arab_emirates,
|
284
|
+
:united_kingdom,
|
285
|
+
:united_states,
|
286
|
+
:united_states_minor_outlying_islands,
|
287
|
+
:uruguay,
|
288
|
+
:uzbekistan,
|
289
|
+
:vanuatu,
|
290
|
+
:venezuela,
|
291
|
+
:viet_nam,
|
292
|
+
:virgin_islands_british,
|
293
|
+
:virgin_islands_us,
|
294
|
+
:wallis_and_futuna,
|
295
|
+
:western_sahara,
|
296
|
+
:yemen,
|
297
|
+
:zambia,
|
298
|
+
:zimbabwe] unless const_defined?('COUNTRIES')
|
299
299
|
|
300
|
-
|
301
|
-
USASTATES = [["Alabama", "AL"], ["Alaska", "AK"], ["Arizona", "AZ"], ["Arkansas", "AR"], ["California", "CA"], ["Colorado", "CO"], ["Connecticut", "CT"], ["Delaware", "DE"], ["District of Columbia", "DC"], ["Florida", "FL"], ["Georgia", "GA"], ["Hawaii", "HI"], ["Idaho", "ID"], ["Illinois", "IL"], ["Indiana", "IN"], ["Iowa", "IA"], ["Kansas", "KS"], ["Kentucky", "KY"], ["Louisiana", "LA"], ["Maine", "ME"], ["Maryland", "MD"], ["Massachusetts", "MA"], ["Michigan", "MI"], ["Minnesota", "MN"], ["Mississippi", "MS"], ["Missouri", "MO"], ["Montana", "MT"], ["Nebraska", "NE"], ["Nevada", "NV"], ["New Hampshire", "NH"], ["New Jersey", "NJ"], ["New Mexico", "NM"], ["New York", "NY"], ["North Carolina", "NC"], ["North Dakota", "ND"], ["Ohio", "OH"], ["Oklahoma", "OK"], ["Oregon", "OR"], ["Pennsylvania", "PA"], ["Rhode Island", "RI"], ["South Carolina", "SC"], ["South Dakota", "SD"], ["Tennessee", "TN"], ["Texas", "TX"], ["Utah", "UT"], ["Vermont", "VT"], ["Virginia", "VA"], ["Washington", "WA"], ["Wisconsin", "WI"], ["West Virginia", "WV"], ["Wyoming", "WY"]] unless const_defined?("USASTATES")
|
300
|
+
USASTATES = [%w(Alabama AL), %w(Alaska AK), %w(Arizona AZ), %w(Arkansas AR), %w(California CA), %w(Colorado CO), %w(Connecticut CT), %w(Delaware DE), ['District of Columbia', 'DC'], %w(Florida FL), %w(Georgia GA), %w(Hawaii HI), %w(Idaho ID), %w(Illinois IL), %w(Indiana IN), %w(Iowa IA), %w(Kansas KS), %w(Kentucky KY), %w(Louisiana LA), %w(Maine ME), %w(Maryland MD), %w(Massachusetts MA), %w(Michigan MI), %w(Minnesota MN), %w(Mississippi MS), %w(Missouri MO), %w(Montana MT), %w(Nebraska NE), %w(Nevada NV), ['New Hampshire', 'NH'], ['New Jersey', 'NJ'], ['New Mexico', 'NM'], ['New York', 'NY'], ['North Carolina', 'NC'], ['North Dakota', 'ND'], %w(Ohio OH), %w(Oklahoma OK), %w(Oregon OR), %w(Pennsylvania PA), ['Rhode Island', 'RI'], ['South Carolina', 'SC'], ['South Dakota', 'SD'], %w(Tennessee TN), %w(Texas TX), %w(Utah UT), %w(Vermont VT), %w(Virginia VA), %w(Washington WA), %w(Wisconsin WI), ['West Virginia', 'WV'], %w(Wyoming WY)] unless const_defined?('USASTATES')
|
302
301
|
end
|
303
302
|
|
304
303
|
module InstanceTagMethods
|
@@ -306,8 +305,9 @@ module ActiveScaffold::Bridges
|
|
306
305
|
html_options = html_options.stringify_keys
|
307
306
|
add_default_name_and_id(html_options)
|
308
307
|
value = value(object)
|
309
|
-
selected_value = options.
|
310
|
-
content_tag(
|
308
|
+
selected_value = options.key?(:selected) ? options[:selected] : value
|
309
|
+
content_tag(
|
310
|
+
'select',
|
311
311
|
add_options(
|
312
312
|
country_options_for_select(selected_value, priority_countries),
|
313
313
|
options, selected_value
|
@@ -319,8 +319,8 @@ module ActiveScaffold::Bridges
|
|
319
319
|
html_options = html_options.stringify_keys
|
320
320
|
add_default_name_and_id(html_options)
|
321
321
|
value = value(object)
|
322
|
-
selected_value = options.
|
323
|
-
content_tag(
|
322
|
+
selected_value = options.key?(:selected) ? options[:selected] : value
|
323
|
+
content_tag('select', add_options(usa_state_options_for_select(selected_value, priority_states), options, selected_value), html_options)
|
324
324
|
end
|
325
325
|
end
|
326
326
|
|
@@ -341,14 +341,14 @@ module ActiveScaffold::Bridges
|
|
341
341
|
usa_state_select(:record, column.name, column.options[:priority], select_options, options)
|
342
342
|
end
|
343
343
|
end
|
344
|
-
|
344
|
+
|
345
345
|
module SearchColumnHelpers
|
346
346
|
def active_scaffold_search_country(column, options)
|
347
|
-
active_scaffold_input_country(column, options.merge!(:selected => options.delete(:value)))
|
347
|
+
active_scaffold_input_country(column, options.merge!(:selected => options.delete(:value)))
|
348
348
|
end
|
349
349
|
|
350
350
|
def active_scaffold_search_usa_state(column, options)
|
351
|
-
active_scaffold_input_usa_state(column, options.merge!(:selected => options.delete(:value)))
|
351
|
+
active_scaffold_input_usa_state(column, options.merge!(:selected => options.delete(:value)))
|
352
352
|
end
|
353
353
|
end
|
354
354
|
end
|
@@ -371,4 +371,3 @@ else
|
|
371
371
|
include ActiveScaffold::Bridges::CountryHelper::InstanceTagMethods
|
372
372
|
end
|
373
373
|
end
|
374
|
-
|