parent
c6912a193c
commit
5e9a79afe8
@ -0,0 +1,32 @@
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3>{{relativePath}}</h3>
|
||||
</div>
|
||||
<div class="modal-body edit-series-modal">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label">Quality</label>
|
||||
|
||||
<div class="col-sm-4">
|
||||
<select class="form-control x-quality" id="inputProfile" name="qualityId">
|
||||
{{#each qualities}}
|
||||
<option value="{{quality.id}}">{{quality.name}}</option>
|
||||
{{/each}}
|
||||
</select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
||||
<span class="indicator x-indicator"><i class="icon-sonarr-spinner fa-spin"></i></span>
|
||||
<button class="btn" data-dismiss="modal">Cancel</button>
|
||||
<button class="btn btn-primary x-save">Save</button>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,60 @@
|
||||
var vent = require('vent');
|
||||
var Marionette = require('marionette');
|
||||
var Qualities = require('../../../Quality/QualityDefinitionCollection');
|
||||
var AsModelBoundView = require('../../../Mixins/AsModelBoundView');
|
||||
var AsValidatedView = require('../../../Mixins/AsValidatedView');
|
||||
var AsEditModalView = require('../../../Mixins/AsEditModalView');
|
||||
require('../../../Mixins/TagInput');
|
||||
require('../../../Mixins/FileBrowser');
|
||||
|
||||
var view = Marionette.ItemView.extend({
|
||||
template : 'Movies/Files/Edit/EditFileTemplate',
|
||||
|
||||
ui : {
|
||||
quality : '.x-quality',
|
||||
path : '.x-path',
|
||||
tags : '.x-tags'
|
||||
},
|
||||
|
||||
events : {
|
||||
|
||||
},
|
||||
|
||||
initialize : function() {
|
||||
this.qualities = new Qualities();
|
||||
var self = this;
|
||||
this.listenTo(this.qualities, 'all', this._qualitiesUpdated);
|
||||
this.qualities.fetch()
|
||||
|
||||
},
|
||||
|
||||
onRender : function() {
|
||||
this.ui.quality.val(this.model.get("quality").quality.id)
|
||||
},
|
||||
|
||||
_onBeforeSave : function() {
|
||||
var qualityId = this.ui.quality.val();
|
||||
var quality = this.qualities.find(function(m){return m.get("quality").id == qualityId}).get("quality");
|
||||
var mQuality = this.model.get("quality");
|
||||
mQuality.quality = quality;
|
||||
this.model.set({ quality : mQuality });
|
||||
},
|
||||
|
||||
_qualitiesUpdated : function() {
|
||||
this.templateHelpers = {};
|
||||
this.templateHelpers.qualities = this.qualities.toJSON();
|
||||
this.render();
|
||||
},
|
||||
|
||||
_onAfterSave : function() {
|
||||
this.trigger('saved');
|
||||
vent.trigger(vent.Commands.CloseModalCommand);
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
AsModelBoundView.call(view);
|
||||
AsValidatedView.call(view);
|
||||
AsEditModalView.call(view);
|
||||
|
||||
module.exports = view;
|
@ -0,0 +1,22 @@
|
||||
var vent = require('vent');
|
||||
var Backgrid = require('backgrid');
|
||||
|
||||
module.exports = Backgrid.Cell.extend({
|
||||
className : 'edit-episode-file-cell',
|
||||
|
||||
events : {
|
||||
'click' : '_onClick'
|
||||
},
|
||||
|
||||
render : function() {
|
||||
this.$el.empty();
|
||||
this.$el.html('<i class="icon-sonarr-edit" title="Edit information about this file."></i>');
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
_onClick : function() {
|
||||
var self = this;
|
||||
vent.trigger(vent.Commands.EditFileCommand, { file : this.model });
|
||||
}
|
||||
});
|
Loading…
Reference in new issue