{"size": 1418, "ext": "js", "max_stars_repo_path": "regulations/static/regulations/js/source/views/main/diff-view.js", "max_stars_repo_name": "navigo/regulations-site", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "regulations/static/regulations/js/source/views/main/diff-view.js", "max_issues_repo_name": "navigo/regulations-site", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "regulations/static/regulations/js/source/views/main/diff-view.js", "max_forks_repo_name": "navigo/regulations-site", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 34.5853658537, "max_line_length": 87, "alphanum_fraction": 0.6805359661}
import storage from '../../redux/storage';
import { paneActiveEvt } from '../../redux/paneReduce';

const $ = require('jquery');
const _ = require('underscore');
const Backbone = require('backbone');
const Helpers = require('../../helpers');
const Resources = require('../../resources');
const ChildView = require('./child-view');

Backbone.$ = $;

const DiffView = ChildView.extend({
  initialize: function initialize(options, ...args) {
    this.options = options;
    this.id = this.options.id;
    this.baseVersion = this.options.baseVersion;
    this.newerVersion = this.options.newerVersion || Helpers.findDiffVersion(
      Resources.versionElements, this.baseVersion);
    this.fromVersion = this.options.fromVersion || this.newerVersion;
        // we preserve the section id as is in config obj because
    this.options.sectionId = this.id;

    this.url = `diff/${this.model.assembleDiffURL(this.options)}`;
    ChildView.prototype.initialize.apply(this, [options].concat(args));

    if (typeof this.options.render === 'undefined') {
      storage().dispatch(paneActiveEvt('timeline'));
    }
  },

  // "12 CFR Comparison of §1005.1 | Redline"
  assembleTitle: function assembleTitle() {
    const titleParts = _.compact(document.title.split(' '));
    const newTitle = [titleParts[0], titleParts[1], this.sectionLabel, '|', 'Redline'];
    return newTitle.join(' ');
  },
});

module.exports = DiffView;
