blacklight 5.0.1 → 5.0.2

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: b55b7f3a93d7f6348223872347ac527c11353e36
4
- data.tar.gz: 19d7ff3d9f85c84d3b9750482f87b3da8d37f1ca
3
+ metadata.gz: 39a6ce9d4e75308e52d555bfc2a9142e4a3e323c
4
+ data.tar.gz: 98fed869e782531d52fd52ba807411ad8c200f59
5
5
  SHA512:
6
- metadata.gz: fe1cc0c70395f26b382169ae6f05f2ba4781a4a98bec30d50d87b037bb4acc438ec3fe8947e968ddf754994c4284612620a74ef99b37943459564129df97b0ca
7
- data.tar.gz: db8975613196501d2492864d078aaf47b4f8fd7438d631bf3c42ca1c51bbfcc84f9b37054318d21c553dc1c14edc712e4425c57dfdf4b493e6766f167fafc562
6
+ metadata.gz: 8008cc989c982ebb220ae69d01e39070c7b07078ed18bccceb3b64af6c8963eafd7a7e5023cb8925c6cf9da4d8bd1f438fe5f12813835c2c2a56760bcdb16851
7
+ data.tar.gz: 05e632077c43895265057e9da360862554d69386f42f90d17faee1130877f63e939ee7db9e4fe4cf461dd2d9a5883b9e4b42c2727f5ad8ccaa8e528ec4b991b2
data/.travis.yml CHANGED
@@ -5,7 +5,7 @@ rvm:
5
5
  - 2.1.0
6
6
  - 2.0.0
7
7
  - 1.9.3
8
- - jruby-19mode
8
+ - jruby
9
9
 
10
10
  before_install:
11
11
  - gem install bundler
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.0.1
1
+ 5.0.2
@@ -83,12 +83,20 @@ if (Blacklight.ajaxModal === undefined) {
83
83
  // a Bootstrap modal div that should be already on the page hidden
84
84
  Blacklight.ajaxModal.modalSelector = "#ajax-modal";
85
85
 
86
+ // Trigger selectors identify forms or hyperlinks that should open
87
+ // inside a modal dialog.
86
88
  Blacklight.ajaxModal.triggerLinkSelector = "a[data-ajax-modal~=trigger], a.lightboxLink,a.more_facets_link,.ajax_modal_launch";
87
89
  Blacklight.ajaxModal.triggerFormSelector = "form[data-ajax-modal~=trigger], form.ajax_form";
88
90
 
89
- // preserve selectors will be scopied inside the modal only
90
- Blacklight.ajaxModal.preserveLinkSelector = 'a[data-ajax-modal~=preserve]';
91
- Blacklight.ajaxModal.preserveFormSelector = 'form[data-ajax-modal~=preserve], form.ajax_form';
91
+ // preserve selectors identify forms or hyperlinks that, if activated already
92
+ // inside a modal dialog, should have destinations remain inside the modal -- but
93
+ // won't trigger a modal if not already in one.
94
+ //
95
+ // No need to repeat selectors from trigger selectors, those will already
96
+ // be preserved. MUST be manually prefixed with the modal selector,
97
+ // so they only apply to things inside a modal.
98
+ Blacklight.ajaxModal.preserveLinkSelector = Blacklight.ajaxModal.modalSelector + ' a[data-ajax-modal~=preserve]';
99
+ Blacklight.ajaxModal.preserveFormSelector = Blacklight.ajaxModal.modalSelector + 'form[data-ajax-modal~=preserve]'
92
100
 
93
101
  Blacklight.ajaxModal.containerSelector = "[data-ajax-modal~=container]";
94
102
 
@@ -152,12 +160,13 @@ Blacklight.ajaxModal.setup_modal = function() {
152
160
  $("body").trigger(e);
153
161
  if (e.isDefaultPrevented()) return;
154
162
 
155
- $("body").on("click", Blacklight.ajaxModal.triggerLinkSelector, Blacklight.ajaxModal.modalAjaxLinkClick);
156
- $("body").on("submit", Blacklight.ajaxModal.triggerFormSelector, Blacklight.ajaxModal.modalAjaxFormSubmit);
157
-
158
- // preserve selectors apply just within the existing modal
159
- $("body").on("click", Blacklight.ajaxModal.modalSelector + " " + Blacklight.ajaxModal.preserveLinkSelector, Blacklight.ajaxModal.modalAjaxLinkClick);
160
- $("body").on("submit", Blacklight.ajaxModal.modalSelector + " " + Blacklight.ajaxModal.preserveFormSelector, Blacklight.ajaxModal.modalAjaxFormSubmit);
163
+ // Register both trigger and preserve selectors in ONE event handler, combining
164
+ // into one selector with a comma, so if something matches BOTH selectors, it
165
+ // still only gets the event handler called once.
166
+ $("body").on("click", Blacklight.ajaxModal.triggerLinkSelector + ", " + Blacklight.ajaxModal.preserveLinkSelector,
167
+ Blacklight.ajaxModal.modalAjaxLinkClick);
168
+ $("body").on("submit", Blacklight.ajaxModal.triggerFormSelector + ", " + Blacklight.ajaxModal.preserveFormSelector,
169
+ Blacklight.ajaxModal.modalAjaxFormSubmit);
161
170
 
162
171
  // Catch our own custom loaded event to implement data-ajax-modal=closed
163
172
  $("body").on("loaded.blacklight.ajax-modal", Blacklight.ajaxModal.check_close_ajax_modal);
@@ -13,11 +13,12 @@ Blacklight = function() {
13
13
  }
14
14
  }();
15
15
 
16
- if (typeof Turbolinks !== "undefined") {
17
- $(document).on('page:load', function() {
18
- Blacklight.activate();
19
- });
20
- }
16
+ // turbolinks triggers page:load events on page transition
17
+ // If app isn't using turbolinks, this event will never be triggered, no prob.
18
+ $(document).on('page:load', function() {
19
+ Blacklight.activate();
20
+ });
21
+
21
22
  $(document).ready(function() {
22
23
  Blacklight.activate();
23
24
  });
@@ -1,4 +1,4 @@
1
- <div id="header-navbar" class="navbar navbar-default navbar-static-top navbar-inverse" role="navigation">
1
+ <div id="header-navbar" class="navbar navbar-inverse navbar-static-top" role="navigation">
2
2
  <div class="container">
3
3
  <div class="navbar-header">
4
4
  <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#user-util-collapse">
@@ -1,7 +1,7 @@
1
1
  require 'ostruct'
2
2
  module Blacklight
3
3
  class OpenStructWithHashAccess < OpenStruct
4
- delegate :keys, :each, :map, :has_key?, :delete, :length, :reject!, :select!, :include, :fetch, :to => :to_h
4
+ delegate :keys, :each, :map, :has_key?, :empty?, :delete, :length, :reject!, :select!, :include, :fetch, :to => :to_h
5
5
 
6
6
  def []=(key, value)
7
7
  send "#{key}=", value
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.1
4
+ version: 5.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Rochkind
@@ -17,7 +17,7 @@ authors:
17
17
  autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
- date: 2014-02-05 00:00:00.000000000 Z
20
+ date: 2014-02-13 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rails