dev_toolbar 1.0.0 → 1.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae8544fc0deb66a6da156b87729c736b2ea98651f3eb16ba1f236b0fdb10e3f9
4
- data.tar.gz: 34880d9149ff1891f3945535568540a3a197b2a5053c4bbff950bc2648c332fd
3
+ metadata.gz: 2c3346cbc6911631a8ab5f783fd8c3f1cce6aee3ff8347f8f733327fc2cdf2f5
4
+ data.tar.gz: dc5718868ec6d26a22f4c6c1dae9cbd7981afb3ea96b20f309b86f54106fd253
5
5
  SHA512:
6
- metadata.gz: 3caf66b8f84258900547d13aa0381375241c13b1de0b0ba8a8a733df8ae4c98f98a49fe66bfff1bb6a482d03a0ce067f744e955879b0cbaa1c4877ae1d11b145
7
- data.tar.gz: ee2fc25df5ac895cc2b6a56f5e43eaa6beeb77c3a2df92624a955bfdbaf8cf8b3d9aea019647beabce6a9af428849102d56200528b31abb1117acddb9db433cd
6
+ metadata.gz: e9248fce47ce7b823952f317c51634012df65d95e05f62f897c06771a969e2b374f4fcc8f337e7f5bacce69868976b44af561abff46086da1ead1e946ef50f36
7
+ data.tar.gz: 858c55b8fab494d9a6d60f928d28bdc3eb0bb44f51888ea25edde8af8a88631f1abbad6088b1932111d3e5b8474f7cd1a1998d822616d21a148004461a5ed8a9
@@ -11,24 +11,61 @@ module DevToolbar
11
11
  response_body = response.body
12
12
  toolbar_html = <<-HTML
13
13
  <div id="dev-toolbar">
14
- #{toolbar_links}
14
+ <div id="dev-toolbar-button">
15
+ <a id="dev-toolbar-toggle">🛠️</a>
16
+ </div>
17
+ <div id="dev-toolbar-links" class="hidden">
18
+ #{toolbar_links}
19
+ </div>
15
20
  </div>
16
21
  <style>
17
22
  #dev-toolbar {
18
23
  position: fixed;
19
24
  right: 0;
20
- top: 0;
21
- background: #333;
22
- color: #fff;
23
- padding: 0.5rem;
25
+ top: 50vh;
26
+ transform: translateY(-50%);
27
+ background-color: #f0f0f0;
28
+ border: 1px solid #ccc;
24
29
  z-index: 1000;
30
+ display: flex;
31
+ flex-direction: column;
32
+ align-items: center;
33
+ font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif;
34
+ color: #808080;
35
+ }
36
+
37
+ #dev-toolbar-toggle {
38
+ font-size: 2em;
39
+ border: none;
40
+ cursor: pointer;
41
+ line-height: 1.5;
42
+ padding: 0 10px;
43
+ text-decoration: none;
44
+ }
45
+
46
+ #dev-toolbar-links {
47
+ display: flex;
48
+ flex-direction: column;
25
49
  }
26
50
 
27
- #dev-toolbar a {
28
- color: #fff;
29
- margin-right: 0.5rem;
51
+ .dev-toolbar-link {
52
+ padding: 5px 10px;
53
+ border-bottom: 1px #f0f0f0 solid;
54
+ color: #808080;
55
+ text-decoration: none;
56
+ background-color: white;
57
+ }
58
+
59
+ #dev-toolbar-links.hidden {
60
+ display: none;
30
61
  }
31
62
  </style>
63
+ <script>
64
+ document.getElementById('dev-toolbar-toggle').addEventListener('click', function() {
65
+ var links = document.getElementById('dev-toolbar-links');
66
+ links.classList.toggle('hidden');
67
+ });
68
+ </script>
32
69
  HTML
33
70
 
34
71
  response_body.sub!('</body>', "#{toolbar_html}</body>")
@@ -44,8 +81,13 @@ module DevToolbar
44
81
 
45
82
  def toolbar_links
46
83
  DevToolbar.configuration.links.map do |link|
47
- "<a href='#{link[:path]}' target='_blank'>#{link[:name]}</a>"
48
- end.join(' ')
84
+ # if the erd.png file does not exist in /public, don't show the link
85
+ if link[:name] == "Data Model" && !File.exist?(Rails.public_path.join("erd.png"))
86
+ next
87
+ else
88
+ "<a href='#{link[:path]}' target='_blank' class='dev-toolbar-link'>#{link[:name]}</a>"
89
+ end
90
+ end.compact.join(" ")
49
91
  end
50
92
  end
51
93
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DevToolbar
4
- VERSION = "1.0.0"
4
+ VERSION = "1.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dev_toolbar
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Purinton
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-07 00:00:00.000000000 Z
11
+ date: 2024-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails