rjs -> webpack

This commit is contained in:
Keivan Beigi
2015-02-02 17:18:45 -08:00
parent 344f3d66ef
commit 428a1439e5
399 changed files with 11591 additions and 16139 deletions
+64 -85
View File
@@ -1,87 +1,66 @@
'use strict';
define(
[
'vent',
'AppLayout',
'marionette',
'Series/Edit/EditSeriesView',
'Series/Delete/DeleteSeriesView',
'Episode/EpisodeDetailsLayout',
'Activity/History/Details/HistoryDetailsLayout',
'System/Logs/Table/Details/LogDetailsView',
'Rename/RenamePreviewLayout',
'Shared/FileBrowser/FileBrowserLayout'
], function (vent,
AppLayout,
Marionette,
EditSeriesView,
DeleteSeriesView,
EpisodeDetailsLayout,
HistoryDetailsLayout,
LogDetailsView,
RenamePreviewLayout,
FileBrowserLayout) {
var vent = require('../../vent');
var AppLayout = require('../../AppLayout');
var Marionette = require('marionette');
var EditSeriesView = require('../../Series/Edit/EditSeriesView');
var DeleteSeriesView = require('../../Series/Delete/DeleteSeriesView');
var EpisodeDetailsLayout = require('../../Episode/EpisodeDetailsLayout');
var HistoryDetailsLayout = require('../../Activity/History/Details/HistoryDetailsLayout');
var LogDetailsView = require('../../System/Logs/Table/Details/LogDetailsView');
var RenamePreviewLayout = require('../../Rename/RenamePreviewLayout');
var FileBrowserLayout = require('../FileBrowser/FileBrowserLayout');
return Marionette.AppRouter.extend({
initialize: function () {
vent.on(vent.Commands.OpenModalCommand, this._openModal, this);
vent.on(vent.Commands.CloseModalCommand, this._closeModal, this);
vent.on(vent.Commands.EditSeriesCommand, this._editSeries, this);
vent.on(vent.Commands.DeleteSeriesCommand, this._deleteSeries, this);
vent.on(vent.Commands.ShowEpisodeDetails, this._showEpisode, this);
vent.on(vent.Commands.ShowHistoryDetails, this._showHistory, this);
vent.on(vent.Commands.ShowLogDetails, this._showLogDetails, this);
vent.on(vent.Commands.ShowRenamePreview, this._showRenamePreview, this);
vent.on(vent.Commands.ShowFileBrowser, this._showFileBrowser, this);
vent.on(vent.Commands.CloseFileBrowser, this._closeFileBrowser, this);
},
_openModal: function (view) {
AppLayout.modalRegion.show(view);
},
_closeModal: function () {
AppLayout.modalRegion.closeModal();
},
_editSeries: function (options) {
var view = new EditSeriesView({ model: options.series });
AppLayout.modalRegion.show(view);
},
_deleteSeries: function (options) {
var view = new DeleteSeriesView({ model: options.series });
AppLayout.modalRegion.show(view);
},
_showEpisode: function (options) {
var view = new EpisodeDetailsLayout({ model: options.episode, hideSeriesLink: options.hideSeriesLink, openingTab: options.openingTab });
AppLayout.modalRegion.show(view);
},
_showHistory: function (options) {
var view = new HistoryDetailsLayout({ model: options.model });
AppLayout.modalRegion.show(view);
},
_showLogDetails: function (options) {
var view = new LogDetailsView({ model: options.model });
AppLayout.modalRegion.show(view);
},
_showRenamePreview: function (options) {
var view = new RenamePreviewLayout(options);
AppLayout.modalRegion.show(view);
},
_showFileBrowser: function (options) {
var view = new FileBrowserLayout(options);
AppLayout.fileBrowserModalRegion.show(view);
},
_closeFileBrowser: function () {
AppLayout.fileBrowserModalRegion.closeModal();
}
module.exports = Marionette.AppRouter.extend({
initialize : function(){
vent.on(vent.Commands.OpenModalCommand, this._openModal, this);
vent.on(vent.Commands.CloseModalCommand, this._closeModal, this);
vent.on(vent.Commands.EditSeriesCommand, this._editSeries, this);
vent.on(vent.Commands.DeleteSeriesCommand, this._deleteSeries, this);
vent.on(vent.Commands.ShowEpisodeDetails, this._showEpisode, this);
vent.on(vent.Commands.ShowHistoryDetails, this._showHistory, this);
vent.on(vent.Commands.ShowLogDetails, this._showLogDetails, this);
vent.on(vent.Commands.ShowRenamePreview, this._showRenamePreview, this);
vent.on(vent.Commands.ShowFileBrowser, this._showFileBrowser, this);
vent.on(vent.Commands.CloseFileBrowser, this._closeFileBrowser, this);
},
_openModal : function(view){
AppLayout.modalRegion.show(view);
},
_closeModal : function(){
AppLayout.modalRegion.closeModal();
},
_editSeries : function(options){
var view = new EditSeriesView({model : options.series});
AppLayout.modalRegion.show(view);
},
_deleteSeries : function(options){
var view = new DeleteSeriesView({model : options.series});
AppLayout.modalRegion.show(view);
},
_showEpisode : function(options){
var view = new EpisodeDetailsLayout({
model : options.episode,
hideSeriesLink : options.hideSeriesLink,
openingTab : options.openingTab
});
});
AppLayout.modalRegion.show(view);
},
_showHistory : function(options){
var view = new HistoryDetailsLayout({model : options.model});
AppLayout.modalRegion.show(view);
},
_showLogDetails : function(options){
var view = new LogDetailsView({model : options.model});
AppLayout.modalRegion.show(view);
},
_showRenamePreview : function(options){
var view = new RenamePreviewLayout(options);
AppLayout.modalRegion.show(view);
},
_showFileBrowser : function(options){
var view = new FileBrowserLayout(options);
AppLayout.fileBrowserModalRegion.show(view);
},
_closeFileBrowser : function(){
AppLayout.fileBrowserModalRegion.closeModal();
}
});
+38 -53
View File
@@ -1,56 +1,41 @@
'use strict';
define(
[
'jquery',
'backbone',
'marionette',
'bootstrap'
], function ($, Backbone, Marionette) {
var region = Marionette.Region.extend({
el: '#modal-region',
var $ = require('jquery');
var Backbone = require('backbone');
var Marionette = require('marionette');
require('bootstrap');
constructor: function () {
Backbone.Marionette.Region.prototype.constructor.apply(this, arguments);
this.on('show', this.showModal, this);
},
getEl: function (selector) {
var $el = $(selector);
$el.on('hidden', this.close);
return $el;
},
showModal: function () {
this.$el.addClass('modal fade');
//need tab index so close on escape works
//https://github.com/twitter/bootstrap/issues/4663
this.$el.attr('tabindex', '-1');
this.$el.modal({
show : true,
keyboard : true,
backdrop : true
});
this.$el.on('hide.bs.modal', $.proxy(this._closing, this));
this.currentView.$el.addClass('modal-dialog');
},
closeModal: function () {
$(this.el).modal('hide');
this.reset();
},
_closing: function () {
if (this.$el) {
this.$el.off('hide.bs.modal');
}
this.reset();
module.exports = (function(){
var region = Marionette.Region.extend({
el : '#modal-region',
constructor : function(){
Backbone.Marionette.Region.prototype.constructor.apply(this, arguments);
this.on('show', this.showModal, this);
},
getEl : function(selector){
var $el = $(selector);
$el.on('hidden', this.close);
return $el;
},
showModal : function(){
this.$el.addClass('modal fade');
this.$el.attr('tabindex', '-1');
this.$el.modal({
show : true,
keyboard : true,
backdrop : true
});
this.$el.on('hide.bs.modal', $.proxy(this._closing, this));
this.currentView.$el.addClass('modal-dialog');
},
closeModal : function(){
$(this.el).modal('hide');
this.reset();
},
_closing : function(){
if(this.$el) {
this.$el.off('hide.bs.modal');
}
});
return region;
this.reset();
}
});
return region;
}).call(this);