#20: Tweaked the genre merging UI to be less tedious.

This commit is contained in:
Peter Deltchev 2016-01-05 11:18:58 -08:00
parent 96be3224e4
commit 4b51ff9c84
2 changed files with 8 additions and 9 deletions

View file

@ -24,9 +24,9 @@
<td><i ng-show="genre.isSaving" class="icon-cog icon-spin icon-large"></i></td> <td><i ng-show="genre.isSaving" class="icon-cog icon-spin icon-large"></i></td>
<td><a ng-href="{{ genre.url }}">{{ genre.track_count }}</a></td> <td><a ng-href="{{ genre.url }}">{{ genre.track_count }}</a></td>
<td class="-actions"> <td class="-actions">
<button class="btn btn-warning" ng-hide="mergeInProgress" ng-click="startMerge(genre)">Merge&hellip;</button> <button class="btn btn-warning" ng-hide="mergeInProgress" ng-click="startMerge(genre)">Merge genres in&hellip;</button>
<button class="btn btn-danger" ng-show="mergeInProgress && genreToDelete.id != genre.id" ng-click="finishMerge(genre)">Merge in <em>{{ genreToDelete.name }}</em>&hellip;</button> <button class="btn btn-danger" ng-show="mergeInProgress && destinationGenre.id != genre.id" ng-click="finishMerge(genre)">Merge into <em>{{ destinationGenre.name }}</em>&hellip;</button>
<button class="btn btn-warning" ng-show="mergeInProgress && genreToDelete.id == genre.id" ng-click="cancelMerge()">Cancel merge</button> <button class="btn btn-warning" ng-show="mergeInProgress && destinationGenre.id == genre.id" ng-click="cancelMerge()">Cancel merge</button>
</td> </td>
</tr> </tr>
</table> </table>

View file

@ -50,17 +50,16 @@ angular.module('ponyfm').controller 'admin-genres', [
genre.isSaving = false genre.isSaving = false
$scope.startMerge = (genreToDelete) -> $scope.startMerge = (destinationGenre) ->
$scope.genreToDelete = genreToDelete $scope.destinationGenre = destinationGenre
$scope.mergeInProgress = true $scope.mergeInProgress = true
$scope.cancelMerge = () -> $scope.cancelMerge = () ->
$scope.genreToDelete = null $scope.destinationGenre = null
$scope.mergeInProgress = false $scope.mergeInProgress = false
$scope.finishMerge = (destinationGenre) -> $scope.finishMerge = (genreToDelete) ->
$scope.mergeInProgress = false genres.merge(genreToDelete.id, $scope.destinationGenre.id)
genres.merge($scope.genreToDelete.id, destinationGenre.id)
.done (response) -> .done (response) ->
loadGenres() loadGenres()
] ]