New: Details for import/grab on Episode Activity tab

This commit is contained in:
Mark McDowall 2014-08-10 21:13:28 -07:00
parent 4b5cf7d7d3
commit 78e5209cfd
9 changed files with 184 additions and 107 deletions

View File

@ -129,6 +129,16 @@ td.episode-status-cell, td.quality-cell {
} }
} }
.episode-activity-details-cell {
width : 18px;
}
.episode-detail-modal {
.episode-actions-cell {
width : 18px;
}
}
.series-actions-cell { .series-actions-cell {
width : 56px; width : 56px;
min-width : 56px; min-width : 56px;

View File

@ -0,0 +1,35 @@
'use strict';
define(
[
'jquery',
'vent',
'marionette',
'Cells/NzbDroneCell',
'History/Details/HistoryDetailsView',
'bootstrap'
], function ($, vent, Marionette, NzbDroneCell, HistoryDetailsView) {
return NzbDroneCell.extend({
className: 'episode-activity-details-cell',
render: function () {
this.$el.empty();
this.$el.html('<i class="icon-info-sign"></i>');
var html = new HistoryDetailsView({ model: this.model }).render().$el;
this.$el.popover({
content : html,
html : true,
trigger : 'hover',
title : 'Details',
placement: 'left',
container: this.$el
});
return this;
}
});
});

View File

@ -8,6 +8,7 @@ define(
'Cells/QualityCell', 'Cells/QualityCell',
'Cells/RelativeDateCell', 'Cells/RelativeDateCell',
'Episode/Activity/EpisodeActivityActionsCell', 'Episode/Activity/EpisodeActivityActionsCell',
'Episode/Activity/EpisodeActivityDetailsCell',
'Episode/Activity/NoActivityView', 'Episode/Activity/NoActivityView',
'Shared/LoadingView' 'Shared/LoadingView'
], function (Marionette, ], function (Marionette,
@ -17,6 +18,7 @@ define(
QualityCell, QualityCell,
RelativeDateCell, RelativeDateCell,
EpisodeActivityActionsCell, EpisodeActivityActionsCell,
EpisodeActivityDetailsCell,
NoActivityView, NoActivityView,
LoadingView) { LoadingView) {
@ -50,6 +52,12 @@ define(
label: 'Date', label: 'Date',
cell : RelativeDateCell cell : RelativeDateCell
}, },
{
name : 'this',
label : '',
cell : EpisodeActivityDetailsCell,
sortable: false
},
{ {
name : 'this', name : 'this',
label : '', label : '',

View File

@ -0,0 +1,40 @@
'use strict';
define(
[
'jquery',
'vent',
'marionette',
'History/Details/HistoryDetailsView'
], function ($, vent, Marionette, HistoryDetailsView) {
return Marionette.Layout.extend({
template: 'History/Details/HistoryDetailsLayoutTemplate',
regions: {
bodyRegion: '.modal-body'
},
events: {
'click .x-mark-as-failed': '_markAsFailed'
},
onShow: function () {
this.bodyRegion.show(new HistoryDetailsView({ model: this.model }));
},
_markAsFailed: function () {
var url = window.NzbDrone.ApiRoot + '/history/failed';
var data = {
id: this.model.get('id')
};
$.ajax({
url: url,
type: 'POST',
data: data
});
vent.trigger(vent.Commands.CloseModalCommand);
}
});
});

View File

@ -0,0 +1,23 @@
<div class="modal-dialog">
<div class="modal-content">
<div class="history-detail-modal">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>
{{#if_eq eventType compare="grabbed"}}Grabbed{{/if_eq}}
{{#if_eq eventType compare="downloadFailed"}}Download Failed{{/if_eq}}
{{#if_eq eventType compare="downloadFolderImported"}}Episode Imported{{/if_eq}}
</h3>
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
{{#if_eq eventType compare="grabbed"}}<button class="btn btn-danger x-mark-as-failed">mark as failed</button>{{/if_eq}}
<button class="btn" data-dismiss="modal">close</button>
</div>
</div>
</div>
</div>

View File

@ -1,32 +1,11 @@
'use strict'; 'use strict';
define( define(
[ [
'jquery',
'vent',
'marionette', 'marionette',
'History/Details/HistoryDetailsAge' 'History/Details/HistoryDetailsAge'
], function ($, vent, Marionette) { ], function (Marionette) {
return Marionette.ItemView.extend({ return Marionette.ItemView.extend({
template: 'History/Details/HistoryDetailsViewTemplate', template: 'History/Details/HistoryDetailsViewTemplate'
events: {
'click .x-mark-as-failed': '_markAsFailed'
},
_markAsFailed: function () {
var url = window.NzbDrone.ApiRoot + '/history/failed';
var data = {
id: this.model.get('id')
};
$.ajax({
url: url,
type: 'POST',
data: data
});
vent.trigger(vent.Commands.CloseModalCommand);
}
}); });
}); });

View File

@ -1,19 +1,5 @@
<div class="modal-dialog"> {{#if_eq eventType compare="grabbed"}}
<div class="modal-content"> <dl class="dl-horizontal">
<div class="history-detail-modal">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>
{{#if_eq eventType compare="grabbed"}}Grabbed{{/if_eq}}
{{#if_eq eventType compare="downloadFailed"}}Download Failed{{/if_eq}}
{{#if_eq eventType compare="downloadFolderImported"}}Episode Imported{{/if_eq}}
</h3>
</div>
<div class="modal-body">
{{#if_eq eventType compare="grabbed"}}
<dl class="dl-horizontal">
<dt>Name:</dt> <dt>Name:</dt>
<dd>{{sourceTitle}}</dd> <dd>{{sourceTitle}}</dd>
@ -48,10 +34,10 @@
{{historyAge}} {{historyAge}}
{{/if}} {{/if}}
{{/with}} {{/with}}
</dl> </dl>
{{/if_eq}} {{/if_eq}}
{{#if_eq eventType compare="downloadFailed"}} {{#if_eq eventType compare="downloadFailed"}}
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt>Name:</dt> <dt>Name:</dt>
<dd>{{sourceTitle}}</dd> <dd>{{sourceTitle}}</dd>
@ -60,10 +46,10 @@
<dt>Message:</dt> <dt>Message:</dt>
<dd>{{message}}</dd> <dd>{{message}}</dd>
{{/with}} {{/with}}
</dl> </dl>
{{/if_eq}} {{/if_eq}}
{{#if_eq eventType compare="downloadFolderImported"}} {{#if_eq eventType compare="downloadFolderImported"}}
<dl class="dl-horizontal"> <dl class="dl-horizontal">
{{#if sourceTitle}} {{#if sourceTitle}}
<dt>Name:</dt> <dt>Name:</dt>
@ -81,13 +67,5 @@
<dd>{{importedPath}}</dd> <dd>{{importedPath}}</dd>
{{/if}} {{/if}}
{{/with}} {{/with}}
</dl> </dl>
{{/if_eq}} {{/if_eq}}
</div>
<div class="modal-footer">
{{#if_eq eventType compare="grabbed"}}<button class="btn btn-danger x-mark-as-failed">mark as failed</button>{{/if_eq}}
<button class="btn" data-dismiss="modal">close</button>
</div>
</div>
</div>
</div>

View File

@ -266,6 +266,10 @@
margin-top : 30px; margin-top : 30px;
font-size : 12px; font-size : 12px;
} }
.episode-activity-details-cell .popover {
max-width: 800px;
}
} }
.season-grid { .season-grid {

View File

@ -7,10 +7,10 @@ define(
'Series/Edit/EditSeriesView', 'Series/Edit/EditSeriesView',
'Series/Delete/DeleteSeriesView', 'Series/Delete/DeleteSeriesView',
'Episode/EpisodeDetailsLayout', 'Episode/EpisodeDetailsLayout',
'History/Details/HistoryDetailsView', 'History/Details/HistoryDetailsLayout',
'System/Logs/Table/Details/LogDetailsView', 'System/Logs/Table/Details/LogDetailsView',
'Rename/RenamePreviewLayout' 'Rename/RenamePreviewLayout'
], function (vent, AppLayout, Marionette, EditSeriesView, DeleteSeriesView, EpisodeDetailsLayout, HistoryDetailsView, LogDetailsView, RenamePreviewLayout) { ], function (vent, AppLayout, Marionette, EditSeriesView, DeleteSeriesView, EpisodeDetailsLayout, HistoryDetailsLayout, LogDetailsView, RenamePreviewLayout) {
return Marionette.AppRouter.extend({ return Marionette.AppRouter.extend({
@ -49,7 +49,7 @@ define(
}, },
_showHistory: function (options) { _showHistory: function (options) {
var view = new HistoryDetailsView({ model: options.model }); var view = new HistoryDetailsLayout({ model: options.model });
AppLayout.modalRegion.show(view); AppLayout.modalRegion.show(view);
}, },