1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00

Quality Profile add card

This commit is contained in:
Mark McDowall 2013-07-26 00:04:25 -07:00
parent d7c70a9c91
commit 4f1b27a523
6 changed files with 54 additions and 38 deletions

View File

@ -10,34 +10,21 @@ define([
itemViewContainer: '.notifications', itemViewContainer: '.notifications',
template : 'Settings/Notifications/CollectionTemplate', template : 'Settings/Notifications/CollectionTemplate',
ui: {
'addCard': '.x-add-card'
},
events: { events: {
'click .x-add': '_openSchemaModal',
'click .x-add-card': '_openSchemaModal' 'click .x-add-card': '_openSchemaModal'
}, },
onBeforeItemAdded: function () {
this.ui.addCard.remove();
},
onAfterItemAdded: function () { onAfterItemAdded: function () {
this._appendAddCard();
},
_openSchemaModal: function () {
SchemaModal.open(this.collection);
},
_appendAddCard: function () {
this.$itemViewContainer.find('.x-add-card').remove(); this.$itemViewContainer.find('.x-add-card').remove();
this.templateFunction = Marionette.TemplateCache.get('Settings/Notifications/AddCardTemplate'); this.templateFunction = Marionette.TemplateCache.get('Settings/Notifications/AddCardTemplate');
var html = this.templateFunction(); var html = this.templateFunction();
this.$itemViewContainer.append(html); this.$itemViewContainer.append(html);
},
_openSchemaModal: function () {
SchemaModal.open(this.collection);
} }
}); });
}); });

View File

@ -56,22 +56,22 @@
.settings { .settings {
margin-top: 5px; margin-top: 5px;
} }
}
.add-card { &.add-card {
.clickable;
color: #adadad;
font-size: 50px;
text-align: center;
.center {
display: inline-block;
padding: 0px 20px;
padding-top: 5px;
margin-top: 15px;
}
i {
.clickable; .clickable;
color: #adadad;
font-size: 50px;
text-align: center;
.center {
display: inline-block;
padding: 0px 20px;
padding-top: 5px;
margin-top: 15px;
}
i {
.clickable;
}
} }
} }

View File

@ -0,0 +1,7 @@
<li>
<div class="quality-profile-item add-card x-add-card">
<span class="center well">
<i class="icon-plus" title="Add Profile"/>
</span>
</div>
</li>

View File

@ -1,10 +1,5 @@
<fieldset> <fieldset>
<legend>Quality Profiles</legend> <legend>Quality Profiles</legend>
<div class="row">
<div class="span12">
<button class="btn btn-success x-add">Add Profile</button>
</div>
</div>
<div class="row"> <div class="row">
<div class="span12"> <div class="span12">
<ul class="quality-profiles"></ul> <ul class="quality-profiles"></ul>

View File

@ -13,7 +13,16 @@ define(['app',
template : 'Settings/Quality/Profile/QualityProfileCollectionTemplate', template : 'Settings/Quality/Profile/QualityProfileCollectionTemplate',
events: { events: {
'click .x-add': '_addProfile' 'click .x-add-card': '_addProfile'
},
onAfterItemAdded: function () {
this.$itemViewContainer.find('.x-add-card').remove();
this.templateFunction = Marionette.TemplateCache.get('Settings/Quality/Profile/AddCardTemplate');
var html = this.templateFunction();
this.$itemViewContainer.append(html);
}, },
_addProfile: function () { _addProfile: function () {

View File

@ -27,6 +27,24 @@
.btn-group { .btn-group {
margin-top: 8px; margin-top: 8px;
} }
&.add-card {
.clickable;
color: #adadad;
font-size: 50px;
text-align: center;
.center {
display: inline-block;
padding: 0px 20px;
padding-top: 5px;
margin-top: 30px;
}
i {
.clickable;
}
}
} }
.quality-size-item { .quality-size-item {