Skip to content

Commit

Permalink
Order the playlists by name in the navigation pane
Browse files Browse the repository at this point in the history
Also, we now navigate automatically to any newly created or renamed playlist.
This way, it will be easier for the user to see, where did her playlist go
after giving the name.

refs #1083
  • Loading branch information
paulijar committed Aug 26, 2023
1 parent 039a406 commit a95071d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* As a side-effect, any UI settings (like volume, view modes) from the previous version get discarded upon the SW update
* Also, volume settings in the Share and Files embedded players are now distint from the volume in the main app
- Small optimization on the size of the `collection.json` loaded by the web front-end
- Order the playlists by name in the navigation pane, navigate automatically to the created or renamed playlist
[#1083](https://github.com/owncloud/music/issues/1083)

### Fixed
- Subsonic: Unhandled exception when attempting to delete a non-existent bookmark
Expand Down
3 changes: 3 additions & 0 deletions js/app/controllers/navigationcontroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ angular.module('Music').controller('NavigationController', [
playlist.updated = result.updated;
});
$scope.showEditForm = null;
libraryService.sortPlaylists();
$timeout(() => $scope.navigateTo(`#playlist/${playlist.id}`));
}
};

Expand Down Expand Up @@ -323,6 +325,7 @@ angular.module('Music').controller('NavigationController', [
};
Restangular.all('playlists').post(args).then(function(playlist) {
libraryService.addPlaylist(playlist);
$timeout(() => $scope.navigateTo(`#playlist/${playlist.id}`));
});
}

Expand Down
5 changes: 5 additions & 0 deletions js/app/services/libraryservice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ export class LibraryService {
}
setPlaylists(lists : any[]) : void {
this.#playlists = _.map(lists, (list) => this.#wrapPlaylist(list));
this.sortPlaylists();
}
setSmartList(list : any) : void {
if (!list) {
Expand Down Expand Up @@ -472,8 +473,12 @@ export class LibraryService {
let idx = _.findIndex(this.#podcastChannels, { id: channel.id });
this.#podcastChannels.splice(idx, 1);
}
sortPlaylists() : void {
this.#sortByTextField(this.#playlists, 'name');
}
addPlaylist(playlist : any) : void {
this.#playlists.push(this.#wrapPlaylist(playlist));
this.sortPlaylists();
}
removePlaylist(playlist : any) : void {
this.#playlists.splice(this.#playlists.indexOf(playlist), 1);
Expand Down

0 comments on commit a95071d

Please sign in to comment.