scrollytelling-counter 0.1.0 → 0.2.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
  SHA1:
3
- metadata.gz: 9a19e343ff242ba0371704d477e1540337bd3f90
4
- data.tar.gz: 291b0368f40b31b4ac2455c421199a3d43604215
3
+ metadata.gz: 35cd95942dcabc85332e75a0f03c35a218112ce5
4
+ data.tar.gz: b492d325261f30819a53dba6586aa346990bcb90
5
5
  SHA512:
6
- metadata.gz: 655038e15c8cd620620883090761e3b133305e28c75e1568a0635eb9288e4d41a2f4cf893af45aca27e1a69f514dfdb0fa52a4f5842cf06f2b8a514cd6dd64f5
7
- data.tar.gz: 703031787dc55ef2e55ee977213b19c3b3b0cfc1bf4a353b26b01b84a927ea3fdabc5337283e8e3202be4d30a38d226219c8a43fe2c7cdb584480e845fa1a101
6
+ metadata.gz: b86e1c0802dd9f249dec2d032893c4f7305c2b27d2de0bba156f1fe1065e115072b186a9dc58c08aef4f9836ae1434ec97fce7c6e3285f7d5b581e97909e18d3
7
+ data.tar.gz: 3063d8a71666bf167573dc355942e4fc62dc6d993cd0c8ddb06491b9598d7ff3a32eb06cd5e8fe1be628648bcbbc5a92cf620af7ccdd4376efa74e2a5a6db0ab
data/README.md CHANGED
@@ -31,9 +31,6 @@ Or install it yourself as:
31
31
  Include assets in your theme:
32
32
 
33
33
  ```ruby
34
- # JavaScript
35
- //= require scrollytelling/counter
36
-
37
34
  # Scss
38
35
  @import "scrollytelling/counter";
39
36
  ```
@@ -0,0 +1,28 @@
1
+ <script>
2
+ pageflow.Counter = {
3
+ placeAfter: $('.options li:first-child'),
4
+ counter: $('<li class="counter"></li>'),
5
+ total: pageflow.pages.length,
6
+
7
+ init: function() {
8
+ this.placeAfter.after(this.counter);
9
+
10
+ // Init first page
11
+ this.setCounter(pageflow.atmo.slideshow.currentPage().index());
12
+
13
+ // Listen to page changes
14
+ pageflow.events.on('page:change', this.updateCounter.bind(this));
15
+ },
16
+
17
+ setCounter: function(index) {
18
+ var pageNumber = index + 1;
19
+ this.counter.html(pageNumber + " | " + this.total);
20
+ },
21
+
22
+ updateCounter: function(page) {
23
+ this.setCounter(page.index)
24
+ }
25
+ };
26
+
27
+ pageflow.Counter.init();
28
+ </script>
@@ -1,5 +1,5 @@
1
1
  module Scrollytelling
2
2
  module Counter
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -8,6 +8,9 @@ module Scrollytelling
8
8
  def roles
9
9
  ['counter']
10
10
  end
11
+
12
+ def render(template, entry)
13
+ template.render('scrollytelling/counter/widget.html.erb')
11
14
  end
12
15
  end
13
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrollytelling-counter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joost Baaij
@@ -67,6 +67,7 @@ files:
67
67
  - Rakefile
68
68
  - app/assets/javascript/scrollytelling/counter.js
69
69
  - app/assets/stylesheets/scrollytelling/counter.scss
70
+ - app/views/scrollytelling/counter/widget.html.erb
70
71
  - bin/console
71
72
  - bin/setup
72
73
  - lib/scrollytelling/counter.rb