Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Machine gen icon for supplemental files #6011

Merged
merged 2 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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