active_scaffold 3.1.15 → 3.1.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -60,12 +60,12 @@ es:
60
60
  update: 'Actualizar'
61
61
  update_model: 'Actualizar %{model}'
62
62
  updated_model: '%{model} actualizado'
63
- '=': '='
64
- '>=': '>='
65
- '<=': '<='
66
- '>': '>'
67
- '<': '<'
68
- '!=': '!='
63
+ '=': 'Igual'
64
+ '>=': 'Mayor o igual'
65
+ '<=': 'Menor o igual'
66
+ '>': 'Mayor'
67
+ '<': 'Menor'
68
+ '!=': 'Distinto'
69
69
  between: 'Entre'
70
70
  is_null: 'Es nulo'
71
71
  is_not_null: 'No es nulo'
@@ -0,0 +1,120 @@
1
+ es:
2
+ time:
3
+ formats:
4
+ picker: "%a, %d %b %Y %H:%M:%S"
5
+ active_scaffold:
6
+ add: 'Añadir'
7
+ add_existing: 'Añadir Existente'
8
+ add_existing_model: 'Añadir %{model} Existente'
9
+ are_you_sure_to_delete: '¿Estás seguro de que quieres borrar %{label}?'
10
+ cancel: 'Cancelar'
11
+ click_to_edit: 'Pulsa para editar'
12
+ click_to_reset: 'Pulsa para restaurar'
13
+ close: 'Cerrar'
14
+ config_list: 'Configurar'
15
+ config_list_model: 'Configurar columnas de %{model}'
16
+ create: 'Crear'
17
+ create_model: 'Crear %{model}'
18
+ create_another: 'Crear Otro %{model}'
19
+ created_model: '%{model} creado'
20
+ create_new: 'Crear Nuevo'
21
+ customize: 'Personalizar'
22
+ delete: 'Borrar'
23
+ deleted_model: '%{model} borrado'
24
+ delimiter: 'Delimitador'
25
+ download: 'Descargar'
26
+ edit: 'Editar'
27
+ export: 'Exportar'
28
+ 'false': 'No'
29
+ filtered: '(Filtrado)'
30
+ found:
31
+ one: 'encontrado'
32
+ other: 'encontrados'
33
+ hide: 'Ocultar'
34
+ live_search: 'Buscar en Vivo'
35
+ loading: 'Cargando…'
36
+ nested_for_model: '%{nested_model} de %{parent_model}'
37
+ nested_of_model: '%{nested_model} de %{parent_model}'
38
+ next: 'Siguiente'
39
+ no_entries: 'Sin entradas'
40
+ no_options: 'sin opciones'
41
+ omit_header: 'Omitir Cabecera'
42
+ options: 'Opciones'
43
+ pdf: 'PDF'
44
+ previous: 'Anterior'
45
+ print: 'Imprimir'
46
+ refresh: 'Recargar'
47
+ remove: 'Eliminar'
48
+ remove_file: 'Eliminar o Reemplazar archivo'
49
+ replace_with_new: 'Reemplazar con Nuevo'
50
+ revisions_for_model: 'Revisiones de %{model}'
51
+ reset: 'Restaurar'
52
+ saving: 'Guardando…'
53
+ search: 'Buscar'
54
+ search_terms: 'Términos a buscar'
55
+ _select_: '- seleccionar -'
56
+ show: 'Ver'
57
+ show_model: 'Ver %{model}'
58
+ _to_ : ' a '
59
+ 'true': 'Sí'
60
+ update: 'Actualizar'
61
+ update_model: 'Actualizar %{model}'
62
+ updated_model: '%{model} actualizado'
63
+ '=': 'Igual a'
64
+ '>=': 'Mayor o igual a'
65
+ '<=': 'Menor o igual a'
66
+ '>': 'Mayor a'
67
+ '<': 'Menor a'
68
+ '!=': 'Distinto de'
69
+ between: 'Entre'
70
+ is_null: 'Es nulo'
71
+ is_not_null: 'No es nulo'
72
+ contains: 'Contiene'
73
+ begins_with: 'Empieza con'
74
+ ends_with: 'Termina con'
75
+ today: 'Hoy'
76
+ yesterday: 'Ayer'
77
+ tomorrow: 'Mañana'
78
+ this_week: 'Esta semana'
79
+ prev_week: 'Semana pasada'
80
+ next_week: 'Próxima semana'
81
+ this_month: 'Este mes'
82
+ prev_month: 'Mes pasado'
83
+ next_month: 'Próximo mes'
84
+ this_year: 'Este año'
85
+ prev_year: 'Año pasado'
86
+ next_year: 'Próximo año'
87
+ past: 'Pasado'
88
+ future: 'Futuro'
89
+ range: 'Rango'
90
+ seconds: 'Segundos'
91
+ minutes: 'Minutos'
92
+ hours: 'Horas'
93
+ days: 'Días'
94
+ weeks: 'Semanas'
95
+ months: 'Meses'
96
+ years: 'Años'
97
+ optional_attributes: 'Más opciones'
98
+ null: 'Nulo'
99
+ not_null: 'No Nulo'
100
+ date_picker_options:
101
+ weekHeader: 'Sm'
102
+ firstDay: 1
103
+ isRTL: false
104
+ showMonthAfterYear: false
105
+ datetime_picker_options:
106
+ timeText: 'Hora'
107
+ currentText: 'Ahora'
108
+ closeText: 'Cerrar'
109
+ errors:
110
+ template:
111
+ header:
112
+ one: "No se pudo guardar debido a un error."
113
+ other: "No se pudo guardar debido a %{count} errores."
114
+ body: "Hubo problemas con los siguientes campos:"
115
+
116
+ # error_messages
117
+ cant_destroy_record: "No se pudo borrar %{record}"
118
+ internal_error: 'Petición fallida (código 500, error interno)'
119
+ version_inconsistency: 'Inconsistencia de versiones - este registro se ha modificado después de que empezó a editarlo.'
120
+ no_authorization_for_action: "No dispone de autorización para la acción %{action}"
@@ -25,13 +25,12 @@ module ActiveScaffold::Actions
25
25
  end
26
26
 
27
27
  def set_nested
28
- if params[:parent_scaffold] && ((params[:association] && params[:assoc_id]) || params[:named_scope])
28
+ if params[:parent_scaffold] && (params[:association] || params[:named_scope])
29
29
  @nested = ActiveScaffold::DataStructures::NestedInfo.get(active_scaffold_config.model, params)
30
30
  unless @nested.nil?
31
- register_constraints_with_action_columns(@nested.constrained_fields, active_scaffold_config.list.hide_nested_column ? [] : [:list])
32
31
  active_scaffold_constraints[:id] = params[:id] if @nested.belongs_to?
32
+ register_constraints_with_action_columns(@nested.constrained_fields, active_scaffold_config.list.hide_nested_column ? [] : [:list])
33
33
  end
34
- #params.delete_if {|key, value| [:parent_scaffold, :association, :named_scope, :assoc_id].include? key.to_sym}
35
34
  end
36
35
  end
37
36
 
@@ -25,15 +25,11 @@ module ActiveScaffold::Actions
25
25
  end
26
26
 
27
27
  def set_nested
28
- if params[:parent_scaffold] && ((params[:association] && params[:assoc_id]) || params[:named_scope])
29
- nested_info = {:parent_scaffold => params[:parent_scaffold].to_s,
30
- :association => params[:association],
31
- :named_scope => params[:named_scope],
32
- :parent_id => params[:assoc_id]}
33
- @nested = ActiveScaffold::DataStructures::NestedInfo.get(active_scaffold_config.model, nested_info)
28
+ if params[:parent_scaffold] && (params[:association] || params[:named_scope])
29
+ @nested = ActiveScaffold::DataStructures::NestedInfo.get(active_scaffold_config.model, params)
34
30
  unless @nested.nil?
35
- register_constraints_with_action_columns(@nested.constrained_fields, active_scaffold_config.list.hide_nested_column ? [] : [:list])
36
31
  active_scaffold_constraints[:id] = params[:id] if @nested.belongs_to?
32
+ register_constraints_with_action_columns(@nested.constrained_fields, active_scaffold_config.list.hide_nested_column ? [] : [:list])
37
33
  end
38
34
  #params.delete_if {|key, value| [:parent_scaffold, :association, :named_scope, :assoc_id].include? key.to_sym}
39
35
  end
@@ -150,7 +150,7 @@ module ActiveScaffold::Bridges
150
150
  module SearchColumnHelpers
151
151
  def active_scaffold_search_date_bridge_calendar_control(column, options, current_search, name)
152
152
  if current_search.is_a? Hash
153
- value = controller.class.condition_value_for_datetime(current_search[name], column.form_ui == :date_picker ? :to_date : :to_time)
153
+ value = controller.class.condition_value_for_datetime(current_search[name], column.search_ui == :date_picker ? :to_date : :to_time)
154
154
  else
155
155
  value = current_search
156
156
  end
@@ -0,0 +1,180 @@
1
+ module ActiveScaffold::Bridges
2
+ class DatePicker
3
+ module Helper
4
+ DATE_FORMAT_CONVERSION = {
5
+ /%a/ => 'D',
6
+ /%A/ => 'DD',
7
+ /%b/ => 'M',
8
+ /%B/ => 'MM',
9
+ /%d/ => 'dd',
10
+ /%e/ => 'd',
11
+ /%j/ => 'oo',
12
+ /%m/ => 'mm',
13
+ /%y/ => 'y',
14
+ /%Y/ => 'yy',
15
+ /%H/ => 'hh', # options ampm => false
16
+ /%I/ => 'hh', # options ampm => true
17
+ /%M/ => 'mm',
18
+ /%p/ => 'tt',
19
+ /%S/ => 'ss',
20
+ /%[cUWwxXZz]/ => ''
21
+ }
22
+
23
+ def self.date_options_for_locales
24
+ I18n.available_locales.collect do |locale|
25
+ locale_date_options = date_options(locale)
26
+ if locale_date_options
27
+ "$.datepicker.regional['#{locale}'] = #{locale_date_options.to_json};"
28
+ else
29
+ nil
30
+ end
31
+ end.compact.join('')
32
+ end
33
+
34
+ def self.date_options(locale)
35
+ begin
36
+ date_picker_options = { :closeText => as_(:close),
37
+ :prevText => as_(:previous),
38
+ :nextText => as_(:next),
39
+ :currentText => as_(:today),
40
+ :monthNames => I18n.translate!('date.month_names', :locale => locale)[1..-1],
41
+ :monthNamesShort => I18n.translate!('date.abbr_month_names', :locale => locale)[1..-1],
42
+ :dayNames => I18n.translate!('date.day_names', :locale => locale),
43
+ :dayNamesShort => I18n.translate!('date.abbr_day_names', :locale => locale),
44
+ :dayNamesMin => I18n.translate!('date.abbr_day_names', :locale => locale),
45
+ :changeYear => true,
46
+ :changeMonth => true,
47
+ }
48
+
49
+ as_date_picker_options = I18n.translate! :date_picker_options, :scope => :active_scaffold, :locale => locale, :default => ''
50
+ date_picker_options.merge!(as_date_picker_options) if as_date_picker_options.is_a? Hash
51
+ Rails.logger.warn "ActiveScaffold: Missing date picker localization for your locale: #{locale}" if as_date_picker_options.blank?
52
+
53
+ js_format = self.to_datepicker_format(I18n.translate!('date.formats.default', :locale => locale, :default => ''))
54
+ date_picker_options[:dateFormat] = js_format unless js_format.blank?
55
+ date_picker_options
56
+ rescue
57
+ raise if locale == I18n.locale
58
+ end
59
+ end
60
+
61
+ def self.datetime_options_for_locales
62
+ I18n.available_locales.collect do |locale|
63
+ locale_datetime_options = datetime_options(locale)
64
+ if locale_datetime_options
65
+ "$.timepicker.regional['#{locale}'] = #{locale_datetime_options.to_json};"
66
+ else
67
+ nil
68
+ end
69
+ end.compact.join('')
70
+ end
71
+
72
+ def self.datetime_options(locale)
73
+ begin
74
+ rails_time_format = I18n.translate! 'time.formats.picker', :locale => locale
75
+ datetime_picker_options = {:ampm => false,
76
+ :hourText => I18n.translate!('datetime.prompts.hour', :locale => locale),
77
+ :minuteText => I18n.translate!('datetime.prompts.minute', :locale => locale),
78
+ :secondText => I18n.translate!('datetime.prompts.second', :locale => locale)
79
+ }
80
+
81
+ as_datetime_picker_options = I18n.translate! :datetime_picker_options, :scope => :active_scaffold, :locale => locale, :default => ''
82
+ datetime_picker_options.merge!(as_datetime_picker_options) if as_datetime_picker_options.is_a? Hash
83
+ Rails.logger.warn "ActiveScaffold: Missing datetime picker localization for your locale: #{locale}" if as_datetime_picker_options.blank?
84
+
85
+ date_format, time_format = self.split_datetime_format(self.to_datepicker_format(rails_time_format))
86
+ datetime_picker_options[:dateFormat] = date_format unless date_format.nil?
87
+ unless time_format.nil?
88
+ datetime_picker_options[:timeFormat] = time_format
89
+ datetime_picker_options[:ampm] = true if rails_time_format.include?('%I')
90
+ end
91
+ datetime_picker_options
92
+ rescue
93
+ raise if locale == I18n.locale
94
+ end
95
+ end
96
+
97
+ def self.to_datepicker_format(rails_format)
98
+ return nil if rails_format.nil?
99
+ if rails_format =~ /%[cUWwxXZz]/
100
+ Rails.logger.warn("AS DatePicker::Helper: rails date format #{rails_format} includes options which can't be converted to jquery datepicker format. Options %c, %U, %W, %w, %x %X, %z, %Z are not supported by datepicker and will be removed")
101
+ nil
102
+ end
103
+ js_format = rails_format.dup
104
+ DATE_FORMAT_CONVERSION.each do |key, value|
105
+ js_format.gsub!(key, value)
106
+ end
107
+ js_format
108
+ end
109
+
110
+ def self.split_datetime_format(datetime_format)
111
+ date_format = datetime_format
112
+ time_format = nil
113
+ time_start_indicators = %w{hh mm tt ss}
114
+ unless datetime_format.nil?
115
+ start_indicator = time_start_indicators.detect {|indicator| datetime_format.include?(indicator)}
116
+ unless start_indicator.nil?
117
+ pos_time_format = datetime_format.index(start_indicator)
118
+ date_format = datetime_format.to(pos_time_format - 1)
119
+ time_format = datetime_format.from(pos_time_format)
120
+ end
121
+ end
122
+ return date_format, time_format
123
+ end
124
+
125
+ module DatepickerColumnHelpers
126
+ def datepicker_split_datetime_format(datetime_format)
127
+ ActiveScaffold::Bridges::DatePicker::Helper.split_datetime_format(datetime_format)
128
+ end
129
+
130
+ def to_datepicker_format(rails_format)
131
+ ActiveScaffold::Bridges::DatePicker::Helper.to_datepicker_format(rails_format)
132
+ end
133
+
134
+ def datepicker_format_options(column, format, options)
135
+ if column.form_ui == :date_picker
136
+ js_format = to_datepicker_format(I18n.translate!("date.formats.#{format}"))
137
+ options['date:dateFormat'] = js_format unless js_format.nil?
138
+ else
139
+ rails_time_format = I18n.translate!("time.formats.#{format}")
140
+ date_format, time_format = datepicker_split_datetime_format(self.to_datepicker_format(rails_time_format))
141
+ options['date:dateFormat'] = date_format unless date_format.nil?
142
+ unless time_format.nil?
143
+ options['time:timeFormat'] = time_format
144
+ options['time:ampm'] = true if rails_time_format.include?('%I')
145
+ end
146
+ end unless format == :default
147
+ end
148
+ end
149
+
150
+ module SearchColumnHelpers
151
+ def active_scaffold_search_date_bridge_calendar_control(column, options, current_search, name)
152
+ if current_search.is_a? Hash
153
+ value = controller.class.condition_value_for_datetime(current_search[name], column.form_ui == :date_picker ? :to_date : :to_time)
154
+ else
155
+ value = current_search
156
+ end
157
+ options = column.options.merge(options).except!(:include_blank, :discard_time, :discard_date, :value)
158
+ options = active_scaffold_input_text_options(options.merge(column.options))
159
+ options[:class] << " #{column.search_ui.to_s}"
160
+ options[:style] = "display:#{(options[:show].nil? || options[:show]) ? '' : 'none'}"
161
+ format = options.delete(:format) || :default
162
+ datepicker_format_options(column, format, options)
163
+ text_field_tag("#{options[:name]}[#{name}]", value ? l(value, :format => format) : nil, options.merge(:id => "#{options[:id]}_#{name}", :name => "#{options[:name]}[#{name}]"))
164
+ end
165
+ end
166
+
167
+ module FormColumnHelpers
168
+ def active_scaffold_input_date_picker(column, options)
169
+ options = active_scaffold_input_text_options(options.merge(column.options))
170
+ options[:class] << " #{column.form_ui.to_s}"
171
+ value = controller.class.condition_value_for_datetime(@record.send(column.name), column.form_ui == :date_picker ? :to_date : :to_time)
172
+ format = options.delete(:format) || :default
173
+ datepicker_format_options(column, format, options)
174
+ options[:value] = (value ? l(value, :format => format) : nil)
175
+ text_field(:record, column.name, options)
176
+ end
177
+ end
178
+ end
179
+ end
180
+ end
@@ -7,10 +7,12 @@ module ActiveScaffold::DataStructures
7
7
  nested_info[:parent_scaffold] = "#{params[:parent_scaffold].to_s.camelize}Controller".constantize
8
8
  nested_info[:parent_model] = nested_info[:parent_scaffold].active_scaffold_config.model
9
9
  nested_info[:parent_id] = params[nested_info[:parent_model].name.foreign_key]
10
- unless nested_info[:association].nil?
11
- ActiveScaffold::DataStructures::NestedInfoAssociation.new(model, nested_info)
12
- else
13
- ActiveScaffold::DataStructures::NestedInfoScope.new(model, nested_info)
10
+ if nested_info[:parent_id]
11
+ unless params[:association].nil?
12
+ ActiveScaffold::DataStructures::NestedInfoAssociation.new(model, nested_info)
13
+ else
14
+ ActiveScaffold::DataStructures::NestedInfoScope.new(model, nested_info)
15
+ end
14
16
  end
15
17
  rescue ActiveScaffold::ControllerNotFound
16
18
  nil
@@ -106,7 +108,7 @@ module ActiveScaffold::DataStructures
106
108
  protected
107
109
 
108
110
  def iterate_model_associations(model)
109
- @constrained_fields = []
111
+ @constrained_fields = []
110
112
  @constrained_fields << association.foreign_key.to_sym unless association.belongs_to?
111
113
  model.reflect_on_all_associations.each do |current|
112
114
  if !current.belongs_to? && association.foreign_key == current.association_foreign_key
@@ -6,12 +6,13 @@ module ActiveScaffold::DataStructures
6
6
  nested_info[:name] = (params[:association] || params[:named_scope]).to_sym
7
7
  nested_info[:parent_scaffold] = "#{params[:parent_scaffold].to_s.camelize}Controller".constantize
8
8
  nested_info[:parent_model] = nested_info[:parent_scaffold].active_scaffold_config.model
9
- unless nested_info[:association].nil?
10
- nested_info[:parent_id] = params[nested_info[:parent_model].name.foreign_key]
11
- ActiveScaffold::DataStructures::NestedInfoAssociation.new(model, nested_info)
12
- else
13
- nested_info[:parent_id] = params[:assoc_id]
14
- ActiveScaffold::DataStructures::NestedInfoScope.new(model, nested_info)
9
+ nested_info[:parent_id] = params[nested_info[:parent_model].name.foreign_key]
10
+ if nested_info[:parent_id]
11
+ unless params[:association].nil?
12
+ ActiveScaffold::DataStructures::NestedInfoAssociation.new(model, nested_info)
13
+ else
14
+ ActiveScaffold::DataStructures::NestedInfoScope.new(model, nested_info)
15
+ end
15
16
  end
16
17
  rescue ActiveScaffold::ControllerNotFound
17
18
  nil
@@ -107,7 +108,8 @@ module ActiveScaffold::DataStructures
107
108
  protected
108
109
 
109
110
  def iterate_model_associations(model)
110
- @constrained_fields = []
111
+ @constrained_fields = []
112
+ debugger
111
113
  @constrained_fields << association.foreign_key.to_sym unless association.belongs_to?
112
114
  model.reflect_on_all_associations.each do |current|
113
115
  if !current.belongs_to? && association.foreign_key == current.association_foreign_key
@@ -74,8 +74,11 @@ module ActionView::Helpers #:nodoc:
74
74
  else
75
75
  content_tag(:div, :id => id, :class => 'active-scaffold-component') do
76
76
  url = url_for(url_options)
77
+ # parse the ActiveRecord model name from the controller path, which
78
+ # might be a namespaced controller (e.g., 'admin/admins')
79
+ model = remote_controller.to_s.sub(/.*\//, '').singularize
77
80
  content_tag(:div, :class => 'active-scaffold-header') do
78
- content_tag :h2, link_to(args.first[:label] || active_scaffold_config_for(remote_controller.to_s.singularize).list.label, url, :remote => true)
81
+ content_tag :h2, link_to(args.first[:label] || active_scaffold_config_for(model).list.label, url, :remote => true)
79
82
  end <<
80
83
  if ActiveScaffold.js_framework == :prototype
81
84
  javascript_tag("new Ajax.Updater('#{id}', '#{url}', {method: 'get', evalScripts: true});")
@@ -2,7 +2,7 @@ module ActiveScaffold
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 1
5
- PATCH = 15
5
+ PATCH = 17
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_scaffold
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 33
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 1
9
- - 15
10
- version: 3.1.15
9
+ - 17
10
+ version: 3.1.17
11
11
  platform: ruby
12
12
  authors:
13
13
  - Many, see README
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-01-18 00:00:00 Z
18
+ date: 2012-01-24 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement
@@ -122,6 +122,7 @@ files:
122
122
  - config/locales/hu.yml
123
123
  - config/locales/ja.yml
124
124
  - config/locales/ru.yml
125
+ - config/locales/es.yml~
125
126
  - frontends/default/views/_add_existing_form.html.erb
126
127
  - frontends/default/views/_create_form.html.erb
127
128
  - frontends/default/views/_create_form_on_list.html.erb
@@ -303,6 +304,7 @@ files:
303
304
  - lib/active_scaffold/bridges/date_picker.rb
304
305
  - lib/active_scaffold/bridges/date_picker/ext.rb
305
306
  - lib/active_scaffold/bridges/date_picker/helper.rb
307
+ - lib/active_scaffold/bridges/date_picker/helper.rb~
306
308
  - lib/active_scaffold/bridges/dragonfly.rb
307
309
  - lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb
308
310
  - lib/active_scaffold/bridges/dragonfly/dragonfly_bridge_helpers.rb