swiper-rails 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Swiper for Rails Asset Pipeline
2
2
 
3
- Integrates [Swiper](http://www.idangero.us/sliders/swiper/) for Rails Asset Pipeline.
3
+ [Swiper](http://www.idangero.us/sliders/swiper/) - is the free and ultra lightweight mobile touch slider. SwiperRails integrates it to yours Rails application.
4
4
 
5
5
  ## Installation
6
6
 
@@ -14,15 +14,34 @@ And then execute:
14
14
 
15
15
  Add Swiper to your `application.css`
16
16
 
17
- $ *= require swiper
17
+ *= require swiper
18
18
 
19
19
  And to `application.js`
20
20
 
21
- $ //= require swiper
21
+ //= require swiper
22
22
 
23
23
  ## Usage
24
24
 
25
- TODO: Write usage instructions here
25
+ SwiperRails has helper method, which can be useful, if you need dynamic slider.
26
+
27
+ = swiper @items { |item| item.image }
28
+
29
+ it will result the following html:
30
+
31
+ <div class="swiper-container">
32
+ <div class="swiper-wrapper">
33
+ <div class="swiper-item">
34
+ <img alt="Image1" src="/images/image1" /></div>
35
+ </div>
36
+ ...
37
+ </div>
38
+ </div>
39
+
40
+ For more information about Swiper's usage check (http://www.idangero.us/sliders/swiper/api.php)
41
+
42
+ ## Customizing
43
+
44
+ Run `rails g swiper`. It will copy Swiper's stylesheet to yours application and you will be able to customize styles.
26
45
 
27
46
  ## Contributing
28
47
 
@@ -0,0 +1,9 @@
1
+ module SwiperHelper
2
+ def swiper(items, &block)
3
+ content_tag :div, class: 'swiper-container' do
4
+ content_tag :div, class: 'swiper-wrapper' do
5
+ items.each { |item| concat content_tag(:div, yield(item), class: 'swiper-item' ) }
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,14 @@
1
+ module Swiper
2
+ module Generators
3
+ class SwiperGenerator < ::Rails::Generators::Base
4
+
5
+ source_root File.expand_path("../../../../app", __FILE__)
6
+ desc 'Copies Swiper stylesheet to your application.'
7
+
8
+ def generate_styles
9
+ copy_file "assets/stylesheets/swiper.css", "app/assets/stylesheets/swiper.css"
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -1,5 +1,5 @@
1
1
  module Swiper
2
2
  module Rails
3
- VERSION = "0.0.1"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
data/lib/swiper-rails.rb CHANGED
@@ -4,7 +4,11 @@ require "rails"
4
4
  module Swiper
5
5
  module Rails
6
6
  class Engine < ::Rails::Engine
7
-
7
+ initializer 'swiper-rails.setup_helpers' do |app|
8
+ app.config.to_prepare do
9
+ ActionController::Base.send :helper, SwiperHelper
10
+ end
11
+ end
8
12
  end
9
13
  end
10
14
  end
data/swiper-rails.gemspec CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |gem|
8
8
  gem.version = Swiper::Rails::VERSION
9
9
  gem.authors = ["Nik Marchenko"]
10
10
  gem.email = ["nik.marchenko@gmail.com"]
11
- gem.description = %q{Swiper toolit for Rails Asset Pipeline}
11
+ gem.description = %q{Swiper toolkit for Rails Asset Pipeline}
12
12
  gem.summary = %q{swiper-rails integrates Swiper toolkit for Rails Asset Pipeline}
13
13
  gem.homepage = "https://github.com/nikmarchenko/swiper-rails"
14
14
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swiper-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-22 00:00:00.000000000 Z
12
+ date: 2013-05-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -27,7 +27,7 @@ dependencies:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: '3.1'
30
- description: Swiper toolit for Rails Asset Pipeline
30
+ description: Swiper toolkit for Rails Asset Pipeline
31
31
  email:
32
32
  - nik.marchenko@gmail.com
33
33
  executables: []
@@ -41,6 +41,8 @@ files:
41
41
  - Rakefile
42
42
  - app/assets/javascripts/swiper.js
43
43
  - app/assets/stylesheets/swiper.css
44
+ - app/helpers/swiper_helper.rb
45
+ - lib/generators/swiper/swiper_generator.rb
44
46
  - lib/swiper-rails.rb
45
47
  - lib/swiper-rails/version.rb
46
48
  - swiper-rails.gemspec