my_scroll_up 0.1.4 → 1.0.0

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
  SHA256:
3
- metadata.gz: dbd627f1bf69b730b6cc5487db6deb218caa22e4ca1712f6f1fedec330d902dd
4
- data.tar.gz: 23c862dd8d5af6cd0360c1c64cdb0cf503f6763d89cbfb3538bf54ef02e429d4
3
+ metadata.gz: e94e2e9eba136743d387e0f3d70946e9c10495fd0cc8d85079c229f0cf3ad13f
4
+ data.tar.gz: 3f7f3d8630804720fd4eb68a0ec6ad026c7ef11ffbf3afb0b5b39de596cb3568
5
5
  SHA512:
6
- metadata.gz: d7299f15925aca0b667940e26751e0340e70e152f12bcfabb1e733b4f5ac9b507ac143630864c3dda3adec7ef17419a88950da74dccb3decc38b32c2f418fe3b
7
- data.tar.gz: e9b5d082a0763fcce6aa952306060509c877def5b563290ec489e3440c16b77fc5ddf62d418f2b06b77c45a57225096d801ca35e43099e357f3dabb7be0839df
6
+ metadata.gz: fa22c0b3f5c3a45a46556e4b10d993e849d651a8c1956c1d9d3f6ea5483760c6c60eaef7f1e4dc3dc616b9d1b647325c1b9221b715e6f66f546c959e4f08f4fb
7
+ data.tar.gz: 8e1f306ee4ee99446ae18b7d5d526ab83d0d37f9e760232dff18303479a6ab388f855e414562f6bec9304c2218e94b8ddb67d8c97b107fd860e6efeabdf4b7f6
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # MyScrollUp
2
- Primitive scroll up for monolith projects.
2
+ Customizable scroll up for monolith projects.
3
+
4
+ ![Scroll UP](img/Screenshot.png)
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
- Haml:
31
- ```haml
32
- %a#scroll-up{:href => "javascript:"}
33
- %i.icon-chevron-up
34
- ```
35
- Erb:
33
+
36
34
  ```erb
37
- <a id="scroll-up" href="javascript:">
38
- <i class="icon-chevron-up"></i>
39
- </a>
35
+ <head>
36
+ <title>My title</title>
37
+ <%= MyScrollUp.render.html_safe %>
38
+ ...
40
39
  ```
41
- Add requires to js and css:
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
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
@@ -0,0 +1,4 @@
1
+ MyScrollUp.configure do |config|
2
+ # Set this options to what makes sense for you
3
+ # config.icon = 'icon-chevron-up'
4
+ end
@@ -0,0 +1,3 @@
1
+ module MyScrollUp
2
+ class Engine < ::Rails::Engine; end
3
+ end
@@ -1,3 +1,3 @@
1
1
  module MyScrollUp
2
- VERSION = "0.1.4".freeze
2
+ VERSION = '1.0.0'.freeze
3
3
  end
data/lib/my_scroll_up.rb CHANGED
@@ -1,5 +1,36 @@
1
- require "my_scroll_up/version"
1
+ require 'my_scroll_up/version'
2
+ require 'my_scroll_up/engine'
2
3
 
4
+ # Main module
3
5
  module MyScrollUp
4
- class Engine < ::Rails::Engine; end
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 = "my_scroll_up"
7
+ spec.name = 'my_scroll_up'
8
8
  spec.version = MyScrollUp::VERSION
9
- spec.authors = ["Mikhail Melnyk"]
10
- spec.email = ["m1kh41l.melnyk@gmail.com"]
9
+ spec.authors = ['Mikhail Melnyk']
10
+ spec.email = ['m1kh41l.melnyk@gmail.com']
11
11
 
12
- spec.summary = %q{Primitive scroll up for monolith projects.}
13
- spec.description = %q{Primitive scroll up for monolith projects.}
14
- spec.homepage = "https://github.com/sOM2H/my_scroll_up"
15
- spec.license = "MIT"
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 = "exe"
18
+ spec.bindir = 'exe'
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
- spec.require_paths = ["lib"]
20
+ spec.require_paths = ['lib']
21
21
 
22
- spec.add_development_dependency "bundler", "~> 1.11"
23
- spec.add_development_dependency "rake", "~> 10.0"
24
- spec.add_development_dependency "rspec", "~> 3.0"
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) { // If page is scrolled more than 50px
3
- $('#scroll-up').fadeIn(200); // Fade in the arrow
2
+ if ($(this).scrollTop() >= 50) {
3
+ $('#scroll-up').fadeIn(200);
4
4
  } else {
5
- $('#scroll-up').fadeOut(200); // Else fade out the arrow
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.1.4
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-21 00:00:00.000000000 Z
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: Primitive scroll up for monolith projects.
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: Primitive scroll up for monolith projects.
104
+ summary: Scroll up for monolith projects.
101
105
  test_files: []