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

Move playlist notice and add check for other notices #371

Merged
merged 5 commits into from
Feb 21, 2024
Merged
Changes from 1 commit
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
65 changes: 40 additions & 25 deletions includes/admin/class-bc-templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,23 @@ public function __construct() {
* Adds all templates for Backbone application
*/
public function add_templates() {
?>
global $pagenow; ?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
global $pagenow; ?>
global $pagenow;
?>


<?php /* Used by views/media-manager.js */ ?>
<script type="text/html" id="tmpl-brightcove-media">
<div id="brightcove-media-frame-router" class="brightcove media-frame-router"></div>
<?php if ( 'admin.php' === $pagenow ) : ?>
<div class="brightcove brightcove-notices">
<# if( data.mediaType === 'playlists' ) { #>
<div class="notice notice-warning">
<p>
<?php esc_html_e( 'Please note that you can create new playlists only from Brightcove.', 'brightcove' ); ?>
</p>
</div>
<# } #>
</div>
<?php endif; ?>
<div id="brightcove-media-frame-router" class="brightcove media-frame-router">
</div>
<div class="brightcove-message message hidden"></div>
<div id="brightcove-media-frame-content" class="brightcove media-frame-content">
<span id="js-media-loading" class="spinner"></span>
Expand Down Expand Up @@ -1275,34 +1287,37 @@ class="brightcove-datetime brightcove-end-date"
<# }); #>
</select>
<# }#>
<?php if ( in_array( $pagenow, array( 'post.php', 'post-new.php' ), true ) ) : ?>
<# if( data.mediaType === 'videoexperience' ) { #>
<div class="notice notice-warning">
<p>
<?php esc_html_e( 'Please note that you can create new Experiences only from Brightcove.', 'brightcove' ); ?>
</p>
</div>
<div class="notice notice-warning">
<p>
<?php esc_html_e( 'Leave videos unselected for default Experience behavior.', 'brightcove' ); ?>
</p>
</div>
<# } #>

<# if( data.mediaType === 'videoexperience' ) { #>
<div class="notice notice-warning">
<p>
<?php esc_html_e( 'Please note that you can create new Experiences only from Brightcove.', 'brightcove' ); ?>
</p>
</div>
<div class="notice notice-warning">
<p>
<?php esc_html_e( 'Leave videos unselected for default Experience behavior.', 'brightcove' ); ?>
</p>
</div>
<# } #>

<# if ( data.mediaType === 'playlistexperience' ) { #>
<div class="notice notice-warning">
<p>
<?php esc_html_e( 'Please note that you can create new Experiences only from Brightcove.', 'brightcove' ); ?>
</p>
</div>
<# } #>

<# if( data.mediaType === 'playlists' || data.mediaType === 'playlistexperience' ) { #>
<# if ( data.mediaType === 'playlistexperience' ) { #>
<div class="notice notice-warning">
<p>
<?php esc_html_e( 'Please note that you can create new playlists only from Brightcove.', 'brightcove' ); ?>
<?php esc_html_e( 'Please note that you can create new Experiences only from Brightcove.', 'brightcove' ); ?>
</p>
</div>
<# } #>

<# if( data.mediaType === 'playlists' || data.mediaType === 'playlistexperience' ) { #>
<div class="notice notice-warning">
<p>
<?php esc_html_e( 'Please note that you can create new playlists only from Brightcove.', 'brightcove' ); ?>
</p>
</div>
<# } #>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand this one, @MARQAS. If you are testing for playlistexperience before, do we want to display another very similar message?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@felipeelia, this was already present, I just moved them. I believe it is there for a reason, There are two different sections, one is to add a Playlist, and the other one is to add a Playlist experience. So it tells the user in the playlist experience section, that you cannot add a new playlist and also you cannot add the new experiences from here as well.
Do you want me to combine them both and say: "Please note that you can create new Playlists or new Experiences only from Brightcove"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Between lines 1292 and 1319 we have 3 ifs, all of them testing data.mediaType. If mediaType is playlistexperience the code will go through 2 ifs (1305 and 1313), and the user will see these two messages at the same time:

Please note that you can create new Experiences only from Brightcove.
Please note that you can create new playlists only from Brightcove.

Do you think that makes sense from the user's perspective? Were you able to reproduce that specific scenario?

<?php endif; ?>
<# if( data.mediaType === 'playlists' || data.mediaType === 'playlistexperience' ) { #>
<p>
<input type="checkbox" name="brightcove-empty-playlists" id="brightcove-empty-playlists" class="brightcove-empty-playlists attachment-filters">
<label for="brightcove-empty-playlists"><?php esc_html_e( 'Hide Empty Playlists', 'brightcove' ); ?></label>
Expand Down
Loading