Skip to content

Commit

Permalink
Merge pull request #98 from theravue/master
Browse files Browse the repository at this point in the history
Add titleClass and titleElement options
  • Loading branch information
tagliala authored Jun 7, 2024
2 parents d0028f9 + 584d68e commit 35552e0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/data-confirm-modal/engine.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module DataConfirmModal
class Engine < ::Rails::Engine
class Engine < ::Rails::Engine
end
end
2 changes: 1 addition & 1 deletion lib/data-confirm-modal/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module DataConfirmModal
VERSION = '1.6.3'
VERSION = '1.6.4'
end
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "data-confirm-modal",
"version": "1.6.2",
"version": "1.6.4",
"description": "Makes Rails' link_to confirm: 'foo' build a Bootstrap Modal instead of calling the browser's confirm() API.",
"main": "vendor/assets/javascripts/data-confirm-modal.js",
"repository": "https://github.com/ifad/data-confirm-modal.git",
Expand Down
8 changes: 7 additions & 1 deletion vendor/assets/javascripts/data-confirm-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

var defaults = {
title: 'Are you sure?',
titleClass: 'modal-title',
titleElement: 'h5',
commit: 'Confirm',
commitClass: 'btn-danger',
cancel: 'Cancel',
Expand Down Expand Up @@ -124,6 +126,8 @@
var buildElementModal = function (element) {
var options = {
title: element.data('title') || element.attr('title') || element.data('original-title'),
titleClass: element.data('title-class'),
titleElement: element.data('title-element'),
text: element.data('confirm'),
focus: element.data('focus'),
method: element.data('method'),
Expand Down Expand Up @@ -159,12 +163,14 @@
var buildModal = function (options) {
var id = 'confirm-modal-' + String(Math.random()).slice(2, -1);
var fade = settings.fade ? 'fade' : '';
var titleClass = options.titleClass ? options.titleClass : settings.titleClass;
var titleElement = options.titleElement ? options.titleElement : settings.titleElement;
var modalClass = options.modalClass ? options.modalClass : settings.modalClass;
var dialogClass = options.dialogClass ? options.dialogClass : settings.dialogClass;
var modalCloseContent = options.modalCloseContent ? options.modalCloseContent : settings.modalCloseContent;
var modalClose = '<button type="button" class="close" data-dismiss="modal" aria-hidden="true">'+modalCloseContent+'</button>'

var modalTitle = '<h5 id="'+id+'Label" class="modal-title"></h5> '
var modalTitle = '<'+titleElement+' id="'+id+'Label" class="'+titleClass+'"></'+titleElement+'> '
var modalHeader;

// Bootstrap 3 and 4 have different DOMs and different CSS. In B4, the
Expand Down

0 comments on commit 35552e0

Please sign in to comment.