Remove unused class variables, reduce indention

This commit is contained in:
guerler
2016-05-25 11:37:46 -04:00
parent 44bd042624
commit e16c3f34f3
5 changed files with 35 additions and 38 deletions
+16 -19
View File
@@ -3,33 +3,30 @@ define([], function() {
/** Frame view */
var FrameView = Backbone.View.extend({
initialize: function( options ) {
var self = this;
this.setElement( $( '<div/>' ).addClass( 'corner' ).addClass( 'frame' ) );
this.$el.append( this.$header = $( '<div/>' ).addClass( 'f-header corner' )
.append( this.$title = $( '<div/>' ).addClass( 'f-title' ).html( options.title || '' ) )
.append( this.$close = $( '<div/>' ).addClass( 'f-icon f-close fa fa-close' )
.tooltip( { title: 'Close', placement: 'bottom' } ) ) )
.append( this.$content = $( '<div/>' ).addClass( 'f-content' ) )
.append( this.$resize = $( '<div/>' ).addClass( 'f-resize f-icon corner fa fa-expand' ).tooltip( { title: 'Resize' } ) )
.append( this.$cover = $( '<div/>' ).addClass( 'f-cover' ) );
// configure content
this.setElement( $( '<div/>' ).addClass( 'corner frame' ) );
this.$el.append( $( '<div/>' ).addClass( 'f-header corner' )
.append( $( '<div/>' ).addClass( 'f-title' ).html( options.title || '' ) )
.append( $( '<div/>' ).addClass( 'f-icon f-close fa fa-close' )
.tooltip( { title: 'Close', placement: 'bottom' } ) ) )
.append( $( '<div/>' ).addClass( 'f-content' ) )
.append( $( '<div/>' ).addClass( 'f-resize f-icon corner fa fa-expand' ).tooltip( { title: 'Resize' } ) )
.append( $( '<div/>' ).addClass( 'f-cover' ) );
var $header = this.$( '.f-header' );
var $content = this.$( '.f-content' );
_.each( options.menu, function( option ) {
self.$header.append( $( '<div/>' ).addClass( 'f-icon-left' )
.addClass( option.icon )
.tooltip( { title: option.tooltip, placement: 'bottom' } )
.on( 'click', function() { option.onclick( self.$content ) } ) );
$header.append( $( '<div/>' ).addClass( 'f-icon-left' )
.addClass( option.icon )
.tooltip( { title: option.tooltip, placement: 'bottom' } )
.on( 'click', function() { option.onclick( $content ) } ) );
} );
// configure content
if ( options.url ) {
this.$content.append(
$content.html(
$ ( '<iframe/>' ).addClass( 'f-iframe' )
.attr( 'scrolling', 'auto' )
.attr( 'src', options.url + ( options.url.indexOf( '?' ) === -1 ? '?' : '&' ) + 'widget=True' )
);
} else if ( options.content ) {
_.isFunction( options.content ) ? options.content( this.$content ) : this.$content.append( options.content );
_.isFunction( options.content ) ? options.content( $content ) : $content.html( options.content );
}
}
});
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long