<commit_before>CocoView = require './CocoView'

module.exports = class ModalView extends CocoView
  className: 'modal fade'
  closeButton: true
  closesOnClickOutside: true
  modalWidthPercent: null
  plain: false
  instant: false
  template: require 'templates/core/modal-base'

  events:
    'click a': 'toggleModal'
    'click button': 'toggleModal'
    'click li': 'toggleModal'

  shortcuts:
    'esc': 'hide'

  constructor: (options) ->
    options ?= {}
    @className = @className.replace ' fade', '' if options.instant or @instant
    @closeButton = options.closeButton if options.closeButton?
    @modalWidthPercent = options.modalWidthPercent if options.modalWidthPercent
    super arguments...

  getRenderData: (context={}) ->
    context = super(context)
    context.closeButton = @closeButton
    context.headerContent = @options.headerContent
    context.bodyContent = @options.bodyContent
    context

  subscriptions:
    {}

  afterRender: ->
    super()
    if Backbone.history.fragment is "employers"
      $(@$el).find(".background-wrapper").each ->
        $(this).addClass("employer-modal-background-wrapper").removeClass("background-wrapper")

    if @modalWidthPercent
      @$el.find('.modal-dialog').css width: "#{@modalWidthPercent}%"
    @$el.on 'hide.bs.modal', =><commit_msg>Fix #3106 introduced by b38a6c50<commit_after>CocoView = require './CocoView'

module.exports = class ModalView extends CocoView
  className: 'modal fade'
  closeButton: true
  closesOnClickOutside: true
  modalWidthPercent: null
  plain: false
  instant: false
  template: require 'templates/core/modal-base'

  events:
    'click a': 'toggleModal'
    'click button': 'toggleModal'
    'click li': 'toggleModal'

  shortcuts:
    'esc': 'hide'

  constructor: (options) ->
    @className = @className.replace ' fade', '' if options?.instant or @instant
    @closeButton = options.closeButton if options?.closeButton?
    @modalWidthPercent = options.modalWidthPercent if options?.modalWidthPercent
    super arguments...
    @options ?= {}

  getRenderData: (context={}) ->
    context = super(context)
    context.closeButton = @closeButton
    context.headerContent = @options.headerContent
    context.bodyContent = @options.bodyContent
    context

  subscriptions:
    {}

  afterRender: ->
    super()
    if Backbone.history.fragment is "employers"
      $(@$el).find(".background-wrapper").each ->
        $(this).addClass("employer-modal-background-wrapper").removeClass("background-wrapper")

    if @modalWidthPercent
      @$el.find('.modal-dialog').css width: "#{@modalWidthPercent}%"
    @$el.on 'hide.bs.modal', =>
{'fraction_non_alphanumeric': 0.1330049261083744, 'fraction_numerical': 0.0034103827207275484, 'mean_word_length': 3.7567567567567566, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7296447', 'n_tokens_mistral': 797, 'n_tokens_neox': 766, 'n_words': 172}