data-confirm-modal 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 036d8ef59a741d41fdde8be51c5133108deda949
4
- data.tar.gz: 78e832d68393925aeff5e1643159dc338b76c615
3
+ metadata.gz: 01626f3b1958f535db12bc855bac6c8bfb17c8ed
4
+ data.tar.gz: 67185163ac5ce03831ff7d143a53ebd54dce0139
5
5
  SHA512:
6
- metadata.gz: 252e3c3a9d9fd2eb9c5a450ae7d3cc100f3ddb6a50778e1a75a45583a48dba3eebf29c49c4781fdd0db1a4983e3e6fb095569a4b14d73e8a28743b846ef41442
7
- data.tar.gz: 27e3cddc2965780e9a74a216b6510e75008f14c42e60407a2d799e45f2dc6025a6a92ece54fb0a5cad70c6bc7d6620cafda18faf996c1d3b3f39089b37a6f871
6
+ metadata.gz: 68bfc13ceaacf7f9ec69edaef593570ab2b09ab8316d65ea3361956f02833b1558b86d3610b65f1f0eb4aae7ea06b418768df215deca7a7603004840fd352bc9
7
+ data.tar.gz: d32978a5a9a3e9f5d2cf4b79a83998de38ee3d5a7a9a12ce1fdd6395b117f2af84d08f08e3f78047fcf9ee7df3b1f8bac7ad1e484b47e77f9ee36854a0fae984
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Data-Confirm Modal
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/data-confirm-modal.svg)](https://badge.fury.io/rb/data-confirm-modal)
4
+
3
5
  Uses [Bootstrap's modals](http://twitter.github.io/bootstrap/javascript.html#modals)
4
6
  in place of the browser's builtin `confirm()` API for links generated through Rails'
5
7
  helpers with the `:confirm` option.
@@ -14,7 +16,7 @@ certain value, for extra willingness confirmation (inspired by GitHub's
14
16
 
15
17
  Add this line to your application's Gemfile:
16
18
 
17
- gem 'data-confirm-modal', github: 'ifad/data-confirm-modal'
19
+ gem 'data-confirm-modal'
18
20
 
19
21
  if you are stuck on Bootstrap 2.3, use the `bootstrap2` branch:
20
22
 
@@ -36,13 +38,12 @@ By default, the Gem's Javascript overrides Rails' [data-confirm behaviour][]
36
38
  for you, with no change required to your code. The modal is applicable to
37
39
  `<a>`, `<button>` and `<input[submit]>` elements by default.
38
40
 
39
- Example:
40
-
41
41
  <%= link_to 'Delete', data: {confirm: 'Are you sure?'} %>
42
42
 
43
- The modal's title will be get from the link's `title` attribute value. The
44
- modal text will be taken from the `data-confirm` value. Multiple paragraphs
45
- are created automatically from two newlines (`\n\n`).
43
+ The modal's title text can be customized using the `data-title` attribute.
44
+ If `data-title` is not defined it falls back to the `title` attribute.
45
+
46
+ <%= link_to 'Delete', data: {title: 'Are You Sure?'} %>
46
47
 
47
48
  The modal's 'confirm' button text can be customized using the `data-commit`
48
49
  attribute.
@@ -1,3 +1,3 @@
1
1
  module DataConfirmModal
2
- VERSION = '1.2.0'
2
+ VERSION = '1.3.0'
3
3
  end
@@ -91,10 +91,11 @@
91
91
 
92
92
  var buildElementModal = function (element) {
93
93
  var options = {
94
- title: element.attr('title') || element.data('original-title'),
94
+ title: element.data('title') || element.attr('title') || element.data('original-title'),
95
95
  text: element.data('confirm'),
96
96
  focus: element.data('focus'),
97
97
  method: element.data('method'),
98
+ modalClass: element.data('modal-class'),
98
99
  commit: element.data('commit'),
99
100
  commitClass: element.data('commit-class'),
100
101
  cancel: element.data('cancel'),
@@ -124,10 +125,10 @@
124
125
  var buildModal = function (options) {
125
126
  var id = 'confirm-modal-' + String(Math.random()).slice(2, -1);
126
127
  var fade = settings.fade ? 'fade' : '';
127
- var modalClass = settings.modalClass ? settings.modalClass : '';
128
+ var modalClass = options.modalClass ? options.modalClass : settings.modalClass;
128
129
 
129
130
  var modal = $(
130
- '<div id="'+id+'" class="modal '+fade+' '+modalClass+'" tabindex="-1" role="dialog" aria-labelledby="'+id+'Label" aria-hidden="true">' +
131
+ '<div id="'+id+'" class="modal '+modalClass+' '+fade+'" tabindex="-1" role="dialog" aria-labelledby="'+id+'Label" aria-hidden="true">' +
131
132
  '<div class="modal-dialog">' +
132
133
  '<div class="modal-content">' +
133
134
  '<div class="modal-header">' +
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: data-confirm-modal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcello Barnaba
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-22 00:00:00.000000000 Z
11
+ date: 2017-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -61,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
61
  version: 1.3.6
62
62
  requirements: []
63
63
  rubyforge_project:
64
- rubygems_version: 2.4.8
64
+ rubygems_version: 2.4.5.1
65
65
  signing_key:
66
66
  specification_version: 4
67
67
  summary: Use bootstrap modals with Rails' UJS data-confirm