effective_bootstrap 0.10.3 → 0.10.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab58cb9ff09bb4d53ce47b37f1db3cf508d8e444d72fddb97ca866e2690d9f6a
4
- data.tar.gz: 3979d703db18b9b0df9fc8a27b116ac03e135733e3133623edc1079bbb4616dd
3
+ metadata.gz: 7ba2eb5dbf37fdf09730ef6cfb8c37ab0897ed37b7a0089b1128d63a97e0cce9
4
+ data.tar.gz: 1a35f8b75f1ba029541d35b56cc74ca5b94274e367ccf6515b896c14cdf505a1
5
5
  SHA512:
6
- metadata.gz: 68b4fef7ed6d28496b22022df65da88723b666e858edc0798dbfdded29bea2758aad1c80d9ebda1bfed47b1f59e0bf5837755e12e24b663ad38a33daa965b6e8
7
- data.tar.gz: 7017b3cce94f970274d7fe9b12ae0b0e94e3fbf63bb2493e0ff67f44c36c1b6d53bec1c5836d2921f1189f20d309207279285dc76df6a33e0ab44df83ab76c61
6
+ metadata.gz: 82d3bd6f546c27a1291b7fa38c659a81cd7e601cf5cbcb16def771d09728ad44929faa58abe1de332b812dbe2a95e08ffac6c6b26cc84327d5fb5df46cd0758a
7
+ data.tar.gz: 576b9152be489de519cc2cee490ff5f6d340f53bc023a1f4f087f398462a7101ed5180f293225ac9cdcb8923c2e3d38d1dd610f8abbf6967c3db57460190225a
@@ -0,0 +1,12 @@
1
+ // reveal_mail_to
2
+ $(document).on('click', '[data-mailto-rot13]', function(event) {
3
+ event.preventDefault();
4
+
5
+ var $link = $(event.currentTarget);
6
+
7
+ var email = $link.data('mailto-rot13').replace(/[a-zA-Z]/g, function(c) {
8
+ return String.fromCharCode((c <= 'Z' ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26);
9
+ });
10
+
11
+ $link.attr('href', 'mailto:' + email).html(email).removeAttr('data-mailto-rot13');
12
+ });
@@ -3,13 +3,13 @@ $(document).ready(function() {
3
3
 
4
4
  if ($tab_with_error.length > 0) {
5
5
  $(".nav.nav-tabs").find("a[href^='#" + $tab_with_error.attr('id') + "']").tab('show');
6
- } else if (document.location.hash.length > 0) {
7
- var $tab_from_url = $(".nav.nav-tabs").find("a[href^='" + document.location.hash + "']");
6
+ return true;
8
7
 
9
- if ($tab_from_url.length > 0) {
10
- document.location.hash = ""; // This prevents scrolling to the wrong place in the page
11
- $tab_from_url.tab("show");
12
- }
8
+ } else if (document.location.search.length > 0) {
9
+ var tab = new URLSearchParams(document.location.search).get('tab');
10
+ if(tab.length == 0) { return false; }
11
+
12
+ $('.nav.nav-tabs').find("a[href^='#" + tab + "']").tab('show');
13
13
  }
14
14
  });
15
15
 
@@ -3,6 +3,7 @@
3
3
  //= require ./effective_bootstrap/form
4
4
  //= require ./effective_bootstrap/logic
5
5
  //= require ./effective_bootstrap/other
6
+ //= require ./effective_bootstrap/reveal_mail_to
6
7
  //= require ./effective_bootstrap/tabs
7
8
 
8
9
  //= require ./effective_datetime/input
@@ -105,7 +105,7 @@ module EffectiveBootstrapHelper
105
105
  def collapse(label, opts = {}, &block)
106
106
  raise 'expected a block' unless block_given?
107
107
 
108
- return accordian_collapse(label, opts, &block) if @_accordion_active
108
+ return accordion_collapse(label, opts, &block) if @_accordion_active
109
109
 
110
110
  id = "collapse-#{effective_bootstrap_unique_id}"
111
111
  show = (opts.delete(:show) == true)
@@ -470,6 +470,11 @@ module EffectiveBootstrapHelper
470
470
  # Let Kaminari override this method.
471
471
  alias_method(:paginate, :bootstrap_paginate) unless (respond_to?(:paginate) || defined?(Kaminari))
472
472
 
473
+ def reveal_mail_to(email)
474
+ raise('expected an email') unless email.kind_of?(String) && email.include?('@')
475
+ link_to 'Click to reveal email', '#', 'data-mailto-rot13' => email.tr('A-Za-z', 'N-ZA-Mn-za-m')
476
+ end
477
+
473
478
  # Tabs DSL
474
479
  # Inserts both the tablist and the tabpanel
475
480
 
@@ -487,7 +492,7 @@ module EffectiveBootstrapHelper
487
492
  raise 'expected a block' unless block_given?
488
493
 
489
494
  @_tab_mode = :tablist
490
- @_tab_active = (active || :first)
495
+ @_tab_active = :first if active.nil?
491
496
  @_tab_unique = effective_bootstrap_unique_id if unique
492
497
 
493
498
  content_tag(:ul, {class: 'nav nav-tabs', role: 'tablist'}.merge(list)) do
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '0.10.3'.freeze
2
+ VERSION = '0.10.6'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.3
4
+ version: 0.10.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-18 00:00:00.000000000 Z
11
+ date: 2022-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -428,6 +428,7 @@ files:
428
428
  - app/assets/javascripts/effective_bootstrap/form.js.coffee
429
429
  - app/assets/javascripts/effective_bootstrap/logic.js.coffee
430
430
  - app/assets/javascripts/effective_bootstrap/other.js.coffee
431
+ - app/assets/javascripts/effective_bootstrap/reveal_mail_to.js
431
432
  - app/assets/javascripts/effective_bootstrap/tabs.js
432
433
  - app/assets/javascripts/effective_bootstrap_editor.js
433
434
  - app/assets/javascripts/effective_checks/initialize.js.coffee