volt-slider 0.1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 34418c97715f65631a65719f30e345411dd3c228
4
+ data.tar.gz: 546e48b2a1c3d36c0b54d529a6e90cbac0e8dc71
5
+ SHA512:
6
+ metadata.gz: 84b665515b64d4f0cdcb8d3892c003e540c8dd527f5c650a16beabbc555c03391d8846a4f8b7cca74430ddbc6e89c26418ffd7e91f540bf95eae37a042c88d08
7
+ data.tar.gz: 08a37fd4a801b162ae3130414abc5d9c408291b4f36fc72318bf168945096551ab7603f6f32d957bcd7821ec6bfc44fe0d6f3893361fc21bba8a53efa12b9f8c
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .idea
19
+ .idea/*
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in volt-slider.gemspec
4
+ gemspec
5
+
6
+ # Optional Gems for testing/dev
7
+
8
+ # The implementation of ReadWriteLock in Volt uses concurrent ruby and ext helps performance.
9
+ gem 'concurrent-ruby-ext', '~> 0.8.0'
10
+
11
+ # Gems you use for development should be added to the gemspec file as
12
+ # development dependencies.
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2016 Kostafun
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.
@@ -0,0 +1,73 @@
1
+ # Volt::Slider
2
+
3
+ Simple slider of any content for Volt framework.
4
+
5
+ Includes Interval module in lib/ , encapsulating javascript setInterval clearInterval functions.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'volt-slider'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install volt-slider
20
+
21
+ Add to dependencies.rb
22
+
23
+ component 'slider'
24
+
25
+ ## Usage
26
+
27
+ html:
28
+
29
+ <:slider interval_time=5000 transition_time=300 stop_on_mouseover="false">
30
+ Your content here, outer div's should be float: left, position: relative, i.e:
31
+ <div class="slider">
32
+ ...
33
+ </div>
34
+ <div class="slider">
35
+ ...
36
+ </div>
37
+ </:slider>
38
+ css:
39
+
40
+ .slider {
41
+ position: relative;
42
+ float: left;
43
+ }
44
+
45
+ ## Configuration
46
+ Sass variables
47
+
48
+ defaults:
49
+
50
+ $slider_visible_width:'800px' !default
51
+ $slider_visible_height: '260px' !default
52
+ $slider_container_length: '2400px' !default
53
+
54
+ Attributes
55
+
56
+ defaults:
57
+
58
+ interval_time: 3000, #interval between moves in ms
59
+ move_length: 800, #in pixels
60
+ transtion_time: 700,
61
+ leftmost_point: -1600, #if container moved farther than that it's reset to zero - showing first slide
62
+ stop_on_mouseover: true
63
+
64
+
65
+ ## Contributing
66
+
67
+ This is my first Volt component, any comments or contributions would be appreciated!
68
+
69
+ 1. Fork it ( http://github.com/[my-github-username]/volt-slider/fork )
70
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
71
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
72
+ 4. Push to the branch (`git push origin my-new-feature`)
73
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,16 @@
1
+ $slider_visible_width: 800px !default
2
+ $slider_visible_height: 260px !default
3
+ $slider_container_length: 2400px !default
4
+
5
+ .slider-viewport
6
+ height: $slider_visible_height
7
+ width: $slider_visible_width
8
+ overflow: hidden
9
+ position: relative
10
+
11
+ .slider-container
12
+ position: relative
13
+ width: $slider_container_length
14
+ left: 0px
15
+ height: 100%
16
+
@@ -0,0 +1 @@
1
+ # Component dependencies
@@ -0,0 +1,10 @@
1
+ # Place any code you want to run when the component is included on the client
2
+ # or server.
3
+
4
+ # To include code only on the client use:
5
+ # if RUBY_PLATFORM == 'opal'
6
+ #
7
+ # To include code only on the server, use:
8
+ # unless RUBY_PLATFORM == 'opal'
9
+ # ^^ this will not send compile in code in the conditional to the client.
10
+ # ^^ this include code required in the conditional.
@@ -0,0 +1 @@
1
+ # Component routes
@@ -0,0 +1,85 @@
1
+ if RUBY_PLATFORM == 'opal'
2
+
3
+ require 'opal-jquery'
4
+
5
+ end
6
+
7
+ module Slider
8
+ class MainController < Volt::ModelController
9
+ def default_options
10
+ {
11
+ interval_time: 3000, #interval between moves in ms
12
+ move_length: 800, #in pixels
13
+ transition_time: 700,
14
+ leftmost_point: -1600, #if container moved farther than that it's reset to zero - showing first slide
15
+ stop_on_mouseover: true
16
+ }
17
+ end
18
+
19
+ def index
20
+ create_options_vars(default_options)
21
+ end
22
+
23
+ def create_options_vars(options)
24
+
25
+ # options.each { |k,v| puts "@#{k}" + (( (attrs.send(k) == '') ? nil : attrs.send(k) ) || v).to_s }
26
+ options.each { |k,v| instance_variable_set("@#{k}", (( (attrs.send(k) == '') ? nil : attrs.send(k) )|| v)) } #instance variables from attrs
27
+ end
28
+
29
+ def move
30
+ if RUBY_PLATFORM == 'opal'
31
+ el = Element.find('.slider-container')
32
+ moveto = el.css('left').to_i - @move_length.to_i
33
+ if moveto < @leftmost_point
34
+ moveto = 0
35
+ end
36
+ el.animate({left: moveto, speed: @transition_time })
37
+ end
38
+ end
39
+
40
+ def index_ready
41
+ if RUBY_PLATFORM == 'opal'
42
+ if @stop_on_mouseover==true or @stop_on_mouseover=="true"
43
+ el = Element.find('.slider-viewport')
44
+
45
+ el.on :mouseover do
46
+ clear_interval(@interval)
47
+ end
48
+
49
+ el.on :mouseout do
50
+ @interval = set_interval(@interval_time) do move end
51
+ end
52
+ end
53
+
54
+ @interval = set_interval(@interval_time) do move end
55
+
56
+ end
57
+ end
58
+
59
+ def before_index_remove
60
+ if RUBY_PLATFORM == 'opal'
61
+ clear_interval(@interval)
62
+ end
63
+ end
64
+
65
+ def set_interval( time=0, &block )
66
+ if RUBY_PLATFORM == 'opal'
67
+ `setInterval(function(){#{block.call}}, time)`
68
+ end
69
+ end
70
+
71
+ def clear_interval( interval )
72
+ if RUBY_PLATFORM == 'opal'
73
+ `clearInterval(#{interval})`
74
+ end
75
+ end
76
+ private
77
+
78
+ # the main template contains a #template binding that shows another
79
+ # template. This is the path to that template. It may change based
80
+ # on the params._controller and params._action values.
81
+ def main_path
82
+ "#{params._component || 'main'}/#{params._controller || 'main'}/#{params._action || 'index'}"
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,9 @@
1
+ <:Body>
2
+ <div class="slider-viewport" >
3
+ <div class="slider-container">
4
+
5
+
6
+ {{ yield }}
7
+
8
+ </div>
9
+ </div>
@@ -0,0 +1,18 @@
1
+ # If you need to require in code in the gem's app folder, keep in mind that
2
+ # the app is not on the load path when the gem is required. Use
3
+ # app/{gemname}/config/initializers/boot.rb to require in client or server
4
+ # code.
5
+ #
6
+ # Also, in volt apps, you typically use the lib folder in the
7
+ # app/{componentname} folder instead of this lib folder. This lib folder is
8
+ # for setting up gem code when Bundler.require is called. (or the gem is
9
+ # required.)
10
+ #
11
+ # If you need to configure volt in some way, you can add a Volt.configure block
12
+ # in this file.
13
+
14
+ module Volt
15
+ module Slider
16
+ # Your code goes here...
17
+ end
18
+ end
@@ -0,0 +1,5 @@
1
+ module Volt
2
+ module Slider
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,41 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'volt/slider/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "volt-slider"
8
+ spec.version = Volt::Slider::VERSION
9
+ spec.authors = ["Kostafun"]
10
+ spec.email = ["kostafunphone@gmail.com"]
11
+ spec.summary = 'Simple slider for volt framework'
12
+ spec.description = 'Slide any type of content using jquery animate'
13
+ spec.homepage = "http://github.com/Kostafun/volt-slider"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "volt", "~> 0.9.6"
22
+ spec.add_development_dependency "rake"
23
+
24
+ # Testing gems
25
+ spec.add_development_dependency 'rspec', '~> 3.2.0'
26
+ spec.add_development_dependency 'opal-rspec', '~> 0.4.2'
27
+ spec.add_development_dependency 'capybara', '~> 2.4.4'
28
+ spec.add_development_dependency 'selenium-webdriver', '~> 2.47.0'
29
+ spec.add_development_dependency 'chromedriver-helper', '~> 1.0.0'
30
+ spec.add_development_dependency 'poltergeist', '~> 1.6.0'
31
+
32
+ # Gems to run the dummy app
33
+ spec.add_development_dependency 'volt-mongo', '0.1.1'
34
+ spec.add_development_dependency 'volt-bootstrap', '~> 0.1.0'
35
+ spec.add_development_dependency 'volt-bootstrap_jumbotron_theme', '~> 0.1.0'
36
+ spec.add_development_dependency 'volt-user_templates', '~> 0.4.0'
37
+ spec.add_development_dependency 'thin', '~> 1.6.0'
38
+
39
+ spec.add_runtime_dependency 'opal-jquery', '~> 0.4'
40
+
41
+ end
metadata ADDED
@@ -0,0 +1,255 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: volt-slider
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Kostafun
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-02-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: volt
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.9.6
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.9.6
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 3.2.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 3.2.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: opal-rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.4.2
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.4.2
69
+ - !ruby/object:Gem::Dependency
70
+ name: capybara
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 2.4.4
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 2.4.4
83
+ - !ruby/object:Gem::Dependency
84
+ name: selenium-webdriver
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 2.47.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 2.47.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: chromedriver-helper
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 1.0.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 1.0.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: poltergeist
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 1.6.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 1.6.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: volt-mongo
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '='
130
+ - !ruby/object:Gem::Version
131
+ version: 0.1.1
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '='
137
+ - !ruby/object:Gem::Version
138
+ version: 0.1.1
139
+ - !ruby/object:Gem::Dependency
140
+ name: volt-bootstrap
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 0.1.0
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 0.1.0
153
+ - !ruby/object:Gem::Dependency
154
+ name: volt-bootstrap_jumbotron_theme
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 0.1.0
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: 0.1.0
167
+ - !ruby/object:Gem::Dependency
168
+ name: volt-user_templates
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: 0.4.0
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: 0.4.0
181
+ - !ruby/object:Gem::Dependency
182
+ name: thin
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: 1.6.0
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: 1.6.0
195
+ - !ruby/object:Gem::Dependency
196
+ name: opal-jquery
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: '0.4'
202
+ type: :runtime
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "~>"
207
+ - !ruby/object:Gem::Version
208
+ version: '0.4'
209
+ description: Slide any type of content using jquery animate
210
+ email:
211
+ - kostafunphone@gmail.com
212
+ executables: []
213
+ extensions: []
214
+ extra_rdoc_files: []
215
+ files:
216
+ - ".gitignore"
217
+ - ".rspec"
218
+ - Gemfile
219
+ - LICENSE.txt
220
+ - README.md
221
+ - Rakefile
222
+ - app/slider/assets/css/slider.sass
223
+ - app/slider/config/dependencies.rb
224
+ - app/slider/config/initializers/boot.rb
225
+ - app/slider/config/routes.rb
226
+ - app/slider/controllers/main_controller.rb
227
+ - app/slider/views/main/index.html
228
+ - lib/volt/slider.rb
229
+ - lib/volt/slider/version.rb
230
+ - volt-slider.gemspec
231
+ homepage: http://github.com/Kostafun/volt-slider
232
+ licenses:
233
+ - MIT
234
+ metadata: {}
235
+ post_install_message:
236
+ rdoc_options: []
237
+ require_paths:
238
+ - lib
239
+ required_ruby_version: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - ">="
242
+ - !ruby/object:Gem::Version
243
+ version: '0'
244
+ required_rubygems_version: !ruby/object:Gem::Requirement
245
+ requirements:
246
+ - - ">="
247
+ - !ruby/object:Gem::Version
248
+ version: '0'
249
+ requirements: []
250
+ rubyforge_project:
251
+ rubygems_version: 2.4.8
252
+ signing_key:
253
+ specification_version: 4
254
+ summary: Simple slider for volt framework
255
+ test_files: []