my_scroll_up 0.1.4 → 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/README.md +28 -12
- data/img/Screenshot.png +0 -0
- data/lib/generators/my_scroll_up/install_generator.rb +15 -0
- data/lib/generators/templates/my_scroll_up_initializer.rb +4 -0
- data/lib/my_scroll_up/engine.rb +3 -0
- data/lib/my_scroll_up/version.rb +1 -1
- data/lib/my_scroll_up.rb +33 -2
- data/my_scroll_up.gemspec +12 -12
- data/vendor/assets/javascripts/my_scroll_up.js +3 -3
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e94e2e9eba136743d387e0f3d70946e9c10495fd0cc8d85079c229f0cf3ad13f
|
4
|
+
data.tar.gz: 3f7f3d8630804720fd4eb68a0ec6ad026c7ef11ffbf3afb0b5b39de596cb3568
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa22c0b3f5c3a45a46556e4b10d993e849d651a8c1956c1d9d3f6ea5483760c6c60eaef7f1e4dc3dc616b9d1b647325c1b9221b715e6f66f546c959e4f08f4fb
|
7
|
+
data.tar.gz: 8e1f306ee4ee99446ae18b7d5d526ab83d0d37f9e760232dff18303479a6ab388f855e414562f6bec9304c2218e94b8ddb67d8c97b107fd860e6efeabdf4b7f6
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# MyScrollUp
|
2
|
-
|
2
|
+
Customizable scroll up for monolith projects.
|
3
|
+
|
4
|
+

|
3
5
|
## Installation
|
4
6
|
|
5
7
|
Add this line to your application's Gemfile:
|
@@ -13,8 +15,9 @@ And then execute:
|
|
13
15
|
|
14
16
|
$ gem install my_scroll_up
|
15
17
|
$ bundle install
|
18
|
+
$ rails g my_scroll_up:install
|
16
19
|
|
17
|
-
If you don't use bootsrap, then add to your head:
|
20
|
+
If you don't use bootsrap, then add this line to your head:
|
18
21
|
|
19
22
|
```html
|
20
23
|
...
|
@@ -27,18 +30,14 @@ Add this code to your body:
|
|
27
30
|
|
28
31
|
`app/views/layouts/application.html.erb`
|
29
32
|
|
30
|
-
|
31
|
-
```haml
|
32
|
-
%a#scroll-up{:href => "javascript:"}
|
33
|
-
%i.icon-chevron-up
|
34
|
-
```
|
35
|
-
Erb:
|
33
|
+
|
36
34
|
```erb
|
37
|
-
<
|
38
|
-
<
|
39
|
-
|
35
|
+
<head>
|
36
|
+
<title>My title</title>
|
37
|
+
<%= MyScrollUp.render.html_safe %>
|
38
|
+
...
|
40
39
|
```
|
41
|
-
Add
|
40
|
+
Add requirements to js and css:
|
42
41
|
|
43
42
|
`app/assets/javascripts/application.js`
|
44
43
|
|
@@ -56,3 +55,20 @@ Add requires to js and css:
|
|
56
55
|
*= require my_scroll_up
|
57
56
|
...
|
58
57
|
```
|
58
|
+
## Usage:
|
59
|
+
|
60
|
+
You can customize your icon style:
|
61
|
+
(Default 'icon-chevron-up')
|
62
|
+
|
63
|
+
`/app/config/initializers/my_scroll_up.rb`
|
64
|
+
|
65
|
+
```ruby
|
66
|
+
MyScrollUp.configure do |config|
|
67
|
+
# Set icon style example
|
68
|
+
# config.icon = 'icon-chevron-up'
|
69
|
+
end
|
70
|
+
```
|
71
|
+
|
72
|
+
## License
|
73
|
+
|
74
|
+
The MIT License
|
data/img/Screenshot.png
ADDED
Binary file
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module MyScrollUp
|
2
|
+
module Generators
|
3
|
+
# Default Rails::Generators::Base InstallGenerator
|
4
|
+
class InstallGenerator < Rails::Generators::Base
|
5
|
+
source_root File.expand_path('../../templates', __FILE__)
|
6
|
+
desc 'Creates Jem initializer for your application'
|
7
|
+
|
8
|
+
def copy_initializer
|
9
|
+
template 'my_scroll_up_initializer.rb', 'config/initializers/my_scroll_up.rb'
|
10
|
+
|
11
|
+
puts 'Install complete.'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/my_scroll_up/version.rb
CHANGED
data/lib/my_scroll_up.rb
CHANGED
@@ -1,5 +1,36 @@
|
|
1
|
-
require
|
1
|
+
require 'my_scroll_up/version'
|
2
|
+
require 'my_scroll_up/engine'
|
2
3
|
|
4
|
+
# Main module
|
3
5
|
module MyScrollUp
|
4
|
-
class
|
6
|
+
class << self
|
7
|
+
attr_accessor :configuration
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.configure
|
11
|
+
self.configuration ||= Configuration.new
|
12
|
+
yield(configuration)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Configuration class
|
16
|
+
class Configuration
|
17
|
+
attr_accessor :icon
|
18
|
+
|
19
|
+
def initialize
|
20
|
+
@icon = 'icon-chevron-up'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.render
|
25
|
+
scroll = '<a id="scroll-up"><i'
|
26
|
+
if MyScrollUp.configuration.icon.nil?
|
27
|
+
scroll << ' class="icon-chevron-up">'
|
28
|
+
else
|
29
|
+
scroll << ' class="'
|
30
|
+
scroll << MyScrollUp.configuration.icon.to_s
|
31
|
+
scroll << '">'
|
32
|
+
end
|
33
|
+
scroll << '</i></a>'
|
34
|
+
scroll
|
35
|
+
end
|
5
36
|
end
|
data/my_scroll_up.gemspec
CHANGED
@@ -4,22 +4,22 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'my_scroll_up/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'my_scroll_up'
|
8
8
|
spec.version = MyScrollUp::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['Mikhail Melnyk']
|
10
|
+
spec.email = ['m1kh41l.melnyk@gmail.com']
|
11
11
|
|
12
|
-
spec.summary = %q{
|
13
|
-
spec.description = %q{
|
14
|
-
spec.homepage =
|
15
|
-
spec.license =
|
12
|
+
spec.summary = %q{Scroll up for monolith projects.}
|
13
|
+
spec.description = %q{Customizable scroll up for monolith projects.}
|
14
|
+
spec.homepage = 'https://github.com/sOM2H/my_scroll_up'
|
15
|
+
spec.license = 'MIT'
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
-
spec.bindir =
|
18
|
+
spec.bindir = 'exe'
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
-
spec.require_paths = [
|
20
|
+
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.add_development_dependency
|
23
|
-
spec.add_development_dependency
|
24
|
-
spec.add_development_dependency
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.11'
|
23
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
24
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
25
25
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
$(window).scroll(function() {
|
2
|
-
if ($(this).scrollTop() >= 50) {
|
3
|
-
$('#scroll-up').fadeIn(200);
|
2
|
+
if ($(this).scrollTop() >= 50) {
|
3
|
+
$('#scroll-up').fadeIn(200);
|
4
4
|
} else {
|
5
|
-
$('#scroll-up').fadeOut(200);
|
5
|
+
$('#scroll-up').fadeOut(200);
|
6
6
|
}
|
7
7
|
});
|
8
8
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: my_scroll_up
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikhail Melnyk
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
-
description:
|
55
|
+
description: Customizable scroll up for monolith projects.
|
56
56
|
email:
|
57
57
|
- m1kh41l.melnyk@gmail.com
|
58
58
|
executables: []
|
@@ -69,7 +69,11 @@ files:
|
|
69
69
|
- Rakefile
|
70
70
|
- bin/console
|
71
71
|
- bin/setup
|
72
|
+
- img/Screenshot.png
|
73
|
+
- lib/generators/my_scroll_up/install_generator.rb
|
74
|
+
- lib/generators/templates/my_scroll_up_initializer.rb
|
72
75
|
- lib/my_scroll_up.rb
|
76
|
+
- lib/my_scroll_up/engine.rb
|
73
77
|
- lib/my_scroll_up/version.rb
|
74
78
|
- my_scroll_up.gemspec
|
75
79
|
- vendor/assets/javascripts/my_scroll_up.js
|
@@ -97,5 +101,5 @@ rubyforge_project:
|
|
97
101
|
rubygems_version: 2.7.6
|
98
102
|
signing_key:
|
99
103
|
specification_version: 4
|
100
|
-
summary:
|
104
|
+
summary: Scroll up for monolith projects.
|
101
105
|
test_files: []
|