Use the standard helper function for displaying custom values
This commit is contained in:
parent
99c6a15795
commit
68130a6718
@ -500,11 +500,7 @@ class DmsfFile < ActiveRecord::Base
|
||||
def custom_value(custom_field)
|
||||
last_revision.custom_field_values.each do |cv|
|
||||
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
|
||||
return cv
|
||||
end
|
||||
end
|
||||
nil
|
||||
@ -584,7 +580,7 @@ class DmsfFile < ActiveRecord::Base
|
||||
end
|
||||
# Custom fields
|
||||
CustomField.where(type: 'DmsfFileRevisionCustomField').order(:position).each do |c|
|
||||
csv << custom_value(c) if columns.include?(c.name)
|
||||
csv << custom_value(c).value if columns.include?(c.name)
|
||||
end
|
||||
csv
|
||||
end
|
||||
|
||||
@ -348,7 +348,9 @@ class DmsfFolder < ActiveRecord::Base
|
||||
|
||||
def custom_value(custom_field)
|
||||
custom_field_values.each do |cv|
|
||||
return cv.value if cv.custom_field == custom_field
|
||||
if cv.custom_field == custom_field
|
||||
return cv
|
||||
end
|
||||
end
|
||||
nil
|
||||
end
|
||||
@ -475,7 +477,7 @@ class DmsfFolder < ActiveRecord::Base
|
||||
csv << '' if columns.include?(l(:label_last_revision_id))
|
||||
# Custom fields
|
||||
CustomField.where(type: 'DmsfFileRevisionCustomField').order(:position).each do |c|
|
||||
csv << custom_value(c) if columns.include?(c.name)
|
||||
csv << custom_value(c).value if columns.include?(c.name)
|
||||
end
|
||||
csv
|
||||
end
|
||||
|
||||
@ -75,7 +75,7 @@
|
||||
<% CustomField.where(type: 'DmsfFileRevisionCustomField').order(:position).each do |c| %>
|
||||
<% if DmsfFolder.is_column_on?(c.name) %>
|
||||
<td class="dmsf_cf">
|
||||
<%= subfolder.custom_value(c) if subfolder %>
|
||||
<%= show_value(subfolder.custom_value(c)) if subfolder %>
|
||||
</td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
<% CustomField.where(type: 'DmsfFileRevisionCustomField').order(:position).each do |c| %>
|
||||
<% if DmsfFolder.is_column_on?(c.name) %>
|
||||
<td class="dmsf_cf">
|
||||
<%= subfolder.custom_value(c) if subfolder %>
|
||||
<%= show_value(subfolder.custom_value(c)) if subfolder %>
|
||||
</td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@ -79,7 +79,7 @@
|
||||
<% CustomField.where(type: 'DmsfFileRevisionCustomField').order(:position).each do |c| %>
|
||||
<% if DmsfFolder.is_column_on?(c.name) %>
|
||||
<td class="dmsf_cf">
|
||||
<%= file.custom_value(c) %>
|
||||
<%= show_value file.custom_value(c) %>
|
||||
</td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
<% CustomField.where(type: 'DmsfFileRevisionCustomField').order(:position).each do |c| %>
|
||||
<% if DmsfFolder.is_column_on?(c.name) %>
|
||||
<td class="dmsf_cf">
|
||||
<%= file.custom_value(c) %>
|
||||
<%= show_value file.custom_value(c) %>
|
||||
</td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user