Skip to content

Commit

Permalink
Merge pull request #5854 from avalonmediasystem/transcript_language
Browse files Browse the repository at this point in the history
Add transcript language edit to UI
  • Loading branch information
masaball authored Jun 7, 2024
2 parents 3fdfc3b + 8cf40fb commit c149610
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/assets/stylesheets/avalon.scss
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ h5.card-title {
height: 25px;
}

&.captions {
&.captions, &.transcripts {
div.supplemental-file-data.is-editing:last-child {
margin-bottom: 1.75rem;
}
Expand Down
2 changes: 1 addition & 1 deletion app/models/supplemental_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def attach_file(new_file)
extension = File.extname(new_file.original_filename)
self.file.content_type = Mime::Type.lookup_by_extension(extension.slice(1..-1)).to_s if extension == '.srt'
self.label = file.filename.to_s if label.blank?
self.language = tags.include?('caption') ? Settings.caption_default.language : 'eng'
self.language = Settings.caption_default.language
end

def mime_type
Expand Down
21 changes: 14 additions & 7 deletions app/views/media_objects/_supplemental_files_list.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Unless required by applicable law or agreed to in writing, software distributed
%>
<% if section.supplemental_files_json.present? %>
<% files=tag.empty? ? section.supplemental_files(tag: nil) : section.supplemental_files(tag: tag) %>
<div class="file_view <% if tag == "caption" %>captions<% end %>">
<div class="file_view <%= tag.pluralize if tag.present? %>">
<% if tag == "caption" %>
<div class="row supplemental-file-data edit-item" id="edit-label-row">
<div class="row col-sm-9 col-md-8 col-9">
Expand All @@ -40,12 +40,19 @@ Unless required by applicable law or agreed to in writing, software distributed
<%= form.text_field :label, id: "supplemental_file_input_#{section.id}_#{file.id}", value: file.label %>
</div>
<% if tag == 'transcript' %>
<span class="form-group col-md-6 col-sm-6 col-6 p-0">
<%= label_tag "machine_generated_#{file.id}", class: "ml-3" do %>
<%= check_box_tag "machine_generated_#{file.id}", '1', file.machine_generated? %>
Machine Generated
<% end %>
</span>
<div class="form-group col-md-6 col p-0">
<%= form.text_field :language, id: "supplemental_file_language_#{section.id}_#{file.id}", value: LanguageTerm.find(file.language).text,
class: "typeahead from-model form-control",
data: { model: 'languageTerm', validate: false } %>
</div>
<div class="row-col-sm-9 row-col-md-8 row-col-9 p-0">
<span class="form-check-inline col-md-6 col-sm-6 col-6 p-0">
<%= label_tag "machine_generated_#{file.id}", class: "checkbox", style: "white-space: nowrap; padding-left: 0.45rem;" do %>
<%= check_box_tag "machine_generated_#{file.id}", '1', file.machine_generated? %>
Machine Generated
<% end %>
</span>
</div>
<% end %>
<% if tag == 'caption' %>
<div class="form-group col-md-6 col p-0">
Expand Down
1 change: 1 addition & 0 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ controlled_digital_lending:
# Choose whether every collection has CDL enabled or disabled by default
collections_enabled: false
default_lending_period: 'P14D' # ISO8601 duration format: P14D == 14.days, PT8H == 8.hours, etc.
# Caption default field also sets the default language information for transcript files
caption_default:
# Language should be 3 letter ISO 639-2 code
language: 'eng'
Expand Down

0 comments on commit c149610

Please sign in to comment.