Skip to content

Commit

Permalink
change: test: phpcs, gjslint修正
Browse files Browse the repository at this point in the history
  • Loading branch information
s-nakajima committed Aug 8, 2020
1 parent 9f0090a commit ff2ce29
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 56 deletions.
48 changes: 24 additions & 24 deletions Controller/VideosController.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,32 +340,32 @@ public function download() {
*
* @return void
*/
public function get_play_counts() {
$query = [
'fields' => [
'Video.id',
'Video.play_number',
],
'conditions' => [
'Video.id' => explode(',', $this->request->query('video_ids')),
],
'recursive' => -1,
];
$orgRecursive = $this->Video->recursive;
$this->Video->recursive = -1;
$videos = $this->Video->find('all', $query);
$this->Video->recursive = $orgRecursive;

if ($this->request->query('increment')) {
foreach ($videos as &$video) {
$video['Video']['play_number'] = $this->Video->countUp($video);
public function get_play_counts() {
$query = [
'fields' => [
'Video.id',
'Video.play_number',
],
'conditions' => [
'Video.id' => explode(',', $this->request->query('video_ids')),
],
'recursive' => -1,
];
$orgRecursive = $this->Video->recursive;
$this->Video->recursive = -1;
$videos = $this->Video->find('all', $query);
$this->Video->recursive = $orgRecursive;

if ($this->request->query('increment')) {
foreach ($videos as &$video) {
$video['Video']['play_number'] = $this->Video->countUp($video);
}
unset($video);
}
unset($video);
}

$this->set('_serialize', ['counts']);
$this->set('counts', $videos);
}
$this->set('_serialize', ['counts']);
$this->set('counts', $videos);
}

/**
* _setFlashMessageAndRedirect
Expand Down
4 changes: 2 additions & 2 deletions View/Videos/index.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ echo $this->NetCommonsHtml->script('/videos/js/videos.js');
}
?>
<div ng-controller="Video.index"
ng-init="init(<?php echo h(json_encode(Current::read('Frame.id')))
. ', ' . h(json_encode($initialValues)); ?>)">
ng-init="init(<?php echo h(json_encode(Current::read('Frame.id'))) .
', ' . h(json_encode($initialValues)); ?>)">
<?php foreach ($videos as $video) : ?>
<article>
<?php echo $this->element('Videos.Videos/list', array(
Expand Down
8 changes: 4 additions & 4 deletions View/Videos/view.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ echo $this->NetCommonsHtml->script(array(
$initialValues[$video['Video']['id']] = $value;
?>
<div class="video-margin-row" ng-controller="VideoView"
ng-init="init(<?php echo h(json_encode(Current::read('Frame.id')))
. ', ' . h(json_encode($initialValues)); ?>)">
ng-init="init(<?php echo h(json_encode(Current::read('Frame.id'))) .
', ' . h(json_encode($initialValues)); ?>)">
<div class="panel panel-default video-detail">
<div class="nc-content-list">
<?php /* ステータス、タイトル */ ?>
Expand Down Expand Up @@ -171,8 +171,8 @@ echo $this->NetCommonsHtml->script(array(
?>
<?php $i = 0; ?>
<div ng-controller="Video.index"
ng-init="init(<?php echo h(json_encode(Current::read('Frame.id')))
. ', ' . h(json_encode($initialValues)); ?>)">
ng-init="init(<?php echo h(json_encode(Current::read('Frame.id'))) .
', ' . h(json_encode($initialValues)); ?>)">
<?php foreach ($relatedVideos as $relatedVideo) : ?>
<?php /* related-videoはJSで必要 */ ?>
<article class="related-video <?php echo $i >= VideosController::START_LIMIT_RELATED_VIDEO ? 'hidden' : '' ?>">
Expand Down
52 changes: 26 additions & 26 deletions webroot/js/videos.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,24 @@
* @param {function($scope, $http, NC3_URL)} Controller
*/
NetCommonsApp.controller('VideoView',
['$scope', '$http', 'NC3_URL',
function($scope, $http, NC3_URL) {
$scope.init = function(frameId, initialValues) {
showPlayCounts($scope, $http, NC3_URL, frameId, initialValues, true);
};
['$scope', '$http', 'NC3_URL',
function($scope, $http, NC3_URL) {
$scope.init = function(frameId, initialValues) {
showPlayCounts($scope, $http, NC3_URL, frameId, initialValues, true);
};

/**
* 埋め込みコード
*
* @return {void}
*/
$scope.embed = function() {
// jquery 表示・非表示
$('div.video-embed').toggle('normal');
// 表示後埋め込みコード選択
$('input.video-embed-text').select();
};
}]);
/**
* 埋め込みコード
*
* @return {void}
*/
$scope.embed = function() {
// jquery 表示・非表示
$('div.video-embed').toggle('normal');
// 表示後埋め込みコード選択
$('input.video-embed-text').select();
};
}]);

function showPlayCounts($scope, $http, NC3_URL, frameId, initialValues, increment) {
var videoIds = initialValues && Object.keys(initialValues);
Expand All @@ -63,15 +63,15 @@
params += '&increment=1';
}
$http.get(NC3_URL + '/videos/videos/get_play_counts.json' + params)
.then(
function(response) {
var counts = response.data.counts;
for (var i = 0; i < counts.length; i++) {
$scope.playCounts[counts[i].Video.id] = counts[i].Video.play_number;
}
},
function() {
});
.then(
function(response) {
var counts = response.data.counts;
for (var i = 0; i < counts.length; i++) {
$scope.playCounts[counts[i].Video.id] = counts[i].Video.play_number;
}
},
function() {
});
}
})();

Expand Down

0 comments on commit ff2ce29

Please sign in to comment.