active_scaffold 3.0.12 → 3.0.21
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/README +21 -11
- data/frontends/default/images/close_touch.png +0 -0
- data/frontends/default/javascripts/jquery/active_scaffold.js +187 -99
- data/frontends/default/javascripts/prototype/active_scaffold.js +105 -33
- data/frontends/default/javascripts/prototype/dhtml_history.js +80 -77
- data/frontends/default/stylesheets/stylesheet.css +121 -2
- data/frontends/default/views/_action_group.html.erb +6 -2
- data/frontends/default/views/_base_form.html.erb +11 -5
- data/frontends/default/views/_base_form.html.erb~ +42 -0
- data/frontends/default/views/_field_search.html.erb +1 -1
- data/frontends/default/views/_form.html.erb +9 -7
- data/frontends/default/views/_form_association.html.erb +8 -3
- data/frontends/default/views/_form_association_footer.html.erb +10 -3
- data/frontends/default/views/_form_attribute.html.erb +8 -3
- data/frontends/default/views/_horizontal_subform.html.erb +12 -2
- data/frontends/default/views/_horizontal_subform_header.html.erb +1 -1
- data/frontends/default/views/_horizontal_subform_record.html.erb +5 -4
- data/frontends/default/views/_list_messages.html.erb +1 -1
- data/frontends/default/views/_list_with_header.html.erb +1 -1
- data/frontends/default/views/_render_field.js.rjs +4 -6
- data/frontends/default/views/_vertical_subform.html.erb +1 -1
- data/frontends/default/views/_vertical_subform_record.html.erb +2 -2
- data/frontends/default/views/on_action_update.js.rjs +3 -1
- data/frontends/default/views/on_mark_all.js.rjs +12 -0
- data/frontends/default/views/on_update.js.rjs +1 -1
- data/frontends/default/views/render_field.js.rjs +1 -0
- data/frontends/default/views/update_column.js.rjs +1 -1
- data/lib/active_scaffold.rb +60 -21
- data/lib/active_scaffold/actions/common_search.rb +2 -2
- data/lib/active_scaffold/actions/core.rb +30 -9
- data/lib/active_scaffold/actions/create.rb +14 -10
- data/lib/active_scaffold/actions/field_search.rb +6 -6
- data/lib/active_scaffold/actions/list.rb +22 -12
- data/lib/active_scaffold/actions/mark.rb +34 -9
- data/lib/active_scaffold/actions/nested.rb +12 -16
- data/lib/active_scaffold/actions/show.rb +2 -2
- data/lib/active_scaffold/actions/subform.rb +15 -8
- data/lib/active_scaffold/actions/update.rb +14 -4
- data/lib/active_scaffold/attribute_params.rb +15 -10
- data/lib/active_scaffold/bridges/bridge.rb +21 -12
- data/lib/active_scaffold/bridges/calendar_date_select/bridge.rb +3 -3
- data/lib/active_scaffold/bridges/cancan/bridge.rb +12 -0
- data/lib/active_scaffold/bridges/cancan/lib/cancan_bridge.rb +107 -0
- data/lib/active_scaffold/bridges/carrierwave/bridge.rb +1 -1
- data/lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge.rb +3 -8
- data/lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge_helpers.rb +1 -15
- data/lib/active_scaffold/bridges/carrierwave/lib/form_ui.rb +23 -13
- data/lib/active_scaffold/bridges/carrierwave/lib/list_ui.rb +1 -1
- data/lib/active_scaffold/bridges/country_helper/bridge.rb +9 -0
- data/lib/active_scaffold/bridges/country_helper/lib/country_helper_bridge.rb +358 -0
- data/lib/active_scaffold/bridges/date_picker/bridge.rb +5 -3
- data/lib/active_scaffold/bridges/date_picker/lib/datepicker_bridge.rb +9 -0
- data/lib/active_scaffold/bridges/dragonfly/bridge.rb +9 -0
- data/lib/active_scaffold/bridges/dragonfly/bridge.rb~ +12 -0
- data/lib/active_scaffold/bridges/dragonfly/lib/dragonfly_bridge.rb +36 -0
- data/lib/active_scaffold/bridges/dragonfly/lib/dragonfly_bridge.rb~ +36 -0
- data/lib/active_scaffold/bridges/dragonfly/lib/dragonfly_bridge_helpers.rb +12 -0
- data/lib/active_scaffold/bridges/dragonfly/lib/dragonfly_bridge_helpers.rb~ +12 -0
- data/lib/active_scaffold/bridges/dragonfly/lib/form_ui.rb +27 -0
- data/lib/active_scaffold/bridges/dragonfly/lib/form_ui.rb~ +27 -0
- data/lib/active_scaffold/bridges/dragonfly/lib/list_ui.rb +16 -0
- data/lib/active_scaffold/bridges/dragonfly/lib/list_ui.rb~ +16 -0
- data/lib/active_scaffold/bridges/paperclip/bridge.rb +1 -1
- data/lib/active_scaffold/bridges/record_select/bridge.rb +5 -0
- data/lib/active_scaffold/bridges/record_select/lib/record_select_bridge.rb +87 -0
- data/lib/active_scaffold/bridges/record_select/lib/record_select_bridge.rb~ +84 -0
- data/lib/active_scaffold/bridges/shared/date_bridge.rb +56 -34
- data/lib/active_scaffold/bridges/tiny_mce/lib/tiny_mce_bridge.rb +19 -3
- data/lib/active_scaffold/config/base.rb +4 -4
- data/lib/active_scaffold/config/core.rb +4 -0
- data/lib/active_scaffold/config/create.rb +1 -1
- data/lib/active_scaffold/config/field_search.rb +7 -7
- data/lib/active_scaffold/config/form.rb +8 -2
- data/lib/active_scaffold/config/list.rb +22 -8
- data/lib/active_scaffold/config/mark.rb +18 -5
- data/lib/active_scaffold/config/nested.rb +3 -3
- data/lib/active_scaffold/config/search.rb +1 -1
- data/lib/active_scaffold/config/show.rb +1 -1
- data/lib/active_scaffold/data_structures/action_columns.rb +10 -6
- data/lib/active_scaffold/data_structures/action_link.rb +14 -10
- data/lib/active_scaffold/data_structures/action_links.rb +2 -2
- data/lib/active_scaffold/data_structures/column.rb +25 -11
- data/lib/active_scaffold/data_structures/nested_info.rb +21 -21
- data/lib/active_scaffold/data_structures/set.rb +2 -3
- data/lib/active_scaffold/data_structures/sorting.rb +8 -8
- data/lib/{extensions → active_scaffold/extensions}/action_controller_rendering.rb +3 -1
- data/lib/{extensions → active_scaffold/extensions}/action_view_rendering.rb +31 -33
- data/lib/{extensions → active_scaffold/extensions}/action_view_resolver.rb +0 -0
- data/lib/{extensions → active_scaffold/extensions}/active_association_reflection.rb +0 -0
- data/lib/active_scaffold/extensions/active_record_offset.rb +12 -0
- data/lib/{extensions → active_scaffold/extensions}/array.rb +0 -0
- data/lib/{extensions → active_scaffold/extensions}/localize.rb +1 -1
- data/lib/{extensions → active_scaffold/extensions}/name_option_for_datetime.rb +1 -1
- data/lib/{extensions → active_scaffold/extensions}/nil_id_in_url_params.rb +0 -0
- data/lib/{extensions → active_scaffold/extensions}/paginator_extensions.rb +2 -2
- data/lib/{extensions → active_scaffold/extensions}/reverse_associations.rb +1 -1
- data/lib/{extensions → active_scaffold/extensions}/routing_mapper.rb +2 -2
- data/lib/{extensions → active_scaffold/extensions}/to_label.rb +0 -0
- data/lib/{extensions → active_scaffold/extensions}/unsaved_associated.rb +0 -0
- data/lib/{extensions → active_scaffold/extensions}/unsaved_record.rb +0 -0
- data/lib/active_scaffold/extensions/usa_state.rb +46 -0
- data/lib/active_scaffold/finder.rb +30 -19
- data/lib/active_scaffold/helpers/controller_helpers.rb +3 -5
- data/lib/active_scaffold/helpers/form_column_helpers.rb +19 -45
- data/lib/active_scaffold/helpers/human_condition_helpers.rb +1 -1
- data/lib/active_scaffold/helpers/id_helpers.rb +2 -2
- data/lib/active_scaffold/helpers/list_column_helpers.rb +28 -17
- data/lib/active_scaffold/helpers/search_column_helpers.rb +51 -40
- data/lib/active_scaffold/helpers/search_column_helpers.rb~ +215 -0
- data/lib/active_scaffold/helpers/show_column_helpers.rb +8 -4
- data/lib/active_scaffold/helpers/view_helpers.rb +50 -27
- data/lib/active_scaffold/locale/de.yml +111 -0
- data/lib/active_scaffold/locale/en.yml +115 -0
- data/lib/active_scaffold/locale/es.yml +32 -32
- data/lib/active_scaffold/locale/fr.yml +118 -0
- data/lib/active_scaffold/marked_model.rb +6 -6
- data/lib/active_scaffold/version.rb +1 -1
- data/lib/active_scaffold_assets.rb +1 -3
- data/lib/active_scaffold_env.rb +1 -2
- data/lib/generators/active_scaffold/active_scaffold_generator.rb +5 -5
- data/lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb +3 -2
- data/lib/generators/active_scaffold_controller/templates/helper.rb +2 -0
- data/lib/generators/active_scaffold_setup/active_scaffold_setup_generator.rb +17 -19
- data/shoulda_macros/macros.rb +4 -4
- data/test/misc/finder_test.rb +2 -2
- data/test/mock_app/public/stylesheets/active_scaffold/default/stylesheet.css +4 -1
- metadata +144 -126
- data/.autotest +0 -27
- data/.document +0 -5
- data/Gemfile +0 -13
- data/Gemfile.lock +0 -20
- data/Rakefile +0 -53
- data/active_scaffold.gemspec +0 -385
- data/init.rb +0 -2
- data/lib/active_scaffold/helpers/country_helpers.rb +0 -358
- data/lib/active_scaffold/locale/de.rb +0 -120
- data/lib/active_scaffold/locale/en.rb +0 -119
- data/lib/active_scaffold/locale/fr.rb +0 -116
- data/lib/extensions/active_record_offset.rb +0 -12
- data/lib/extensions/usa_state.rb +0 -50
- data/test/mock_app/.gitignore +0 -2
- data/uninstall.rb +0 -13
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
:'en' => {
|
|
3
|
-
:active_scaffold => {
|
|
4
|
-
:add => 'Add',
|
|
5
|
-
:add_existing => 'Add Existing',
|
|
6
|
-
:add_existing_model => 'Add Existing %{model}',
|
|
7
|
-
:are_you_sure_to_delete => 'Are you sure you want to delete %{label}?',
|
|
8
|
-
:cancel => 'Cancel',
|
|
9
|
-
:click_to_edit => 'Click to edit',
|
|
10
|
-
:click_to_reset => 'Click to reset',
|
|
11
|
-
:close => 'Close',
|
|
12
|
-
:config_list => 'Configure',
|
|
13
|
-
:config_list_model => 'Configure Columns for %{model}',
|
|
14
|
-
:create => 'Create',
|
|
15
|
-
:create_model => 'Create %{model}',
|
|
16
|
-
:create_another => 'Create Another %{model}',
|
|
17
|
-
:created_model => 'Created %{model}',
|
|
18
|
-
:create_new => 'Create New',
|
|
19
|
-
:customize => 'Customize',
|
|
20
|
-
:delete => 'Delete',
|
|
21
|
-
:deleted_model => 'Deleted %{model}',
|
|
22
|
-
:delimiter => 'Delimiter',
|
|
23
|
-
:download => 'Download',
|
|
24
|
-
:edit => 'Edit',
|
|
25
|
-
:export => 'Export',
|
|
26
|
-
:nested_for_model => '%{nested_model} for %{parent_model}',
|
|
27
|
-
:nested_of_model => '%{nested_model} of %{parent_model}',
|
|
28
|
-
:false => 'False',
|
|
29
|
-
:filtered => '(Filtered)',
|
|
30
|
-
:found => 'Found',
|
|
31
|
-
:hide => 'Hide',
|
|
32
|
-
:live_search => 'Live Search',
|
|
33
|
-
:loading => 'Loading…',
|
|
34
|
-
:next => 'Next',
|
|
35
|
-
:no_entries => 'No Entries',
|
|
36
|
-
:no_options => 'no options',
|
|
37
|
-
:omit_header => 'Omit Header',
|
|
38
|
-
:options => 'Options',
|
|
39
|
-
:pdf => 'PDF',
|
|
40
|
-
:previous => 'Previous',
|
|
41
|
-
:print => 'Print',
|
|
42
|
-
:refresh => 'Refresh',
|
|
43
|
-
:remove => 'Remove',
|
|
44
|
-
:remove_file => 'Remove or Replace file',
|
|
45
|
-
:replace_with_new => 'Replace With New',
|
|
46
|
-
:revisions_for_model => 'Revisions for %{model}',
|
|
47
|
-
:reset => 'Reset',
|
|
48
|
-
:saving => 'Saving…',
|
|
49
|
-
:search => 'Search',
|
|
50
|
-
:search_terms => 'Search Terms',
|
|
51
|
-
:_select_ => '- select -',
|
|
52
|
-
:show => 'Show',
|
|
53
|
-
:show_model => 'Show %{model}',
|
|
54
|
-
:_to_ => ' to ',
|
|
55
|
-
:true => 'True',
|
|
56
|
-
:update => 'Update',
|
|
57
|
-
:update_model => 'Update %{model}',
|
|
58
|
-
:updated_model => 'Updated %{model}',
|
|
59
|
-
:'=' => '=',
|
|
60
|
-
:'>=' => '>=',
|
|
61
|
-
:'<=' => '<=',
|
|
62
|
-
:'>' => '>',
|
|
63
|
-
:'<' => '<',
|
|
64
|
-
:'!=' => '!=',
|
|
65
|
-
:between => 'Between',
|
|
66
|
-
:contains => 'Contains',
|
|
67
|
-
:begins_with => 'Begins with',
|
|
68
|
-
:ends_with => 'Ends with',
|
|
69
|
-
:today => 'Today',
|
|
70
|
-
:yesterday => 'Yesterday',
|
|
71
|
-
:tomorrow => 'Tommorrow',
|
|
72
|
-
:this_week => 'This Week',
|
|
73
|
-
:prev_week => 'Last Week',
|
|
74
|
-
:next_week => 'Next Week',
|
|
75
|
-
:this_month => 'This Month',
|
|
76
|
-
:prev_month => 'Last Month',
|
|
77
|
-
:next_month => 'Next Month',
|
|
78
|
-
:this_year => 'This Year',
|
|
79
|
-
:prev_year => 'Last Year',
|
|
80
|
-
:next_year => 'Next Year',
|
|
81
|
-
:past => 'Past',
|
|
82
|
-
:future => 'Future',
|
|
83
|
-
:range => 'Range',
|
|
84
|
-
:seconds => 'Seconds',
|
|
85
|
-
:minutes => 'Minutes',
|
|
86
|
-
:hours => 'Hours',
|
|
87
|
-
:days => 'Days',
|
|
88
|
-
:weeks => 'Weeks',
|
|
89
|
-
:months => 'Months',
|
|
90
|
-
:years => 'Years',
|
|
91
|
-
:optional_attributes => 'Further Options',
|
|
92
|
-
:null => 'Null',
|
|
93
|
-
:not_null => 'Not Null',
|
|
94
|
-
:date_picker_options => {
|
|
95
|
-
:weekHeader => 'Wk',
|
|
96
|
-
:firstDay => 0,
|
|
97
|
-
:isRTL => false,
|
|
98
|
-
:showMonthAfterYear => false
|
|
99
|
-
},
|
|
100
|
-
:datetime_picker_options => {
|
|
101
|
-
},
|
|
102
|
-
:errors => {
|
|
103
|
-
:template => {
|
|
104
|
-
:header => {
|
|
105
|
-
:one => "1 error prohibited this %{model} from being saved.",
|
|
106
|
-
:other => "%{count} errors prohibited this %{model} from being saved"
|
|
107
|
-
},
|
|
108
|
-
:body => "There were problems with the following fields:"
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
# error_messages
|
|
112
|
-
:cant_destroy_record => "%{record} can't be destroyed",
|
|
113
|
-
:internal_error => 'Request Failed (code 500, Internal Error)',
|
|
114
|
-
:version_inconsistency => 'Version inconsistency - this record has been modified since you started editing it.',
|
|
115
|
-
:record_not_saved => 'Failed to save record cause of an unknown error',
|
|
116
|
-
:no_authorization_for_action => "No Authorization for action %{action}"
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
:'fr' => {
|
|
3
|
-
:active_scaffold => {
|
|
4
|
-
:add => 'Ajouter',
|
|
5
|
-
:add_existing => 'Ajouter un(e) existant(e)',
|
|
6
|
-
:add_existing_model => 'Ajouter un(e) %{model} existant(e)',
|
|
7
|
-
:are_you_sure_to_delete => 'Êtes vous sûr?',
|
|
8
|
-
:cancel => 'Annuler',
|
|
9
|
-
:click_to_edit => 'Cliquer pour éditer',
|
|
10
|
-
:close => 'Fermer',
|
|
11
|
-
:config_list => 'Configure',
|
|
12
|
-
:config_list_model => 'Configure Columns for %{model}',
|
|
13
|
-
:create => 'Créer',
|
|
14
|
-
:create_model => 'Créer %{model}',
|
|
15
|
-
:create_another => 'Créer un autre',
|
|
16
|
-
:created_model => '%{model} créé',
|
|
17
|
-
:create_new => 'Créer un nouveau',
|
|
18
|
-
:customize => 'Personnaliser',
|
|
19
|
-
:delete => 'Supprimer',
|
|
20
|
-
:deleted_model => 'Suppression de %{model}',
|
|
21
|
-
:delimiter => 'Délimiteur',
|
|
22
|
-
:download => 'Télécharger',
|
|
23
|
-
:edit => 'Éditer',
|
|
24
|
-
:export => 'Exporter',
|
|
25
|
-
:nested_for_model => '%{nested_model} pour %{parent_model}',
|
|
26
|
-
:nested_of_model => '%{nested_model} de %{parent_model}',
|
|
27
|
-
:filtered => '(Filtré)',
|
|
28
|
-
:found => 'Trouvé',
|
|
29
|
-
:hide => 'Cacher',
|
|
30
|
-
:live_search => 'Recherche en temps réel',
|
|
31
|
-
:loading => 'Chargement…',
|
|
32
|
-
:next => 'Suivant',
|
|
33
|
-
:no_entries => "Pas d'entrée",
|
|
34
|
-
:no_options => "pas d'option",
|
|
35
|
-
:omit_header => 'Omettre les en-têtes',
|
|
36
|
-
:options => 'Options',
|
|
37
|
-
:pdf => 'PDF',
|
|
38
|
-
:previous => 'Précédent',
|
|
39
|
-
:print => 'Imprimer',
|
|
40
|
-
:refresh => 'Rafraîchir',
|
|
41
|
-
:remove => 'Supprimer',
|
|
42
|
-
:remove_file => 'Supprimer et remplacer le fichier',
|
|
43
|
-
:replace_with_new => 'Remplacer avec le nouveau',
|
|
44
|
-
:revisions_for_model => 'Révision pour %{model}',
|
|
45
|
-
:reset => 'Annuler',
|
|
46
|
-
:saving => 'Sauvegarder…',
|
|
47
|
-
:search => 'Rechercher',
|
|
48
|
-
:search_terms => 'Recherche de termes',
|
|
49
|
-
:_select_ => '- sélectionner -',
|
|
50
|
-
:show => 'Montrer',
|
|
51
|
-
:show_model => 'Montrer %{model}',
|
|
52
|
-
:_to_ => ' à ',
|
|
53
|
-
:update => 'Mettre à jour',
|
|
54
|
-
:update_model => 'Mettre à jour le(/la) %{model}',
|
|
55
|
-
:updated_model => 'Mis à jour de %{model}',
|
|
56
|
-
:'=' => '=',
|
|
57
|
-
:'>=' => '>=',
|
|
58
|
-
:'<=' => '<=',
|
|
59
|
-
:'>' => '>',
|
|
60
|
-
:'<' => '<',
|
|
61
|
-
:'!=' => '!=',
|
|
62
|
-
:between => 'Entre',
|
|
63
|
-
:today => 'Today',
|
|
64
|
-
:yesterday => 'Yesterday',
|
|
65
|
-
:tomorrow => 'Tommorrow',
|
|
66
|
-
:this_week => 'This Week',
|
|
67
|
-
:prev_week => 'Last Week',
|
|
68
|
-
:next_week => 'Next Week',
|
|
69
|
-
:this_month => 'This Month',
|
|
70
|
-
:prev_month => 'Last Month',
|
|
71
|
-
:next_month => 'Next Month',
|
|
72
|
-
:this_year => 'This Year',
|
|
73
|
-
:prev_year => 'Last Year',
|
|
74
|
-
:next_year => 'Next Year',
|
|
75
|
-
:past => 'Past',
|
|
76
|
-
:future => 'Future',
|
|
77
|
-
:range => 'Range',
|
|
78
|
-
:seconds => 'Seconds',
|
|
79
|
-
:minutes => 'Minutes',
|
|
80
|
-
:hours => 'Hours',
|
|
81
|
-
:days => 'Days',
|
|
82
|
-
:weeks => 'Weeks',
|
|
83
|
-
:months => 'Months',
|
|
84
|
-
:years => 'Years',
|
|
85
|
-
:optional_attributes => 'Further Options',
|
|
86
|
-
:null => 'Null',
|
|
87
|
-
:not_null => 'Not Null',
|
|
88
|
-
:date_picker_options => {
|
|
89
|
-
:weekHeader => 'Sm',
|
|
90
|
-
:firstDay => 1,
|
|
91
|
-
:isRTL => false,
|
|
92
|
-
:showMonthAfterYear => false,
|
|
93
|
-
},
|
|
94
|
-
:datetime_picker_options => {
|
|
95
|
-
:timeText => 'Heure',
|
|
96
|
-
:currentText => 'Maintenant',
|
|
97
|
-
:closeText => 'Fermer'
|
|
98
|
-
},
|
|
99
|
-
:errors => {
|
|
100
|
-
:template => {
|
|
101
|
-
:header => {
|
|
102
|
-
:one => "1 error prohibited this %{model} from being saved.",
|
|
103
|
-
:other => "%{count} errors prohibited this %{model} from being saved"
|
|
104
|
-
},
|
|
105
|
-
:body => "There were problems with the following fields:"
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
# error_messages
|
|
109
|
-
:cant_destroy_record => "%{record} can't be destroyed",
|
|
110
|
-
:internal_error => 'Erreur de la requête (code 500, Erreur interne)',
|
|
111
|
-
:version_inconsistency => "Version incomplète - Cet enregistrement a été modifié depuis que vous avez commencé à l'éditer.",
|
|
112
|
-
:record_not_saved => 'Failed to save record cause of an unknown error',
|
|
113
|
-
:no_authorization_for_action => "No Authorization for action %{action}"
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# Bugfix: Team.offset(1).limit(1) throws an error
|
|
2
|
-
ActiveRecord::Base.instance_eval do
|
|
3
|
-
def offset(*args, &block)
|
|
4
|
-
scoped.__send__(:offset, *args, &block)
|
|
5
|
-
rescue NoMethodError
|
|
6
|
-
if scoped.nil?
|
|
7
|
-
'depends on :allow_nil'
|
|
8
|
-
else
|
|
9
|
-
raise
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
data/lib/extensions/usa_state.rb
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
module ActionView
|
|
2
|
-
module Helpers
|
|
3
|
-
module FormOptionsHelper
|
|
4
|
-
|
|
5
|
-
# Return a full select and option tags for the given object and
|
|
6
|
-
# method, using usa_state_options_for_select to generate the
|
|
7
|
-
# list of option <tags>.
|
|
8
|
-
def usa_state_select(object, method, priority_states = nil, options = {}, html_options = {})
|
|
9
|
-
InstanceTag.new(object, method, self, options.delete(:object)).to_usa_state_select_tag(priority_states, options, html_options)
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
# Returns a string of option tags for the states in the United
|
|
14
|
-
# States. Supply a state name as +selected to have it marked as
|
|
15
|
-
# the selected option tag. Included also is the option to set a
|
|
16
|
-
# couple of +priority_states+ in case you want to highligh a
|
|
17
|
-
# local area. NOTE: Only the option tags are returned from this
|
|
18
|
-
# method, wrap it in a <select>
|
|
19
|
-
def usa_state_options_for_select(selected = nil, priority_states = nil)
|
|
20
|
-
state_options = ""
|
|
21
|
-
if priority_states
|
|
22
|
-
state_options += options_for_select(priority_states, selected)
|
|
23
|
-
state_options += "<option>-------------</option>\n"
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
if priority_states && priority_states.include?(selected)
|
|
27
|
-
state_options += options_for_select(USASTATES - priority_states, selected)
|
|
28
|
-
else
|
|
29
|
-
state_options += options_for_select(USASTATES, selected)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
return state_options
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
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")
|
|
36
|
-
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
class InstanceTag #:nodoc:
|
|
40
|
-
include FormOptionsHelper
|
|
41
|
-
|
|
42
|
-
def to_usa_state_select_tag(priority_states, options, html_options)
|
|
43
|
-
html_options = html_options.stringify_keys
|
|
44
|
-
add_default_name_and_id(html_options)
|
|
45
|
-
value = value(object) if method(:value).arity > 0
|
|
46
|
-
content_tag("select", add_options(usa_state_options_for_select(value, priority_states), options, value), html_options)
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
data/test/mock_app/.gitignore
DELETED
data/uninstall.rb
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
##
|
|
2
|
-
## Delete public asset files
|
|
3
|
-
##
|
|
4
|
-
|
|
5
|
-
require 'fileutils'
|
|
6
|
-
|
|
7
|
-
directory = File.dirname(__FILE__)
|
|
8
|
-
|
|
9
|
-
[ :stylesheets, :javascripts, :images].each do |asset_type|
|
|
10
|
-
path = File.join(directory, "../../../public/#{asset_type}/active_scaffold")
|
|
11
|
-
FileUtils.rm_r(path)
|
|
12
|
-
end
|
|
13
|
-
FileUtils.rm(File.join(directory, "../../../public/blank.html"))
|