show rejection reasons in a tool tip instead of plaint text in the grid.

This commit is contained in:
Keivan Beigi 2013-07-02 17:44:22 -07:00
parent 31d472a0a0
commit ef4ad53277
8 changed files with 76 additions and 40 deletions

View File

@ -0,0 +1,40 @@
'use strict';
define(
[
'backgrid',
'marionette',
'bootstrap'
], function (Backgrid, Marionette) {
return Backgrid.Cell.extend({
className: 'approval-status-cell',
template : 'Cells/ApprovalStatusCellTemplate',
render: function () {
var rejections = this.model.get(this.column.get('name'));
if (rejections.length === 0) {
return this;
}
this.templateFunction = Marionette.TemplateCache.get(this.template);
var html = this.templateFunction(rejections);
this.$el.html('<i class="icon-exclamation-sign"/>');
this.$el.popover({
content : html,
html : true,
trigger : 'hover',
title : 'Release Rejected',
placement: 'left',
container: this.$el
});
return this;
}
});
});

View File

@ -0,0 +1,6 @@
<ul>
{{#each this}}
<li>{{this}}</li>
{{debug}}
{{/each}}
</ul>

View File

@ -1,23 +1,39 @@
@import "../content/Bootstrap/mixins"; @import "../content/Bootstrap/mixins";
@import "../content/Bootstrap/variables"; @import "../content/Bootstrap/variables";
@import "../content/Bootstrap/buttons"; @import "../content/Bootstrap/buttons";
@import "../shared/styles/clickable";
.episode-title-cell { .episode-title-cell {
.btn-link; .btn-link;
} }
.air-date-cell { .air-date-cell {
width: 100px; width : 100px;
} }
.relative-date-cell { .relative-date-cell {
width: 150px; width : 150px;
} }
.quality-cell{ .quality-cell {
width: 130px; width : 130px;
} }
.history-event-type-cell{ .history-event-type-cell {
width : 10px; width : 10px;
} }
.download-report-cell {
.clickable();
}
.approval-status-cell {
widows : 10px;
.popover {
max-width : 400px;
}
i {
color : @red;
}
}

View File

@ -14,8 +14,8 @@ define(
'Logs/Layout', 'Logs/Layout',
'Release/Layout', 'Release/Layout',
'Shared/NotFoundView' 'Shared/NotFoundView'
], function (App, Marionette, HistoryLayout, SettingsLayout, AddSeriesLayout, SeriesIndexLayout, SeriesDetailsLayout, MissingLayout, SeriesModel, CalendarLayout, NotFoundView, ], function (App, Marionette, HistoryLayout, SettingsLayout, AddSeriesLayout, SeriesIndexLayout, SeriesDetailsLayout, MissingLayout, SeriesModel, CalendarLayout,
LogsLayout, ReleaseLayout) { LogsLayout, ReleaseLayout, NotFoundView) {
return Marionette.Controller.extend({ return Marionette.Controller.extend({
series : function () { series : function () {

View File

@ -5,7 +5,7 @@ define(
'backgrid', 'backgrid',
'Cells/FileSizeCell', 'Cells/FileSizeCell',
'Cells/QualityCell', 'Cells/QualityCell',
'Release/ApprovalStatusCell', 'Cells/ApprovalStatusCell',
'Release/DownloadReportCell' 'Release/DownloadReportCell'
], function (Marionette, Backgrid, FileSizeCell, QualityCell, ApprovalStatusCell, DownloadReportCell) { ], function (Marionette, Backgrid, FileSizeCell, QualityCell, ApprovalStatusCell, DownloadReportCell) {
@ -46,7 +46,7 @@ define(
{ {
name : 'rejections', name : 'rejections',
label: 'decision', label: '',
cell : ApprovalStatusCell cell : ApprovalStatusCell
}, },
{ {

View File

@ -1,26 +0,0 @@
'use strict';
define(
[
'backgrid'
], function (Backgrid) {
return Backgrid.Cell.extend({
className: 'approval-status-cell',
render: function () {
var rejections = this.model.get(this.column.get('name'));
var result = '';
_.each(rejections, function (reason) {
result += reason + ' ';
});
this.$el.html(result);
this.delegateEvents();
return this;
}
});
});

View File

@ -18,13 +18,13 @@ define(
this.$el.html('<i class =\'icon-spinner icon-spin\' />'); this.$el.html('<i class =\'icon-spinner icon-spin\' />');
this.model.save().always(function () { this.model.save().always(function () {
self.$el.html('<i class =\'icon-download-alt\' />'); self.$el.html('<i class =\'icon-download-alt\' title=\'Add to download queue\' />');
}); });
}, },
render: function () { render: function () {
this.$el.html('<i class =\'icon-download-alt\' />'); this.$el.html('<i class =\'icon-download-alt\' title=\'Add to download queue\' />');
return this; return this;
} }

View File

@ -8,7 +8,7 @@ define(
'Cells/EpisodeNumberCell', 'Cells/EpisodeNumberCell',
'Cells/FileSizeCell', 'Cells/FileSizeCell',
'Cells/QualityCell', 'Cells/QualityCell',
'Release/ApprovalStatusCell', 'Cells/ApprovalStatusCell',
'Shared/SpinnerView' 'Shared/SpinnerView'
], function (Marionette, Backgrid, ReleaseCollection, IndexerCell, EpisodeNumberCell, FileSizeCell, QualityCell, ApprovalStatusCell, SpinnerView) { ], function (Marionette, Backgrid, ReleaseCollection, IndexerCell, EpisodeNumberCell, FileSizeCell, QualityCell, ApprovalStatusCell, SpinnerView) {
return Marionette.Layout.extend({ return Marionette.Layout.extend({
@ -55,7 +55,7 @@ define(
{ {
name : 'rejections', name : 'rejections',
label: 'decision', label: '',
cell : ApprovalStatusCell cell : ApprovalStatusCell
} }
], ],