Skip to content

Commit

Permalink
Machine gen icon for supplemental files (#6011)
Browse files Browse the repository at this point in the history
* Show an icon for machine-generated transcripts in manage file

* From code review: cleanup JS
  • Loading branch information
Dananji authored Aug 30, 2024
1 parent c3dce9d commit d9dfe95
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/assets/javascripts/supplemental_files.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ $('.supplemental-file-form')
.on('ajax:success', (event, data, status, xhr) => {
var $row = $(event.currentTarget.parentElement);
const { masterfileId, fileId } = event.currentTarget.dataset;
// Get machine-generated checkbox input on form submission
var isMachineGen = $row.find(`input[id="machine_generated_${fileId}"]`)[0].checked;

// Set the label to the new value
var newLabel = $row
Expand All @@ -90,6 +92,10 @@ $('.supplemental-file-form')

// Show flash message for success
$row.find('.message-content').html('Successfully updated.');
// Show/hide icon based on the updated machine-generated form check
isMachineGen
? $row.find('.fa-laptop').removeClass('d-none')
: $row.find('.fa-laptop').addClass('d-none');
$row.find('.icon-success').removeClass('d-none');
$row.find('.visible-inline').addClass('alert');
})
Expand Down
3 changes: 3 additions & 0 deletions app/assets/stylesheets/avalon.scss
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,9 @@ h5.card-title {
.form-group {
margin-bottom: 0.2rem;
}
.fa-laptop {
display: none;
}
display: flex;
}
margin-top: 0.75rem;
Expand Down
1 change: 1 addition & 0 deletions app/views/media_objects/_supplemental_files_list.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ Unless required by applicable law or agreed to in writing, software distributed
</small>
<div class="btn-toolbar float-right">
<%# Update button %>
<i class="fa fa-laptop align-content-center<%= file.machine_generated? ? '' : ' d-none' %>" title="Machine generated file"></i>
<%= button_tag name: 'edit_label', class:'btn btn-outline btn-sm edit_label display-item', type: 'button' do %>
<i class="fa fa-edit" title="Edit"></i> <span class="sm-hidden">Edit</span>
<% end %>
Expand Down

0 comments on commit d9dfe95

Please sign in to comment.