Skip to content

Commit

Permalink
add track published column to recording list
Browse files Browse the repository at this point in the history
  • Loading branch information
kkuepper committed Dec 5, 2023
1 parent 8dc360b commit ed41944
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
24 changes: 22 additions & 2 deletions admin/app/scripts/controllers/album_recording_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ angular.module('bmmApp')
delete toApi.id;

var somethingHasChanged = false;

if (toApi.is_visible !== child.is_visible) {
somethingHasChanged = true;
toApi.is_visible = child.is_visible;
}

for (var i in toApi.translations) {
if (toApi.translations.hasOwnProperty(i)) {
var translation = toApi.translations[i];
Expand Down Expand Up @@ -136,9 +142,11 @@ angular.module('bmmApp')

$scope.model = false;
$scope.children = false;
$scope.loadModel();

$scope.can_save = true;
setTimeout(function(){
$scope.loadModel();
$scope.can_save = true;
}, 500); //We're giving the server a bit of time to process the changes (otherwise _meta.is_visible isn't updated yet)
};

$scope.play = function (bundle, mediaType) {
Expand Down Expand Up @@ -178,6 +186,12 @@ angular.module('bmmApp')
_play.setPlay([track], 0);
};

$scope.trackIsPublished = function(rawTrack) {
if (rawTrack) {
return rawTrack.is_visible;
}
};

$scope.trackHasAudio = function (rawTrack) {
return $scope.trackHasMedia(rawTrack, 'audio');
};
Expand Down Expand Up @@ -222,6 +236,12 @@ angular.module('bmmApp')
}
};

$scope.toggleTrackIsPublished = function(rawTrack) {
if (rawTrack) {
rawTrack.is_visible = !rawTrack.is_visible;
}
};

$scope.toggleHasAudioEnabled = function(rawTrack) {
$scope.toggleHasMediaEnabled(rawTrack, 'audio');
};
Expand Down
10 changes: 10 additions & 0 deletions admin/app/views/pages/album-recording-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ <h4>{{translatedModel.title}}</h4>
<table>
<tr class="track" ng-if="translatedModel.children[0].type == 'track'">
<th></th>
<th>
{{init.translation.page.editor.published}}
</th>
<th>
{{init.translation.page.editor.audio}}
<label class="audio-enabled"></label>
Expand Down Expand Up @@ -71,6 +74,9 @@ <h2>
<table>
<tr class="track" ng-if="c.translated.children[0].type == 'track'">
<th></th>
<th>
{{init.translation.page.editor.published}}
</th>
<th>
{{init.translation.page.editor.audio}}
<label class="audio-enabled"></label>
Expand All @@ -93,6 +99,10 @@ <h2>
</td>

<td ng-if="c.translated.type == 'track'" class="{{c.translated.subtype}} enabled-{{c.translated['_meta'].is_visible}} order" width="1">{{c.raw.order}}</td>
<td ng-if="c.translated.type == 'track'" class="{{c.translated.subtype}} enabled-{{c.translated['_meta'].is_visible}} track-published width="1">
<input type="checkbox" ng-checked="trackIsPublished(c.raw)" />
<label ng-click="toggleTrackIsPublished(c.raw)" class="enabled-true"></label>
</td>
<td ng-if="c.translated.type == 'track'" class="{{c.translated.subtype}} enabled-{{c.translated['_meta'].is_visible}} audio-enabled" width="1">
<input ng-if="trackHasAudio(c.raw)" type="checkbox" ng-checked="trackHasAudioEnabled(c.raw)" />
<label ng-click="toggleHasAudioEnabled(c.raw)" class="enabled-{{trackHasAudio(c.raw)}}"></label>
Expand Down

0 comments on commit ed41944

Please sign in to comment.