lib/js/ComponentSettingsView.js
function(model, componentView, customView) {
      var t = this,
          componentPane = t.$('.nm-cs-component');

      // Remember the model state on entry
      t.model = model;
      t.componentView = componentView;
      t.monitor = model.get('monitor');
      t.originalModel = t.model.toJSON({trim:false});

      // Remove any inner views
      if (t.sourceView) {
        t.sourceView.remove();
      }
      if (t.customView) {
        t.customView.remove();
      }

      // Clean up prior monitorParams
      if (t.monitorParams) {
        t.monitorParams.off('change');
      }

      // Create the custom settings view
      if (customView) {
        t.customView = new customView({
          model: t.model.get('viewOptions'),
          monitor: t.model.get('monitor'),
          pageView: UI.pageView,
          component: t.model,
          componentView: componentView
        });
        t.$('.nm-cs-view-settings').append(t.customView.el);
        t.customView.render();

        // Attach tooltips to anything with a title
        UI.tooltip(t.$('*[title]'));
      }

      // Normal data binding - name to model
      t.modelBinder.bind(t.model, t.$el, t.componentBindings);

      // Bind data-view-option elements to component.viewOptions
      t.viewOptionBinder.bind(
        t.model.get('viewOptions'),
        componentPane,
        Backbone.ModelBinder.createDefaultBindings(componentPane, 'data-view-option')
      );

      // Bind data-monitor-param elements to monitor.initParams.
      // This is a bit more difficult because initParams isnt a Backbone model.
      // Copy into a Backbone model, and bind to that.
      t.monitorParams = new Backbone.Model(t.monitor.get('initParams'));
      t.monitorParamBinder.bind(
        t.monitorParams,
        componentPane,
        Backbone.ModelBinder.createDefaultBindings(componentPane, 'data-monitor-param')
      );
      t.monitorParams.on('change', function() {
        t.monitor.set('initParams', t.monitorParams.toJSON());
      });

      // Instantiate the source view
      t.sourceView = new UI.JsonView({
        model: t.model.toJSON({trim:false})
      });
      t.sourceView.render();
      t.$('.nm-cs-source-view').append(t.sourceView.$el);
    }
function(model, componentView, customView) {
      var t = this,
          componentPane = t.$('.nm-cs-component');

      // Remember the model state on entry
      t.model = model;
      t.componentView = componentView;
      t.monitor = model.get('monitor');
      t.originalModel = t.model.toJSON({trim:false});

      // Remove any inner views
      if (t.sourceView) {
        t.sourceView.remove();
      }
      if (t.customView) {
        t.customView.remove();
      }

      // Clean up prior monitorParams
      if (t.monitorParams) {
        t.monitorParams.off('change');
      }

      // Create the custom settings view
      if (customView) {
        t.customView = new customView({
          model: t.model.get('viewOptions'),
          monitor: t.model.get('monitor'),
          pageView: UI.pageView,
          component: t.model,
          componentView: componentView
        });
        t.$('.nm-cs-view-settings').append(t.customView.el);
        t.customView.render();

        // Attach tooltips to anything with a title
        UI.tooltip(t.$('*[title]'));
      }

      // Normal data binding - name to model
      t.modelBinder.bind(t.model, t.$el, t.componentBindings);

      // Bind data-view-option elements to component.viewOptions
      t.viewOptionBinder.bind(
        t.model.get('viewOptions'),
        componentPane,
        Backbone.ModelBinder.createDefaultBindings(componentPane, 'data-view-option')
      );

      // Bind data-monitor-param elements to monitor.initParams.
      // This is a bit more difficult because initParams isnt a Backbone model.
      // Copy into a Backbone model, and bind to that.
      t.monitorParams = new Backbone.Model(t.monitor.get('initParams'));
      t.monitorParamBinder.bind(
        t.monitorParams,
        componentPane,
        Backbone.ModelBinder.createDefaultBindings(componentPane, 'data-monitor-param')
      );
      t.monitorParams.on('change', function() {
        t.monitor.set('initParams', t.monitorParams.toJSON());
      });

      // Instantiate the source view
      t.sourceView = new UI.JsonView({
        model: t.model.toJSON({trim:false})
      });
      t.sourceView.render();
      t.$('.nm-cs-source-view').append(t.sourceView.$el);
    }
function ( model , componentView , customView ) { var t = this , componentPane = t . $ ( '.nm-cs-component' ) ; // Remember the model state on entry t . model = model ; t . componentView = componentView ; t . monitor = model . get ( 'monitor' ) ; t . originalModel = t . model . toJSON ( { trim : false } ) ; // Remove any inner views if ( t . sourceView ) { t . sourceView . remove ( ) ; } if ( t . customView ) { t . customView . remove ( ) ; } // Clean up prior monitorParams if ( t . monitorParams ) { t . monitorParams . off ( 'change' ) ; } // Create the custom settings view if ( customView ) { t . customView = new customView ( { model : t . model . get ( 'viewOptions' ) , monitor : t . model . get ( 'monitor' ) , pageView : UI . pageView , component : t . model , componentView : componentView } ) ; t . $ ( '.nm-cs-view-settings' ) . append ( t . customView . el ) ; t . customView . render ( ) ; // Attach tooltips to anything with a title UI . tooltip ( t . $ ( '*[title]' ) ) ; } // Normal data binding - name to model t . modelBinder . bind ( t . model , t . $el , t . componentBindings ) ; // Bind data-view-option elements to component.viewOptions t . viewOptionBinder . bind ( t . model . get ( 'viewOptions' ) , componentPane , Backbone . ModelBinder . createDefaultBindings ( componentPane , 'data-view-option' ) ) ; // Bind data-monitor-param elements to monitor.initParams. // This is a bit more difficult because initParams isnt a Backbone model. // Copy into a Backbone model, and bind to that. t . monitorParams = new Backbone . Model ( t . monitor . get ( 'initParams' ) ) ; t . monitorParamBinder . bind ( t . monitorParams , componentPane , Backbone . ModelBinder . createDefaultBindings ( componentPane , 'data-monitor-param' ) ) ; t . monitorParams . on ( 'change' , function ( ) { t . monitor . set ( 'initParams' , t . monitorParams . toJSON ( ) ) ; } ) ; // Instantiate the source view t . sourceView = new UI . JsonView ( { model : t . model . toJSON ( { trim : false } ) } ) ; t . sourceView . render ( ) ; t . $ ( '.nm-cs-source-view' ) . append ( t . sourceView . $el ) ; }
Set the specified data model into the component, specifying any custom component settings view
Set the specified data model into the component specifying any custom component settings view