Skip to content

Commit

Permalink
Revert "upgrade jquery ckeditor and bootstrap versions (#2720)"
Browse files Browse the repository at this point in the history
This reverts commit 522b688.
  • Loading branch information
sri49 committed Jul 11, 2024
1 parent ebd0d51 commit 6dfe5b1
Show file tree
Hide file tree
Showing 19 changed files with 137 additions and 10,579 deletions.
5 changes: 3 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ PATH
notifier (0.0.1)
aasm (~> 4.8.0)
acapi
ckeditor (= 5.0.0)
ckeditor (= 4.2.4)
combine_pdf
config
curl
Expand Down Expand Up @@ -342,7 +342,8 @@ GEM
coffee-rails (>= 3.2)
railties (>= 3.0)
sassc-rails (>= 2.1.2)
ckeditor (5.0.0)
ckeditor (4.2.4)
cocaine
orm_adapter (~> 0.5.0)
climate_control (0.2.0)
cocaine (0.6.0)
Expand Down
4 changes: 2 additions & 2 deletions app/assets/javascripts/application.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery2
//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require bootstrap.bundle.min
//= require bootstrap.min
//= require bootstrap-multiselect
//= require jquery.selectric.min
//= require turbolinks
Expand Down
308 changes: 102 additions & 206 deletions app/assets/javascripts/button.js
Original file line number Diff line number Diff line change
@@ -1,229 +1,125 @@
/*!
* Bootstrap button.js v4.6.2 (https://getbootstrap.com/)
* Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery')) :
typeof define === 'function' && define.amd ? define(['jquery'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Button = factory(global.jQuery));
})(this, (function ($) { 'use strict';

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var $__default = /*#__PURE__*/_interopDefaultLegacy($);

function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
/* ========================================================================
* Bootstrap: button.js v3.4.1
* https://getbootstrap.com/docs/3.4/javascript/#buttons
* ========================================================================
* Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */

function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}

/**
* Constants
*/

var NAME = 'button';
var VERSION = '4.6.2';
var DATA_KEY = 'bs.button';
var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = $__default["default"].fn[NAME];
var CLASS_NAME_ACTIVE = 'active';
var CLASS_NAME_BUTTON = 'btn';
var CLASS_NAME_FOCUS = 'focus';
var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY;
var EVENT_FOCUS_BLUR_DATA_API = "focus" + EVENT_KEY + DATA_API_KEY + " " + ("blur" + EVENT_KEY + DATA_API_KEY);
var EVENT_LOAD_DATA_API = "load" + EVENT_KEY + DATA_API_KEY;
var SELECTOR_DATA_TOGGLE_CARROT = '[data-toggle^="button"]';
var SELECTOR_DATA_TOGGLES = '[data-toggle="buttons"]';
var SELECTOR_DATA_TOGGLE = '[data-toggle="button"]';
var SELECTOR_DATA_TOGGLES_BUTTONS = '[data-toggle="buttons"] .btn';
var SELECTOR_INPUT = 'input:not([type="hidden"])';
var SELECTOR_ACTIVE = '.active';
var SELECTOR_BUTTON = '.btn';
/**
* Class definition
*/

var Button = /*#__PURE__*/function () {
function Button(element) {
this._element = element;
this.shouldAvoidTriggerChange = false;
} // Getters


var _proto = Button.prototype;

// Public
_proto.toggle = function toggle() {
var triggerChangeEvent = true;
var addAriaPressed = true;
var rootElement = $__default["default"](this._element).closest(SELECTOR_DATA_TOGGLES)[0];

if (rootElement) {
var input = this._element.querySelector(SELECTOR_INPUT);

if (input) {
if (input.type === 'radio') {
if (input.checked && this._element.classList.contains(CLASS_NAME_ACTIVE)) {
triggerChangeEvent = false;
} else {
var activeElement = rootElement.querySelector(SELECTOR_ACTIVE);

if (activeElement) {
$__default["default"](activeElement).removeClass(CLASS_NAME_ACTIVE);
}
}
}

if (triggerChangeEvent) {
// if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
if (input.type === 'checkbox' || input.type === 'radio') {
input.checked = !this._element.classList.contains(CLASS_NAME_ACTIVE);
}

if (!this.shouldAvoidTriggerChange) {
$__default["default"](input).trigger('change');
}
}

input.focus();
addAriaPressed = false;
}
}
+function ($) {
'use strict';

if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
if (addAriaPressed) {
this._element.setAttribute('aria-pressed', !this._element.classList.contains(CLASS_NAME_ACTIVE));
}
// BUTTON PUBLIC CLASS DEFINITION
// ==============================

if (triggerChangeEvent) {
$__default["default"](this._element).toggleClass(CLASS_NAME_ACTIVE);
}
}
};

_proto.dispose = function dispose() {
$__default["default"].removeData(this._element, DATA_KEY);
this._element = null;
} // Static
;

Button._jQueryInterface = function _jQueryInterface(config, avoidTriggerChange) {
return this.each(function () {
var $element = $__default["default"](this);
var data = $element.data(DATA_KEY);

if (!data) {
data = new Button(this);
$element.data(DATA_KEY, data);
}

data.shouldAvoidTriggerChange = avoidTriggerChange;

if (config === 'toggle') {
data[config]();
}
});
};

_createClass(Button, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}]);
var Button = function (element, options) {
this.$element = $(element)
this.options = $.extend({}, Button.DEFAULTS, options)
this.isLoading = false
}

return Button;
}();
/**
* Data API implementation
*/
Button.VERSION = '3.4.1'

Button.DEFAULTS = {
loadingText: 'loading...'
}

$__default["default"](document).on(EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) {
var button = event.target;
var initialButton = button;
Button.prototype.setState = function (state) {
var d = 'disabled'
var $el = this.$element
var val = $el.is('input') ? 'val' : 'html'
var data = $el.data()

if (!$__default["default"](button).hasClass(CLASS_NAME_BUTTON)) {
button = $__default["default"](button).closest(SELECTOR_BUTTON)[0];
}
state += 'Text'

if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
event.preventDefault(); // work around Firefox bug #1540995
} else {
var inputBtn = button.querySelector(SELECTOR_INPUT);
if (data.resetText == null) $el.data('resetText', $el[val]())

if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
event.preventDefault(); // work around Firefox bug #1540995
// push to event loop to allow forms to submit
setTimeout($.proxy(function () {
$el[val](data[state] == null ? this.options[state] : data[state])

return;
if (state == 'loadingText') {
this.isLoading = true
$el.addClass(d).attr(d, d).prop(d, true)
} else if (this.isLoading) {
this.isLoading = false
$el.removeClass(d).removeAttr(d).prop(d, false)
}
}, this), 0)
}

if (initialButton.tagName === 'INPUT' || button.tagName !== 'LABEL') {
Button._jQueryInterface.call($__default["default"](button), 'toggle', initialButton.tagName === 'INPUT');
Button.prototype.toggle = function () {
var changed = true
var $parent = this.$element.closest('[data-toggle="buttons"]')

if ($parent.length) {
var $input = this.$element.find('input')
if ($input.prop('type') == 'radio') {
if ($input.prop('checked')) changed = false
$parent.find('.active').removeClass('active')
this.$element.addClass('active')
} else if ($input.prop('type') == 'checkbox') {
if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false
this.$element.toggleClass('active')
}
$input.prop('checked', this.$element.hasClass('active'))
if (changed) $input.trigger('change')
} else {
this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
this.$element.toggleClass('active')
}
}).on(EVENT_FOCUS_BLUR_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) {
var button = $__default["default"](event.target).closest(SELECTOR_BUTTON)[0];
$__default["default"](button).toggleClass(CLASS_NAME_FOCUS, /^focus(in)?$/.test(event.type));
});
$__default["default"](window).on(EVENT_LOAD_DATA_API, function () {
// ensure correct active class is set to match the controls' actual values/states
// find all checkboxes/readio buttons inside data-toggle groups
var buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLES_BUTTONS));

for (var i = 0, len = buttons.length; i < len; i++) {
var button = buttons[i];
var input = button.querySelector(SELECTOR_INPUT);

if (input.checked || input.hasAttribute('checked')) {
button.classList.add(CLASS_NAME_ACTIVE);
} else {
button.classList.remove(CLASS_NAME_ACTIVE);
}
} // find all button toggles
}


buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE));
// BUTTON PLUGIN DEFINITION
// ========================

for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
var _button = buttons[_i];
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.button')
var options = typeof option == 'object' && option

if (_button.getAttribute('aria-pressed') === 'true') {
_button.classList.add(CLASS_NAME_ACTIVE);
} else {
_button.classList.remove(CLASS_NAME_ACTIVE);
}
}
});
/**
* jQuery
*/
if (!data) $this.data('bs.button', (data = new Button(this, options)))

if (option == 'toggle') data.toggle()
else if (option) data.setState(option)
})
}

var old = $.fn.button

$__default["default"].fn[NAME] = Button._jQueryInterface;
$__default["default"].fn[NAME].Constructor = Button;
$.fn.button = Plugin
$.fn.button.Constructor = Button

$__default["default"].fn[NAME].noConflict = function () {
$__default["default"].fn[NAME] = JQUERY_NO_CONFLICT;
return Button._jQueryInterface;
};

return Button;
// BUTTON NO CONFLICT
// ==================

$.fn.button.noConflict = function () {
$.fn.button = old
return this
}


// BUTTON DATA-API
// ===============

$(document)
.on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
var $btn = $(e.target).closest('.btn')
Plugin.call($btn, 'toggle')
if (!($(e.target).is('input[type="radio"], input[type="checkbox"]'))) {
// Prevent double click on radios, and the double selections (so cancellation) on checkboxes
e.preventDefault()
// The target component still receive the focus
if ($btn.is('input,button')) $btn.trigger('focus')
else $btn.find('input:visible,button:visible').first().trigger('focus')
}
})
.on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
$(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
})

}));
//# sourceMappingURL=button.js.map
}(jQuery);
4 changes: 2 additions & 2 deletions app/assets/javascripts/ui-components/components.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//= require jquery2
//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require bootstrap.bundle.min
//= require bootstrap.min
//= require bootstrap-treeview
//= require jquery.selectric.min
//= require bowser.min
Expand Down
13 changes: 0 additions & 13 deletions app/assets/stylesheets/bootstrap_overrides.scss.erb
Original file line number Diff line number Diff line change
Expand Up @@ -457,16 +457,3 @@ strong {
}
}
}

// Upgrading Bootstrap 3 to 4 breaks modals with top level fade class
.modal.fade {
transition: opacity 0.15s linear;
}

.modal.fade.show {
opacity: 1;
}

.modal.fade:not(.show) {
opacity: 0;
}
Loading

0 comments on commit 6dfe5b1

Please sign in to comment.