active_scaffold 3.0.12 → 3.0.21
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -8,8 +8,8 @@ es:
|
|
8
8
|
click_to_edit: 'Pulsa para editar'
|
9
9
|
click_to_reset: 'Pulsa para restaurar'
|
10
10
|
close: 'Cerrar'
|
11
|
-
config_list: '
|
12
|
-
config_list_model: '
|
11
|
+
config_list: 'Configurar'
|
12
|
+
config_list_model: 'Configurar columnas de %{model}'
|
13
13
|
create: 'Crear'
|
14
14
|
create_model: 'Crear %{model}'
|
15
15
|
create_another: 'Crear Otro %{model}'
|
@@ -31,7 +31,7 @@ es:
|
|
31
31
|
live_search: 'Buscar en Vivo'
|
32
32
|
loading: 'Cargando…'
|
33
33
|
nested_for_model: '%{nested_model} de %{parent_model}'
|
34
|
-
nested_of_model: '%{nested_model}
|
34
|
+
nested_of_model: '%{nested_model} de %{parent_model}'
|
35
35
|
next: 'Siguiente'
|
36
36
|
no_entries: 'Sin entradas'
|
37
37
|
no_options: 'sin opciones'
|
@@ -67,31 +67,31 @@ es:
|
|
67
67
|
contains: 'Contiene'
|
68
68
|
begins_with: 'Empieza con'
|
69
69
|
ends_with: 'Termina con'
|
70
|
-
today: '
|
71
|
-
yesterday: '
|
72
|
-
tomorrow: '
|
73
|
-
this_week: '
|
74
|
-
prev_week: '
|
75
|
-
next_week: '
|
76
|
-
this_month: '
|
77
|
-
prev_month: '
|
78
|
-
next_month: '
|
79
|
-
this_year: '
|
80
|
-
prev_year: '
|
81
|
-
next_year: '
|
82
|
-
past: '
|
83
|
-
future: '
|
84
|
-
range: '
|
85
|
-
seconds: '
|
86
|
-
minutes: '
|
87
|
-
hours: '
|
88
|
-
days: '
|
89
|
-
weeks: '
|
90
|
-
months: '
|
91
|
-
years: '
|
92
|
-
optional_attributes: '
|
93
|
-
null: '
|
94
|
-
not_null: '
|
70
|
+
today: 'Hoy'
|
71
|
+
yesterday: 'Ayer'
|
72
|
+
tomorrow: 'Mañana'
|
73
|
+
this_week: 'Esta semana'
|
74
|
+
prev_week: 'Semana pasada'
|
75
|
+
next_week: 'Próxima semana'
|
76
|
+
this_month: 'Este mes'
|
77
|
+
prev_month: 'Mes pasado'
|
78
|
+
next_month: 'Próximo mes'
|
79
|
+
this_year: 'Este año'
|
80
|
+
prev_year: 'Año pasado'
|
81
|
+
next_year: 'Próximo año'
|
82
|
+
past: 'Pasado'
|
83
|
+
future: 'Futuro'
|
84
|
+
range: 'Rango'
|
85
|
+
seconds: 'Segundos'
|
86
|
+
minutes: 'Minutos'
|
87
|
+
hours: 'Horas'
|
88
|
+
days: 'Días'
|
89
|
+
weeks: 'Semanas'
|
90
|
+
months: 'Meses'
|
91
|
+
years: 'Años'
|
92
|
+
optional_attributes: 'Más opciones'
|
93
|
+
null: 'Nulo'
|
94
|
+
not_null: 'No Nulo'
|
95
95
|
date_picker_options:
|
96
96
|
weekHeader: 'Sm'
|
97
97
|
firstDay: 1
|
@@ -104,12 +104,12 @@ es:
|
|
104
104
|
errors:
|
105
105
|
template:
|
106
106
|
header:
|
107
|
-
one: "
|
108
|
-
other: "
|
109
|
-
body: "
|
107
|
+
one: "No se pudo guardar debido a un error."
|
108
|
+
other: "No se pudo guardar debido a %{count} errores."
|
109
|
+
body: "Hubo problemas con los siguientes campos:"
|
110
110
|
|
111
111
|
# error_messages
|
112
112
|
cant_destroy_record: "No se pudo borrar %{record}"
|
113
113
|
internal_error: 'Petición fallida (código 500, error interno)'
|
114
114
|
version_inconsistency: 'Inconsistencia de versiones - este registro se ha modificado después de que empezó a editarlo.'
|
115
|
-
no_authorization_for_action: "No
|
115
|
+
no_authorization_for_action: "No dispone de autorización para la acción %{action}"
|
@@ -0,0 +1,118 @@
|
|
1
|
+
fr:
|
2
|
+
active_scaffold:
|
3
|
+
add: 'Ajouter'
|
4
|
+
add_existing: 'Ajouter un(e) existant(e)'
|
5
|
+
add_existing_model: 'Ajouter un(e) %{model} existant(e)'
|
6
|
+
are_you_sure_to_delete: 'Êtes vous sûr?'
|
7
|
+
cancel: 'Annuler'
|
8
|
+
click_to_edit: 'Cliquer pour éditer'
|
9
|
+
click_to_reset: 'Cliquer pour ré-initialiser'
|
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
|
+
'false': 'Faux'
|
28
|
+
filtered: '(Filtré)'
|
29
|
+
found: 'Trouvé'
|
30
|
+
hide: 'Cacher'
|
31
|
+
live_search: 'Recherche en temps réel'
|
32
|
+
loading: 'Chargement…'
|
33
|
+
next: 'Suivant'
|
34
|
+
no_entries: "Pas d'entrée"
|
35
|
+
no_options: "pas d'option"
|
36
|
+
omit_header: 'Omettre les en-têtes'
|
37
|
+
options: 'Options'
|
38
|
+
pdf: 'PDF'
|
39
|
+
previous: 'Précédent'
|
40
|
+
print: 'Imprimer'
|
41
|
+
refresh: 'Rafraîchir'
|
42
|
+
remove: 'Supprimer'
|
43
|
+
remove_file: 'Supprimer et remplacer le fichier'
|
44
|
+
replace_with_new: 'Remplacer avec le nouveau'
|
45
|
+
revisions_for_model: 'Révision pour %{model}'
|
46
|
+
reset: 'Annuler'
|
47
|
+
saving: 'Sauvegarder…'
|
48
|
+
search: 'Rechercher'
|
49
|
+
search_terms: 'Recherche de termes'
|
50
|
+
_select_: '- sélectionner -'
|
51
|
+
show: 'Montrer'
|
52
|
+
show_model: 'Montrer %{model}'
|
53
|
+
_to_ : ' à '
|
54
|
+
'true': 'Vrai'
|
55
|
+
update: 'Mettre à jour'
|
56
|
+
update_model: 'Mettre à jour le(/la) %{model}'
|
57
|
+
updated_model: 'Mis à jour de %{model}'
|
58
|
+
'=': '='
|
59
|
+
'>=': '>='
|
60
|
+
'<=': '<='
|
61
|
+
'>': '>'
|
62
|
+
'<': '<'
|
63
|
+
'!=': '!='
|
64
|
+
between: 'Entre'
|
65
|
+
contains: 'Contient'
|
66
|
+
begins_with: 'Commençant par'
|
67
|
+
ends_with: 'Se terminant par'
|
68
|
+
today: "Aujourd'hui"
|
69
|
+
yesterday: 'Hier'
|
70
|
+
tomorrow: 'Demain'
|
71
|
+
this_week: 'Cette Semaine'
|
72
|
+
prev_week: 'Semaine dernière'
|
73
|
+
next_week: 'Semaine prochaine'
|
74
|
+
this_month: 'Ce Mois'
|
75
|
+
prev_month: 'Mois dernier'
|
76
|
+
next_month: 'Mois prochain'
|
77
|
+
this_year: 'Cette Année'
|
78
|
+
prev_year: 'Année dernière'
|
79
|
+
next_year: 'Année prochaine'
|
80
|
+
past: 'Passé'
|
81
|
+
future: 'Futur'
|
82
|
+
range: 'Intervale'
|
83
|
+
seconds: 'Secondes'
|
84
|
+
minutes: 'Minutes'
|
85
|
+
hours: 'Heures'
|
86
|
+
days: 'Jours'
|
87
|
+
weeks: 'Semaines'
|
88
|
+
months: 'Mois'
|
89
|
+
years: 'Années'
|
90
|
+
optional_attributes: 'Options additionnelles'
|
91
|
+
null: 'Nulle'
|
92
|
+
not_null: 'Non Nulle'
|
93
|
+
date_picker_options:
|
94
|
+
weekHeader: 'Sm'
|
95
|
+
firstDay: 1
|
96
|
+
isRTL: false
|
97
|
+
showMonthAfterYear: false
|
98
|
+
|
99
|
+
datetime_picker_options:
|
100
|
+
timeText: 'Heure'
|
101
|
+
currentText: 'Maintenant'
|
102
|
+
closeText: 'Fermer'
|
103
|
+
|
104
|
+
errors:
|
105
|
+
template:
|
106
|
+
header:
|
107
|
+
one: "1 erreur interdit ce(tte) %{model} d'être sauvegardé."
|
108
|
+
other: "%{count} erreurs interdit ce(tte) %{model} d'être sauvegardé"
|
109
|
+
|
110
|
+
body: "Il y avait des problèmes avec les champs suivants :"
|
111
|
+
|
112
|
+
|
113
|
+
# error_messages
|
114
|
+
cant_destroy_record: "%{record} ne peut être supprimé"
|
115
|
+
internal_error: 'Erreur de la requête (code 500, Erreur interne)'
|
116
|
+
version_inconsistency: "Version incomplète - Cet enregistrement a été modifié depuis que vous avez commencé à l'éditer."
|
117
|
+
record_not_saved: "Impossible d'enregistrer l'enregistrement à cause d'une erreur inconnue"
|
118
|
+
no_authorization_for_action: "Aucune autorisation pour l'action %{action}"
|
@@ -1,16 +1,16 @@
|
|
1
1
|
module ActiveScaffold
|
2
2
|
module MarkedModel
|
3
3
|
# This is a module aimed at making the make session_stored marked_records available to ActiveRecord models
|
4
|
-
|
4
|
+
|
5
5
|
def self.included(base)
|
6
6
|
base.extend ClassMethods
|
7
7
|
base.scope :marked, lambda {{:conditions => {:id => base.marked_records.to_a}}}
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
def marked
|
11
11
|
marked_records.include?(self.id)
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
def marked=(value)
|
15
15
|
value = [true, 'true', 1, '1', 'T', 't'].include?(value.class == String ? value.downcase : value)
|
16
16
|
if value == true
|
@@ -19,17 +19,17 @@ module ActiveScaffold
|
|
19
19
|
marked_records.delete(self.id)
|
20
20
|
end
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
module ClassMethods
|
24
24
|
def marked_records
|
25
25
|
Thread.current[:marked_records] ||= Set.new
|
26
26
|
end
|
27
27
|
|
28
28
|
def marked_records=(marked)
|
29
|
-
Thread.current[:marked_records] = marked
|
29
|
+
Thread.current[:marked_records] = marked
|
30
30
|
end
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
# Instance-level access to the marked_records
|
34
34
|
def marked_records
|
35
35
|
self.class.marked_records
|
@@ -8,8 +8,6 @@ class ActiveScaffoldAssets
|
|
8
8
|
copy_asset_type(from, available_frontends, asset_type, options)
|
9
9
|
end
|
10
10
|
end
|
11
|
-
rescue
|
12
|
-
raise $! unless Rails.env == 'production'
|
13
11
|
end
|
14
12
|
|
15
13
|
protected
|
@@ -44,4 +42,4 @@ protected
|
|
44
42
|
FileUtils.rm Dir.glob("#{destination}/*") if options[:clean_up_destination]
|
45
43
|
FileUtils.cp_r(Dir.glob("#{source}/#{file_mask}"), destination)
|
46
44
|
end
|
47
|
-
end
|
45
|
+
end
|
data/lib/active_scaffold_env.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# TODO: clean up extensions. some could be organized for autoloading, and others could be removed entirely.
|
2
|
-
Dir["#{File.dirname __FILE__}/extensions/*.rb"].each { |file| require file }
|
2
|
+
Dir["#{File.dirname __FILE__}/active_scaffold/extensions/*.rb"].each { |file| require file }
|
3
3
|
|
4
4
|
ActionController::Base.send(:include, ActiveScaffold)
|
5
5
|
ActionController::Base.send(:include, RespondsToParent)
|
@@ -11,4 +11,3 @@ ActiveRecord::Base.class_eval {include ActiveRecordPermissions::ModelUserAcc
|
|
11
11
|
ActiveRecord::Base.class_eval {include ActiveRecordPermissions::Permissions}
|
12
12
|
|
13
13
|
I18n.load_path += Dir[File.join(File.dirname(__FILE__), 'active_scaffold', 'locale', '*.{rb,yml}')]
|
14
|
-
#ActiveScaffold.js_framework = :jquery
|
@@ -6,14 +6,14 @@ module Rails
|
|
6
6
|
class ActiveScaffoldGenerator < ResourceGenerator #metagenerator
|
7
7
|
remove_hook_for :resource_controller
|
8
8
|
remove_class_option :actions
|
9
|
-
|
9
|
+
|
10
10
|
def add_resource_route
|
11
|
-
route_config = class_path.collect{|namespace| "namespace :#{namespace} do " }.join(" ")
|
11
|
+
route_config = class_path.collect{|namespace| "namespace :#{namespace} do " }.join(" ")
|
12
12
|
route_config << "resources :#{file_name.pluralize} do as_routes end"
|
13
|
-
route_config << " end" * class_path.size
|
13
|
+
route_config << " end" * class_path.size
|
14
14
|
route route_config
|
15
|
-
end
|
16
|
-
|
15
|
+
end
|
16
|
+
|
17
17
|
invoke "active_scaffold_controller"
|
18
18
|
end
|
19
19
|
end
|
@@ -16,13 +16,14 @@ module Rails
|
|
16
16
|
|
17
17
|
def create_controller_files
|
18
18
|
template 'controller.rb', File.join('app/controllers', class_path, "#{controller_file_name}_controller.rb")
|
19
|
+
template 'helper.rb', File.join('app/helpers', class_path, "#{controller_file_name}_helper.rb")
|
19
20
|
end
|
20
21
|
|
21
22
|
hook_for :test_framework, :as => :scaffold
|
22
23
|
|
23
24
|
def create_view_root_folder
|
24
25
|
empty_directory File.join("app/views", controller_file_path)
|
25
|
-
end
|
26
|
+
end
|
26
27
|
end
|
27
28
|
end
|
28
|
-
end
|
29
|
+
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Rails
|
2
2
|
module Generators
|
3
3
|
class ActiveScaffoldSetupGenerator < Rails::Generators::Base #metagenerator
|
4
|
-
argument :js_lib, :type => :string, :default => 'prototype', :desc => 'js_lib for activescaffold (prototype|jquery)'
|
5
|
-
|
4
|
+
argument :js_lib, :type => :string, :default => 'prototype', :desc => 'js_lib for activescaffold (prototype|jquery)'
|
5
|
+
|
6
6
|
def self.source_root
|
7
7
|
@source_root ||= File.join(File.dirname(__FILE__), 'templates')
|
8
8
|
end
|
@@ -19,43 +19,41 @@ module Rails
|
|
19
19
|
get "https://github.com/vhochstein/jQuery-Timepicker-Addon/raw/master/jquery-ui-timepicker-addon.js", "public/javascripts/jquery-ui-timepicker-addon.js"
|
20
20
|
end
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
def configure_active_scaffold
|
24
|
+
return unless js_lib == 'jquery'
|
24
25
|
if defined?(ACTIVE_SCAFFOLD_PLUGIN)
|
25
|
-
|
26
|
-
gsub_file 'vendor/plugins/active_scaffold/lib/active_scaffold_env.rb', /#ActiveScaffold.js_framework = :jquery/, 'ActiveScaffold.js_framework = :jquery'
|
27
|
-
end
|
26
|
+
content = "ActiveSupport.on_load(:active_scaffold) { self.js_framework = :jquery }"
|
28
27
|
else
|
29
|
-
|
30
|
-
create_file "config/initializers/active_scaffold.rb", "ActiveScaffold.js_framework = :jquery"
|
31
|
-
end
|
28
|
+
content = "ActiveScaffold.js_framework = :jquery"
|
32
29
|
end
|
30
|
+
create_file "config/initializers/active_scaffold.rb", content
|
33
31
|
end
|
34
|
-
|
32
|
+
|
35
33
|
def configure_application_layout
|
36
34
|
if js_lib == 'prototype'
|
37
|
-
inject_into_file "app/views/layouts/application.html.erb",
|
35
|
+
inject_into_file "app/views/layouts/application.html.erb",
|
38
36
|
" <%= active_scaffold_includes %>\n",
|
39
37
|
:after => "<%= javascript_include_tag :defaults %>\n"
|
40
38
|
elsif js_lib == 'jquery'
|
41
|
-
inject_into_file "app/views/layouts/application.html.erb",
|
42
|
-
" <%= stylesheet_link_tag 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.
|
43
|
-
<%= javascript_include_tag 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.
|
39
|
+
inject_into_file "app/views/layouts/application.html.erb",
|
40
|
+
" <%= stylesheet_link_tag 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/ui-lightness/jquery-ui.css' %>
|
41
|
+
<%= javascript_include_tag 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js' %>
|
44
42
|
<%= javascript_include_tag 'rails_jquery.js' %>
|
45
|
-
<%= javascript_include_tag 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.
|
43
|
+
<%= javascript_include_tag 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.js' %>
|
46
44
|
<%= javascript_include_tag 'jquery-ui-timepicker-addon.js' %>
|
47
45
|
<%= javascript_include_tag 'application.js' %>
|
48
46
|
<%= active_scaffold_includes %>\n",
|
49
47
|
:after => "<%= javascript_include_tag :defaults %>\n"
|
50
|
-
|
48
|
+
|
51
49
|
inject_into_file "config/locales/en.yml",
|
52
50
|
" time:
|
53
51
|
formats:
|
54
|
-
default: \"%a, %d %b %Y %H:%M:%S\"",
|
52
|
+
default: \"%a, %d %b %Y %H:%M:%S\"",
|
55
53
|
:after => "hello: \"Hello world\"\n"
|
56
54
|
gsub_file 'app/views/layouts/application.html.erb', /<%= javascript_include_tag :defaults/, '<%# javascript_include_tag :defaults'
|
57
55
|
end
|
58
|
-
end
|
56
|
+
end
|
59
57
|
end
|
60
58
|
end
|
61
|
-
end
|
59
|
+
end
|
data/shoulda_macros/macros.rb
CHANGED
@@ -26,7 +26,7 @@ class ActiveSupport::TestCase
|
|
26
26
|
def self.should_render_as_form_ui(column_name, form_ui)
|
27
27
|
should "render column #{column_name} as #{form_ui} form_ui", :before => lambda{
|
28
28
|
@rendered_columns = []
|
29
|
-
|
29
|
+
@controller.view_context_class.any_instance.expects(:"active_scaffold_input_#{form_ui}").at_least_once.with {|column, options|
|
30
30
|
@rendered_columns << column.name
|
31
31
|
true
|
32
32
|
}
|
@@ -60,7 +60,7 @@ class ActiveSupport::TestCase
|
|
60
60
|
def self.should_render_as_form_hidden(column_name)
|
61
61
|
should "render column #{column_name} as form hidden", :before => lambda{
|
62
62
|
@rendered_columns = []
|
63
|
-
|
63
|
+
@controller.view_context_class.any_instance.expects(:"hidden_field").at_least_once.with {|object, method, options|
|
64
64
|
@rendered_columns << method
|
65
65
|
true
|
66
66
|
}
|
@@ -73,7 +73,7 @@ class ActiveSupport::TestCase
|
|
73
73
|
def self.should_render_as_list_ui(column_name, list_ui)
|
74
74
|
should "render column #{column_name} as #{list_ui} list_ui", :before => lambda{
|
75
75
|
@rendered_columns = []
|
76
|
-
|
76
|
+
@controller.view_context_class.any_instance.expects(:"active_scaffold_column_#{list_ui}").at_least_once.with {|column, options|
|
77
77
|
@rendered_columns << column.name
|
78
78
|
true
|
79
79
|
}
|
@@ -102,7 +102,7 @@ class ActiveSupport::TestCase
|
|
102
102
|
@column = @controller.active_scaffold_config.columns[column_name]
|
103
103
|
@rendered_columns = []
|
104
104
|
method = @column.list_ui == :checkbox ? :format_column_checkbox : :active_scaffold_inplace_edit
|
105
|
-
|
105
|
+
@controller.view_context_class.any_instance.expects(method).at_least_once.with {|model, column, options|
|
106
106
|
@rendered_columns << column.name
|
107
107
|
true
|
108
108
|
}
|
data/test/misc/finder_test.rb
CHANGED
@@ -33,13 +33,13 @@ class FinderTest < Test::Unit::TestCase
|
|
33
33
|
]
|
34
34
|
|
35
35
|
expected_conditions = [
|
36
|
-
'(
|
36
|
+
'("model_stubs"."a" LIKE ? OR "model_stubs"."b" LIKE ?) AND ("model_stubs"."a" LIKE ? OR "model_stubs"."b" LIKE ?)',
|
37
37
|
'%foo%', '%foo%', '%bar%', '%bar%'
|
38
38
|
]
|
39
39
|
assert_equal expected_conditions, ClassWithFinder.create_conditions_for_columns(tokens, columns)
|
40
40
|
|
41
41
|
expected_conditions = [
|
42
|
-
'(
|
42
|
+
'("model_stubs"."a" LIKE ? OR "model_stubs"."b" LIKE ?)',
|
43
43
|
'%foo%', '%foo%'
|
44
44
|
]
|
45
45
|
assert_equal expected_conditions, ClassWithFinder.create_conditions_for_columns('foo', columns)
|