Skip to content

Commit 9abd3b6

Browse files
author
Jon Cameron
authored
Merge pull request #5970 from avalonmediasystem/develop
v7.8 RC3
2 parents 1c48a24 + 783f49f commit 9abd3b6

20 files changed

+186
-40
lines changed

app/assets/javascripts/player_listeners.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ let addToPlaylistListenersAdded = false;
2020
let firstLoad = true;
2121
let streamId = '';
2222
let isMobile = false;
23+
let isPlaying = false;
2324

2425
/**
2526
* Bind action buttons on the page with player events and re-populate details
@@ -69,17 +70,21 @@ function addActionButtonListeners(player, mediaObjectId, sectionIds) {
6970
}
7071

7172
/* Add player event listeners to update UI components on the page */
72-
// Listen to 'timeupdate' event to udate add to playlist form when using while media is playing or manually seeking
73-
player.player.on('timeupdate', () => {
73+
// Listen to 'seeked' event to udate add to playlist form
74+
player.player.on('seeked', () => {
7475
if (getActiveItem() != undefined) {
7576
activeTrack = getActiveItem(false);
7677
if (activeTrack != undefined) {
7778
streamId = activeTrack.streamId;
7879
}
79-
disableEnableCurrentTrack(activeTrack, player.player.currentTime(), true, currentSectionLabel);
80+
disableEnableCurrentTrack(activeTrack, player.player.currentTime(), isPlaying, currentSectionLabel);
8081
}
8182
});
8283

84+
player.player.on('play', () => { isPlaying = true; });
85+
86+
player.player.on('pause', () => { isPlaying = false; });
87+
8388
/*
8489
Disable action buttons tied to player related information on player's 'loadstart' event which functions
8590
parallel to the player's src changes. So, that the user doesn't interact with them get corrupted data
@@ -273,7 +278,7 @@ function addToPlaylistListeners(sectionIds, mediaObjectId) {
273278
disableEnableCurrentTrack(
274279
activeTrack,
275280
currentTime,
276-
false,
281+
isPlaying,
277282
$('#playlist_item_title').val() || currentSectionLabel // Preserve user edits for the title when available
278283
);
279284
$('#current-section-name').text(currentSectionLabel);

app/assets/javascripts/ramp_utils.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ function getTimelineScopes() {
111111
if (parent.length === 0) {
112112
let begin = 0;
113113
let end = activeItem.times.end;
114-
scopes[0].times = { begin: 0, end: end }
114+
scopes[0].times = { begin: 0, end: end };
115115
}
116116
while (parent.length > 0) {
117117
let next = parent.closest('ul').closest('li');
@@ -209,10 +209,10 @@ function collapseMoreDetails() {
209209
* disable the option otherwise enable it.
210210
* @param {Object} activeTrack JSON object for the active timespans
211211
* @param {Number} currentTime player's playhead position
212-
* @param {Boolean} isSeeked flag to indicate player 'seeked' event happened/not
212+
* @param {Boolean} isPlaying flag to inidicate media is playing or not
213213
* @param {String} sectionTitle name of the current section
214214
*/
215-
function disableEnableCurrentTrack(activeTrack, currentTime, isSeeked, sectionTitle) {
215+
function disableEnableCurrentTrack(activeTrack, currentTime, isPlaying, sectionTitle) {
216216
// Return when add to playlist form is not visible
217217
let playlistForm = $('#add_to_playlist')[0];
218218
if (!playlistForm) {
@@ -222,7 +222,8 @@ function disableEnableCurrentTrack(activeTrack, currentTime, isSeeked, sectionTi
222222
if (activeTrack != undefined) {
223223
streamId = activeTrack.streamId;
224224
let { label, times, sectionLabel } = activeTrack;
225-
let starttime = currentTime || times.begin;
225+
// Update starttime when media is not playing
226+
let starttime = isPlaying ? times.begin : currentTime || times.begin;
226227
$('#playlist_item_start').val(createTimestamp(starttime, true));
227228
$('#playlist_item_end').val(createTimestamp(times.end, true));
228229
title = `${sectionLabel} - ${label}`;
@@ -245,9 +246,7 @@ function disableEnableCurrentTrack(activeTrack, currentTime, isSeeked, sectionTi
245246
$('#playlistitem_scope_track').prop('checked', false);
246247
}
247248
}
248-
// Only change the title when user actively seeked to a different timestamp,
249-
// persisting the user changes to the field unless the active track is changed
250-
if (isSeeked && sectionTitle != undefined) {
249+
if (sectionTitle != undefined) {
251250
$('#playlist_item_title').val(title);
252251
}
253252
}
@@ -345,4 +344,10 @@ function resetAddToPlaylistForm() {
345344
function closeAlert() {
346345
$('#add_to_playlist_alert').slideUp();
347346
$('#add_to_playlist_form_group').slideDown();
347+
// Set default selection in options list when alert is closed
348+
if ($('#playlistitem_scope_track')[0].disabled) {
349+
$('#playlistitem_scope_section').prop('checked', true);
350+
} else {
351+
$('#playlistitem_scope_track').prop('checked', true);
352+
}
348353
}

app/assets/stylesheets/avalon/_footer.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
width: 100%;
2222
min-height: 2.5rem;
2323
color: #999999;
24-
z-index: -1000;
24+
z-index: 0;
2525
}
2626

2727
footer {

app/assets/stylesheets/avalon/_playlists.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@
176176

177177
#Playlists_paginate {
178178
float: right;
179+
z-index: 10;
179180
}
180181

181182
/* Playlist copy modal */

app/controllers/catalog_controller.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,18 @@ class CatalogController < ApplicationController
8989
config.add_facet_field 'unit_ssim', label: 'Unit', limit: 5
9090
config.add_facet_field 'language_ssim', label: 'Language', limit: 5
9191
# Hide these facets if not a Collection Manager
92-
config.add_facet_field 'workflow_published_sim', label: 'Published', limit: 5, if: Proc.new {|context, config, opts| Ability.new(context.current_user, context.user_session).can? :create, MediaObject}, group: "workflow"
93-
config.add_facet_field 'avalon_uploader_ssi', label: 'Created by', limit: 5, if: Proc.new {|context, config, opts| Ability.new(context.current_user, context.user_session).can? :create, MediaObject}, group: "workflow"
94-
config.add_facet_field 'read_access_group_ssim', label: 'Item access', if: Proc.new {|context, config, opts| Ability.new(context.current_user, context.user_session).can? :create, MediaObject}, group: "workflow", query: {
92+
config.add_facet_field 'workflow_published_sim', label: 'Published', limit: 5, if: Proc.new {|context, config, opts| context.current_ability.can? :create, MediaObject}, group: "workflow"
93+
config.add_facet_field 'avalon_uploader_ssi', label: 'Created by', limit: 5, if: Proc.new {|context, config, opts| context.current_ability.can? :create, MediaObject}, group: "workflow"
94+
config.add_facet_field 'read_access_group_ssim', label: 'Item access', if: Proc.new {|context, config, opts| context.current_ability.can? :create, MediaObject}, group: "workflow", query: {
9595
public: { label: "Public", fq: "has_model_ssim:MediaObject AND read_access_group_ssim:#{Hydra::AccessControls::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC}" },
9696
restricted: { label: "Authenticated", fq: "has_model_ssim:MediaObject AND read_access_group_ssim:#{Hydra::AccessControls::AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED}" },
9797
private: { label: "Private", fq: "has_model_ssim:MediaObject AND NOT read_access_group_ssim:#{Hydra::AccessControls::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC} AND NOT read_access_group_ssim:#{Hydra::AccessControls::AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED}" }
9898
}
99-
config.add_facet_field 'read_access_virtual_group_ssim', label: 'External Group', limit: 5, if: Proc.new {|context, config, opts| Ability.new(context.current_user, context.user_session).can? :create, MediaObject}, group: "workflow", helper_method: :vgroup_display
100-
config.add_facet_field 'date_digitized_ssim', label: 'Date Digitized', limit: 5, if: Proc.new {|context, config, opts| Ability.new(context.current_user, context.user_session).can? :create, MediaObject}, group: "workflow"#, partial: 'blacklight/hierarchy/facet_hierarchy'
101-
config.add_facet_field 'date_ingested_ssim', label: 'Date Ingested', limit: 5, if: Proc.new {|context, config, opts| Ability.new(context.current_user, context.user_session).can? :create, MediaObject}, group: "workflow"
102-
config.add_facet_field 'has_captions_bsi', label: 'Has Captions', if: Proc.new {|context, config, opts| Ability.new(context.current_user, context.user_session).can? :create, MediaObject}, group: "workflow", helper_method: :display_has_caption_or_transcript
103-
config.add_facet_field 'has_transcripts_bsi', label: 'Has Transcripts', if: Proc.new {|context, config, opts| Ability.new(context.current_user, context.user_session).can? :create, MediaObject}, group: "workflow", helper_method: :display_has_caption_or_transcript
99+
config.add_facet_field 'read_access_virtual_group_ssim', label: 'External Group', limit: 5, if: Proc.new {|context, config, opts| context.current_ability.can? :create, MediaObject}, group: "workflow", helper_method: :vgroup_display
100+
config.add_facet_field 'date_digitized_ssim', label: 'Date Digitized', limit: 5, if: Proc.new {|context, config, opts| context.current_ability.can? :create, MediaObject}, group: "workflow"#, partial: 'blacklight/hierarchy/facet_hierarchy'
101+
config.add_facet_field 'date_ingested_ssim', label: 'Date Ingested', limit: 5, if: Proc.new {|context, config, opts| context.current_ability.can? :create, MediaObject}, group: "workflow"
102+
config.add_facet_field 'has_captions_bsi', label: 'Has Captions', if: Proc.new {|context, config, opts| context.current_ability.can? :create, MediaObject}, group: "workflow", helper_method: :display_has_caption_or_transcript
103+
config.add_facet_field 'has_transcripts_bsi', label: 'Has Transcripts', if: Proc.new {|context, config, opts| context.current_ability.can? :create, MediaObject}, group: "workflow", helper_method: :display_has_caption_or_transcript
104104

105105
# Have BL send all facet field names to Solr, which has been the default
106106
# previously. Simply remove these lines if you'd rather use Solr request

app/helpers/application_helper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ def lti_share_url_for(obj, _opts = {})
6161
def image_for(document)
6262
master_file_id = document["section_id_ssim"].try :first
6363

64-
video_count = document["avalon_resource_type_ssim"].count{|m| m.start_with?('moving image') } rescue 0
65-
audio_count = document["avalon_resource_type_ssim"].count{|m| m.start_with?('sound recording') } rescue 0
64+
video_count = document["avalon_resource_type_ssim"].count{|m| m.downcase.start_with?('moving image') } rescue 0
65+
audio_count = document["avalon_resource_type_ssim"].count{|m| m.downcase.start_with?('sound recording') } rescue 0
6666

6767
if master_file_id
6868
if video_count > 0

app/helpers/blacklight/local_blacklight_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def facet_group_names
2626
end
2727

2828
def url_for_document doc, options = {}
29-
SpeedyAF::Base.find(doc[:id])
29+
SpeedyAF::Base.for(doc.to_h.with_indifferent_access)
3030
end
3131

3232
def contributor_index_display args

app/javascript/components/PlaylistRamp.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ const Ramp = ({
223223
</div>
224224
</Col>
225225
</Row>
226-
<Row className="ramp--playlist-desc-tags">
226+
<Row className="ramp--playlist-desc-tags mx-1 mx-sm-0">
227227
{comment && (
228228
<div style={{ position: 'relative' }}>
229229
<h4>{comment_label}</h4>
@@ -251,7 +251,7 @@ const Ramp = ({
251251
</Row>
252252
{playlist_item_ids?.length > 0 && (
253253
<React.Fragment>
254-
<h4 className="mt-3">Playlist Items</h4>
254+
<h4 className="mt-3 mx-1 mx-sm-0">Playlist Items</h4>
255255
<StructuredNavigation />
256256
</React.Fragment>
257257
)}

app/models/master_file.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ def create_frame_source_hls_temp_file(offset)
597597
# Fixes https://github.com/avalonmediasystem/avalon/issues/3474
598598
target_location = File.basename(details[:location]).split('?')[0]
599599
target = File.join(Dir.tmpdir, target_location)
600-
File.open(target,'wb') { |f| URI.open(details[:location]) { |io| f.write(io.read) } }
600+
File.open(target,'wb') { |f| URI.open(details[:location], "Referer" => Rails.application.routes.url_helpers.root_url) { |io| f.write(io.read) } }
601601
return target, details[:offset]
602602
end
603603

app/models/media_object.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def section_ids
177177
return @section_ids if @section_ids
178178

179179
# Do migration
180-
self.section_ids = self.ordered_master_file_ids if self.section_list.nil?
180+
self.section_ids = self.ordered_master_file_ids.compact if self.section_list.nil?
181181

182182
return [] if self.section_list.nil?
183183
@section_ids = JSON.parse(self.section_list)

0 commit comments

Comments
 (0)