bootbox-rails 0.2.0 → 0.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: 53d96ab1df21b0acec764c8803adc535521af86c
4
- data.tar.gz: 6d2c63ae9847cc96b476f87cfb030b70d63280e3
3
+ metadata.gz: 2ce65319bd41539cbf316ed271695de0087c57fe
4
+ data.tar.gz: 01242208aa4e2b8f6dbc4a2d1ca8e433f65ae8a6
5
5
  SHA512:
6
- metadata.gz: 5525b7f43328f99a46060e88018b0e5c9e23f1a72245250e0be53d51284a9bfc9a1ec58e906251fdae3c71e8f81ac05f54b48c54d411770727d76af943782192
7
- data.tar.gz: f854bf316d82974873f2fd031ebdb7a4e1b96fe63452dc3001a6592a0e92dc7b9abc718163a11f844e452bb9b5d3a298258361dc97f320a0958957a62618984e
6
+ metadata.gz: 33864abeacfba7be259b65410ce649e2ec9babb79c3f91eb2e3425919d93044df24a296f229f5a8508a28c72a4a42f28a4e4f992d68f1dabe93eb440ee27f1cb
7
+ data.tar.gz: 5d59b1b44d169163528cc31b60c4b1250044943437a22fe4a85d76474cc84d5d5c8498895d4fec5ec55f2e34bb89325fa0bc2499a9f60e1d4347dbecb83a9479
data/README.md CHANGED
@@ -9,13 +9,13 @@ Check out how to use bootbox.js at http://bootboxjs.com/
9
9
  First, put this line in your `Gemfile` (for Bootstrap 3):
10
10
 
11
11
  ```ruby
12
- gem 'bootbox-rails', '~>0.2'
12
+ gem 'bootbox-rails', '~>0.3'
13
13
  ```
14
14
 
15
15
  For Bootstrap 2 use following version:
16
16
 
17
17
  ```ruby
18
- gem 'bootbox-rails', '~>0.1'
18
+ gem 'bootbox-rails', '~>0.1.0'
19
19
  ```
20
20
 
21
21
  _Don't forget to add `jquery-rails` gem into your `Gemfile`. Also you may use very handy `bootstrap-sass` gem to add full stack of Twitter Bootstrap into your app._
@@ -1,10 +1,29 @@
1
1
  /**
2
- * bootbox.js [v4.1.0]
2
+ * bootbox.js [master branch]
3
3
  *
4
4
  * http://bootboxjs.com/license.txt
5
5
  */
6
- // @see https://github.com/makeusabrew/bootbox/issues/71
7
- window.bootbox = window.bootbox || (function init($, undefined) {
6
+
7
+ // @see https://github.com/makeusabrew/bootbox/issues/180
8
+ // @see https://github.com/makeusabrew/bootbox/issues/186
9
+ (function (root, factory) {
10
+
11
+ "use strict";
12
+ if (typeof define === "function" && define.amd) {
13
+ // AMD. Register as an anonymous module.
14
+ define(["jquery"], factory);
15
+ } else if (typeof exports === "object") {
16
+ // Node. Does not work with strict CommonJS, but
17
+ // only CommonJS-like environments that support module.exports,
18
+ // like Node.
19
+ module.exports = factory(require("jquery"));
20
+ } else {
21
+ // Browser globals (root is window)
22
+ root.bootbox = factory(root.jQuery);
23
+ }
24
+
25
+ }(this, function init($, undefined) {
26
+
8
27
  "use strict";
9
28
 
10
29
  // the base DOM structure needed to create a modal
@@ -24,24 +43,31 @@ window.bootbox = window.bootbox || (function init($, undefined) {
24
43
  footer:
25
44
  "<div class='modal-footer'></div>",
26
45
  closeButton:
27
- "<button type='button' class='bootbox-close-button close'>&times;</button>",
46
+ "<button type='button' class='bootbox-close-button close' data-dismiss='modal' aria-hidden='true'>&times;</button>",
28
47
  form:
29
48
  "<form class='bootbox-form'></form>",
30
49
  inputs: {
31
50
  text:
32
51
  "<input class='bootbox-input bootbox-input-text form-control' autocomplete=off type=text />",
52
+ textarea:
53
+ "<textarea class='bootbox-input bootbox-input-textarea form-control'></textarea>",
33
54
  email:
34
55
  "<input class='bootbox-input bootbox-input-email form-control' autocomplete='off' type='email' />",
35
56
  select:
36
57
  "<select class='bootbox-input bootbox-input-select form-control'></select>",
37
58
  checkbox:
38
- "<div class='checkbox'><label><input class='bootbox-input bootbox-input-checkbox' type='checkbox' /></label></div>"
59
+ "<div class='checkbox'><label><input class='bootbox-input bootbox-input-checkbox' type='checkbox' /></label></div>",
60
+ date:
61
+ "<input class='bootbox-input bootbox-input-date form-control' autocomplete=off type='date' />",
62
+ time:
63
+ "<input class='bootbox-input bootbox-input-time form-control' autocomplete=off type='time' />",
64
+ number:
65
+ "<input class='bootbox-input bootbox-input-number form-control' autocomplete=off type='number' />",
66
+ password:
67
+ "<input class='bootbox-input bootbox-input-password form-control' autocomplete='off' type='password' />"
39
68
  }
40
69
  };
41
70
 
42
- // cache a reference to the jQueryfied body element
43
- var appendTo = $("body");
44
-
45
71
  var defaults = {
46
72
  // default language
47
73
  locale: "en",
@@ -54,7 +80,9 @@ window.bootbox = window.bootbox || (function init($, undefined) {
54
80
  // whether or not to include a close button
55
81
  closeButton: true,
56
82
  // show the dialog immediately by default
57
- show: true
83
+ show: true,
84
+ // dialog container
85
+ container: "body"
58
86
  };
59
87
 
60
88
  // our public object; augmented after our private API
@@ -69,6 +97,7 @@ window.bootbox = window.bootbox || (function init($, undefined) {
69
97
  }
70
98
 
71
99
  function processCallback(e, dialog, callback) {
100
+ e.stopPropagation();
72
101
  e.preventDefault();
73
102
 
74
103
  // by default we assume a callback will get rid of the dialog,
@@ -352,6 +381,14 @@ window.bootbox = window.bootbox || (function init($, undefined) {
352
381
  // it, but we need to make sure we respect a preference not to show it
353
382
  shouldShow = (options.show === undefined) ? true : options.show;
354
383
 
384
+ // check if the browser supports the option.inputType
385
+ var html5inputs = ["date","time","number"];
386
+ var i = document.createElement("input");
387
+ i.setAttribute("type", options.inputType);
388
+ if(html5inputs[options.inputType]){
389
+ options.inputType = i.type;
390
+ }
391
+
355
392
  /**
356
393
  * overrides; undo anything the user tried to set they shouldn't have
357
394
  */
@@ -366,8 +403,13 @@ window.bootbox = window.bootbox || (function init($, undefined) {
366
403
 
367
404
  switch (options.inputType) {
368
405
  case "text":
406
+ case "textarea":
369
407
  case "email":
370
408
  case "select":
409
+ case "date":
410
+ case "time":
411
+ case "number":
412
+ case "password":
371
413
  value = input.val();
372
414
  break;
373
415
 
@@ -407,7 +449,12 @@ window.bootbox = window.bootbox || (function init($, undefined) {
407
449
 
408
450
  switch (options.inputType) {
409
451
  case "text":
452
+ case "textarea":
410
453
  case "email":
454
+ case "date":
455
+ case "time":
456
+ case "number":
457
+ case "password":
411
458
  input.val(options.value);
412
459
  break;
413
460
 
@@ -490,11 +537,17 @@ window.bootbox = window.bootbox || (function init($, undefined) {
490
537
  input.attr("placeholder", options.placeholder);
491
538
  }
492
539
 
540
+ if(options.pattern){
541
+ input.attr("pattern", options.pattern);
542
+ }
543
+
493
544
  // now place it in our form
494
545
  form.append(input);
495
546
 
496
547
  form.on("submit", function(e) {
497
548
  e.preventDefault();
549
+ // Fix for SammyJS (or similar JS routing library) hijacking the form post.
550
+ e.stopPropagation();
498
551
  // @TODO can we actually click *the* button object instead?
499
552
  // e.g. buttons.confirm.click() or similar
500
553
  dialog.find(".btn-primary").click();
@@ -521,6 +574,7 @@ window.bootbox = window.bootbox || (function init($, undefined) {
521
574
  options = sanitize(options);
522
575
 
523
576
  var dialog = $(templates.dialog);
577
+ var innerDialog = dialog.find(".modal-dialog");
524
578
  var body = dialog.find(".modal-body");
525
579
  var buttons = options.buttons;
526
580
  var buttonStr = "";
@@ -547,6 +601,14 @@ window.bootbox = window.bootbox || (function init($, undefined) {
547
601
  dialog.addClass(options.className);
548
602
  }
549
603
 
604
+ if (options.size === "large") {
605
+ innerDialog.addClass("modal-lg");
606
+ }
607
+
608
+ if (options.size === "small") {
609
+ innerDialog.addClass("modal-sm");
610
+ }
611
+
550
612
  if (options.title) {
551
613
  body.before(templates.header);
552
614
  }
@@ -643,7 +705,7 @@ window.bootbox = window.bootbox || (function init($, undefined) {
643
705
  // functionality and then giving the resulting object back
644
706
  // to our caller
645
707
 
646
- appendTo.append(dialog);
708
+ $(options.container).append(dialog);
647
709
 
648
710
  dialog.modal({
649
711
  backdrop: options.backdrop,
@@ -718,6 +780,11 @@ window.bootbox = window.bootbox || (function init($, undefined) {
718
780
  CANCEL : "Abbrechen",
719
781
  CONFIRM : "Akzeptieren"
720
782
  },
783
+ el : {
784
+ OK : "Εντάξει",
785
+ CANCEL : "Ακύρωση",
786
+ CONFIRM : "Επιβεβαίωση"
787
+ },
721
788
  en : {
722
789
  OK : "OK",
723
790
  CANCEL : "Cancel",
@@ -738,11 +805,26 @@ window.bootbox = window.bootbox || (function init($, undefined) {
738
805
  CANCEL : "Annuler",
739
806
  CONFIRM : "D'accord"
740
807
  },
808
+ he : {
809
+ OK : "אישור",
810
+ CANCEL : "ביטול",
811
+ CONFIRM : "אישור"
812
+ },
741
813
  it : {
742
814
  OK : "OK",
743
815
  CANCEL : "Annulla",
744
816
  CONFIRM : "Conferma"
745
817
  },
818
+ lt : {
819
+ OK : "Gerai",
820
+ CANCEL : "Atšaukti",
821
+ CONFIRM : "Patvirtinti"
822
+ },
823
+ lv : {
824
+ OK : "Labi",
825
+ CANCEL : "Atcelt",
826
+ CONFIRM : "Apstiprināt"
827
+ },
746
828
  nl : {
747
829
  OK : "OK",
748
830
  CANCEL : "Annuleren",
@@ -763,6 +845,16 @@ window.bootbox = window.bootbox || (function init($, undefined) {
763
845
  CANCEL : "Отмена",
764
846
  CONFIRM : "Применить"
765
847
  },
848
+ sv : {
849
+ OK : "OK",
850
+ CANCEL : "Avbryt",
851
+ CONFIRM : "OK"
852
+ },
853
+ tr : {
854
+ OK : "Tamam",
855
+ CANCEL : "İptal",
856
+ CONFIRM : "Onayla"
857
+ },
766
858
  zh_CN : {
767
859
  OK : "OK",
768
860
  CANCEL : "取消",
@@ -776,9 +868,8 @@ window.bootbox = window.bootbox || (function init($, undefined) {
776
868
  };
777
869
 
778
870
  exports.init = function(_$) {
779
- window.bootbox = init(_$ || $);
871
+ return init(_$ || $);
780
872
  };
781
873
 
782
874
  return exports;
783
-
784
- }(window.jQuery));
875
+ }));
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootbox-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kozloff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-10 00:00:00.000000000 Z
11
+ date: 2014-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  version: '0'
88
88
  requirements: []
89
89
  rubyforge_project:
90
- rubygems_version: 2.0.3
90
+ rubygems_version: 2.1.11
91
91
  signing_key:
92
92
  specification_version: 4
93
93
  summary: Wrappers for JavaScript alert(), confirm() and other flexible dialogs using