1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00

Added links and api key links to notifications

This commit is contained in:
Mark McDowall 2013-07-27 13:57:41 -07:00
parent 35d29df864
commit 625acef635
23 changed files with 90 additions and 9 deletions

View File

@ -8,6 +8,7 @@ public class Field
public string Name { get; set; }
public string Label { get; set; }
public string HelpText { get; set; }
public string HelpLink { get; set; }
public object Value { get; set; }
public string Type { get; set; }
public List<SelectOption> SelectOptions { get; set; }

View File

@ -26,6 +26,7 @@ public static List<Field> GenerateSchema(object model)
Name = propertyInfo.Name,
Label = fieldAttribute.Label,
HelpText = fieldAttribute.HelpText,
HelpLink = fieldAttribute.HelpLink,
Order = fieldAttribute.Order,
Type = fieldAttribute.Type.ToString().ToLowerInvariant()
};

View File

@ -9,6 +9,7 @@ public class NotificationResource : RestResource
{
public String Name { get; set; }
public String ImplementationName { get; set; }
public String Link { get; set; }
public Boolean OnGrab { get; set; }
public Boolean OnDownload { get; set; }
public List<Field> Fields { get; set; }

View File

@ -13,6 +13,7 @@ public FieldDefinitionAttribute(int order)
public int Order { get; private set; }
public string Label { get; set; }
public string HelpText { get; set; }
public string HelpLink { get; set; }
public FieldType Type { get; set; }
public Type SelectOptions { get; set; }
}

View File

@ -22,6 +22,11 @@ public override string ImplementationName
get { return "Email"; }
}
public override string Link
{
get { return null; }
}
public override void OnGrab(string message)
{
const string subject = "NzbDrone [TV] - Grabbed";

View File

@ -21,6 +21,11 @@ public override string ImplementationName
get { return "Growl"; }
}
public override string Link
{
get { return "http://growl.info/"; }
}
public override void OnGrab(string message)
{
const string title = "Episode Grabbed";

View File

@ -6,6 +6,7 @@ public interface INotification
{
string Name { get; }
string ImplementationName { get; }
string Link { get; }
NotificationDefinition InstanceDefinition { get; set; }

View File

@ -5,6 +5,7 @@ public class Notification
public int Id { get; set; }
public string Name { get; set; }
public string ImplementationName { get; set; }
public string Link { get; set; }
public bool OnGrab { get; set; }
public bool OnDownload { get; set; }
public INotifcationSettings Settings { get; set; }

View File

@ -7,6 +7,7 @@ namespace NzbDrone.Core.Notifications
{
public abstract string Name { get; }
public abstract string ImplementationName { get; }
public abstract string Link { get; }
public NotificationDefinition InstanceDefinition { get; set; }

View File

@ -68,6 +68,7 @@ public List<Notification> Schema()
newNotification.Instance = (INotification)_container.Resolve(type);
newNotification.Id = i;
newNotification.ImplementationName = notification.ImplementationName;
newNotification.Link = notification.Link;
var instanceType = newNotification.Instance.GetType();
var baseGenArgs = instanceType.BaseType.GetGenericArguments();

View File

@ -21,6 +21,11 @@ public override string ImplementationName
get { return "Plex Client"; }
}
public override string Link
{
get { return "http://www.plexapp.com/"; }
}
public override void OnGrab(string message)
{
const string header = "NzbDrone [TV] - Grabbed";

View File

@ -21,6 +21,11 @@ public override string ImplementationName
get { return "Plex Server"; }
}
public override string Link
{
get { return "http://www.plexapp.com/"; }
}
public override void OnGrab(string message)
{
}

View File

@ -22,6 +22,11 @@ public override string ImplementationName
get { return "Prowl"; }
}
public override string Link
{
get { return "http://www.prowlapp.com/"; }
}
public override void OnGrab(string message)
{
const string title = "Episode Grabbed";

View File

@ -5,7 +5,7 @@ namespace NzbDrone.Core.Notifications.Prowl
{
public class ProwlSettings : INotifcationSettings
{
[FieldDefinition(0, Label = "API Key")]
[FieldDefinition(0, Label = "API Key", HelpLink = "https://www.prowlapp.com/api_settings.php")]
public String ApiKey { get; set; }
[FieldDefinition(1, Label = "Priority", Type = FieldType.Select, SelectOptions= typeof(ProwlPriority) )]

View File

@ -23,6 +23,11 @@ public override string ImplementationName
get { return "Pushover"; }
}
public override string Link
{
get { return "https://pushover.net/"; }
}
public override void OnGrab(string message)
{
const string title = "Episode Grabbed";

View File

@ -5,7 +5,7 @@ namespace NzbDrone.Core.Notifications.Pushover
{
public class PushoverSettings : INotifcationSettings
{
[FieldDefinition(0, Label = "User Key")]
[FieldDefinition(0, Label = "User Key", HelpLink = "https://pushover.net/")]
public String UserKey { get; set; }
[FieldDefinition(1, Label = "Priority", Type = FieldType.Select, SelectOptions = typeof(PushoverPriority) )]

View File

@ -22,6 +22,11 @@ public override string ImplementationName
get { return "XBMC"; }
}
public override string Link
{
get { return "http://xbmc.org/"; }
}
public override void OnGrab(string message)
{
const string header = "NzbDrone [TV] - Grabbed";

View File

@ -1,4 +1,6 @@
.control-group {
@import "../Shared/Styles/clickable.less";
.control-group {
.controls {
i {
font-size : 16px;
@ -31,3 +33,11 @@
textarea.release-restrictions {
width : 260px;
}
.help-link {
text-decoration: none !important;
i {
.clickable;
}
}

View File

@ -0,0 +1,11 @@
{{#if helpText}}
<span class="help-inline">
<i class="icon-question-sign" title="{{helpText}}"/>
</span>
{{/if}}
{{#if helpLink}}
<span class="help-inline">
<a href="{{helpLink}}" class="help-link"><i class="icon-info-sign"/></a>
</span>
{{/if}}

View File

@ -3,10 +3,6 @@
<div class="controls">
<input type="text" name="fields.{{order}}.value" spellcheck="false"/>
{{#if helpText}}
<span class="help-inline">
<i class="icon-question-sign" title="{{helpText}}"/>
</span>
{{/if}}
{{> FormHelpPartial}}
</div>
</div>

View File

@ -2,6 +2,9 @@
<div class="row">
<div class="span3">
{{implementationName}}
{{#if link}}
<a href="{{link}}"><i class="icon-info-sign"/></a>
{{/if}}
</div>
</div>
</div>

View File

@ -18,7 +18,11 @@ define([
this.notificationCollection = options.notificationCollection;
},
addNotification: function () {
addNotification: function (e) {
if ($(e.target).hasClass('icon-info-sign')) {
return;
}
this.model.set('id', undefined);
var editView = new EditView({ model: this.model, notificationCollection: this.notificationCollection });
App.modalRegion.show(editView);

View File

@ -1,4 +1,5 @@
@import "../../Shared/Styles/card.less";
@import "../../Shared/Styles/clickable.less";
.add-notification-item {
.card;
@ -6,6 +7,19 @@
font-size: 24px;
font-weight: lighter;
text-align: center;
a {
font-size: 16px;
color: #595959;
i {
.clickable;
}
}
a:hover {
text-decoration: none;
}
}
.add-notifications {