Skip to content

Commit

Permalink
[POD-1803] model, view, controller changes for new DFP fields
Browse files Browse the repository at this point in the history
  • Loading branch information
aploshay committed Oct 10, 2023
1 parent 51960bc commit e369d70
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ def dp_params
:id, :filename, :comment, :date_digitized, :display_date_digitized, :created_by,
:speed_used, :signal_chain_id, :volume_units, :tape_fluxivity, :peak, :analog_output_voltage,
:stylus_size, :turnover, :rolloff, :noise_reduction, :reference_tone_frequency,
:sample_rate, :digital_to_analog,
:rumble_filter, :_destroy]
)
end
Expand Down
5 changes: 4 additions & 1 deletion app/models/dat_tm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ class DatTm < ActiveRecord::Base
extend TechnicalMetadatumClassModule
# TM module constants
DIGITAL_PROVENANCE_FILES = ['Digital Master', 'PresInt']
# PROVENANCE_REQUIREMENTS unchanged from default
PROVENANCE_REQUIREMENTS = TechnicalMetadatumModule::PROVENANCE_REQUIREMENTS.merge({
sample_rate: false,
digital_to_analog: false
})
TM_FORMAT = ['DAT']
TM_SUBTYPE = false
TM_GENRE = :audio
Expand Down
4 changes: 4 additions & 0 deletions app/models/digital_file_provenance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ class DigitalFileProvenance < ActiveRecord::Base
validate :filename_validation
validate :validate_signal_chain

# validation for these?
# sample_rate
# digital_to_analog

default_scope { order(:filename) }

# File Uses:
Expand Down
12 changes: 12 additions & 0 deletions app/views/digital_provenance/_digital_file_provenance.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@
<%= f.text_field :speed_used, readonly: !@edit_mode, disabled: dp_na(:speed_used), value: dp_na(:speed_used) ? nil : f.object.speed_used %>
</td>
</tr>
<tr <%= 'style=display:none;' if dp_na(:sample_rate) && @hide_dp_na %>>
<th>Sample Rate<%= dp_requirement(:sample_rate) %></th>
<td>
<%= f.text_field :sample_rate, readonly: !@edit_mode, disabled: dp_na(:sample_rate), value: dp_na(:sample_rate) ? nil : f.object.sample_rate %>
</td>
</tr>
<tr <%= 'style=display:none;' if dp_na(:digital_to_analog) && @hide_dp_na %>>
<th>Digital to Analog<%= dp_requirement(:speed_used) %></th>
<td>
<%= f.check_box :digital_to_analog, readonly: !@edit_mode, disabled: dp_na(:digital_to_analog), value: dp_na(:digital_to_analog) ? nil : f.object.digital_to_analog %>
</td>
</tr>
<tr <%= 'style=display:none;' if dp_na(:tape_fluxivity) && @hide_dp_na %>>
<th>Reference Fluxivity (nWb/m)<%= dp_requirement(:tape_fluxivity) %></th>
<td>
Expand Down
2 changes: 2 additions & 0 deletions app/views/responses/digiprov_metadata.xml.builder
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ xml.pod("xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance") do
xml.comment dfp.comment.to_s
xml.created_by dfp.created_by.to_s
xml.speed_used dfp.speed_used.to_s
xml.sample_rate dfp.sample_rate.to_s
xml.digital_to_analog dfp.digital_to_analog.to_s
xml.tape_fluxivity dfp.tape_fluxivity.to_s + (dfp.tape_fluxivity.blank? ? "" : " nWb/m")
xml.volume_units dfp.volume_units.to_s + (dfp.volume_units.blank? ? "" : " dB")
xml.analog_output_voltage dfp.analog_output_voltage.to_s + (dfp.analog_output_voltage.blank? ? "" : " dBu")
Expand Down
2 changes: 2 additions & 0 deletions app/views/responses/full_metadata.xml.builder
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ xml.pod("xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance") do
xml.comment dfp.comment
xml.created_by dfp.created_by
xml.speed_used dfp.speed_used
xml.sample_rate dfp.sample_rate
xml.digital_to_analog dfp.digital_to_analog
xml.tape_fluxivity dfp.tape_fluxivity
xml.volume_units dfp.volume_units
xml.analog_output_voltage dfp.analog_output_voltage
Expand Down

0 comments on commit e369d70

Please sign in to comment.