Skip to content

Commit

Permalink
Merge pull request #261 from 10up/develop
Browse files Browse the repository at this point in the history
Release 2.5.2
  • Loading branch information
oscarssanchez authored Mar 17, 2022
2 parents f5f0f58 + 3e61eb8 commit cf06bc3
Show file tree
Hide file tree
Showing 15 changed files with 975 additions and 658 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file, per [the Ke

## [Unreleased] - TBD

## [2.5.2] - 2022-03-17

### Added
- Update multilingual metadata. Props [@oscarssanchez](https://github.com/oscarssanchez) via [#256](https://github.com/10up/brightcove-video-connect/pull/256).

## [2.5.1] - 2022-01-24

### Added
Expand Down Expand Up @@ -357,6 +362,7 @@ All notable changes to this project will be documented in this file, per [the Ke
- First release

[Unreleased]: https://github.com/10up/brightcove-video-connect/compare/master...develop
[2.5.2]: https://github.com/10up/brightcove-video-connect/compare/2.5.1...2.5.2
[2.5.1]: https://github.com/10up/brightcove-video-connect/compare/2.5.0...2.5.1
[2.5.0]: https://github.com/10up/brightcove-video-connect/compare/2.4.0...2.5.0
[2.4.0]: https://github.com/10up/brightcove-video-connect/compare/2.3.1...2.4.0
Expand Down
62 changes: 52 additions & 10 deletions assets/js/brightcove-admin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/js/brightcove-admin.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions assets/js/brightcove-admin.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions assets/js/src/models/media.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ var MediaModel = Backbone.Model.extend({
thumbnail: this.get('thumbnail'),
captions: this.get('captions'),
labels: this.get('labels'),
sub_type: this.get('subType'),
language: this.get('language'),
});

var video_ids = this.get('video_ids');
Expand Down
60 changes: 50 additions & 10 deletions assets/js/src/views/video-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,40 @@ var VideoEditView = BrightcoveView.extend({
'click .attachment .check': 'removeAttachment',
'click .caption-secondary-fields .delete': 'removeCaptionRow',
'click .add-remote-caption': 'addCaptionRow',
'change .brightcove-variant': 'changeVariant',
'click .add-bc-label': 'addLabelRow',
'keypress .brightcove-labels': 'labelAutocomplete',
'click .bc-label-secondary-fields .delete': 'removeLabelRow',
},

/**
* Changes template variant based on current variant.
* @param event
*/
changeVariant: function (event) {
const valueSelected = this.$el.find('.brightcove-variant').val(),
options = this.model.toJSON();

let template;

if (valueSelected === 'none') {
template = wp.template('brightcove-video-edit');
$('.brightcove-variant-details').replaceWith(template(options));
} else {
let variantIndex = options.variants
.map(function (variant) {
return variant.language;
})
.indexOf(valueSelected);
let variant = options.variants[variantIndex];
variant.variantList = options.variants;
variant.valueSelected = valueSelected;
template = wp.template('brightcove-variants');

$('.brightcove-variant-details').replaceWith(template(variant));
}
},

back: function (event) {
event.preventDefault();

Expand Down Expand Up @@ -359,22 +388,33 @@ var VideoEditView = BrightcoveView.extend({
);
}

// Trim whitespace and commas from tags beginning/end.
this.model.set(
'tags',
this.$el
.find('.brightcove-tags')
.val()
.trim()
.replace(/(^,)|(,$)/g, ''),
);
const brightcoveTags = this.$el.find('.brightcove-tags');

if (brightcoveTags.length !== 0) {
// Trim whitespace and commas from tags beginning/end.
this.model.set(
'tags',
brightcoveTags
.val()
.trim()
.replace(/(^,)|(,$)/g, ''),
);
}

this.model.set('mediaType', 'videos');
this.model.set('height', this.$el.find('.brightcove-height').val());
this.model.set('width', this.$el.find('.brightcove-width').val());
this.model.set('mediaType', 'videos');
this.model.set('poster', this.$el.find('.brightcove-poster').val());
this.model.set('thumbnail', this.$el.find('.brightcove-thumbnail').val());
this.model.set('folderId', this.$el.find('.brightcove-folder').val());

const isVariant = this.$el.find('.brightcove-variant').val();

if (isVariant !== 'none' && this.model.get('mediaType') === 'videos') {
this.model.set('subType', 'variant');
this.model.set('language', isVariant);
}

// Captions
var captions = [];
this.$el
Expand Down
4 changes: 2 additions & 2 deletions brightcove-video-connect.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Brightcove Video Connect
* Plugin URI: https://wordpress.org/plugins/brightcove-video-connect/
* Description: A Brightcove™ Connector for WordPress that leverages enhanced APIs and Brightcove™ Capabilities
* Version: 2.5.1
* Version: 2.5.2
* Author: 10up
* Author URI: http://10up.com
* License: GPLv2+
Expand All @@ -29,7 +29,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 021.0.2301 USA
*/

define( 'BRIGHTCOVE_VERSION', '2.5.1' );
define( 'BRIGHTCOVE_VERSION', '2.5.2' );
define( 'BRIGHTCOVE_URL', plugin_dir_url( __FILE__ ) );
define( 'BRIGHTCOVE_PATH', dirname( __FILE__ ) . '/' );
define( 'BRIGHTCOVE_BASENAME', plugin_basename( __FILE__ ) );
Expand Down
65 changes: 32 additions & 33 deletions includes/admin/api/class-bc-admin-media-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ public function bc_ajax_update_video_or_playlist() {
'state',
'scheduled_start_date',
'scheduled_end_date',
'sub_type',
'language'
);

foreach ( $fields as $field ) {
Expand Down Expand Up @@ -217,42 +219,45 @@ public function bc_ajax_update_video_or_playlist() {
$type_msg = 'playlist';

} elseif ( 'videos' === $_POST['type'] ) {

$status = $this->videos->update_bc_video( $updated_data );
$type_msg = 'video';
if ( 'variant' === $_POST['sub_type'] ) {
$status = $this->videos->update_bc_video( $updated_data, sanitize_text_field( $_POST['sub_type'] ) );
} else {
$status = $this->videos->update_bc_video( $updated_data );

if ( isset( $_POST['folderId'] ) && isset( $_POST['oldFolderId'] ) ) {
$folderId = sanitize_text_field( $_POST['folderId'] );
$oldFolderId = sanitize_text_field( $_POST['oldFolderId'] );
if ( isset( $_POST['folderId'] ) && isset( $_POST['oldFolderId'] ) ) {
$folderId = sanitize_text_field( $_POST['folderId'] );
$oldFolderId = sanitize_text_field( $_POST['oldFolderId'] );

$this->cms_api->add_folder_to_video( $oldFolderId, $folderId, $updated_data['video_id'] );
}
$this->cms_api->add_folder_to_video( $oldFolderId, $folderId, $updated_data['video_id'] );
}

// Maybe update poster
if ( isset( $_POST['poster'] ) ) {
$poster_data = json_decode( wp_unslash( $_POST['poster'] ), true );
// Maybe update poster
if ( isset( $_POST['poster'] ) ) {
$poster_data = json_decode( wp_unslash( $_POST['poster'] ), true );

if ( $poster_data ) {
// Maybe update poster
$this->ajax_poster_upload( $hash, $updated_data['video_id'], $poster_data['url'], $poster_data['width'], $poster_data['height'] );
if ( $poster_data ) {
// Maybe update poster
$this->ajax_poster_upload( $hash, $updated_data['video_id'], $poster_data['url'], $poster_data['width'], $poster_data['height'] );
}
}
}

// Maybe update thumbnail
if ( isset( $_POST['thumbnail'] ) ) {
$thumb_data = json_decode( wp_unslash( $_POST['thumbnail'] ), true );
// Maybe update thumbnail
if ( isset( $_POST['thumbnail'] ) ) {
$thumb_data = json_decode( wp_unslash( $_POST['thumbnail'] ), true );

if ( $thumb_data ) {
// Maybe update poster
$this->ajax_thumb_upload( $hash, $updated_data['video_id'], $thumb_data['url'], $thumb_data['width'], $thumb_data['height'] );
if ( $thumb_data ) {
// Maybe update poster
$this->ajax_thumb_upload( $hash, $updated_data['video_id'], $thumb_data['url'], $thumb_data['width'], $thumb_data['height'] );
}
}
}

if ( isset( $_POST['captions'] ) ) {
// Maybe update captions
$this->ajax_caption_upload( $hash, $updated_data['video_id'], $_POST['captions'] );
} else {
$this->ajax_caption_delete( $hash, $updated_data['video_id'] );
if ( isset( $_POST['captions'] ) ) {
// Maybe update captions
$this->ajax_caption_upload( $hash, $updated_data['video_id'], $_POST['captions'] );
} else {
$this->ajax_caption_delete( $hash, $updated_data['video_id'] );
}
}
}

Expand Down Expand Up @@ -434,13 +439,7 @@ public function brightcove_media_upload() {
*
* @return array An array of media items.
*/
public function fetch_all(
$type,
$posts_per_page = 100,
$page = 1,
$query_string = '',
$sort_order = 'updated_at'
) {
public function fetch_all( $type, $posts_per_page = 100, $page = 1, $query_string = '', $sort_order = 'updated_at' ) {

global $bc_accounts;

Expand Down
Loading

0 comments on commit cf06bc3

Please sign in to comment.