Skip to content

Commit b4c4b6e

Browse files
committed
adds minimal counter function right in the page
1 parent 88834a9 commit b4c4b6e

File tree

4 files changed

+161
-0
lines changed

4 files changed

+161
-0
lines changed

Gemfile.lock

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
PATH
2+
remote: .
3+
specs:
4+
saddlebag (0.1.0)
5+
rails (~> 6.0.3, >= 6.0.3.2)
6+
7+
GEM
8+
remote: https://rubygems.org/
9+
specs:
10+
actioncable (6.0.3.2)
11+
actionpack (= 6.0.3.2)
12+
nio4r (~> 2.0)
13+
websocket-driver (>= 0.6.1)
14+
actionmailbox (6.0.3.2)
15+
actionpack (= 6.0.3.2)
16+
activejob (= 6.0.3.2)
17+
activerecord (= 6.0.3.2)
18+
activestorage (= 6.0.3.2)
19+
activesupport (= 6.0.3.2)
20+
mail (>= 2.7.1)
21+
actionmailer (6.0.3.2)
22+
actionpack (= 6.0.3.2)
23+
actionview (= 6.0.3.2)
24+
activejob (= 6.0.3.2)
25+
mail (~> 2.5, >= 2.5.4)
26+
rails-dom-testing (~> 2.0)
27+
actionpack (6.0.3.2)
28+
actionview (= 6.0.3.2)
29+
activesupport (= 6.0.3.2)
30+
rack (~> 2.0, >= 2.0.8)
31+
rack-test (>= 0.6.3)
32+
rails-dom-testing (~> 2.0)
33+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
34+
actiontext (6.0.3.2)
35+
actionpack (= 6.0.3.2)
36+
activerecord (= 6.0.3.2)
37+
activestorage (= 6.0.3.2)
38+
activesupport (= 6.0.3.2)
39+
nokogiri (>= 1.8.5)
40+
actionview (6.0.3.2)
41+
activesupport (= 6.0.3.2)
42+
builder (~> 3.1)
43+
erubi (~> 1.4)
44+
rails-dom-testing (~> 2.0)
45+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
46+
activejob (6.0.3.2)
47+
activesupport (= 6.0.3.2)
48+
globalid (>= 0.3.6)
49+
activemodel (6.0.3.2)
50+
activesupport (= 6.0.3.2)
51+
activerecord (6.0.3.2)
52+
activemodel (= 6.0.3.2)
53+
activesupport (= 6.0.3.2)
54+
activestorage (6.0.3.2)
55+
actionpack (= 6.0.3.2)
56+
activejob (= 6.0.3.2)
57+
activerecord (= 6.0.3.2)
58+
marcel (~> 0.3.1)
59+
activesupport (6.0.3.2)
60+
concurrent-ruby (~> 1.0, >= 1.0.2)
61+
i18n (>= 0.7, < 2)
62+
minitest (~> 5.1)
63+
tzinfo (~> 1.1)
64+
zeitwerk (~> 2.2, >= 2.2.2)
65+
builder (3.2.4)
66+
concurrent-ruby (1.1.7)
67+
crass (1.0.6)
68+
erubi (1.9.0)
69+
globalid (0.4.2)
70+
activesupport (>= 4.2.0)
71+
i18n (1.8.5)
72+
concurrent-ruby (~> 1.0)
73+
loofah (2.7.0)
74+
crass (~> 1.0.2)
75+
nokogiri (>= 1.5.9)
76+
mail (2.7.1)
77+
mini_mime (>= 0.1.1)
78+
marcel (0.3.3)
79+
mimemagic (~> 0.3.2)
80+
method_source (1.0.0)
81+
mimemagic (0.3.5)
82+
mini_mime (1.0.2)
83+
mini_portile2 (2.4.0)
84+
minitest (5.14.2)
85+
nio4r (2.5.3)
86+
nokogiri (1.10.10)
87+
mini_portile2 (~> 2.4.0)
88+
rack (2.2.3)
89+
rack-test (1.1.0)
90+
rack (>= 1.0, < 3)
91+
rails (6.0.3.2)
92+
actioncable (= 6.0.3.2)
93+
actionmailbox (= 6.0.3.2)
94+
actionmailer (= 6.0.3.2)
95+
actionpack (= 6.0.3.2)
96+
actiontext (= 6.0.3.2)
97+
actionview (= 6.0.3.2)
98+
activejob (= 6.0.3.2)
99+
activemodel (= 6.0.3.2)
100+
activerecord (= 6.0.3.2)
101+
activestorage (= 6.0.3.2)
102+
activesupport (= 6.0.3.2)
103+
bundler (>= 1.3.0)
104+
railties (= 6.0.3.2)
105+
sprockets-rails (>= 2.0.0)
106+
rails-dom-testing (2.0.3)
107+
activesupport (>= 4.2.0)
108+
nokogiri (>= 1.6)
109+
rails-html-sanitizer (1.3.0)
110+
loofah (~> 2.3)
111+
railties (6.0.3.2)
112+
actionpack (= 6.0.3.2)
113+
activesupport (= 6.0.3.2)
114+
method_source
115+
rake (>= 0.8.7)
116+
thor (>= 0.20.3, < 2.0)
117+
rake (13.0.1)
118+
sprockets (4.0.2)
119+
concurrent-ruby (~> 1.0)
120+
rack (> 1, < 3)
121+
sprockets-rails (3.2.1)
122+
actionpack (>= 4.0)
123+
activesupport (>= 4.0)
124+
sprockets (>= 3.0.0)
125+
thor (1.0.1)
126+
thread_safe (0.3.6)
127+
tzinfo (1.2.7)
128+
thread_safe (~> 0.1)
129+
websocket-driver (0.7.3)
130+
websocket-extensions (>= 0.1.0)
131+
websocket-extensions (0.1.5)
132+
zeitwerk (2.4.0)
133+
134+
PLATFORMS
135+
ruby
136+
137+
DEPENDENCIES
138+
saddlebag!
139+
140+
BUNDLED WITH
141+
2.1.4
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
require_dependency "saddlebag/application_controller"
2+
3+
module Saddlebag
4+
class CounterController < ApplicationController
5+
def index; end
6+
end
7+
end
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<h1>HELLO!</h1>
2+
3+
<p>elapsed since page load: <span id="counter">0</span></p>
4+
5+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
6+
<script>
7+
let loadedAt = new Date().getTime();
8+
let updateFn = setInterval(function() {
9+
let elapsed = (new Date().getTime() - loadedAt)/1000;
10+
document.getElementById("counter").innerHTML = elapsed;
11+
}, 200); // update 5x second for maximum fan usage
12+
</script>

config/routes.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
Saddlebag::Engine.routes.draw do
2+
get '/counter', to: 'counter#index'
23
end

0 commit comments

Comments
 (0)