mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-12 11:15:43 +02:00
Added UpdateSeries to SeriesProvider.
Edit now works for Series, AJAX save. Fixed Adding new series to use the DefaultQualityProfile as the QualityProfileId value.
This commit is contained in:
parent
d3b7d199ab
commit
dbca3a1974
@ -24,5 +24,6 @@ public interface ISeriesProvider
|
||||
Dictionary<Guid, String> GetUnmappedFolders();
|
||||
Series FindSeries(string cleanTitle);
|
||||
bool QualityWanted(int seriesId, QualityTypes quality);
|
||||
void UpdateSeries(Series series);
|
||||
}
|
||||
}
|
@ -108,7 +108,7 @@ public void AddSeries(string path, TvdbSeries series)
|
||||
repoSeries.Path = path;
|
||||
repoSeries.CleanTitle = Parser.NormalizeTitle(series.SeriesName);
|
||||
repoSeries.Monitored = true; //New shows should be monitored
|
||||
repoSeries.QualityProfileId = Convert.ToInt32(_config.GetValue("Quality", 1, true));
|
||||
repoSeries.QualityProfileId = Convert.ToInt32(_config.GetValue("DefaultQualityProfile", "1", true));
|
||||
_sonioRepo.Add(repoSeries);
|
||||
}
|
||||
|
||||
@ -117,6 +117,11 @@ public Series FindSeries(string cleanTitle)
|
||||
return _sonioRepo.Single<Series>(s => s.CleanTitle == cleanTitle);
|
||||
}
|
||||
|
||||
public void UpdateSeries(Series series)
|
||||
{
|
||||
_sonioRepo.Update(series);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Static Helpers
|
||||
|
@ -18,15 +18,17 @@ public class SeriesController : Controller
|
||||
private readonly IEpisodeProvider _episodeProvider;
|
||||
private readonly ISyncProvider _syncProvider;
|
||||
private readonly IRssSyncProvider _rssSyncProvider;
|
||||
private readonly IQualityProvider _qualityProvider;
|
||||
//
|
||||
// GET: /Series/
|
||||
|
||||
public SeriesController(ISyncProvider syncProvider, ISeriesProvider seriesProvider, IEpisodeProvider episodeProvider, IRssSyncProvider rssSyncProvider)
|
||||
public SeriesController(ISyncProvider syncProvider, ISeriesProvider seriesProvider, IEpisodeProvider episodeProvider, IRssSyncProvider rssSyncProvider, IQualityProvider qualityProvider)
|
||||
{
|
||||
_seriesProvider = seriesProvider;
|
||||
_episodeProvider = episodeProvider;
|
||||
_syncProvider = syncProvider;
|
||||
_rssSyncProvider = rssSyncProvider;
|
||||
_qualityProvider = qualityProvider;
|
||||
}
|
||||
|
||||
public ActionResult Index()
|
||||
@ -52,12 +54,6 @@ public ActionResult UnMapped()
|
||||
return View(_seriesProvider.GetUnmappedFolders().Select(c => new MappingModel() { Id = 1, Path = c.Value }).ToList());
|
||||
}
|
||||
|
||||
public ActionResult Edit(int seriesId)
|
||||
{
|
||||
var series = _seriesProvider.GetSeries(seriesId);
|
||||
return View(series);
|
||||
}
|
||||
|
||||
public ActionResult LoadEpisodes(int seriesId)
|
||||
{
|
||||
_episodeProvider.RefreshEpisodeInfo(seriesId);
|
||||
@ -168,5 +164,22 @@ public ActionResult Details(int seriesId)
|
||||
var series = _seriesProvider.GetSeries(seriesId);
|
||||
return View(series);
|
||||
}
|
||||
|
||||
public ActionResult Edit(int seriesId)
|
||||
{
|
||||
var profiles = _qualityProvider.GetAllProfiles();
|
||||
ViewData["SelectList"] = new SelectList(profiles, "QualityProfileId", "Name");
|
||||
|
||||
var series = _seriesProvider.GetSeries(seriesId);
|
||||
return View(series);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult Edit(Series series)
|
||||
{
|
||||
//Need to add seriesProvider.Update
|
||||
_seriesProvider.UpdateSeries(series);
|
||||
return Content("Series Updated Successfully");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ Html.Telerik().Grid(specialSeasons.Episodes).Name("seasons_specials")
|
||||
}
|
||||
%>
|
||||
<p>
|
||||
<%-- <%: Html.ActionLink("Edit", "Edit", new { /* id=Model.PrimaryKey */ }) %> |--%>
|
||||
<%: Html.ActionLink("Edit", "Edit", new {seriesId = Model.SeriesId}) %> |
|
||||
<%: Html.ActionLink("Back to Series", "Index") %>
|
||||
</p>
|
||||
</asp:Content>
|
||||
|
@ -2,74 +2,46 @@
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
|
||||
Edit
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
var options = {
|
||||
target: '#result',
|
||||
beforeSubmit: showRequest,
|
||||
success: showResponse,
|
||||
type: 'post',
|
||||
resetForm: false
|
||||
};
|
||||
$('#form').ajaxForm(options);
|
||||
$('#save_button').attr('disabled', '');
|
||||
});
|
||||
|
||||
function showRequest(formData, jqForm, options) {
|
||||
$("#result").empty().html('Saving Series...');
|
||||
$("#form :input").attr("disabled", true);
|
||||
}
|
||||
|
||||
function showResponse(responseText, statusText, xhr, $form) {
|
||||
$("#result").empty().html(responseText);
|
||||
$("#form :input").attr("disabled", false);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
|
||||
|
||||
<h2>Edit</h2>
|
||||
<h2><%: Html.DisplayTextFor(model => model.Title) %></h2>
|
||||
|
||||
<% using (Html.BeginForm()) {%>
|
||||
<%: Html.ValidationSummary(true) %>
|
||||
<% Html.EnableClientValidation(); %>
|
||||
<% using (Html.BeginForm("Edit", "Series", FormMethod.Post, new { id = "form", name = "form" }))
|
||||
{ %>
|
||||
|
||||
<fieldset>
|
||||
<legend>Fields</legend>
|
||||
|
||||
<div class="editor-label">
|
||||
<%: Html.LabelFor(model => model.SeriesId) %>
|
||||
</div>
|
||||
<div class="editor-field">
|
||||
<%: Html.TextBoxFor(model => model.SeriesId) %>
|
||||
<%: Html.ValidationMessageFor(model => model.SeriesId) %>
|
||||
</div>
|
||||
|
||||
<div class="editor-label">
|
||||
<%: Html.LabelFor(model => model.Title) %>
|
||||
</div>
|
||||
<div class="editor-field">
|
||||
<%: Html.TextBoxFor(model => model.Title) %>
|
||||
<%: Html.ValidationMessageFor(model => model.Title) %>
|
||||
</div>
|
||||
|
||||
<div class="editor-label">
|
||||
<%: Html.LabelFor(model => model.CleanTitle) %>
|
||||
</div>
|
||||
<div class="editor-field">
|
||||
<%: Html.TextBoxFor(model => model.CleanTitle) %>
|
||||
<%: Html.ValidationMessageFor(model => model.CleanTitle) %>
|
||||
</div>
|
||||
|
||||
<div class="editor-label">
|
||||
<%: Html.LabelFor(model => model.Status) %>
|
||||
</div>
|
||||
<div class="editor-field">
|
||||
<%: Html.TextBoxFor(model => model.Status) %>
|
||||
<%: Html.ValidationMessageFor(model => model.Status) %>
|
||||
</div>
|
||||
|
||||
<div class="editor-label">
|
||||
<%: Html.LabelFor(model => model.Overview) %>
|
||||
</div>
|
||||
<div class="editor-field">
|
||||
<%: Html.TextBoxFor(model => model.Overview) %>
|
||||
<%: Html.ValidationMessageFor(model => model.Overview) %>
|
||||
</div>
|
||||
|
||||
<div class="editor-label">
|
||||
<%: Html.LabelFor(model => model.AirTimes) %>
|
||||
</div>
|
||||
<div class="editor-field">
|
||||
<%: Html.TextBoxFor(model => model.AirTimes) %>
|
||||
<%: Html.ValidationMessageFor(model => model.AirTimes) %>
|
||||
</div>
|
||||
|
||||
<div class="editor-label">
|
||||
<%: Html.LabelFor(model => model.Language) %>
|
||||
</div>
|
||||
<div class="editor-field">
|
||||
<%: Html.TextBoxFor(model => model.Language) %>
|
||||
<%: Html.ValidationMessageFor(model => model.Language) %>
|
||||
</div>
|
||||
|
||||
<legend>Edit</legend>
|
||||
|
||||
<div class="editor-label">
|
||||
<%: Html.LabelFor(model => model.Path) %>
|
||||
</div>
|
||||
@ -82,29 +54,42 @@
|
||||
<%: Html.LabelFor(model => model.Monitored) %>
|
||||
</div>
|
||||
<div class="editor-field">
|
||||
<%: Html.TextBoxFor(model => model.Monitored) %>
|
||||
<%: Html.CheckBoxFor(model => model.Monitored) %>
|
||||
<%: Html.ValidationMessageFor(model => model.Monitored) %>
|
||||
</div>
|
||||
|
||||
<%--<div class="editor-label">
|
||||
<%: Html.LabelFor(model => model.ProfileId) %>
|
||||
<div class="editor-label">
|
||||
<%: Html.LabelFor(model => model.QualityProfileId) %>
|
||||
</div>
|
||||
<div class="editor-field">
|
||||
<%: Html.TextBoxFor(model => model.ProfileId) %>
|
||||
<%: Html.ValidationMessageFor(model => model.ProfileId) %>
|
||||
</div>--%>
|
||||
<%: Html.DropDownListFor(model => model.QualityProfileId, (SelectList)ViewData["SelectList"])%>
|
||||
<%: Html.ValidationMessageFor(model => model.QualityProfileId) %>
|
||||
</div>
|
||||
|
||||
<div class="hidden" style="display:none;">
|
||||
<%: Html.TextBoxFor(model => model.SeriesId) %>
|
||||
<%: Html.TextBoxFor(model => model.Title) %>
|
||||
<%: Html.TextBoxFor(model => model.CleanTitle) %>
|
||||
<%: Html.TextBoxFor(model => model.Status) %>
|
||||
<%: Html.TextBoxFor(model => model.Overview) %>
|
||||
<%: Html.TextBoxFor(model => model.AirsDayOfWeek) %>
|
||||
<%: Html.TextBoxFor(model => model.AirTimes) %>
|
||||
<%: Html.TextBoxFor(model => model.Language) %>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<input type="submit" value="Save" />
|
||||
<input type="submit" id="save_button" value="Save" disabled="disabled" />
|
||||
</p>
|
||||
</fieldset>
|
||||
|
||||
<% } %>
|
||||
|
||||
<div>
|
||||
<%: Html.ActionLink("Back to Show", "Details", new { seriesId = Model.SeriesId }) %> |
|
||||
<%: Html.ActionLink("Back to List", "Index") %>
|
||||
</div>
|
||||
|
||||
<div id="result"></div>
|
||||
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="headerContent" runat="server">
|
||||
|
@ -22,7 +22,7 @@
|
||||
$("#result").empty().html(responseText);
|
||||
$("#form :input").attr("disabled", false);
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
<% Html.EnableClientValidation(); %>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user