scrollytelling-counter 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9a19e343ff242ba0371704d477e1540337bd3f90
4
+ data.tar.gz: 291b0368f40b31b4ac2455c421199a3d43604215
5
+ SHA512:
6
+ metadata.gz: 655038e15c8cd620620883090761e3b133305e28c75e1568a0635eb9288e4d41a2f4cf893af45aca27e1a69f514dfdb0fa52a4f5842cf06f2b8a514cd6dd64f5
7
+ data.tar.gz: 703031787dc55ef2e55ee977213b19c3b3b0cfc1bf4a353b26b01b84a927ea3fdabc5337283e8e3202be4d30a38d226219c8a43fe2c7cdb584480e845fa1a101
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
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.4
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in scrollytelling-counter.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Scrollytelling::Counter
2
+
3
+ [Pageflow](https://github.com/codevise/pageflow) plugin to add a page counter to your stories. Requires a [Scrollytelling](https://github.com/scrollytelling) theme.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'scrollytelling-counter'
11
+ ```
12
+
13
+ Register the plugin inside the configure block in `config/initializers/pageflow.rb`:
14
+
15
+ ```ruby
16
+ Pageflow.configure do |config|
17
+ config.plugin(Scrollytelling::Counter.plugin)
18
+ end
19
+ ```
20
+
21
+ And then execute:
22
+
23
+ $ bundle
24
+
25
+ Or install it yourself as:
26
+
27
+ $ gem install scrollytelling-counter
28
+
29
+ ## Usage
30
+
31
+ Include assets in your theme:
32
+
33
+ ```ruby
34
+ # JavaScript
35
+ //= require scrollytelling/counter
36
+
37
+ # Scss
38
+ @import "scrollytelling/counter";
39
+ ```
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,32 @@
1
+ pageflow.Counter = {
2
+
3
+ placeAfter: $('.options li:first-child'),
4
+
5
+ counter: $('<li class="counter"></li>'),
6
+
7
+ total: pageflow.pages.length,
8
+
9
+ init: function() {
10
+
11
+ this.placeAfter.after(this.counter);
12
+
13
+ // Init first page
14
+ this.setCounter(pageflow.atmo.slideshow.currentPage().index());
15
+
16
+ // Listen to page changes
17
+ pageflow.events.on('page:change', this.updateCounter.bind(this));
18
+
19
+ },
20
+
21
+ setCounter: function(index) {
22
+ var pageNumber = index + 1;
23
+ this.counter.html(pageNumber + " | " + this.total);
24
+ },
25
+
26
+ updateCounter: function(page) {
27
+ this.setCounter(page.index)
28
+ }
29
+
30
+ };
31
+
32
+ pageflow.Counter.init();
@@ -0,0 +1,8 @@
1
+ .options .counter {
2
+ color:#fff;
3
+ font-family: Muli;
4
+ text-align:center;
5
+ font-weight: 700;
6
+ opacity: 0.7;
7
+ text-shadow: 1px 1px #CECECE;
8
+ }
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "scrollytelling/counter"
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,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,16 @@
1
+ require "scrollytelling/counter/version"
2
+ require "scrollytelling/counter/engine"
3
+ require "scrollytelling/counter/plugin"
4
+ require "scrollytelling/counter/widget_type"
5
+
6
+ module Scrollytelling
7
+ module Counter
8
+ def self.plugin
9
+ Plugin.new
10
+ end
11
+
12
+ def self.widget_type
13
+ WidgetType.new
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,7 @@
1
+ module Scrollytelling
2
+ module Counter
3
+ class Engine < Rails::Engine
4
+ isolate_namespace Scrollytelling::Counter
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ module Scrollytelling
2
+ module Counter
3
+ class Plugin < Pageflow::Plugin
4
+ def configure(config)
5
+ config.widget_types.register(Scrollytelling::Counter.widget_type)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ module Scrollytelling
2
+ module Counter
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,13 @@
1
+ module Scrollytelling
2
+ module Counter
3
+ class WidgetType < Pageflow::WidgetType
4
+ def name
5
+ "scrollytelling_counter"
6
+ end
7
+
8
+ def roles
9
+ ['counter']
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'scrollytelling/counter/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "scrollytelling-counter"
8
+ spec.version = Scrollytelling::Counter::VERSION
9
+ spec.authors = ["Joost Baaij"]
10
+ spec.email = ["joost@spacebabies.nl"]
11
+
12
+ spec.summary = "A counter for Pageflow stories."
13
+ spec.homepage = "https://github.com/scrollytelling/scrollytelling-counter"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
+ spec.bindir = "exe"
17
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "pageflow"
21
+
22
+ spec.add_development_dependency "bundler"
23
+ spec.add_development_dependency "rake"
24
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scrollytelling-counter
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-05-26 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'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
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: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description:
56
+ email:
57
+ - joost@spacebabies.nl
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
+ - Gemfile
66
+ - README.md
67
+ - Rakefile
68
+ - app/assets/javascript/scrollytelling/counter.js
69
+ - app/assets/stylesheets/scrollytelling/counter.scss
70
+ - bin/console
71
+ - bin/setup
72
+ - lib/scrollytelling/counter.rb
73
+ - lib/scrollytelling/counter/engine.rb
74
+ - lib/scrollytelling/counter/plugin.rb
75
+ - lib/scrollytelling/counter/version.rb
76
+ - lib/scrollytelling/counter/widget_type.rb
77
+ - scrollytelling-counter.gemspec
78
+ homepage: https://github.com/scrollytelling/scrollytelling-counter
79
+ licenses: []
80
+ metadata: {}
81
+ post_install_message:
82
+ rdoc_options: []
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubyforge_project:
97
+ rubygems_version: 2.2.2
98
+ signing_key:
99
+ specification_version: 4
100
+ summary: A counter for Pageflow stories.
101
+ test_files: []
102
+ has_rdoc: