scrollytelling-pageflow-navigation 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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9ce32d8476a75ae7289d82cbf647ce825f7dde32
4
+ data.tar.gz: df9645600b07c59239fd179cb2d284b5b718ab0e
5
+ SHA512:
6
+ metadata.gz: 850cb41bcd6a732844a8c14aac62d90469313f55f483dd35dd44e34458760fffb703264d1451cf9827faa09964b0c888b8bbaad558fc5c7b397c2ec283835d2a
7
+ data.tar.gz: d6a168ca1664a573fa751c825dc1b36e3095fb04dc3ab4914d1350d352970fca8f372ee3190b324e9d98c6c70fe48b1829bb6f9dc8da6e0a33d832ce231d9c2b
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at joost@spacebabies.nl. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in scrollytelling-pageflow-navigation.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Joost Baaij
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # Scrollytelling::Pageflow::Navigation
2
+
3
+ This Pageflow plugin replaces the built-in Pageflow navigation with the Scrollytelling version.
4
+
5
+ The Scrollytelling navigation uses dots to show progress instead of thumbnails. This plugin does not replace the mobile Pageflow navigation; only the desktop navigation.
6
+
7
+ ## Examples
8
+
9
+ For examples see the various stories on [our homepage](https://www.scrollytelling.io/).
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'scrollytelling-pageflow-navigation'
17
+ ```
18
+
19
+ Bundle the plugin with your application by typing this on the command line:
20
+
21
+ $ bundle
22
+
23
+ ## Usage
24
+
25
+ You will need to register the plugin in the Pageflow initializer and then add it to your asset pipeline.
26
+
27
+ ```
28
+ # config/initializers/pageflow.rb
29
+ config.plugin(Scrollytelling::Pageflow::Navigation::Plugin.new)
30
+
31
+ # app/assets/javascripts/pageflow/application.js
32
+ //= require scrollytelling/pageflow/navigation
33
+
34
+ # app/assets/stylesheets/pageflow/application.css.scss
35
+ @import "scrollytelling/pageflow/navigation";
36
+ ```
37
+
38
+ After all that, restart your application server.
39
+
40
+ ## Development
41
+
42
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
43
+
44
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
45
+
46
+ ## Contributing
47
+
48
+ Bug reports and pull requests are welcome on GitHub at https://github.com/scrollytelling/scrollytelling-pageflow-navigation. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
49
+
50
+
51
+ ## License
52
+
53
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,2 @@
1
+ //= require ./navigation/invert
2
+ //= require ./navigation/counter
@@ -0,0 +1,38 @@
1
+ pageflow.Counter = {
2
+ navigation: function() {
3
+ return $('#scrollytelling-pageflow-navigation')
4
+ },
5
+
6
+ setActive: function(page) {
7
+ this.navigation().find('a').removeClass('active');
8
+ this.navigation().find('a[href="#'+page.id+'"]').addClass('active');
9
+ },
10
+
11
+ updateActive: function(page) {
12
+ this.setActive(page.element[0]);
13
+ },
14
+
15
+ init: function() {
16
+ // Init active dot
17
+ this.setActive(pageflow.atmo.slideshow.currentPage()[0]);
18
+
19
+ // Listen to page changes
20
+ pageflow.events.on('page:change', this.updateActive.bind(this));
21
+
22
+ // Set click handler
23
+ $('a', this.navigation()).on('click', this.onClick);
24
+ },
25
+
26
+ onClick(event) {
27
+ event.preventDefault();
28
+
29
+ var page_id = $(this).attr('data-page-id');
30
+
31
+ pageflow.atmo.slideshow.goToById(page_id);
32
+ }
33
+
34
+ }
35
+
36
+ pageflow.ready.then(function() {
37
+ pageflow.Counter.init();
38
+ });
@@ -0,0 +1,27 @@
1
+ // Set class .page-invert on body if the active page has the class .invert
2
+ pageflow.Invert = {
3
+
4
+ container: $('body'),
5
+
6
+ changeInvert: function(page) {
7
+ this.setInvert(page.element[0]);
8
+ },
9
+
10
+ setInvert: function(page_element) {
11
+ $(page_element).hasClass('invert') ? this.container.addClass('page-invert') : this.container.removeClass('page-invert');
12
+ },
13
+
14
+ init: function() {
15
+
16
+ // Set inverted class on first load
17
+ this.setInvert(pageflow.atmo.slideshow.currentPage()[0]);
18
+
19
+ // Listen to page changes
20
+ pageflow.events.on('page:change', this.changeInvert.bind(this));
21
+
22
+ }
23
+ }
24
+
25
+ pageflow.ready.then(function() {
26
+ pageflow.Invert.init();
27
+ });
@@ -0,0 +1,135 @@
1
+ @media screen and (max-width: 768px) {
2
+ #scrollytelling-pageflow-navigation {
3
+ display: none;
4
+ }
5
+ }
6
+
7
+ #scrollytelling-pageflow-navigation {
8
+ right: 2.3%;
9
+ position: fixed;
10
+ z-index: 100;
11
+ top: 50%;
12
+ opacity: 1;
13
+ transform: translateY(-50%);
14
+
15
+ ul {
16
+ margin: 0;
17
+ padding: 0;
18
+ list-style: none;
19
+ }
20
+
21
+ li {
22
+ display: block;
23
+ width: 14px;
24
+ height: 13px;
25
+ margin: 7px;
26
+ position: relative;
27
+ }
28
+
29
+ li:hover {
30
+ a span {
31
+ width: 10px;
32
+ height: 10px;
33
+ margin: -5px 0 0 -5px;
34
+ }
35
+
36
+ .scrollytelling-pageflow-navigation-tooltip {
37
+ transition: opacity 0.2s ease-in;
38
+ width: auto;
39
+ opacity: 1;
40
+ display: block;
41
+
42
+ &:empty {
43
+ display: none;
44
+ }
45
+ }
46
+ }
47
+
48
+ a {
49
+ display: block;
50
+ position: relative;
51
+ z-index: 1;
52
+ width: 100%;
53
+ height: 100%;
54
+ cursor: pointer;
55
+ text-decoration: none;
56
+
57
+ span {
58
+ border-radius: 50%;
59
+ position: absolute;
60
+ z-index: 1;
61
+ height: 4px;
62
+ width: 4px;
63
+ border: 0;
64
+ background: white;
65
+ left: 50%;
66
+ top: 50%;
67
+ margin: -2px 0 0 -2px;
68
+ transition: all 0.1s ease-in-out;
69
+ }
70
+
71
+ &.active span {
72
+ height: 12px;
73
+ width: 12px;
74
+ margin: -6px 0 0 -6px;
75
+ border-radius: 100%;
76
+ }
77
+ }
78
+
79
+ .scrollytelling-pageflow-navigation-tooltip {
80
+ $bg-color: #000;
81
+
82
+ right: 20px;
83
+ position: absolute;
84
+ top: -7px;
85
+ color: white;
86
+ font-size: 14px;
87
+ white-space: nowrap;
88
+ max-width: 220px;
89
+ opacity: 0;
90
+ width: 0;
91
+ cursor: pointer;
92
+ line-height: 1;
93
+ display: none;
94
+
95
+ background-color: $bg-color;
96
+ padding: 6px;
97
+ padding-right: 20px;
98
+ border-radius: 3px;
99
+
100
+ &:after {
101
+ left: 100%;
102
+ top: 50%;
103
+ border: solid transparent;
104
+ content: " ";
105
+ height: 0;
106
+ width: 0;
107
+ position: absolute;
108
+ pointer-events: none;
109
+ border-color: rgba(255, 255, 255, 0);
110
+ border-left-color: $bg-color;
111
+ border-width: 5px;
112
+ margin-top: -5px;
113
+ }
114
+
115
+ }
116
+
117
+ .page-invert & {
118
+ a span {
119
+ background: black;
120
+ }
121
+
122
+ .scrollytelling-pageflow-navigation-tooltip {
123
+
124
+ $bg-color: #fff;
125
+
126
+ color: black;
127
+ background-color: $bg-color;
128
+
129
+ &:after {
130
+ border-left-color: $bg-color;
131
+ }
132
+
133
+ }
134
+ }
135
+ }
@@ -0,0 +1,7 @@
1
+ <nav id="scrollytelling-pageflow-navigation">
2
+ <ul>
3
+ <% entry.pages.displayed_in_navigation.each do |page| %>
4
+ <li><a href="#<%= page.perma_id %>" data-page-id="<%= page.id %>"><span></span></a><div class="scrollytelling-pageflow-navigation-tooltip"><%= page.configuration["title"] %></div></li>
5
+ <% end %>
6
+ </ul>
7
+ </nav>
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "scrollytelling/pageflow/navigation"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,14 @@
1
+ require "scrollytelling/pageflow/navigation/version"
2
+ require "scrollytelling/pageflow/navigation/plugin"
3
+ require "scrollytelling/pageflow/navigation/widget_type"
4
+ require "scrollytelling/pageflow/navigation/engine"
5
+
6
+ module Scrollytelling
7
+ module Pageflow
8
+ module Navigation
9
+ def self.widget_type
10
+ WidgetType.new
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,11 @@
1
+ require 'rails/engine'
2
+
3
+ module Scrollytelling
4
+ module Pageflow
5
+ module Navigation
6
+ class Engine < ::Rails::Engine
7
+ isolate_namespace Scrollytelling::Pageflow::Navigation
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ require 'pageflow/plugin'
2
+
3
+ module Scrollytelling
4
+ module Pageflow
5
+ module Navigation
6
+ class Plugin < ::Pageflow::Plugin
7
+ def configure(config)
8
+ config.widget_types.register(Scrollytelling::Pageflow::Navigation.widget_type, default: true)
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,7 @@
1
+ module Scrollytelling
2
+ module Pageflow
3
+ module Navigation
4
+ VERSION = "0.1.0"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,21 @@
1
+ require 'pageflow/widget_type'
2
+
3
+ module Scrollytelling
4
+ module Pageflow
5
+ module Navigation
6
+ class WidgetType < ::Pageflow::WidgetType
7
+ def name
8
+ 'scrollytelling-pageflow-navigation'
9
+ end
10
+
11
+ def roles
12
+ ['navigation']
13
+ end
14
+
15
+ def render(template, entry)
16
+ template.render('scrollytelling/pageflow/navigation/widget.html.erb', entry: entry)
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'scrollytelling/pageflow/navigation/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "scrollytelling-pageflow-navigation"
8
+ spec.version = Scrollytelling::Pageflow::Navigation::VERSION
9
+ spec.authors = ["Joost Baaij"]
10
+ spec.email = ["joost@spacebabies.nl"]
11
+
12
+ spec.summary = "Replace Pageflow navigation with Scrollytelling navigation"
13
+ spec.homepage = "https://github.com/scrollytelling/scrollytelling-pageflow-navigation"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_runtime_dependency 'pageflow', '>= 0.7'
22
+ spec.add_runtime_dependency 'rails', '>= 3.0'
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.11"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec", "~> 3.0"
27
+ end
metadata ADDED
@@ -0,0 +1,135 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scrollytelling-pageflow-navigation
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Joost Baaij
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-06-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pageflow
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0.7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.11'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.11'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ description:
84
+ email:
85
+ - joost@spacebabies.nl
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".rspec"
92
+ - CODE_OF_CONDUCT.md
93
+ - Gemfile
94
+ - LICENSE.txt
95
+ - README.md
96
+ - Rakefile
97
+ - app/assets/javascripts/scrollytelling/pageflow/navigation.js
98
+ - app/assets/javascripts/scrollytelling/pageflow/navigation/counter.js
99
+ - app/assets/javascripts/scrollytelling/pageflow/navigation/invert.js
100
+ - app/assets/stylesheets/scrollytelling/pageflow/navigation.scss
101
+ - app/views/scrollytelling/pageflow/navigation/_widget.html.erb
102
+ - bin/console
103
+ - bin/setup
104
+ - lib/scrollytelling/pageflow/navigation.rb
105
+ - lib/scrollytelling/pageflow/navigation/engine.rb
106
+ - lib/scrollytelling/pageflow/navigation/plugin.rb
107
+ - lib/scrollytelling/pageflow/navigation/version.rb
108
+ - lib/scrollytelling/pageflow/navigation/widget_type.rb
109
+ - scrollytelling-pageflow-navigation.gemspec
110
+ homepage: https://github.com/scrollytelling/scrollytelling-pageflow-navigation
111
+ licenses:
112
+ - MIT
113
+ metadata: {}
114
+ post_install_message:
115
+ rdoc_options: []
116
+ require_paths:
117
+ - lib
118
+ required_ruby_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ required_rubygems_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ requirements: []
129
+ rubyforge_project:
130
+ rubygems_version: 2.4.8
131
+ signing_key:
132
+ specification_version: 4
133
+ summary: Replace Pageflow navigation with Scrollytelling navigation
134
+ test_files: []
135
+ has_rdoc: