mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-23 22:25:09 -04:00
Moved source code under src folder - massive change
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
<div class="add-notification-item span3">
|
||||
<div class="row">
|
||||
<div class="span3">
|
||||
{{implementationName}}
|
||||
{{#if link}}
|
||||
<a href="{{link}}"><i class="icon-info-sign"/></a>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
|
||||
define([
|
||||
'app',
|
||||
'marionette',
|
||||
'Settings/Notifications/EditView'
|
||||
], function (App, Marionette, EditView) {
|
||||
|
||||
return Marionette.ItemView.extend({
|
||||
template: 'Settings/Notifications/AddItemTemplate',
|
||||
tagName : 'li',
|
||||
|
||||
events: {
|
||||
'click': 'addNotification'
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
this.notificationCollection = options.notificationCollection;
|
||||
},
|
||||
|
||||
addNotification: function (e) {
|
||||
if ($(e.target).hasClass('icon-info-sign')) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.model.set({
|
||||
id: undefined,
|
||||
name: this.model.get('implementationName'),
|
||||
onGrab: true,
|
||||
onDownload: true
|
||||
});
|
||||
|
||||
var editView = new EditView({ model: this.model, notificationCollection: this.notificationCollection });
|
||||
App.modalRegion.show(editView);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3>Add Notification</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="add-notifications">
|
||||
<ul class="items"></ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn" data-dismiss="modal">close</button>
|
||||
</div>
|
||||
@@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
define([
|
||||
'marionette',
|
||||
'Settings/Notifications/AddItemView'
|
||||
], function (Marionette, AddItemView) {
|
||||
|
||||
return Marionette.CompositeView.extend({
|
||||
itemView : AddItemView,
|
||||
itemViewContainer: '.add-notifications .items',
|
||||
template : 'Settings/Notifications/AddTemplate',
|
||||
|
||||
itemViewOptions: function () {
|
||||
return {
|
||||
notificationCollection: this.notificationCollection
|
||||
};
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
this.notificationCollection = options.notificationCollection;
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'Settings/Notifications/Model'
|
||||
], function (NotificationModel) {
|
||||
return Backbone.Collection.extend({
|
||||
url : window.NzbDrone.ApiRoot + '/notification',
|
||||
model: NotificationModel
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
<ul class="notifications">
|
||||
<li>
|
||||
<div class="notification-item add-card x-add-card">
|
||||
<span class="center well">
|
||||
<i class="icon-plus" title="Add Connection"/>
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
define([
|
||||
'app',
|
||||
'marionette',
|
||||
'Settings/Notifications/ItemView',
|
||||
'Settings/Notifications/SchemaModal'
|
||||
], function (App, Marionette, NotificationItemView, SchemaModal) {
|
||||
return Marionette.CompositeView.extend({
|
||||
itemView : NotificationItemView,
|
||||
itemViewContainer: '.notifications',
|
||||
template : 'Settings/Notifications/CollectionTemplate',
|
||||
|
||||
ui: {
|
||||
'addCard': '.x-add-card'
|
||||
},
|
||||
|
||||
events: {
|
||||
'click .x-add-card': '_openSchemaModal'
|
||||
},
|
||||
|
||||
appendHtml: function(collectionView, itemView, index){
|
||||
collectionView.ui.addCard.parent('li').before(itemView.el);
|
||||
},
|
||||
|
||||
_openSchemaModal: function () {
|
||||
SchemaModal.open(this.collection);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3>Delete Notification</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Are you sure you want to delete '{{name}}'?</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn" data-dismiss="modal">cancel</button>
|
||||
<button class="btn btn-danger x-confirm-delete">delete</button>
|
||||
</div>
|
||||
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
define(['app', 'marionette'], function (App, Marionette) {
|
||||
return Marionette.ItemView.extend({
|
||||
template: 'Settings/Notifications/DeleteTemplate',
|
||||
|
||||
events: {
|
||||
'click .x-confirm-delete': '_removeNotification'
|
||||
},
|
||||
|
||||
_removeNotification: function () {
|
||||
this.model.destroy({
|
||||
wait : true,
|
||||
success: function () {
|
||||
App.vent.trigger(App.Commands.CloseModalCommand);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,83 @@
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
{{#if id}}
|
||||
<h3>Edit - {{implementationName}}</h3>
|
||||
{{else}}
|
||||
<h3>Add - {{implementationName}}</h3>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-horizontal">
|
||||
<div class="control-group">
|
||||
<label class="control-label">Name</label>
|
||||
|
||||
<div class="controls">
|
||||
<input type="text" name="name"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label">On Grab</label>
|
||||
|
||||
<div class="controls">
|
||||
<label class="checkbox toggle well">
|
||||
<input type="checkbox" name="onGrab"/>
|
||||
<p>
|
||||
<span>Yes</span>
|
||||
<span>No</span>
|
||||
</p>
|
||||
|
||||
<div class="btn btn-primary slide-button"/>
|
||||
</label>
|
||||
|
||||
<span class="help-inline-checkbox">
|
||||
<i class="icon-question-sign" title="Do you want to get notifications when episodes are grabbed?"/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label">On Download</label>
|
||||
|
||||
<div class="controls">
|
||||
<label class="checkbox toggle well">
|
||||
<input type="checkbox" name="onDownload"/>
|
||||
<p>
|
||||
<span>Yes</span>
|
||||
<span>No</span>
|
||||
</p>
|
||||
|
||||
<div class="btn btn-primary slide-button"/>
|
||||
</label>
|
||||
|
||||
<span class="help-inline-checkbox">
|
||||
<i class="icon-question-sign" title="Do you want to get notifications when episodes are downloaded?"/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{formBuilder}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
{{#if id}}
|
||||
<button class="btn btn-danger pull-left x-delete">delete</button>
|
||||
{{else}}
|
||||
<button class="btn pull-left x-back">back</button>
|
||||
{{/if}}
|
||||
|
||||
<button class="btn x-test">test <i class="x-test-icon icon-nd-test"/></button>
|
||||
<button class="btn" data-dismiss="modal">cancel</button>
|
||||
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-primary x-save">save</button>
|
||||
<button class="btn btn-icon-only btn-primary dropdown-toggle" data-toggle="dropdown">
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li class="save-and-add x-save-and-add">
|
||||
save and add
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,92 @@
|
||||
'use strict';
|
||||
|
||||
define([
|
||||
'app',
|
||||
'marionette',
|
||||
'Settings/Notifications/Model',
|
||||
'Settings/Notifications/DeleteView',
|
||||
'Shared/Messenger',
|
||||
'Commands/CommandController',
|
||||
'Mixins/AsModelBoundView',
|
||||
'Form/FormBuilder'
|
||||
|
||||
], function (App, Marionette, NotificationModel, DeleteView, Messenger, CommandController, AsModelBoundView) {
|
||||
|
||||
var model = Marionette.ItemView.extend({
|
||||
template: 'Settings/Notifications/EditTemplate',
|
||||
|
||||
events: {
|
||||
'click .x-save' : '_saveNotification',
|
||||
'click .x-save-and-add' : '_saveAndAddNotification',
|
||||
'click .x-delete' : '_deleteNotification',
|
||||
'click .x-back' : '_back',
|
||||
'click .x-test' : '_test'
|
||||
},
|
||||
|
||||
ui: {
|
||||
testButton: '.x-test',
|
||||
testIcon : '.x-test-icon'
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
this.notificationCollection = options.notificationCollection;
|
||||
},
|
||||
|
||||
_saveNotification: function () {
|
||||
var self = this;
|
||||
var promise = this.model.saveSettings();
|
||||
|
||||
if (promise) {
|
||||
promise.done(function () {
|
||||
self.notificationCollection.add(self.model, { merge: true });
|
||||
App.vent.trigger(App.Commands.CloseModalCommand);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_saveAndAddNotification: function () {
|
||||
var self = this;
|
||||
var promise = this.model.saveSettings();
|
||||
|
||||
if (promise) {
|
||||
promise.done(function () {
|
||||
self.notificationCollection.add(self.model, { merge: true });
|
||||
|
||||
require('Settings/Notifications/SchemaModal').open(self.notificationCollection);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_deleteNotification: function () {
|
||||
var view = new DeleteView({ model: this.model });
|
||||
App.modalRegion.show(view);
|
||||
},
|
||||
|
||||
_back: function () {
|
||||
require('Settings/Notifications/SchemaModal').open(this.notificationCollection);
|
||||
},
|
||||
|
||||
_test: function () {
|
||||
var testCommand = this.model.get('testCommand');
|
||||
if (testCommand) {
|
||||
this.idle = false;
|
||||
var properties = {};
|
||||
|
||||
_.each(this.model.get('fields'), function (field) {
|
||||
properties[field.name] = field.value;
|
||||
});
|
||||
|
||||
|
||||
CommandController.Execute(testCommand, properties);
|
||||
}
|
||||
},
|
||||
|
||||
_testOnAlways: function () {
|
||||
if (!this.isClosed) {
|
||||
this.idle = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return AsModelBoundView.call(model);
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
<div class="notification-item">
|
||||
<div>
|
||||
<h3>{{name}}</h3>
|
||||
<span class="btn-group pull-right">
|
||||
<button class="btn btn-mini btn-icon-only x-edit"><i class="icon-nd-edit"/></button>
|
||||
<button class="btn btn-mini btn-icon-only x-delete"><i class="icon-nd-delete"/></button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="settings">
|
||||
{{#if onGrab}}
|
||||
<span class="label label-success">On Grab</span>
|
||||
{{else}}
|
||||
<span class="label">On Grab</span>
|
||||
{{/if}}
|
||||
|
||||
{{#if onDownload}}
|
||||
<span class="label label-success">On Download</span>
|
||||
{{else}}
|
||||
<span class="label">On Download</span>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
|
||||
define([
|
||||
'app',
|
||||
'marionette',
|
||||
'Settings/Notifications/EditView',
|
||||
'Settings/Notifications/DeleteView'
|
||||
|
||||
], function (App, Marionette, EditView, DeleteView) {
|
||||
|
||||
return Marionette.ItemView.extend({
|
||||
template: 'Settings/Notifications/ItemTemplate',
|
||||
tagName : 'li',
|
||||
|
||||
events: {
|
||||
'click .x-edit' : '_editNotification',
|
||||
'click .x-delete': '_deleteNotification'
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
this.listenTo(this.model, 'sync', this.render);
|
||||
},
|
||||
|
||||
_editNotification: function () {
|
||||
var view = new EditView({ model: this.model, notificationCollection: this.model.collection});
|
||||
App.modalRegion.show(view);
|
||||
},
|
||||
|
||||
_deleteNotification: function () {
|
||||
var view = new DeleteView({ model: this.model});
|
||||
App.modalRegion.show(view);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
define([
|
||||
'Settings/SettingsModelBase'], function (ModelBase) {
|
||||
return ModelBase.extend({
|
||||
|
||||
successMessage: 'Notification Saved',
|
||||
errorMessage : 'Couldn\'t save notification'
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
define([
|
||||
'app',
|
||||
'Settings/Notifications/Collection',
|
||||
'Settings/Notifications/AddView'
|
||||
], function (App, NotificationCollection, AddSelectionNotificationView) {
|
||||
return ({
|
||||
|
||||
open: function (collection) {
|
||||
var schemaCollection = new NotificationCollection();
|
||||
schemaCollection.url = '/api/notification/schema';
|
||||
schemaCollection.fetch();
|
||||
schemaCollection.url = '/api/notification';
|
||||
|
||||
var view = new AddSelectionNotificationView({ collection: schemaCollection, notificationCollection: collection});
|
||||
App.modalRegion.show(view);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,79 @@
|
||||
@import "../../Shared/Styles/card.less";
|
||||
@import "../../Shared/Styles/clickable.less";
|
||||
|
||||
.add-notification-item {
|
||||
.card;
|
||||
cursor: pointer;
|
||||
font-size: 24px;
|
||||
font-weight: lighter;
|
||||
text-align: center;
|
||||
|
||||
a {
|
||||
font-size: 16px;
|
||||
color: #595959;
|
||||
|
||||
i {
|
||||
.clickable;
|
||||
}
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
|
||||
.add-notifications {
|
||||
text-align: center;
|
||||
|
||||
.items {
|
||||
list-style-type: none;
|
||||
margin: 0px;
|
||||
|
||||
li {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.notifications {
|
||||
width: -webkit-fit-content;
|
||||
width: -moz-fit-content;
|
||||
width: fit-content;
|
||||
|
||||
li {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
}
|
||||
}
|
||||
.notification-item {
|
||||
|
||||
.card;
|
||||
|
||||
width: 290px;
|
||||
height: 90px;
|
||||
padding: 20px 20px;
|
||||
|
||||
h3 {
|
||||
margin-top: 0px;
|
||||
display: inline-block;
|
||||
width: 230px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.btn-group {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.settings {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
&.add-card {
|
||||
.center {
|
||||
margin-top: 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user