Stylized the new profiles
This commit is contained in:
parent
ae8db51839
commit
a6a5277de8
|
@ -32,6 +32,7 @@ _ReSharper*/
|
||||||
[Ll]ogs/
|
[Ll]ogs/
|
||||||
[Aa]pp_Data/
|
[Aa]pp_Data/
|
||||||
/[Pp]ackage/
|
/[Pp]ackage/
|
||||||
|
/FakesAssemblies/
|
||||||
#NZBDrone specific
|
#NZBDrone specific
|
||||||
*.db
|
*.db
|
||||||
*Web.Publish.xml
|
*Web.Publish.xml
|
||||||
|
|
|
@ -36,29 +36,29 @@ namespace NzbDrone.Api.QualityProfiles
|
||||||
return Mapper.Map<QualityProfile, QualityProfileModel>(profile);
|
return Mapper.Map<QualityProfile, QualityProfileModel>(profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override object OnPost(QualityProfileModel data)
|
//Create
|
||||||
|
public override object OnPost(QualityProfileModel request)
|
||||||
{
|
{
|
||||||
//Create
|
var profile = Mapper.Map<QualityProfileModel, QualityProfile>(request);
|
||||||
var profile = Mapper.Map<QualityProfileModel, QualityProfile>(data);
|
|
||||||
_qualityProvider.Add(profile);
|
_qualityProvider.Add(profile);
|
||||||
|
|
||||||
return data;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override object OnPut(QualityProfileModel data)
|
//Update
|
||||||
|
public override object OnPut(QualityProfileModel request)
|
||||||
{
|
{
|
||||||
//Update
|
var profile = Mapper.Map<QualityProfileModel, QualityProfile>(request);
|
||||||
var profile = Mapper.Map<QualityProfileModel, QualityProfile>(data);
|
|
||||||
_qualityProvider.Update(profile);
|
_qualityProvider.Update(profile);
|
||||||
|
|
||||||
return data;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override object OnDelete(QualityProfileModel data)
|
public override object OnDelete(QualityProfileModel request)
|
||||||
{
|
{
|
||||||
_qualityProvider.Delete(data.Id);
|
_qualityProvider.Delete(request.Id);
|
||||||
|
|
||||||
return "ok";
|
return request.Id.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -38,8 +38,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/* QualityProfileItem */
|
/* QualityProfileItem */
|
||||||
.quality-selectee
|
.quality-selectee {
|
||||||
{
|
|
||||||
border-color: #065EFE;
|
border-color: #065EFE;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
|
@ -51,73 +50,50 @@
|
||||||
float: left;
|
float: left;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
}
|
}
|
||||||
.quality-selecting
|
.quality-selecting {
|
||||||
{
|
|
||||||
background: #85AEF9;
|
background: #85AEF9;
|
||||||
}
|
}
|
||||||
.quality-selected
|
|
||||||
{
|
.quality-selected {
|
||||||
background: #065EFE;
|
background: #065EFE;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.profileSection
|
.quality-profile {
|
||||||
{
|
|
||||||
float: left;
|
float: left;
|
||||||
width: 265px;
|
width: 260px;
|
||||||
margin: 2px;
|
margin: 2px;
|
||||||
border:solid 1px #CCCCCD;
|
border:solid 1px #CCCCCD;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
padding: 5px 5px 5px 5px;
|
padding: 5px 5px 5px 5px;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.profileOptions label
|
.quality-profile-setting label {
|
||||||
{
|
width: 45px;
|
||||||
margin-top: 10px;
|
|
||||||
margin-left: 7px;
|
|
||||||
margin-right: 20px;
|
|
||||||
font-weight: bold;
|
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.profileOptions input, .profileOptions select
|
|
||||||
{
|
|
||||||
font-size:12px;
|
|
||||||
padding:4px 2px;
|
|
||||||
border:solid 1px #aacfe4;
|
|
||||||
width:170px;
|
|
||||||
margin-right: 2px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.profileOptions input
|
.quality-profile-setting input {
|
||||||
{
|
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
margin-bottom: 2px;
|
width: 160px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.profileOptions select
|
.quality-profile-setting select {
|
||||||
{
|
width: 166px;
|
||||||
width: 176px;
|
|
||||||
margin-bottom: 7px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.qualitySelector
|
.remove-profile {
|
||||||
{
|
|
||||||
padding-left: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.delete-profile {
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0px;
|
top: 0px;
|
||||||
right: 0px;
|
right: 4px;
|
||||||
font-size: 16px;
|
font-size: 20px;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.delete-profile > i[class*="icon-"]:hover {
|
.remove-profile > i[class*="icon-"]:hover {
|
||||||
cursor: pointer !important;
|
cursor: pointer !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -2,10 +2,14 @@
|
||||||
tagName: "div",
|
tagName: "div",
|
||||||
className: "quality-profile",
|
className: "quality-profile",
|
||||||
template: "#QualityProfileTemplate",
|
template: "#QualityProfileTemplate",
|
||||||
|
initialize: function() {
|
||||||
|
this.model.on('destroy', this.remove, this)
|
||||||
|
},
|
||||||
events: {
|
events: {
|
||||||
'click .quality-selectee': 'toggleAllowed',
|
'click .quality-selectee': 'toggleAllowed',
|
||||||
'change .cutoff': 'changeCutoff',
|
'change .cutoff': 'changeCutoff',
|
||||||
'change .name': 'changeName'
|
'change .name': 'changeName',
|
||||||
|
'click .remove-profile': 'destroy'
|
||||||
},
|
},
|
||||||
toggleAllowed: function (e) {
|
toggleAllowed: function (e) {
|
||||||
//Add to cutoff
|
//Add to cutoff
|
||||||
|
@ -54,6 +58,17 @@
|
||||||
|
|
||||||
this.model.set({ "Name": name });
|
this.model.set({ "Name": name });
|
||||||
this.model.save();
|
this.model.save();
|
||||||
|
},
|
||||||
|
destroy: function (e) {
|
||||||
|
if (e === undefined)
|
||||||
|
return;
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
this.model.destroy();
|
||||||
|
e.stopPropagation();
|
||||||
|
},
|
||||||
|
remove: function (e) {
|
||||||
|
$(this.el).remove();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -78,6 +93,7 @@ QualityProfileCollectionView = Backbone.Marionette.CompositeView.extend({
|
||||||
},
|
},
|
||||||
addProfile: function (e) {
|
addProfile: function (e) {
|
||||||
//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...
|
||||||
this.collection.add(new QualityProfile());
|
this.collection.add(new QualityProfile());
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,12 +114,13 @@
|
||||||
@*@Html.IncludeScript("backbone/bootstrapper.js")*@
|
@*@Html.IncludeScript("backbone/bootstrapper.js")*@
|
||||||
|
|
||||||
<script id="QualityProfileTemplate" type="text/template">
|
<script id="QualityProfileTemplate" type="text/template">
|
||||||
<div>
|
<a href="#" class="remove-profile"><i class="icon-remove"></i></a>
|
||||||
<strong>Name</strong>
|
<div class="quality-profile-setting">
|
||||||
|
<label>Name</label>
|
||||||
<input type="text" value="<%= Name %>" class="name" />
|
<input type="text" value="<%= Name %>" class="name" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="quality-profile-setting">
|
||||||
<strong>Cutoff</strong>
|
<label>Cutoff</label>
|
||||||
<select id="<%= Id %>" class="cutoff">
|
<select id="<%= Id %>" class="cutoff">
|
||||||
<% _.each(Qualities, function(quality) { %>
|
<% _.each(Qualities, function(quality) { %>
|
||||||
<% if (quality.Allowed === true) { %>
|
<% if (quality.Allowed === true) { %>
|
||||||
|
@ -132,14 +133,16 @@
|
||||||
|
|
||||||
<% _.each(Qualities, function(quality) { %>
|
<% _.each(Qualities, function(quality) { %>
|
||||||
<input id="<%= Id %>_<%= quality.Id %>"
|
<input id="<%= Id %>_<%= quality.Id %>"
|
||||||
class="quality-selectee"
|
class="quality-selectee"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
value="<%= quality.Allowed %>"
|
value="<%= quality.Allowed %>"
|
||||||
data-quality-id="<%= quality.Id %>"
|
data-quality-id="<%= quality.Id %>"
|
||||||
<%= quality.Allowed ? 'checked="checked"' : '' %>
|
<%= quality.Allowed ? 'checked="checked"' : '' %>
|
||||||
/>
|
/>
|
||||||
<label for="<%= Id %>_<%= quality.Id %>"><%= quality.Name %></label>
|
<label for="<%= Id %>_<%= quality.Id %>"><%= quality.Name %></label>
|
||||||
<% }); %>
|
<% }); %>
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script id="QualityProfileCollectionTemplate" type="text/template">
|
<script id="QualityProfileCollectionTemplate" type="text/template">
|
||||||
|
|
Loading…
Reference in New Issue