How tagging with multiple values works? #701

This commit is contained in:
Karel Picman 2017-04-13 13:30:54 +02:00
parent 59256ecf2d
commit cc5ffb7b28
3 changed files with 22 additions and 3 deletions

View File

@ -500,7 +500,13 @@ class DmsfFile < ActiveRecord::Base
def custom_value(custom_field)
self.last_revision.custom_field_values.each do |cv|
return cv.value if cv.custom_field == custom_field
if cv.custom_field == custom_field
if cv.value.is_a? Array
return cv.value.reject{ |x| x.empty? }.join(',')
else
return cv.value
end
end
end
nil
end

View File

@ -26,8 +26,16 @@ class DmsfFileRevisionCustomField < CustomField
end
def compare_values?(x, y)
if x.is_a?(Array) && y.is_a?(Array) && !y.empty?
x.include? y[0]
if x.is_a?(Array) && y.is_a?(Array)
y.reject!{ |a| a.empty? }
return true if y.empty?
x.reject!{ |a| a.empty? }
y.each do |b|
if x.include?(b)
return true
end
end
return false
else
x == y
end

View File

@ -28,6 +28,11 @@
margin-left: 5px;
}
#dmsf_tag .check_box_group {
background: inherit;
border: 0px;
}
.list .dmsf_modified {
min-width: 127px;
width: 127px;