Skip to content

Commit

Permalink
Merge pull request #5371 from avalonmediasystem/create_thumbnail
Browse files Browse the repository at this point in the history
Move create thumbnail button out of player
  • Loading branch information
masaball authored Sep 22, 2023
2 parents fb118f3 + 185d185 commit 71c691c
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 266 deletions.
1 change: 0 additions & 1 deletion app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
//= stub mediaelement/plugins/quality-i18n
//= stub media_player_wrapper/mejs4_plugin_add_to_playlist
//= stub media_player_wrapper/mejs4_plugin_add_marker_to_playlist
//= stub media_player_wrapper/mejs4_plugin_create_thumbnail
//= stub media_player_wrapper/mejs4_plugin_track_scrubber
//= stub media_player_wrapper/mejs4_link_back
//= stub media_player_wrapper/mejs4_plugin_playlist_items
Expand Down

This file was deleted.

9 changes: 4 additions & 5 deletions app/assets/javascripts/mejs4_player.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*
/*
* Copyright 2011-2023, The Trustees of Indiana University and Northwestern
* University. Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
Expand All @@ -20,7 +20,6 @@
//= require mediaelement/plugins/quality-i18n
//= require media_player_wrapper/mejs4_plugin_add_to_playlist
//= require media_player_wrapper/mejs4_plugin_add_marker_to_playlist
//= require media_player_wrapper/mejs4_plugin_create_thumbnail
//= require media_player_wrapper/mejs4_plugin_track_scrubber
//= require media_player_wrapper/mejs4_link_back
//= require media_player_wrapper/mejs4_plugin_playlist_items
2 changes: 1 addition & 1 deletion app/controllers/master_files_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def set_frame
unless @master_file.save
flash[:notice] = @master_file.errors.to_a.join('<br/>')
end
redirect_to edit_media_object_path(@master_file.media_object_id, step: "file-upload")
redirect_back(fallback_location: edit_media_object_path(@master_file.media_object_id, step: "file-upload"))
end
end
end
Expand Down
46 changes: 24 additions & 22 deletions app/javascript/components/Ramp.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*
/*
* Copyright 2011-2023, The Trustees of Indiana University and Northwestern
* University. Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
Expand All @@ -15,27 +15,28 @@
*/

import React from 'react';
import {
Transcript,
IIIFPlayer,
MediaPlayer,
StructuredNavigation,
MetadataDisplay,
SupplmentalFiles
import {
Transcript,
IIIFPlayer,
MediaPlayer,
StructuredNavigation,
MetadataDisplay,
SupplmentalFiles
} from "@samvera/ramp";
import 'video.js/dist/video-js.css';
import "@samvera/ramp/dist/ramp.css";
import { Col, Row, Tab, Tabs } from 'react-bootstrap';
import './Ramp.scss';

const Ramp = ({
base_url,
mo_id,
master_files_count,
share,
timeline,
in_progress,
cdl
const Ramp = ({
base_url,
mo_id,
master_files_count,
share,
timeline,
thumbnail,
in_progress,
cdl
}) => {
const [manifestUrl, setManifestUrl] = React.useState('');

Expand All @@ -49,15 +50,16 @@ const Ramp = ({
<Row>
{!in_progress &&
<Col sm={8}>
{ (cdl.enabled && !cdl.can_stream)
{ (cdl.enabled && !cdl.can_stream)
? (<div dangerouslySetInnerHTML={{ __html: cdl.embed }} />)
: ( <React.Fragment>
{ master_files_count > 0 &&
{ master_files_count > 0 &&
<React.Fragment>
<MediaPlayer enableFileDownload={false} />
<div className="ramp--rails-content">
{ timeline.canCreate && <div className="mr-1" dangerouslySetInnerHTML={{ __html: timeline.content }} /> }
{ share.canShare && <div className="share-tabs" dangerouslySetInnerHTML={{ __html: share.content }} /> }
{ thumbnail.canCreate && <div className="mr-1" dangerouslySetInnerHTML={{ __html: thumbnail.content }} /> }
</div>
<StructuredNavigation />
</React.Fragment>
Expand All @@ -73,7 +75,7 @@ const Ramp = ({
<Tab eventKey="details" title="Details">
<MetadataDisplay showHeading={false} displayTitle={false}/>
</Tab>
{ (cdl.can_stream && master_files_count != 0 && !in_progress) &&
{ (cdl.can_stream && master_files_count != 0 && !in_progress) &&
<Tab eventKey="transcripts" title="Transcripts">
<Transcript
playerID="iiif-media-player"
Expand Down
9 changes: 5 additions & 4 deletions app/views/media_objects/_item_view.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,22 @@ Unless required by applicable law or agreed to in writing, software distributed
<% @poster_url = request.base_url + @currentStreamInfo[:poster_image] unless @currentStreamInfo[:poster_image].nil? %>
<% @page_type = @currentStreamInfo[:is_video] ? 'video' : 'audio' %>
<% can_stream = lending_enabled?(@media_object) ? current_user && @media_object.current_checkout(current_user.id).present? : true %>
<% can_stream = lending_enabled?(@media_object) ? current_user && @media_object.current_checkout(current_user.id).present? : true %>
<% in_progress = show_progress?(@masterFiles) %>
<div class="row">
<div class="col-sm-8">
<%= render 'workflow_progress' %>
</div>
<div class="<%= in_progress || !@currentStream ? 'col-sm-4' : 'col-sm-12' %>">
<%= react_component("Ramp",
<%= react_component("Ramp",
{
base_url: request.protocol+request.host_with_port,
mo_id: @media_object.id,
base_url: request.protocol+request.host_with_port,
mo_id: @media_object.id,
master_files_count: @media_object.master_files.size,
share: { canShare: (will_partial_list_render? :share), content: lending_enabled?(@media_object) ? (render('share') if can_stream) : render('share') },
timeline: { canCreate: (current_ability.can? :create, Timeline), content: lending_enabled?(@media_object) ? (render('timeline') if can_stream) : render('timeline') },
thumbnail: { canCreate: (current_ability.can? :edit, @media_object), content: lending_enabled?(@media_object) ? (render('thumbnail') if can_stream) : render('thumbnail') },
in_progress: in_progress,
cdl: { enabled: lending_enabled?(@media_object), can_stream: can_stream, embed: render('embed_checkout'), destroy: render('destroy_checkout') }
}
Expand Down
Loading

0 comments on commit 71c691c

Please sign in to comment.