openseadragon 0.1.0 → 0.2.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/LICENSE +14 -0
- data/README.md +24 -6
- data/Rakefile +7 -0
- data/app/assets/javascripts/openseadragon.js +2 -0
- data/app/assets/javascripts/openseadragon/jquery.js +39 -0
- data/app/assets/javascripts/openseadragon/rails.js +5 -37
- data/app/assets/stylesheets/openseadragon/openseadragon.css +4 -0
- data/lib/generators/openseadragon/install_generator.rb +18 -0
- data/lib/generators/openseadragon/templates/openseadragon.css +3 -0
- data/lib/generators/openseadragon/templates/openseadragon.js +2 -0
- data/lib/openseadragon/version.rb +1 -1
- data/openseadragon.gemspec +4 -4
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +18 -0
- data/spec/test_app_templates/show.html.erb +1 -0
- data/vendor/assets/javascripts/{openseadragon.js → openseadragon/openseadragon.js} +0 -0
- metadata +22 -8
- data/LICENSE.txt +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14efe47c95e1ac88bc454c7ad91100b92b1835d5
|
4
|
+
data.tar.gz: 5ea80765a25fde178aeb7a88746a1de7b9dd1793
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f9866c71944872ea106c1c1505a1ef5939b0e023c061dacd58588fecffd8973b9c01c72c0f77c38ded543305449f8a490cf2685a6cc5885f5063a1152a4af3c
|
7
|
+
data.tar.gz: 91b744c99940886dba57481b7e454c9588bc7b561610cc896b3c8153124685d735eaadd82158e9b5cbedc58503bfec645cae4c79e4b61ba2924879699187c63e
|
data/LICENSE
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
Copyright 2015 The Board of Trustees of the Leland Stanford Junior University and Data Curation Experts
|
2
|
+
Additional copyright may be held by others, as reflected in the commit log
|
3
|
+
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
you may not use this file except in compliance with the License.
|
6
|
+
You may obtain a copy of the License at
|
7
|
+
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
See the License for the specific language governing permissions and
|
14
|
+
limitations under the License.
|
data/README.md
CHANGED
@@ -4,16 +4,34 @@ OpenSeadragon is a javascript library for displaying tiling images. This gem pac
|
|
4
4
|
|
5
5
|
http://openseadragon.github.io/
|
6
6
|
|
7
|
-
|
7
|
+
## Installation
|
8
8
|
|
9
|
-
|
9
|
+
Add the gem to your Gemfile:
|
10
10
|
|
11
|
-
In your controller add this line:
|
12
11
|
```ruby
|
13
|
-
|
12
|
+
gem 'openseadragon-rails'
|
13
|
+
```
|
14
|
+
|
15
|
+
Run bundle install:
|
16
|
+
|
17
|
+
```
|
18
|
+
$ bundle install
|
19
|
+
```
|
20
|
+
|
21
|
+
And run the openseadragon-rails install generator:
|
22
|
+
|
23
|
+
```
|
24
|
+
$ bundle exec rails g openseadragon:install
|
14
25
|
```
|
15
26
|
|
16
|
-
|
27
|
+
The generator will install the Rails helpers and openseadragon assets.
|
28
|
+
|
29
|
+
## Usage
|
30
|
+
|
31
|
+
This gem provides two helpers, `#picture_tag` and `#openseadragon_picture_tag`.
|
32
|
+
|
33
|
+
|
34
|
+
### picture_tag
|
17
35
|
|
18
36
|
The `#picture_tag` helper creates [HTML5 <picture> tags](http://www.w3.org/TR/html-picture-element/).
|
19
37
|
|
@@ -47,7 +65,7 @@ picture_tag ['page1.jpg' => { id: 'first-picture'}], 'page2.jpg', 'page3.jpg', {
|
|
47
65
|
</picture>
|
48
66
|
```
|
49
67
|
|
50
|
-
|
68
|
+
### openseadragon_picture_tag
|
51
69
|
|
52
70
|
If you have an OpenSeaDragon tilesource, you can use this helper to construct a HTML5 `<picture>` that will render as an OpenSeaDragon tile viewer.
|
53
71
|
|
data/Rakefile
CHANGED
@@ -0,0 +1,39 @@
|
|
1
|
+
(function($) {
|
2
|
+
$.fn.openseadragon = function() {
|
3
|
+
var __osd_counter = 0;
|
4
|
+
function generateOsdId() {
|
5
|
+
__osd_counter++;
|
6
|
+
|
7
|
+
return "Openseadragon" + __osd_counter;
|
8
|
+
}
|
9
|
+
|
10
|
+
$(this).each(function() {
|
11
|
+
var $picture = $(this);
|
12
|
+
$picture.addClass('openseadragon-viewer');
|
13
|
+
|
14
|
+
if (typeof $picture.attr('id') === "undefined") {
|
15
|
+
$picture.attr('id', generateOsdId());
|
16
|
+
}
|
17
|
+
|
18
|
+
var collectionOptions = $picture.data('openseadragon');
|
19
|
+
|
20
|
+
var sources = $picture.find('source[media="openseadragon"]');
|
21
|
+
|
22
|
+
var tilesources = $.map(sources, function(e) {
|
23
|
+
if ($(e).data('openseadragon')) {
|
24
|
+
return $(e).data('openseadragon');
|
25
|
+
} else {
|
26
|
+
return $(e).attr('src');
|
27
|
+
}
|
28
|
+
});
|
29
|
+
|
30
|
+
$picture.css('height', $picture.css('height'));
|
31
|
+
|
32
|
+
$picture.data('osdViewer', OpenSeadragon(
|
33
|
+
$.extend({ id: $picture.attr('id') }, collectionOptions, { tileSources: tilesources })
|
34
|
+
));
|
35
|
+
});
|
36
|
+
|
37
|
+
return this;
|
38
|
+
};
|
39
|
+
})(jQuery);
|
@@ -1,42 +1,10 @@
|
|
1
|
-
//= require openseadragon
|
1
|
+
//= require openseadragon/jquery
|
2
2
|
|
3
3
|
(function($) {
|
4
|
-
var __osd_counter = 0;
|
5
|
-
function generateOsdId() {
|
6
|
-
__osd_counter++;
|
7
|
-
|
8
|
-
return "Openseadragon" + __osd_counter;
|
9
|
-
}
|
10
|
-
|
11
4
|
function initOpenSeadragon() {
|
12
|
-
$('picture[data-openseadragon]').
|
13
|
-
|
14
|
-
|
15
|
-
if (typeof $picture.attr('id') === "undefined") {
|
16
|
-
$picture.attr('id', generateOsdId());
|
17
|
-
}
|
18
|
-
|
19
|
-
var collectionOptions = $picture.data('openseadragon');
|
20
|
-
|
21
|
-
var sources = $picture.find('source[media="openseadragon"]');
|
22
|
-
|
23
|
-
var tilesources = $.map(sources, function(e) {
|
24
|
-
if ($(e).data('openseadragon')) {
|
25
|
-
return $(e).data('openseadragon');
|
26
|
-
} else {
|
27
|
-
return $(e).attr('src');
|
28
|
-
}
|
29
|
-
});
|
30
|
-
|
31
|
-
$picture.css("display", "block");
|
32
|
-
$picture.css("height", "500px");
|
33
|
-
|
34
|
-
$picture.data('osdViewer', OpenSeadragon(
|
35
|
-
$.extend({ id: $picture.attr('id') }, collectionOptions, { tileSources: tilesources })
|
36
|
-
));
|
37
|
-
});
|
38
|
-
};
|
5
|
+
$('picture[data-openseadragon]').openseadragon();
|
6
|
+
}
|
39
7
|
|
40
|
-
|
41
|
-
document.
|
8
|
+
$(document).on('page:load', initOpenSeadragon);
|
9
|
+
$(document).ready(initOpenSeadragon);
|
42
10
|
})(jQuery);
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Openseadragon
|
4
|
+
class Install < Rails::Generators::Base
|
5
|
+
source_root File.expand_path('../templates', __FILE__)
|
6
|
+
|
7
|
+
def assets
|
8
|
+
copy_file "openseadragon.css", "app/assets/stylesheets/openseadragon.css"
|
9
|
+
copy_file "openseadragon.js", "app/assets/javascripts/openseadragon.js"
|
10
|
+
end
|
11
|
+
|
12
|
+
def inject_helper
|
13
|
+
inject_into_class 'app/controllers/application_controller.rb', ApplicationController do
|
14
|
+
" helper Openseadragon::OpenseadragonHelper\n"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/openseadragon.gemspec
CHANGED
@@ -6,12 +6,12 @@ require 'openseadragon/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "openseadragon"
|
8
8
|
spec.version = Openseadragon::VERSION
|
9
|
-
spec.authors = ["Justin Coyne", "
|
10
|
-
spec.email = ["justin@curationexperts.com"]
|
9
|
+
spec.authors = ["Justin Coyne", "Chris Beer", "Christopher Jesudurai"]
|
10
|
+
spec.email = ["justin@curationexperts.com", "cabeer@stanford.edu", "jchris@stanford.edu"],
|
11
11
|
spec.summary = %q{OpenSeadragon assets and helpers for Rails. http://openseadragon.github.io/}
|
12
12
|
spec.description = %q{OpenSeadragon is a javascript library for displaying tiling images. This gem packages those assets and some Rails helpers for using them}
|
13
|
-
spec.homepage = ""
|
14
|
-
spec.license = "
|
13
|
+
spec.homepage = "https://github.com/iiif/openseadragon-rails"
|
14
|
+
spec.license = "Apache 2.0"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
class TestAppGenerator < Rails::Generators::Base
|
4
|
+
source_root "../../spec/test_app_templates"
|
5
|
+
|
6
|
+
def run_generator
|
7
|
+
generate 'openseadragon:install'
|
8
|
+
end
|
9
|
+
|
10
|
+
def generate_controller
|
11
|
+
generate 'controller test show'
|
12
|
+
route "root to: 'test#show'"
|
13
|
+
end
|
14
|
+
|
15
|
+
def add_osd_to_view
|
16
|
+
copy_file "show.html.erb", 'app/views/test/show.html.erb', force: true
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= openseadragon_picture_tag 'https://stacks.stanford.edu/image/iiif/xf680rd3068%2Fxf680rd3068_00_0001/info.json' %>
|
File without changes
|
metadata
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openseadragon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
8
|
-
-
|
8
|
+
- Chris Beer
|
9
|
+
- Christopher Jesudurai
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2015-
|
13
|
+
date: 2015-03-18 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: bundler
|
@@ -112,7 +113,10 @@ dependencies:
|
|
112
113
|
description: OpenSeadragon is a javascript library for displaying tiling images. This
|
113
114
|
gem packages those assets and some Rails helpers for using them
|
114
115
|
email:
|
115
|
-
- justin@curationexperts.com
|
116
|
+
- - justin@curationexperts.com
|
117
|
+
- cabeer@stanford.edu
|
118
|
+
- jchris@stanford.edu
|
119
|
+
- OpenSeadragon assets and helpers for Rails. http://openseadragon.github.io/
|
116
120
|
executables: []
|
117
121
|
extensions: []
|
118
122
|
extra_rdoc_files: []
|
@@ -120,13 +124,19 @@ files:
|
|
120
124
|
- ".gitignore"
|
121
125
|
- ".travis.yml"
|
122
126
|
- Gemfile
|
123
|
-
- LICENSE
|
127
|
+
- LICENSE
|
124
128
|
- README.md
|
125
129
|
- Rakefile
|
130
|
+
- app/assets/javascripts/openseadragon.js
|
131
|
+
- app/assets/javascripts/openseadragon/jquery.js
|
126
132
|
- app/assets/javascripts/openseadragon/rails.js
|
133
|
+
- app/assets/stylesheets/openseadragon/openseadragon.css
|
127
134
|
- app/helpers/openseadragon/openseadragon_helper.rb
|
128
135
|
- app/models/openseadragon/image.rb
|
129
136
|
- app/models/openseadragon/open_street_map.rb
|
137
|
+
- lib/generators/openseadragon/install_generator.rb
|
138
|
+
- lib/generators/openseadragon/templates/openseadragon.css
|
139
|
+
- lib/generators/openseadragon/templates/openseadragon.js
|
130
140
|
- lib/openseadragon.rb
|
131
141
|
- lib/openseadragon/engine.rb
|
132
142
|
- lib/openseadragon/version.rb
|
@@ -135,6 +145,8 @@ files:
|
|
135
145
|
- spec/models/openseadragon/image_spec.rb
|
136
146
|
- spec/models/openseadragon/open_street_map.rb
|
137
147
|
- spec/spec_helper.rb
|
148
|
+
- spec/test_app_templates/lib/generators/test_app_generator.rb
|
149
|
+
- spec/test_app_templates/show.html.erb
|
138
150
|
- vendor/assets/images/openseadragon/fullpage_grouphover.png
|
139
151
|
- vendor/assets/images/openseadragon/fullpage_hover.png
|
140
152
|
- vendor/assets/images/openseadragon/fullpage_pressed.png
|
@@ -167,10 +179,10 @@ files:
|
|
167
179
|
- vendor/assets/images/openseadragon/zoomout_hover.png
|
168
180
|
- vendor/assets/images/openseadragon/zoomout_pressed.png
|
169
181
|
- vendor/assets/images/openseadragon/zoomout_rest.png
|
170
|
-
- vendor/assets/javascripts/openseadragon.js
|
171
|
-
homepage:
|
182
|
+
- vendor/assets/javascripts/openseadragon/openseadragon.js
|
183
|
+
homepage: https://github.com/iiif/openseadragon-rails
|
172
184
|
licenses:
|
173
|
-
-
|
185
|
+
- Apache 2.0
|
174
186
|
metadata: {}
|
175
187
|
post_install_message:
|
176
188
|
rdoc_options: []
|
@@ -197,3 +209,5 @@ test_files:
|
|
197
209
|
- spec/models/openseadragon/image_spec.rb
|
198
210
|
- spec/models/openseadragon/open_street_map.rb
|
199
211
|
- spec/spec_helper.rb
|
212
|
+
- spec/test_app_templates/lib/generators/test_app_generator.rb
|
213
|
+
- spec/test_app_templates/show.html.erb
|
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2014 TODO: Write your name
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|