fotoramajs 4.5.0 → 4.5.2

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
  SHA1:
3
- metadata.gz: 494a6e2cafb5b6670f5b6afcc60fa2b610e84648
4
- data.tar.gz: 559a3c9317f53f6d7ba02854b717689a8353a4b1
3
+ metadata.gz: 7529574fa08e35a59ded8573f0870362522a7951
4
+ data.tar.gz: dedd513bb61db97eb6e29ba939510e941ec95572
5
5
  SHA512:
6
- metadata.gz: a17b66ee2b8823a3cc1148e822afb9a46a95ab0603329b3674990d3814181236f56dbb175390de077e005d59bda7c96ba32ed3cb5349dac64f913b8bf9c0754d
7
- data.tar.gz: e0088ed8fb56ff6d5be39066eafec22dcfb7d0ebcaa1e9979628a1887b521dd50645ae177b4c59e78ccae16f929a6e84c010acae4b5d597d690522075dad992e
6
+ metadata.gz: aff3691c8114df1f4813ac9db1b5beac2a950933eff3fde74d9da06318f07afcf1577e2678989a4c32c9b0f6051493eda5688fd07e05438b5efc81bb36639122
7
+ data.tar.gz: 229be358ec764374e2056868462927cd94e5050b14baa3e0ccaa717e8f5fd2f483a704467681b4151f0a71f4d5a533c5a9d7c0dda675cfbc59da31fc21ff4328
data/README.md CHANGED
@@ -3,9 +3,10 @@
3
3
  [Fotorama] is a simple, stunning, powerful JavaScript gallery.
4
4
 
5
5
  This is packager, that allows you to simply install and maintain Fotorama
6
- by RubyGem in Rails Assets Pipeline.
6
+ by RubyGem in Rails Assets Pipeline. In development it will use local copy
7
+ and in production it will use CDN.
7
8
 
8
- Fotorama is created and maintained by [Artem Polikarpov].
9
+ Fotorama was created and maintained by [Artem Polikarpov].
9
10
 
10
11
  [Fotorama]: http://fotorama.io/
11
12
  [Artem Polikarpov]: http://artpolikarpov.ru/
@@ -24,23 +25,20 @@ Fotorama is created and maintained by [Artem Polikarpov].
24
25
  bundle install
25
26
  ```
26
27
 
27
- 3. Include jQuery in your project. I recommend [jquery-rails-cdn].
28
- 4. Include Fotorama script, for example, in `application.js.coffee`:
28
+ 3. Include jQuery in your project. I recommend [jquery-cdn]
29
+ or [jquery-rails-cdn].
30
+ 4. Put `include_fotorama` after jQuery script tag:
29
31
 
30
- ```coffee
31
- #= require fotorama
32
+ ```haml
33
+ head
34
+ = include_jquery
35
+ = include_fotorama
32
36
  ```
33
-
34
- 5. Include Fotorama styles, for example, in `application.css.sass`:
35
-
36
- ```coffee
37
- @import 'fotorama'
38
- ```
39
-
40
- 6. Use Fotorama by [documentation].
37
+ 5. Use Fotorama by [documentation].
41
38
 
42
39
  [jquery-rails-cdn]: https://github.com/kenn/jquery-rails-cdn
43
40
  [documentation]: http://fotorama.io/customize/
41
+ [jquery-cdn]: https://github.com/ai/jquery-cdn
44
42
 
45
43
  ## Development
46
44
 
data/Rakefile CHANGED
@@ -10,8 +10,10 @@ task :update do
10
10
  def github_tags(repo)
11
11
  http = HTTPClient.new
12
12
  body = http.get("https://api.github.com/repos/#{repo}/tags").body
13
- response = JSON.parse(body)
14
- response.map { |tag| Gem::Version.new(tag['name']) }.sort
13
+ JSON.parse(body)
14
+ .reject { |tag| tag['name'] =~ /[^\d\.]/ }
15
+ .map { |tag| Gem::Version.new(tag['name']) }
16
+ .sort
15
17
  end
16
18
 
17
19
  def get(url, to)
@@ -0,0 +1,16 @@
1
+ module Fotoramajs
2
+ module Helpers
3
+ def include_fotorama(options = {})
4
+ options[:env] ||= ::Rails.env.to_sym
5
+
6
+ if options[:env] == :development
7
+ root = ''
8
+ else
9
+ cdnjs = '//cdnjs.cloudflare.com/ajax/libs/'
10
+ root = cdnjs + "fotorama/#{ Fotoramajs::VERSION }/"
11
+ end
12
+ stylesheet_link_tag(root + 'fotorama.css') +
13
+ javascript_include_tag(root + 'fotorama.js', defer: options[:defer])
14
+ end
15
+ end
16
+ end
@@ -1,3 +1,3 @@
1
1
  module Fotoramajs
2
- VERSION = "4.5.0"
2
+ VERSION = "4.5.2"
3
3
  end
data/lib/fotoramajs.rb CHANGED
@@ -1,3 +1,6 @@
1
+ require_relative 'fotoramajs/version'
2
+ require_relative 'fotoramajs/helpers'
3
+
1
4
  # Used only for Ruby on Rails gem to tell, that gem contain `lib/assets`.
2
5
  module Fotoramajs
3
6
  class Railtie < Rails::Railtie
@@ -5,6 +8,10 @@ module Fotoramajs
5
8
  if Gem::Version.new(::Rails.version) >= Gem::Version.new("4.0.0")
6
9
  app.config.assets.precompile += ['fotorama.png', 'fotorama@2x.png']
7
10
  end
11
+
12
+ ActiveSupport.on_load(:action_view) do
13
+ include Fotoramajs::Helpers
14
+ end
8
15
  end
9
16
  end
10
17