Fixed: Artist Editor View and API Backend (#29)

Fixed: Artist Editor View and API Backend
pull/31/head
Qstick 7 years ago committed by Joseph Milazzo
parent a0e0a6e587
commit d4b79b9c41

@ -0,0 +1,31 @@
using System.Collections.Generic;
using System.Linq;
using Nancy;
using NzbDrone.Api.Extensions;
using NzbDrone.Core.Music;
namespace NzbDrone.Api.Music
{
public class ArtistEditorModule : NzbDroneApiModule
{
private readonly IArtistService _artistService;
public ArtistEditorModule(IArtistService seriesService)
: base("/artist/editor")
{
_artistService = seriesService;
Put["/"] = artist => SaveAll();
}
private Response SaveAll()
{
var resources = Request.Body.FromJson<List<ArtistResource>>();
var artist = resources.Select(artistResource => artistResource.ToModel(_artistService.GetArtist(artistResource.Id))).ToList();
return _artistService.UpdateArtists(artist)
.ToResource()
.AsResponse(HttpStatusCode.Accepted);
}
}
}

@ -108,6 +108,7 @@
<Compile Include="Commands\CommandResource.cs" />
<Compile Include="AlbumStudio\AlbumStudioModule.cs" />
<Compile Include="AlbumStudio\AlbumStudioResource.cs" />
<Compile Include="Music\ArtistEditorModule.cs" />
<Compile Include="TrackFiles\TrackFileModule.cs" />
<Compile Include="TrackFiles\TrackFileResource.cs" />
<Compile Include="Albums\AlbumModule.cs" />

@ -22,9 +22,9 @@
</div>
<div class="form-group col-md-2">
<label>Season Folder</label>
<label>Album Folder</label>
<select class="form-control x-action x-season-folder">
<select class="form-control x-action x-album-folder">
<option value="noChange">No change</option>
<option value="true">Yes</option>
<option value="false">No</option>

@ -6,7 +6,7 @@ var ArtistCollection = require('../ArtistCollection');
var ArtistTitleCell = require('../../Cells/ArtistTitleCell');
var ProfileCell = require('../../Cells/ProfileCell');
var ArtistStatusCell = require('../../Cells/ArtistStatusCell');
var ArtistFolderCell = require('../../Cells/ArtistFolderCell');
var AlbumFolderCell = require('../../Cells/AlbumFolderCell');
var SelectAllCell = require('../../Cells/SelectAllCell');
var ToolbarLayout = require('../../Shared/Toolbar/ToolbarLayout');
var FooterView = require('./ArtistEditorFooterView');
@ -56,9 +56,9 @@ module.exports = Marionette.Layout.extend({
cell : ProfileCell
},
{
name : 'artistFolder',
label : 'Artist Folder',
cell : ArtistFolderCell
name : 'albumFolder',
label : 'Album Folder',
cell : AlbumFolderCell
},
{
name : 'path',

@ -5,9 +5,8 @@ module.exports = Backgrid.Cell.extend({
render : function() {
this.$el.empty();
var artistFolder = this.model.get(this.column.get('name'));
this.$el.html(artistFolder.toString());
var albumFolder = this.model.get(this.column.get('name'));
this.$el.html(albumFolder.toString());
return this;
}
Loading…
Cancel
Save