import _ from 'underscore';
import {Configuration} from './Configuration';
import {EntryMetadataConfiguration} from './EntryMetadataConfiguration';

export const EntryMetadata = Configuration.extend({
  modelName: 'entry',
  i18nKey: 'pageflow/entry',

  defaults: {},

  initialize: function(attributes, options) {
    Configuration.prototype.initialize.apply(this, attributes, options);
    this.configuration =
      new EntryMetadataConfiguration(_.clone(attributes.configuration) || {});

    this.listenTo(this.configuration, 'change', function() {
      this.trigger('change');
      this.parent.save();
    });
  },

  // Pageflow Scrolled only synchronizes saved records to entry state.
  isNew() {
    return false;
  }
});

import _ from 'underscore';
import {Configuration} from './Configuration';
import {EntryMetadataConfiguration} from './EntryMetadataConfiguration';

export const EntryMetadata = Configuration.extend({
  modelName: 'entry',
  i18nKey: 'pageflow/entry',

  defaults: {},

  initialize: function(attributes, options) {
    Configuration.prototype.initialize.apply(this, attributes, options);
    this.configuration =
      new EntryMetadataConfiguration(_.clone(attributes.configuration) || {});

    this.listenTo(this.configuration, 'change', function(model, options) {
      this.trigger('change', model, options);
      this.parent.save();
    });
  },

  // Pageflow Scrolled only synchronizes saved records to entry state.
  isNew() {
    return false;
  }
});

Fix signature of metadata change event
Fix signature of metadata change event

All events are expected to pass model and options. This is required to
make it work with Scrolled's `watchCollection`.

REDMINE-19303
