mirror of https://github.com/Sonarr/Sonarr
Adding works!
This commit is contained in:
parent
af2c86e40a
commit
d481000001
|
@ -0,0 +1,20 @@
|
||||||
|
<ProjectConfiguration>
|
||||||
|
<CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
|
||||||
|
<ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
|
||||||
|
<PreloadReferencedAssemblies>false</PreloadReferencedAssemblies>
|
||||||
|
<AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking>
|
||||||
|
<AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking>
|
||||||
|
<IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
|
||||||
|
<RunPreBuildEvents>false</RunPreBuildEvents>
|
||||||
|
<RunPostBuildEvents>false</RunPostBuildEvents>
|
||||||
|
<PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
|
||||||
|
<InstrumentAssembly>true</InstrumentAssembly>
|
||||||
|
<PreventSigningOfAssembly>false</PreventSigningOfAssembly>
|
||||||
|
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
|
||||||
|
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
|
||||||
|
<DefaultTestTimeout>60000</DefaultTestTimeout>
|
||||||
|
<UseBuildConfiguration />
|
||||||
|
<UseBuildPlatform />
|
||||||
|
<ProxyProcessPath />
|
||||||
|
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
|
||||||
|
</ProjectConfiguration>
|
|
@ -40,7 +40,7 @@ namespace NzbDrone.Api.QualityProfiles
|
||||||
public override object OnPost(QualityProfileModel request)
|
public override object OnPost(QualityProfileModel request)
|
||||||
{
|
{
|
||||||
var profile = Mapper.Map<QualityProfileModel, QualityProfile>(request);
|
var profile = Mapper.Map<QualityProfileModel, QualityProfile>(request);
|
||||||
_qualityProvider.Add(profile);
|
request.Id = _qualityProvider.Add(profile);
|
||||||
|
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,13 +16,13 @@
|
||||||
#add-profile
|
#add-profile
|
||||||
{
|
{
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-size:16px;
|
font-size: 14px;
|
||||||
color: black;
|
color: black;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
#add-profile > i {
|
#add-profile i:before {
|
||||||
color: green;
|
color: green;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
|
@ -15,6 +15,7 @@
|
||||||
//Add to cutoff
|
//Add to cutoff
|
||||||
//Update model
|
//Update model
|
||||||
var target = $(e.target);
|
var target = $(e.target);
|
||||||
|
var el = $(this.el);
|
||||||
|
|
||||||
var checked = $(target).attr('checked') != undefined;
|
var checked = $(target).attr('checked') != undefined;
|
||||||
var id = this.model.get("Id");
|
var id = this.model.get("Id");
|
||||||
|
@ -26,9 +27,8 @@
|
||||||
if (qualityType.Id == qualityId) {
|
if (qualityType.Id == qualityId) {
|
||||||
qualityType.Allowed = checked;
|
qualityType.Allowed = checked;
|
||||||
|
|
||||||
//Todo: Add/Remove from cutoff
|
|
||||||
//Find cutoff dropdown
|
//Find cutoff dropdown
|
||||||
var cutoff = ('select#' + id);
|
var cutoff = $(el).find('.cutoff');
|
||||||
|
|
||||||
if (checked) {
|
if (checked) {
|
||||||
$('<option>' + qualityType.Name + '</option>').val(qualityId).appendTo(cutoff);
|
$('<option>' + qualityType.Name + '</option>').val(qualityId).appendTo(cutoff);
|
||||||
|
@ -49,7 +49,6 @@
|
||||||
this.model.save();
|
this.model.save();
|
||||||
},
|
},
|
||||||
changeCutoff: function(e) {
|
changeCutoff: function(e) {
|
||||||
//Todo: save change
|
|
||||||
var cutoff = $(e.target).val();
|
var cutoff = $(e.target).val();
|
||||||
|
|
||||||
this.model.set({ "Cutoff": cutoff });
|
this.model.set({ "Cutoff": cutoff });
|
||||||
|
@ -58,15 +57,14 @@
|
||||||
changeName: function(e) {
|
changeName: function(e) {
|
||||||
var name = $(e.target).val();
|
var name = $(e.target).val();
|
||||||
|
|
||||||
//Todo: update default quality dropdown
|
|
||||||
$('#DefaultQualityProfileId option[value="' + this.model.get("Id") + '"]').html(name);
|
$('#DefaultQualityProfileId option[value="' + this.model.get("Id") + '"]').html(name);
|
||||||
|
|
||||||
this.model.set({ "Name": name });
|
this.model.set({ "Name": name });
|
||||||
this.model.save();
|
this.model.save();
|
||||||
},
|
},
|
||||||
destroy: function (e) {
|
destroy: function (e) {
|
||||||
if (e === undefined)
|
//if (e === undefined)
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.model.destroy();
|
this.model.destroy();
|
||||||
|
@ -97,9 +95,22 @@ QualityProfileCollectionView = Backbone.Marionette.CompositeView.extend({
|
||||||
'click #add-profile': 'addProfile'
|
'click #add-profile': 'addProfile'
|
||||||
},
|
},
|
||||||
addProfile: function (e) {
|
addProfile: function (e) {
|
||||||
|
e.preventDefault();
|
||||||
//Add new profile to collection
|
//Add new profile to collection
|
||||||
//Todo: How will we get the list of qualities (they would all be NOT allowed) - it all comes from the server side...
|
//Todo: How will we get the list of qualities (they would all be NOT allowed) - it all comes from the server side...
|
||||||
this.collection.add(new QualityProfile());
|
var newProfile = new QualityProfile({
|
||||||
e.preventDefault();
|
Name: '', Cutoff: 0, Qualities: [
|
||||||
|
{ "Id": 0, "Weight": 0, "Name": "Unknown", "Allowed": false },
|
||||||
|
{ "Id": 1, "Weight": 1, "Name": "SDTV", "Allowed": false },
|
||||||
|
{ "Id": 2, "Weight": 2, "Name": "DVD", "Allowed": false },
|
||||||
|
{ "Id": 4, "Weight": 4, "Name": "HDTV", "Allowed": false },
|
||||||
|
{ "Id": 5, "Weight": 5, "Name": "WEBDL-720p", "Allowed": false },
|
||||||
|
{ "Id": 3, "Weight": 7, "Name": "WEBDL-1080p", "Allowed": false },
|
||||||
|
{ "Id": 6, "Weight": 6, "Name": "Bluray720p", "Allowed": false },
|
||||||
|
{ "Id": 7, "Weight": 8, "Name": "Bluray1080p", "Allowed": false }
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
this.collection.add(newProfile);
|
||||||
}
|
}
|
||||||
});
|
});
|
|
@ -121,7 +121,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="quality-profile-setting">
|
<div class="quality-profile-setting">
|
||||||
<label>Cutoff</label>
|
<label>Cutoff</label>
|
||||||
<select id="<%= Id %>" class="cutoff">
|
<select class="cutoff">
|
||||||
<% _.each(Qualities, function(quality) { %>
|
<% _.each(Qualities, function(quality) { %>
|
||||||
<% if (quality.Allowed === true) { %>
|
<% if (quality.Allowed === true) { %>
|
||||||
<option value="<%= quality.Id %>" <%= quality.Id === Cutoff ? 'selected="selected"' : '' %>><%= quality.Name %></option>
|
<option value="<%= quality.Id %>" <%= quality.Id === Cutoff ? 'selected="selected"' : '' %>><%= quality.Name %></option>
|
||||||
|
@ -147,12 +147,12 @@
|
||||||
|
|
||||||
<script id="QualityProfileCollectionTemplate" type="text/template">
|
<script id="QualityProfileCollectionTemplate" type="text/template">
|
||||||
<div id="profileHeader">
|
<div id="profileHeader">
|
||||||
<button id="add-profile">Add New Profile</button>
|
@*<button id="add-profile"><i class="icon-plus icon-large"></i> Add New Profile</button>*@
|
||||||
|
|
||||||
@*<a id="add-profile" href="@Url.Action("AddProfile", "Settings")">
|
<a id="add-profile" href="@Url.Action("AddProfile", "Settings")">
|
||||||
<i class="icon-plus icon-large"></i>
|
<i class="icon-plus icon-large"></i>
|
||||||
Add New Profile
|
Add New Profile
|
||||||
</a>*@
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue