<commit_before>// modal pattern.
//
// Author: <NAME>
// Contact: <EMAIL>
// Version: 1.0
// Depends: jquery.js patterns.js jquery.form.js
//
// Description:
//
// License:
//
// Copyright (C) 2010 Plone Foundation
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 of the License.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the Free Software Foundation, Inc., 51
// Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//


define([
  'jquery',
  'underscore',
  'mockup-patterns-base',
  'mockup-patterns-backdrop',
  'mockup-registry',
  'jquery.form'
], function($, _, Base, Backdrop, registry) {
  "use strict";

  var Modal = Base.extend({
    name: "modal",
    createModal: null,
    $model: null,
    defaults: {
      width: "",
      height: "",
      margin: function() { return 20; }, // can be int or function that returns an int -- int is a pixel value
      position: "center middle", // format: "<horizontal> <vertical>" -- allowed values: top, bottom, left, right, center, middle
      triggers: [],
      backdrop: "body", // Element to initiate the Backdrop on.
      backdropOptions: {
        zIndex: "1040",
        opacity: "0.8",
        klass: "backdrop",
        klassActive: "backdrop-active",
        closeOnEsc: true,
        closeOnClick: true
      },
      templateOptions: {
        title: null,
        titleSelector: 'h1:first',
        buttons: '.formControls > input[type="submit"]',
        automaticallyAddButtonActions: true,
        loadLinksWithinModal: true,
        content: '#content',
        klass: "modal",
        klassHeader: "modal-header",
        klassBody: "modal-body",
        klassFooter: "modal-footer",
        klassWrapper: "modal-wrapper",
        klassWrapperInner: "modal-wrapper-inner",
        klassLoading: "modal-loading",
        klassActive: "active",
        klassPrepend: "", // String, css class to be applied to the wrapper of the prepended content
        klassContent: '',  // String, class name to be applied to the content of the modal, useful for modal specific styling
        prependContent: '.portalMessage',
        template: '' +
          '<div class="<%= options.klass %>">' +
          '  <div class="<%= options.klassHeader %>">' +
          '    <a class="close">&times;</a>' +
          '    <% if (title) { %><h3><%= title %></h3><% } %>' +
          '  </div>' +
          '  <div class="<%= options.klassBody %>">' +
          '    <div class="<%= options.klassPrepend %>"><%= prepend %></div> ' +
          '    <div class="<%= options.klassContent %>"><%= content %></div>' +
          '  </div>' +
          '  <div class="options.klassFooter"> ' +
          '    <%= buttons %> ' +
          '  </div>' +
          '</div>',
        actions: {},
        actionsOptions: {
          eventType: 'click',
          target: null,
          ajaxUrl: null, // string, or function($el, options) that returns a string
          modalFunction: null, // String, function name on self to call
          isForm: false,
          timeout: 5000,
          displayInModal: true,
          reloadWindowOnClose: true,
          error: '.portalMessage.error',<commit_msg>fix borked modal footer class<commit_after>// modal pattern.
//
// Author: <NAME>
// Contact: <EMAIL>
// Version: 1.0
// Depends: jquery.js patterns.js jquery.form.js
//
// Description:
//
// License:
//
// Copyright (C) 2010 Plone Foundation
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 of the License.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the Free Software Foundation, Inc., 51
// Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//


define([
  'jquery',
  'underscore',
  'mockup-patterns-base',
  'mockup-patterns-backdrop',
  'mockup-registry',
  'jquery.form'
], function($, _, Base, Backdrop, registry) {
  "use strict";

  var Modal = Base.extend({
    name: "modal",
    createModal: null,
    $model: null,
    defaults: {
      width: "",
      height: "",
      margin: function() { return 20; }, // can be int or function that returns an int -- int is a pixel value
      position: "center middle", // format: "<horizontal> <vertical>" -- allowed values: top, bottom, left, right, center, middle
      triggers: [],
      backdrop: "body", // Element to initiate the Backdrop on.
      backdropOptions: {
        zIndex: "1040",
        opacity: "0.8",
        klass: "backdrop",
        klassActive: "backdrop-active",
        closeOnEsc: true,
        closeOnClick: true
      },
      templateOptions: {
        title: null,
        titleSelector: 'h1:first',
        buttons: '.formControls > input[type="submit"]',
        automaticallyAddButtonActions: true,
        loadLinksWithinModal: true,
        content: '#content',
        klass: "modal",
        klassHeader: "modal-header",
        klassBody: "modal-body",
        klassFooter: "modal-footer",
        klassWrapper: "modal-wrapper",
        klassWrapperInner: "modal-wrapper-inner",
        klassLoading: "modal-loading",
        klassActive: "active",
        klassPrepend: "", // String, css class to be applied to the wrapper of the prepended content
        klassContent: '',  // String, class name to be applied to the content of the modal, useful for modal specific styling
        prependContent: '.portalMessage',
        template: '' +
          '<div class="<%= options.klass %>">' +
          '  <div class="<%= options.klassHeader %>">' +
          '    <a class="close">&times;</a>' +
          '    <% if (title) { %><h3><%= title %></h3><% } %>' +
          '  </div>' +
          '  <div class="<%= options.klassBody %>">' +
          '    <div class="<%= options.klassPrepend %>"><%= prepend %></div> ' +
          '    <div class="<%= options.klassContent %>"><%= content %></div>' +
          '  </div>' +
          '  <div class="<%= options.klassFooter %>"> ' +
          '    <%= buttons %> ' +
          '  </div>' +
          '</div>',
        actions: {},
        actionsOptions: {
          eventType: 'click',
          target: null,
          ajaxUrl: null, // string, or function($el, options) that returns a string
          modalFunction: null, // String, function name on self to call
          isForm: false,
          timeout: 5000,
          displayInModal: true,
          reloadWindowOnClose: true,
          error: '.portalMessage.error',
{'fraction_non_alphanumeric': 0.14297509288564744, 'fraction_numerical': 0.009082152194853447, 'mean_word_length': 2.3385392742305924, 'pattern_counts': {'":': 0, '<': 66, '<?xml version=': 0, '>': 68, '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': '6233131', 'n_tokens_mistral': 2115, 'n_tokens_neox': 2057, 'n_words': 680}