vidl-toolbox 0.0.6 → 0.0.7

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.
@@ -160,7 +160,8 @@ module Toolbox
160
160
  :type => { :type => [Symbol], :default => :textfield, :values => [:select, :collection_select, :auto_complete, :textfield, :radio, :date, :check_box]},
161
161
  :url => { :type => [Symbol]},
162
162
  :size => { :type => [Fixnum]},
163
- :values => { :type => [Array]}
163
+ :values => { :type => [Array]},
164
+ :info => { :type => [String]}
164
165
  end
165
166
 
166
167
  # Holds the configuration for a non-editable field
@@ -137,7 +137,7 @@ module Toolbox
137
137
  def create
138
138
  if params[:save] # save or ok clicked
139
139
  p = params[model_name.to_sym]
140
- preprocess_autocomplete nil, p
140
+ preprocess_params nil, p
141
141
  obj = model_class.new p
142
142
  set_record obj
143
143
 
@@ -174,7 +174,7 @@ module Toolbox
174
174
 
175
175
  if params[:save]
176
176
  par = params[model_name.to_sym]
177
- preprocess_autocomplete obj, par
177
+ preprocess_params obj, par
178
178
  # Ensure that the the collection attributes exist - create them if not
179
179
  # This is needed, if all collection items have been deleted.
180
180
  edit_config(obj).controlsets.each do |controlset|
@@ -279,13 +279,17 @@ module Toolbox
279
279
 
280
280
 
281
281
  # check the consitency between the visible input-field
282
- # and the invisible id field
283
- def preprocess_autocomplete rec, params
282
+ # and the invisible id field of autocomplete fields and
283
+ # parses date-fields
284
+ def preprocess_params rec, params
284
285
  edit_config(rec).controlsets.each do |controlset|
285
286
  controlset.widget_list.widgets.each do |widget|
286
- if widget.type == :auto_complete
287
+ case widget.type
288
+ when :auto_complete
287
289
  value = params.delete widget.name
288
290
  params[widget.name.to_s.foreign_key] = nil if value == '' || value == nil
291
+ when :date
292
+ #params[widget.name] = Date.strptime(params[widget.name], '%d.%m.%y')
289
293
  end
290
294
  end
291
295
  end
@@ -186,6 +186,7 @@ module Toolbox
186
186
  options = {}
187
187
  options[:class] = 'error' if has_error
188
188
  options[:id] = "dialog_#{form.tag_id @widget_config.name}" if @dialog
189
+ options[:title] = @view.send(:h, @widget_config.info) if @widget_config.info
189
190
  case @widget_config.type
190
191
  when :select
191
192
  form.select @widget_config.name, @widget_config.values, {}, options
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Toolbox
3
- VERSION = '0.0.6'
3
+ VERSION = '0.0.7'
4
4
  end
@@ -10,7 +10,12 @@
10
10
  has_error = rec.errors.on(renderer.widget_config.name)
11
11
  %>
12
12
  <tr>
13
- <td><%= frm.label renderer.widget_config.name unless renderer.widget_config.suppress_label %></td>
13
+ <td>
14
+ <% unless renderer.widget_config.suppress_label%>
15
+ <%= renderer.widget_config.label if renderer.widget_config.label %>
16
+ <%= frm.label renderer.widget_config.name unless renderer.widget_config.label %>
17
+ <% end %>
18
+ </td>
14
19
  <td ><%= renderer.render_control(frm, rec, has_error) %></td>
15
20
  </tr>
16
21
  <% end %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vidl-toolbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Nyffenegger