dima 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dima/html/field.rb +3 -1
- data/lib/dima/version.rb +1 -1
- metadata +2 -2
data/lib/dima/html/field.rb
CHANGED
@@ -369,11 +369,13 @@ module Dima::Html
|
|
369
369
|
|
370
370
|
class SelectField < SimpleField
|
371
371
|
attr_accessor :collection
|
372
|
+
attr_accessor :empty
|
372
373
|
|
373
374
|
def simple_value_node
|
374
375
|
if self.edit?
|
375
376
|
id = self.val.id rescue nil
|
376
377
|
node = Node.new(tag: 'select', attributes: { name: "dim[#{name}]", class: 'dim-main-content dim-select' })
|
378
|
+
node << Node.new(tag: 'option', attributes: { selected: (id == nil), value: '' }, text: self.empty) if self.empty
|
377
379
|
self.collection.each do |v|
|
378
380
|
node << Node.new(tag: 'option', attributes: { value: v.id, selected: (v.id == id) }, text: v.to_s)
|
379
381
|
end if self.collection
|
@@ -386,7 +388,7 @@ module Dima::Html
|
|
386
388
|
def value_from_text(val)
|
387
389
|
self.collection.each do |v|
|
388
390
|
if val == v.id.to_s
|
389
|
-
self.val = v
|
391
|
+
self.val = v #.id
|
390
392
|
break
|
391
393
|
end
|
392
394
|
end if self.collection
|
data/lib/dima/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dima
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|