openseadragon 0.9.0 → 1.0.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 +4 -4
- data/.github/workflows/ruby.yml +4 -5
- data/README.md +18 -3
- data/app/assets/javascripts/openseadragon/dom.js +58 -0
- data/app/assets/javascripts/openseadragon/jquery.js +5 -4
- data/app/assets/javascripts/openseadragon/rails.js +8 -26
- data/app/helpers/openseadragon/openseadragon_helper.rb +44 -44
- data/lib/generators/openseadragon/install_generator.rb +12 -13
- data/lib/openseadragon/engine.rb +1 -1
- data/lib/openseadragon/version.rb +1 -1
- data/spec/helpers/openseadragon_helper_spec.rb +11 -13
- metadata +3 -44
- data/vendor/assets/images/openseadragon/button_grouphover.png +0 -0
- data/vendor/assets/images/openseadragon/button_hover.png +0 -0
- data/vendor/assets/images/openseadragon/button_pressed.png +0 -0
- data/vendor/assets/images/openseadragon/button_rest.png +0 -0
- data/vendor/assets/images/openseadragon/flip_grouphover.png +0 -0
- data/vendor/assets/images/openseadragon/flip_hover.png +0 -0
- data/vendor/assets/images/openseadragon/flip_pressed.png +0 -0
- data/vendor/assets/images/openseadragon/flip_rest.png +0 -0
- data/vendor/assets/images/openseadragon/fullpage_grouphover.png +0 -0
- data/vendor/assets/images/openseadragon/fullpage_hover.png +0 -0
- data/vendor/assets/images/openseadragon/fullpage_pressed.png +0 -0
- data/vendor/assets/images/openseadragon/fullpage_rest.png +0 -0
- data/vendor/assets/images/openseadragon/home_grouphover.png +0 -0
- data/vendor/assets/images/openseadragon/home_hover.png +0 -0
- data/vendor/assets/images/openseadragon/home_pressed.png +0 -0
- data/vendor/assets/images/openseadragon/home_rest.png +0 -0
- data/vendor/assets/images/openseadragon/next_grouphover.png +0 -0
- data/vendor/assets/images/openseadragon/next_hover.png +0 -0
- data/vendor/assets/images/openseadragon/next_pressed.png +0 -0
- data/vendor/assets/images/openseadragon/next_rest.png +0 -0
- data/vendor/assets/images/openseadragon/previous_grouphover.png +0 -0
- data/vendor/assets/images/openseadragon/previous_hover.png +0 -0
- data/vendor/assets/images/openseadragon/previous_pressed.png +0 -0
- data/vendor/assets/images/openseadragon/previous_rest.png +0 -0
- data/vendor/assets/images/openseadragon/rotateleft_grouphover.png +0 -0
- data/vendor/assets/images/openseadragon/rotateleft_hover.png +0 -0
- data/vendor/assets/images/openseadragon/rotateleft_pressed.png +0 -0
- data/vendor/assets/images/openseadragon/rotateleft_rest.png +0 -0
- data/vendor/assets/images/openseadragon/rotateright_grouphover.png +0 -0
- data/vendor/assets/images/openseadragon/rotateright_hover.png +0 -0
- data/vendor/assets/images/openseadragon/rotateright_pressed.png +0 -0
- data/vendor/assets/images/openseadragon/rotateright_rest.png +0 -0
- data/vendor/assets/images/openseadragon/zoomin_grouphover.png +0 -0
- data/vendor/assets/images/openseadragon/zoomin_hover.png +0 -0
- data/vendor/assets/images/openseadragon/zoomin_pressed.png +0 -0
- data/vendor/assets/images/openseadragon/zoomin_rest.png +0 -0
- data/vendor/assets/images/openseadragon/zoomout_grouphover.png +0 -0
- data/vendor/assets/images/openseadragon/zoomout_hover.png +0 -0
- data/vendor/assets/images/openseadragon/zoomout_pressed.png +0 -0
- data/vendor/assets/images/openseadragon/zoomout_rest.png +0 -0
- data/vendor/assets/javascripts/openseadragon/openseadragon.js +0 -27261
- data/vendor/assets/javascripts/openseadragon/openseadragon.js.map +0 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d7774460f6047afd32a055f73ef27f7f526a2d83e27b5c66bab970fde011d293
|
|
4
|
+
data.tar.gz: 1a902664d22f91262178b5a7658de84906cc56c0fdfd604409ca3c6ce081590d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a8c0ee6fc12b38de8943f6122f4357d98b84356fb2bcd696b54ef603e9709d77023b470bbdc012d7b57675aa07637b9d60644f9b4174556f407d964452ae99d2
|
|
7
|
+
data.tar.gz: c69f13549e8763a3bbc016e78f6717cc316755896cf23fd0182c06b6fd15f7e095933e1a2c09476e014b7e4ef8dae440cd74fa1f02871e8d150fa0a730fccf10
|
data/.github/workflows/ruby.yml
CHANGED
|
@@ -11,17 +11,16 @@ jobs:
|
|
|
11
11
|
runs-on: ubuntu-latest
|
|
12
12
|
strategy:
|
|
13
13
|
matrix:
|
|
14
|
-
rails_version: [
|
|
14
|
+
rails_version: [8.0.1]
|
|
15
15
|
ruby: [3.2, 3.3]
|
|
16
16
|
include:
|
|
17
17
|
- ruby: 3.3
|
|
18
|
-
rails_version: 7.
|
|
18
|
+
rails_version: 7.2.2.1
|
|
19
19
|
- ruby: 3.2
|
|
20
|
-
rails_version: 7.
|
|
21
|
-
- ruby: 3.1
|
|
22
|
-
rails_version: 6.1.7.8
|
|
20
|
+
rails_version: 7.1.5.1
|
|
23
21
|
env:
|
|
24
22
|
RAILS_VERSION: ${{ matrix.rails_version }}
|
|
23
|
+
ENGINE_CART_RAILS_OPTIONS: "--skip-git --skip-listen --skip-spring --skip-keeps --skip-kamal --skip-test -a propshaft"
|
|
25
24
|
steps:
|
|
26
25
|
- uses: actions/checkout@v2
|
|
27
26
|
- name: Set up Ruby ${{ matrix.ruby }}
|
data/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Add the gem to your Gemfile:
|
|
|
12
12
|
gem 'openseadragon'
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
Run bundle install:
|
|
15
|
+
Run bundle install:
|
|
16
16
|
|
|
17
17
|
```
|
|
18
18
|
$ bundle install
|
|
@@ -28,10 +28,25 @@ The generator will install the Rails helpers and openseadragon assets.
|
|
|
28
28
|
|
|
29
29
|
## Usage
|
|
30
30
|
|
|
31
|
+
You must provide the `OpenSeadragon` function as a global. You can do this via the NPM dependency:
|
|
32
|
+
```js
|
|
33
|
+
import OpenSeadragon from 'openseadragon'
|
|
34
|
+
window.OpenSeadragon = OpenSeadragon
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
or via the CDN:
|
|
38
|
+
```html
|
|
39
|
+
<script src="https://cdn.jsdelivr.net/npm/openseadragon@5.0/build/openseadragon/openseadragon.min.js"></script>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
See [https://openseadragon.github.io](https://openseadragon.github.io) for further details
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Helpers
|
|
31
46
|
This gem provides two helpers, `#picture_tag` and `#openseadragon_picture_tag`.
|
|
32
47
|
|
|
33
48
|
|
|
34
|
-
|
|
49
|
+
#### picture_tag
|
|
35
50
|
|
|
36
51
|
The `#picture_tag` helper creates [HTML5 <picture> tags](http://www.w3.org/TR/html-picture-element/).
|
|
37
52
|
|
|
@@ -65,7 +80,7 @@ picture_tag ['page1.jpg' => { id: 'first-picture'}], 'page2.jpg', 'page3.jpg', {
|
|
|
65
80
|
</picture>
|
|
66
81
|
```
|
|
67
82
|
|
|
68
|
-
|
|
83
|
+
#### openseadragon_picture_tag
|
|
69
84
|
|
|
70
85
|
If you have an OpenSeaDragon tilesource, you can use this helper to construct a HTML5 `<picture>` that will render as an OpenSeaDragon tile viewer.
|
|
71
86
|
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
(function() {
|
|
2
|
+
let __osd_counter = 0;
|
|
3
|
+
|
|
4
|
+
function generateOsdId() {
|
|
5
|
+
__osd_counter++;
|
|
6
|
+
return "Openseadragon" + __osd_counter;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function openseadragon() {
|
|
10
|
+
this.forEach(function(picture) {
|
|
11
|
+
// Ensure the element is an HTMLElement
|
|
12
|
+
if (!(picture instanceof HTMLElement)) return;
|
|
13
|
+
|
|
14
|
+
picture.classList.add('openseadragon-viewer');
|
|
15
|
+
|
|
16
|
+
// Set ID if it doesn't exist
|
|
17
|
+
if (!picture.id) {
|
|
18
|
+
picture.id = generateOsdId();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Retrieve openseadragon data attribute as JSON
|
|
22
|
+
const collectionOptions = picture.dataset.openseadragon
|
|
23
|
+
? JSON.parse(picture.dataset.openseadragon)
|
|
24
|
+
: {};
|
|
25
|
+
|
|
26
|
+
// Find all <source> elements with media="openseadragon"
|
|
27
|
+
const sources = Array.from(picture.querySelectorAll('source[media="openseadragon"]'));
|
|
28
|
+
|
|
29
|
+
const tileSources = sources.map(source => {
|
|
30
|
+
const osdData = source.dataset.openseadragon;
|
|
31
|
+
return osdData ? JSON.parse(osdData) : source.getAttribute('src');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Preserve height of the picture
|
|
35
|
+
const height = window.getComputedStyle(picture).height;
|
|
36
|
+
picture.style.height = height;
|
|
37
|
+
|
|
38
|
+
// Initialize OpenSeadragon
|
|
39
|
+
picture.osdViewer = OpenSeadragon({
|
|
40
|
+
id: picture.id,
|
|
41
|
+
...collectionOptions,
|
|
42
|
+
tileSources: tileSources
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Attach the function to NodeList and HTMLElement prototypes for convenience
|
|
50
|
+
NodeList.prototype.openseadragon = openseadragon;
|
|
51
|
+
HTMLCollection.prototype.openseadragon = openseadragon;
|
|
52
|
+
|
|
53
|
+
// For a single HTMLElement
|
|
54
|
+
HTMLElement.prototype.openseadragon = function() {
|
|
55
|
+
return openseadragon.call([this]);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
})();
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
(function($) {
|
|
2
2
|
$.fn.openseadragon = function() {
|
|
3
|
+
console.warn("openseadragon/jquery.js is deprecated. Use openseadragon/dom.js instead.")
|
|
3
4
|
var __osd_counter = 0;
|
|
4
5
|
function generateOsdId() {
|
|
5
6
|
__osd_counter++;
|
|
6
|
-
|
|
7
|
+
|
|
7
8
|
return "Openseadragon" + __osd_counter;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
$(this).each(function() {
|
|
11
12
|
var $picture = $(this);
|
|
12
13
|
$picture.addClass('openseadragon-viewer');
|
|
13
|
-
|
|
14
|
+
|
|
14
15
|
if (typeof $picture.attr('id') === "undefined") {
|
|
15
16
|
$picture.attr('id', generateOsdId());
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
var collectionOptions = $picture.data('openseadragon');
|
|
19
|
-
|
|
20
|
+
|
|
20
21
|
var sources = $picture.find('source[media="openseadragon"]');
|
|
21
22
|
|
|
22
23
|
var tilesources = $.map(sources, function(e) {
|
|
@@ -36,4 +37,4 @@
|
|
|
36
37
|
|
|
37
38
|
return this;
|
|
38
39
|
};
|
|
39
|
-
})(jQuery);
|
|
40
|
+
})(jQuery);
|
|
@@ -1,32 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import 'openseadragon/dom'
|
|
2
2
|
|
|
3
|
-
(function(
|
|
3
|
+
(function() {
|
|
4
4
|
function initOpenSeadragon() {
|
|
5
|
-
|
|
5
|
+
document.querySelectorAll('picture[data-openseadragon]:not(:has(.openseadragon-container))').openseadragon();
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
const jquery3 = parseInt($.fn.jquery.split('.')[0]) >= 3;
|
|
9
|
-
let handler = 'ready';
|
|
10
|
-
|
|
11
8
|
if (typeof Turbo !== 'undefined') {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
handler = 'turbolinks:load';
|
|
17
|
-
} else {
|
|
18
|
-
// Turbolinks < 5
|
|
19
|
-
handler = 'page:load ready';
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// Support for $(document).on( "ready", handler ) was removed in jQuery 3
|
|
24
|
-
if (jquery3 && handler.includes('ready')) {
|
|
25
|
-
handler = handler.replace('ready', '').trim();
|
|
26
|
-
$(initOpenSeadragon);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (handler) {
|
|
30
|
-
$(document).on(handler, initOpenSeadragon);
|
|
9
|
+
addEventListener("turbo:load", () => initOpenSeadragon())
|
|
10
|
+
addEventListener("turbo:frame-load", () => initOpenSeadragon())
|
|
11
|
+
} else {
|
|
12
|
+
addEventListener('load', () => initOpenSeadragon())
|
|
31
13
|
}
|
|
32
|
-
})(
|
|
14
|
+
})();
|
|
@@ -6,7 +6,7 @@ module Openseadragon
|
|
|
6
6
|
# for the value of the src attribute and the value as the
|
|
7
7
|
# arguments for the tag options.
|
|
8
8
|
#
|
|
9
|
-
# The last hash is intepreted as optional arguments for the
|
|
9
|
+
# The last hash is intepreted as optional arguments for the
|
|
10
10
|
# <picture> tag. The second to last hash is optional arguments
|
|
11
11
|
# to all <source> tags.
|
|
12
12
|
#
|
|
@@ -23,10 +23,10 @@ module Openseadragon
|
|
|
23
23
|
src, src_options = source.first
|
|
24
24
|
src_options ||= {}
|
|
25
25
|
source_options.merge(src_options.merge(src: src))
|
|
26
|
-
else
|
|
26
|
+
else
|
|
27
27
|
source_options.merge(src: source)
|
|
28
28
|
end
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
yield tag_options if block_given?
|
|
31
31
|
tag :source, tag_options
|
|
32
32
|
end)
|
|
@@ -34,7 +34,7 @@ module Openseadragon
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
##
|
|
37
|
-
# Generate a <picture> tag ready to be parsed by the
|
|
37
|
+
# Generate a <picture> tag ready to be parsed by the rails
|
|
38
38
|
# javascript and transformed into an openseadragon viewer. Openseadragon
|
|
39
39
|
# tile source options are passed as a JSON encoded hash on the
|
|
40
40
|
# data-openseadragon attribute.
|
|
@@ -49,7 +49,7 @@ module Openseadragon
|
|
|
49
49
|
sources.flatten!
|
|
50
50
|
|
|
51
51
|
tile_sources = sources.map { |thing| extract_openseadragon_picture_tilesource(thing) }
|
|
52
|
-
|
|
52
|
+
|
|
53
53
|
picture_options[:data] ||= {}
|
|
54
54
|
picture_options[:data][:openseadragon] = osd_asset_defaults.merge(picture_options[:data][:openseadragon] || {}).to_json
|
|
55
55
|
|
|
@@ -64,7 +64,7 @@ module Openseadragon
|
|
|
64
64
|
# @overload extract_openseadragon_picture_tilesource(tilesource_obj)
|
|
65
65
|
# @param tilesource_obj [#to_tilesource] a tilesource-backed object that
|
|
66
66
|
# is either a hash of openseadragon tilesource parameters or a URL to
|
|
67
|
-
# a manifest containing those parameters.
|
|
67
|
+
# a manifest containing those parameters.
|
|
68
68
|
# @overload extract_openseadragon_picture_tilesource(options)
|
|
69
69
|
# @param [Hash] options a hash of openseadragon tilesource options
|
|
70
70
|
# @option options [Hash] :html parameters for the <source> tag
|
|
@@ -79,10 +79,10 @@ module Openseadragon
|
|
|
79
79
|
html_options ||= {}
|
|
80
80
|
html_options[:data] ||= {}
|
|
81
81
|
html_options[:data][:openseadragon] ||= {}
|
|
82
|
-
|
|
82
|
+
|
|
83
83
|
tilesource = thing.to_tilesource
|
|
84
84
|
src = "openseadragon-tilesource"
|
|
85
|
-
|
|
85
|
+
|
|
86
86
|
if tilesource.is_a? Hash
|
|
87
87
|
html_options[:data][:openseadragon].merge! tilesource
|
|
88
88
|
else
|
|
@@ -96,13 +96,13 @@ module Openseadragon
|
|
|
96
96
|
html_options = {}
|
|
97
97
|
html_options.merge! src_options.fetch(:html, {})
|
|
98
98
|
html_options[:data] ||= {}
|
|
99
|
-
|
|
99
|
+
|
|
100
100
|
osd_options = html_options[:data][:openseadragon] || {}
|
|
101
101
|
osd_options.merge!(src_options.except(:html))
|
|
102
102
|
|
|
103
103
|
if src.respond_to? :to_tilesource
|
|
104
104
|
tilesource = src.to_tilesource
|
|
105
|
-
|
|
105
|
+
|
|
106
106
|
if tilesource.is_a? Hash
|
|
107
107
|
osd_options.reverse_merge! tilesource
|
|
108
108
|
src = "openseadragon-tilesource"
|
|
@@ -110,9 +110,9 @@ module Openseadragon
|
|
|
110
110
|
src = tilesource
|
|
111
111
|
end
|
|
112
112
|
end
|
|
113
|
-
|
|
113
|
+
|
|
114
114
|
html_options[:data][:openseadragon] = osd_options.to_json
|
|
115
|
-
|
|
115
|
+
|
|
116
116
|
[ html_options.fetch(:src, src) => html_options ]
|
|
117
117
|
else # string
|
|
118
118
|
thing
|
|
@@ -124,52 +124,52 @@ module Openseadragon
|
|
|
124
124
|
prefixUrl: '',
|
|
125
125
|
navImages: {
|
|
126
126
|
zoomIn: {
|
|
127
|
-
REST: path_to_image('
|
|
128
|
-
GROUP: path_to_image('
|
|
129
|
-
HOVER: path_to_image('
|
|
130
|
-
DOWN: path_to_image('
|
|
127
|
+
REST: path_to_image('zoomin_rest.png'),
|
|
128
|
+
GROUP: path_to_image('zoomin_grouphover.png'),
|
|
129
|
+
HOVER: path_to_image('zoomin_hover.png'),
|
|
130
|
+
DOWN: path_to_image('zoomin_pressed.png')
|
|
131
131
|
},
|
|
132
132
|
zoomOut: {
|
|
133
|
-
REST: path_to_image('
|
|
134
|
-
GROUP: path_to_image('
|
|
135
|
-
HOVER: path_to_image('
|
|
136
|
-
DOWN: path_to_image('
|
|
133
|
+
REST: path_to_image('zoomout_rest.png'),
|
|
134
|
+
GROUP: path_to_image('zoomout_grouphover.png'),
|
|
135
|
+
HOVER: path_to_image('zoomout_hover.png'),
|
|
136
|
+
DOWN: path_to_image('zoomout_pressed.png')
|
|
137
137
|
},
|
|
138
138
|
home: {
|
|
139
|
-
REST: path_to_image('
|
|
140
|
-
GROUP: path_to_image('
|
|
141
|
-
HOVER: path_to_image('
|
|
142
|
-
DOWN: path_to_image('
|
|
139
|
+
REST: path_to_image('home_rest.png'),
|
|
140
|
+
GROUP: path_to_image('home_grouphover.png'),
|
|
141
|
+
HOVER: path_to_image('home_hover.png'),
|
|
142
|
+
DOWN: path_to_image('home_pressed.png')
|
|
143
143
|
},
|
|
144
144
|
fullpage: {
|
|
145
|
-
REST: path_to_image('
|
|
146
|
-
GROUP: path_to_image('
|
|
147
|
-
HOVER: path_to_image('
|
|
148
|
-
DOWN: path_to_image('
|
|
145
|
+
REST: path_to_image('fullpage_rest.png'),
|
|
146
|
+
GROUP: path_to_image('fullpage_grouphover.png'),
|
|
147
|
+
HOVER: path_to_image('fullpage_hover.png'),
|
|
148
|
+
DOWN: path_to_image('fullpage_pressed.png')
|
|
149
149
|
},
|
|
150
150
|
rotateleft: {
|
|
151
|
-
REST: path_to_image('
|
|
152
|
-
GROUP: path_to_image('
|
|
153
|
-
HOVER: path_to_image('
|
|
154
|
-
DOWN: path_to_image('
|
|
151
|
+
REST: path_to_image('rotateleft_rest.png'),
|
|
152
|
+
GROUP: path_to_image('rotateleft_grouphover.png'),
|
|
153
|
+
HOVER: path_to_image('rotateleft_hover.png'),
|
|
154
|
+
DOWN: path_to_image('rotateleft_pressed.png')
|
|
155
155
|
},
|
|
156
156
|
rotateright: {
|
|
157
|
-
REST: path_to_image('
|
|
158
|
-
GROUP: path_to_image('
|
|
159
|
-
HOVER: path_to_image('
|
|
160
|
-
DOWN: path_to_image('
|
|
157
|
+
REST: path_to_image('rotateright_rest.png'),
|
|
158
|
+
GROUP: path_to_image('rotateright_grouphover.png'),
|
|
159
|
+
HOVER: path_to_image('rotateright_hover.png'),
|
|
160
|
+
DOWN: path_to_image('rotateright_pressed.png')
|
|
161
161
|
},
|
|
162
162
|
previous: {
|
|
163
|
-
REST: path_to_image('
|
|
164
|
-
GROUP: path_to_image('
|
|
165
|
-
HOVER: path_to_image('
|
|
166
|
-
DOWN: path_to_image('
|
|
163
|
+
REST: path_to_image('previous_rest.png'),
|
|
164
|
+
GROUP: path_to_image('previous_grouphover.png'),
|
|
165
|
+
HOVER: path_to_image('previous_hover.png'),
|
|
166
|
+
DOWN: path_to_image('previous_pressed.png')
|
|
167
167
|
},
|
|
168
168
|
next: {
|
|
169
|
-
REST: path_to_image('
|
|
170
|
-
GROUP: path_to_image('
|
|
171
|
-
HOVER: path_to_image('
|
|
172
|
-
DOWN: path_to_image('
|
|
169
|
+
REST: path_to_image('next_rest.png'),
|
|
170
|
+
GROUP: path_to_image('next_grouphover.png'),
|
|
171
|
+
HOVER: path_to_image('next_hover.png'),
|
|
172
|
+
DOWN: path_to_image('next_pressed.png')
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
}.with_indifferent_access
|
|
@@ -4,29 +4,28 @@ module Openseadragon
|
|
|
4
4
|
class Install < Rails::Generators::Base
|
|
5
5
|
source_root File.expand_path('../templates', __FILE__)
|
|
6
6
|
|
|
7
|
-
def assets
|
|
8
|
-
return unless defined?(Sprockets)
|
|
9
|
-
|
|
10
|
-
copy_file "openseadragon.css", "app/assets/stylesheets/openseadragon.css"
|
|
11
|
-
copy_file "openseadragon.js", "app/assets/javascripts/openseadragon.js"
|
|
12
|
-
|
|
13
|
-
if File.exist? 'app/assets/config/manifest.js'
|
|
14
|
-
append_to_file 'app/assets/config/manifest.js', "\n//= link openseadragon-assets\n"
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
7
|
def append_javascript
|
|
19
|
-
|
|
8
|
+
run "yarn init -y"
|
|
9
|
+
gsub_file "package.json", /\.internal_test_app/, "internal_test_app" # name beginning with a dot is illegal
|
|
10
|
+
run "yarn add openseadragon"
|
|
20
11
|
|
|
21
12
|
append_to_file 'app/javascript/application.js' do
|
|
22
13
|
<<~CONTENT
|
|
23
14
|
// Openseadragon gem imports
|
|
24
|
-
import "openseadragon/
|
|
15
|
+
import "openseadragon/dom"
|
|
25
16
|
import "openseadragon/rails"
|
|
26
17
|
CONTENT
|
|
27
18
|
end
|
|
28
19
|
end
|
|
29
20
|
|
|
21
|
+
def append_image_paths
|
|
22
|
+
append_to_file 'config/initializers/assets.rb' do
|
|
23
|
+
<<~CONTENT
|
|
24
|
+
Rails.application.config.assets.paths << Rails.application.root + 'node_modules/openseadragon/build/openseadragon/images'
|
|
25
|
+
CONTENT
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
30
29
|
def inject_helper
|
|
31
30
|
inject_into_class 'app/controllers/application_controller.rb', ApplicationController do
|
|
32
31
|
" helper Openseadragon::OpenseadragonHelper\n"
|
data/lib/openseadragon/engine.rb
CHANGED
|
@@ -15,7 +15,7 @@ module Openseadragon
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
initializer 'openseadragon.assets.precompile' do |app|
|
|
18
|
-
app.config.assets.precompile += %w[openseadragon/*.png]
|
|
18
|
+
app.config.assets.precompile += %w[node_modules/openseadragon/build/openseadragon/images/*.png]
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
initializer "openseadragon.importmap", before: "importmap" do |app|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe Openseadragon::OpenseadragonHelper do
|
|
3
|
+
RSpec.describe Openseadragon::OpenseadragonHelper do
|
|
4
4
|
describe "#picture_tag" do
|
|
5
5
|
context "without any sources" do
|
|
6
6
|
it "should render an empty <picture>" do
|
|
@@ -88,7 +88,7 @@ describe Openseadragon::OpenseadragonHelper do
|
|
|
88
88
|
end
|
|
89
89
|
end
|
|
90
90
|
|
|
91
|
-
context "
|
|
91
|
+
context "tilesource key and options" do
|
|
92
92
|
let(:source) { double(to_tilesource: { a: 1, b: 1}) }
|
|
93
93
|
subject { helper.openseadragon_picture_tag([source => { html: { id: 'xyz' }, b: 2, c: 3}]) }
|
|
94
94
|
it "should merge a tilesource key with the options provided" do
|
|
@@ -105,21 +105,19 @@ describe Openseadragon::OpenseadragonHelper do
|
|
|
105
105
|
|
|
106
106
|
describe "['prefixUrl']" do
|
|
107
107
|
subject { defaults['prefixUrl'] }
|
|
108
|
-
it {
|
|
108
|
+
it { is_expected.to eq ''}
|
|
109
109
|
end
|
|
110
110
|
|
|
111
111
|
describe "['navImages']" do
|
|
112
112
|
subject { defaults['navImages'] }
|
|
113
|
-
it {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
"next"=>{"REST"=>"/assets/openseadragon/next_rest.png", "GROUP"=>"/assets/openseadragon/next_grouphover.png", "HOVER"=>"/assets/openseadragon/next_hover.png", "DOWN"=>"/assets/openseadragon/next_pressed.png"}
|
|
122
|
-
)}
|
|
113
|
+
it { is_expected.to include('zoomIn', 'zoomOut', 'home', 'fullpage', 'rotateleft', 'rotateright', 'previous', 'next') }
|
|
114
|
+
|
|
115
|
+
it 'has all the values' do
|
|
116
|
+
expect(subject).to all(include(have_key('REST')))
|
|
117
|
+
expect(subject).to all(include(have_key('GROUP')))
|
|
118
|
+
expect(subject).to all(include(have_key('HOVER')))
|
|
119
|
+
expect(subject).to all(include(have_key('DOWN')))
|
|
120
|
+
end
|
|
123
121
|
end
|
|
124
122
|
end
|
|
125
123
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: openseadragon
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Justin Coyne
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2024-12-
|
|
13
|
+
date: 2024-12-19 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: bundler
|
|
@@ -129,6 +129,7 @@ files:
|
|
|
129
129
|
- Rakefile
|
|
130
130
|
- app/assets/config/openseadragon-assets.js
|
|
131
131
|
- app/assets/javascripts/openseadragon.js
|
|
132
|
+
- app/assets/javascripts/openseadragon/dom.js
|
|
132
133
|
- app/assets/javascripts/openseadragon/jquery.js
|
|
133
134
|
- app/assets/javascripts/openseadragon/rails.js
|
|
134
135
|
- app/assets/stylesheets/openseadragon/openseadragon.css
|
|
@@ -149,48 +150,6 @@ files:
|
|
|
149
150
|
- spec/spec_helper.rb
|
|
150
151
|
- spec/test_app_templates/lib/generators/test_app_generator.rb
|
|
151
152
|
- spec/test_app_templates/show.html.erb
|
|
152
|
-
- vendor/assets/images/openseadragon/button_grouphover.png
|
|
153
|
-
- vendor/assets/images/openseadragon/button_hover.png
|
|
154
|
-
- vendor/assets/images/openseadragon/button_pressed.png
|
|
155
|
-
- vendor/assets/images/openseadragon/button_rest.png
|
|
156
|
-
- vendor/assets/images/openseadragon/flip_grouphover.png
|
|
157
|
-
- vendor/assets/images/openseadragon/flip_hover.png
|
|
158
|
-
- vendor/assets/images/openseadragon/flip_pressed.png
|
|
159
|
-
- vendor/assets/images/openseadragon/flip_rest.png
|
|
160
|
-
- vendor/assets/images/openseadragon/fullpage_grouphover.png
|
|
161
|
-
- vendor/assets/images/openseadragon/fullpage_hover.png
|
|
162
|
-
- vendor/assets/images/openseadragon/fullpage_pressed.png
|
|
163
|
-
- vendor/assets/images/openseadragon/fullpage_rest.png
|
|
164
|
-
- vendor/assets/images/openseadragon/home_grouphover.png
|
|
165
|
-
- vendor/assets/images/openseadragon/home_hover.png
|
|
166
|
-
- vendor/assets/images/openseadragon/home_pressed.png
|
|
167
|
-
- vendor/assets/images/openseadragon/home_rest.png
|
|
168
|
-
- vendor/assets/images/openseadragon/next_grouphover.png
|
|
169
|
-
- vendor/assets/images/openseadragon/next_hover.png
|
|
170
|
-
- vendor/assets/images/openseadragon/next_pressed.png
|
|
171
|
-
- vendor/assets/images/openseadragon/next_rest.png
|
|
172
|
-
- vendor/assets/images/openseadragon/previous_grouphover.png
|
|
173
|
-
- vendor/assets/images/openseadragon/previous_hover.png
|
|
174
|
-
- vendor/assets/images/openseadragon/previous_pressed.png
|
|
175
|
-
- vendor/assets/images/openseadragon/previous_rest.png
|
|
176
|
-
- vendor/assets/images/openseadragon/rotateleft_grouphover.png
|
|
177
|
-
- vendor/assets/images/openseadragon/rotateleft_hover.png
|
|
178
|
-
- vendor/assets/images/openseadragon/rotateleft_pressed.png
|
|
179
|
-
- vendor/assets/images/openseadragon/rotateleft_rest.png
|
|
180
|
-
- vendor/assets/images/openseadragon/rotateright_grouphover.png
|
|
181
|
-
- vendor/assets/images/openseadragon/rotateright_hover.png
|
|
182
|
-
- vendor/assets/images/openseadragon/rotateright_pressed.png
|
|
183
|
-
- vendor/assets/images/openseadragon/rotateright_rest.png
|
|
184
|
-
- vendor/assets/images/openseadragon/zoomin_grouphover.png
|
|
185
|
-
- vendor/assets/images/openseadragon/zoomin_hover.png
|
|
186
|
-
- vendor/assets/images/openseadragon/zoomin_pressed.png
|
|
187
|
-
- vendor/assets/images/openseadragon/zoomin_rest.png
|
|
188
|
-
- vendor/assets/images/openseadragon/zoomout_grouphover.png
|
|
189
|
-
- vendor/assets/images/openseadragon/zoomout_hover.png
|
|
190
|
-
- vendor/assets/images/openseadragon/zoomout_pressed.png
|
|
191
|
-
- vendor/assets/images/openseadragon/zoomout_rest.png
|
|
192
|
-
- vendor/assets/javascripts/openseadragon/openseadragon.js
|
|
193
|
-
- vendor/assets/javascripts/openseadragon/openseadragon.js.map
|
|
194
153
|
homepage: https://github.com/sul-dlss/openseadragon-rails
|
|
195
154
|
licenses:
|
|
196
155
|
- Apache 2.0
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|