ribbonit 0.2.1 → 1.0.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 +5 -5
- data/.rubocop.yml +9 -1
- data/CHANGELOG.md +69 -21
- data/README.md +32 -25
- data/app/assets/stylesheets/ribbon.css +204 -0
- data/{lib/app/views/partials → app/views/application}/_lines.html.erb +7 -1
- data/{lib/app/views/partials → app/views/application}/_ribbon.html.erb +3 -3
- data/lib/generators/ribbonit/templates/ribbonit.rb +5 -5
- data/lib/ribbonit/configuration.rb +16 -16
- data/lib/ribbonit/rails/engine.rb +1 -4
- data/lib/ribbonit/version.rb +1 -1
- data/lib/ribbonit/view_helpers.rb +22 -13
- data/ribbonit.gemspec +1 -2
- metadata +13 -28
- data/vendor/assets/stylesheets/_ribbon.sass +0 -143
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: c5ca8f4d7bea650a675a768118ad09ebcf436cbe95f030e32f24cb2531a92e2e
|
|
4
|
+
data.tar.gz: 0af1f3378026d75532001084c855a4db7ab9a2542d10a746ff559ed5c7dee821
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ab01f4f2611da1cc2d1b39c29aa6715e0aee4d2bea0838c045c51ec74a4592a6d85ba034994a1bab88b806cdb3d310af3f0a13d0c3cac58a40403514146d793f
|
|
7
|
+
data.tar.gz: 82f5751ad0cd9a167f7732ec2e536ee3ccaf7cb9a773a11e90310ff725b054423dc64a926cca169775c5b7097b7a6c8ad7e07eed0c380e8bb1d0efd0805a9471
|
data/.rubocop.yml
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
inherit_from:
|
|
1
|
+
inherit_from:
|
|
2
|
+
- https://raw.githubusercontent.com/anthony-robin/rubocop-rules/master/.rubocop-bundler.yml
|
|
3
|
+
- https://raw.githubusercontent.com/anthony-robin/rubocop-rules/master/.rubocop-layout.yml
|
|
4
|
+
- https://raw.githubusercontent.com/anthony-robin/rubocop-rules/master/.rubocop-lint.yml
|
|
5
|
+
- https://raw.githubusercontent.com/anthony-robin/rubocop-rules/master/.rubocop-naming.yml
|
|
6
|
+
- https://raw.githubusercontent.com/anthony-robin/rubocop-rules/master/.rubocop-performance.yml
|
|
7
|
+
- https://raw.githubusercontent.com/anthony-robin/rubocop-rules/master/.rubocop-style.yml
|
|
8
|
+
- https://raw.githubusercontent.com/anthony-robin/rubocop-rules/master/.rubocop-rails.yml
|
|
2
9
|
|
|
3
10
|
AllCops:
|
|
11
|
+
DisabledByDefault: true
|
|
4
12
|
TargetRubyVersion: 2.4
|
data/CHANGELOG.md
CHANGED
|
@@ -1,40 +1,88 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changelog
|
|
2
2
|
|
|
3
|
-
## [
|
|
4
|
-
|
|
3
|
+
## [Unreleased](https://github.com/anthony-robin/ribbonit/tree/HEAD)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://github.com/anthony-robin/ribbonit/compare/v1.0.0...HEAD)
|
|
6
|
+
|
|
7
|
+
**Closed issues:**
|
|
8
|
+
|
|
9
|
+
- +YJIT [\#27](https://github.com/anthony-robin/ribbonit/issues/27)
|
|
10
|
+
- config for production [\#22](https://github.com/anthony-robin/ribbonit/issues/22)
|
|
11
|
+
|
|
12
|
+
## [v1.0.0](https://github.com/anthony-robin/ribbonit/tree/v1.0.0) (2023-12-09)
|
|
13
|
+
|
|
14
|
+
[Full Changelog](https://github.com/anthony-robin/ribbonit/compare/v0.3.0...v1.0.0)
|
|
15
|
+
|
|
16
|
+
**Implemented enhancements:**
|
|
17
|
+
|
|
18
|
+
- USE `I18n` files to store hardcoded texts [\#9](https://github.com/anthony-robin/ribbonit/issues/9)
|
|
19
|
+
- Add `extra_content` configuration option [\#28](https://github.com/anthony-robin/ribbonit/pull/28) ([anthony-robin](https://github.com/anthony-robin))
|
|
20
|
+
|
|
21
|
+
**Closed issues:**
|
|
22
|
+
|
|
23
|
+
- ADD option to display 'server' name [\#20](https://github.com/anthony-robin/ribbonit/issues/20)
|
|
24
|
+
- ADD specs [\#15](https://github.com/anthony-robin/ribbonit/issues/15)
|
|
25
|
+
|
|
26
|
+
## [v0.3.0](https://github.com/anthony-robin/ribbonit/tree/v0.3.0) (2017-11-06)
|
|
27
|
+
|
|
28
|
+
[Full Changelog](https://github.com/anthony-robin/ribbonit/compare/v0.2.1...v0.3.0)
|
|
5
29
|
|
|
6
30
|
**Implemented enhancements:**
|
|
7
31
|
|
|
8
|
-
- REFACTOR
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
32
|
+
- REFACTOR way to define environments to apply [\#25](https://github.com/anthony-robin/ribbonit/pull/25) ([anthony-robin](https://github.com/anthony-robin))
|
|
33
|
+
- UPDATE Rubocop sources [\#24](https://github.com/anthony-robin/ribbonit/pull/24) ([anthony-robin](https://github.com/anthony-robin))
|
|
34
|
+
|
|
35
|
+
**Merged pull requests:**
|
|
36
|
+
|
|
37
|
+
- CLEAN documentation options [\#26](https://github.com/anthony-robin/ribbonit/pull/26) ([anthony-robin](https://github.com/anthony-robin))
|
|
38
|
+
|
|
39
|
+
## [v0.2.1](https://github.com/anthony-robin/ribbonit/tree/v0.2.1) (2017-06-04)
|
|
40
|
+
|
|
41
|
+
[Full Changelog](https://github.com/anthony-robin/ribbonit/compare/v0.2.0...v0.2.1)
|
|
42
|
+
|
|
43
|
+
**Fixed bugs:**
|
|
44
|
+
|
|
45
|
+
- FIX broken CSS [\#21](https://github.com/anthony-robin/ribbonit/pull/21) ([anthony-robin](https://github.com/anthony-robin))
|
|
46
|
+
|
|
47
|
+
## [v0.2.0](https://github.com/anthony-robin/ribbonit/tree/v0.2.0) (2017-05-28)
|
|
48
|
+
|
|
49
|
+
[Full Changelog](https://github.com/anthony-robin/ribbonit/compare/v0.1.0...v0.2.0)
|
|
50
|
+
|
|
51
|
+
**Implemented enhancements:**
|
|
52
|
+
|
|
53
|
+
- REFACTOR style using BEM syntax [\#19](https://github.com/anthony-robin/ribbonit/pull/19) ([anthony-robin](https://github.com/anthony-robin))
|
|
54
|
+
- ADD 'root\_link' option that wraps ribbon [\#18](https://github.com/anthony-robin/ribbonit/pull/18) ([anthony-robin](https://github.com/anthony-robin))
|
|
55
|
+
- ADD Changelog file [\#17](https://github.com/anthony-robin/ribbonit/pull/17) ([anthony-robin](https://github.com/anthony-robin))
|
|
56
|
+
- ADD 'git\_branch' option [\#14](https://github.com/anthony-robin/ribbonit/pull/14) ([anthony-robin](https://github.com/anthony-robin))
|
|
57
|
+
- ADD 'sticky' option [\#13](https://github.com/anthony-robin/ribbonit/pull/13) ([anthony-robin](https://github.com/anthony-robin))
|
|
58
|
+
- USE Array for infos [\#12](https://github.com/anthony-robin/ribbonit/pull/12) ([anthony-robin](https://github.com/anthony-robin))
|
|
59
|
+
- REPLACE 'minitest' by 'rspec' [\#8](https://github.com/anthony-robin/ribbonit/pull/8) ([anthony-robin](https://github.com/anthony-robin))
|
|
60
|
+
- ADD Codacy badges [\#5](https://github.com/anthony-robin/ribbonit/pull/5) ([anthony-robin](https://github.com/anthony-robin))
|
|
61
|
+
- ADD Gemnasium badge [\#4](https://github.com/anthony-robin/ribbonit/pull/4) ([anthony-robin](https://github.com/anthony-robin))
|
|
62
|
+
- ADD badge displaying 'gem' version [\#3](https://github.com/anthony-robin/ribbonit/pull/3) ([anthony-robin](https://github.com/anthony-robin))
|
|
18
63
|
|
|
19
64
|
**Fixed bugs:**
|
|
20
65
|
|
|
21
|
-
- RUN specs with Travis [\#7](https://github.com/anthony-robin/
|
|
66
|
+
- RUN specs with Travis [\#7](https://github.com/anthony-robin/ribbonit/pull/7) ([anthony-robin](https://github.com/anthony-robin))
|
|
22
67
|
|
|
23
68
|
**Closed issues:**
|
|
24
69
|
|
|
25
|
-
- ADD 'git\_branch' option to Ribbon displayed informations [\#16](https://github.com/anthony-robin/
|
|
26
|
-
- CREATE a 'CHANGELOG' file [\#11](https://github.com/anthony-robin/
|
|
27
|
-
- ADD 'sticky' option to Ribbon configuration [\#10](https://github.com/anthony-robin/
|
|
70
|
+
- ADD 'git\_branch' option to Ribbon displayed informations [\#16](https://github.com/anthony-robin/ribbonit/issues/16)
|
|
71
|
+
- CREATE a 'CHANGELOG' file [\#11](https://github.com/anthony-robin/ribbonit/issues/11)
|
|
72
|
+
- ADD 'sticky' option to Ribbon configuration [\#10](https://github.com/anthony-robin/ribbonit/issues/10)
|
|
73
|
+
|
|
74
|
+
## [v0.1.0](https://github.com/anthony-robin/ribbonit/tree/v0.1.0) (2017-05-21)
|
|
75
|
+
|
|
76
|
+
[Full Changelog](https://github.com/anthony-robin/ribbonit/compare/d88c4473e5d90902326a4ddbc398237872ee4462...v0.1.0)
|
|
28
77
|
|
|
29
|
-
## [v0.1.0](https://github.com/anthony-robin/Ribbonit/tree/v0.1.0) (2017-05-21)
|
|
30
78
|
**Implemented enhancements:**
|
|
31
79
|
|
|
32
|
-
- UPDATE travis instructions, FIX rubocop offenses [\#1](https://github.com/anthony-robin/
|
|
80
|
+
- UPDATE travis instructions, FIX rubocop offenses [\#1](https://github.com/anthony-robin/ribbonit/pull/1) ([anthony-robin](https://github.com/anthony-robin))
|
|
33
81
|
|
|
34
82
|
**Fixed bugs:**
|
|
35
83
|
|
|
36
|
-
- ADD 'line-height' css property [\#2](https://github.com/anthony-robin/
|
|
84
|
+
- ADD 'line-height' css property [\#2](https://github.com/anthony-robin/ribbonit/pull/2) ([anthony-robin](https://github.com/anthony-robin))
|
|
37
85
|
|
|
38
86
|
|
|
39
87
|
|
|
40
|
-
\* *This
|
|
88
|
+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/README.md
CHANGED
|
@@ -39,9 +39,12 @@ $ bin/rails g ribbonit:install
|
|
|
39
39
|
This will create a `ribbonit.rb` file in `config/initializers`
|
|
40
40
|
|
|
41
41
|
2) Import assets
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
```css
|
|
43
|
+
/* application.css */
|
|
44
|
+
|
|
45
|
+
/*
|
|
46
|
+
*= require ribbon
|
|
47
|
+
*/
|
|
45
48
|
```
|
|
46
49
|
|
|
47
50
|
3) Call ribbon in layout
|
|
@@ -53,33 +56,37 @@ body
|
|
|
53
56
|
```
|
|
54
57
|
|
|
55
58
|
## Options
|
|
56
|
-
You can customize some options through the initializer. Here are the
|
|
59
|
+
You can customize some options through the initializer. Here are the default ones:
|
|
57
60
|
|
|
58
61
|
```ruby
|
|
59
62
|
# config/initializers/ribbonit.rb
|
|
60
|
-
|
|
61
|
-
# rails_version: Version of Ruby on Rails
|
|
62
|
-
# ruby_version: Version of Ruby
|
|
63
|
-
# git_branch: Current git branch (only displayed in development)
|
|
64
|
-
config.infos_to_display = %i[rails_version ruby_version git_branch]
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
#
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
63
|
+
Ribbonit.configure do |config|
|
|
64
|
+
# rails_version: Version of Ruby on Rails
|
|
65
|
+
# ruby_version: Version of Ruby
|
|
66
|
+
# git_branch: Current git branch (only displayed in development)
|
|
67
|
+
config.infos_to_display = %i[rails_version ruby_version git_branch]
|
|
68
|
+
|
|
69
|
+
# additional extra content to display at the bottom of ribbon
|
|
70
|
+
config.extra_content = nil # 'Foo bar'
|
|
71
|
+
|
|
72
|
+
config.root_link = false # Wrap ribbon with root_url link ?
|
|
73
|
+
|
|
74
|
+
config.hide_for_small = true # Display ribbon in small devices ?
|
|
75
|
+
config.position = 'top-left' # top-right, bottom-left, bottom-right
|
|
76
|
+
config.sticky = true # stick to page corner ?
|
|
77
|
+
|
|
78
|
+
# Available colors:
|
|
79
|
+
# orange, blue, green, red, purple, black, white
|
|
80
|
+
config.themes = {
|
|
81
|
+
development: 'black',
|
|
82
|
+
staging: 'blue',
|
|
83
|
+
my_custom_environment: 'purple'
|
|
84
|
+
}
|
|
85
|
+
end
|
|
81
86
|
```
|
|
82
87
|
|
|
88
|
+
To add a custom environment, just add it inside the `themes` option and set the color you want (careful, if you define `config.themes` in your initializer it will erase default environments values so you will have to readd them).
|
|
89
|
+
|
|
83
90
|
## Screenshots
|
|
84
91
|
### Colors
|
|
85
92
|
<table>
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--ribbon-width: 165px;
|
|
3
|
+
--ribbon-height: 165px;
|
|
4
|
+
|
|
5
|
+
--ribbon-top: 33px;
|
|
6
|
+
--ribbon-left: -66px;
|
|
7
|
+
--ribbon-offset: -5px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.ribbon,
|
|
11
|
+
.ribbon__container {
|
|
12
|
+
-webkit-box-sizing: border-box;
|
|
13
|
+
-moz-box-sizing: border-box;
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.ribbon {
|
|
18
|
+
display: block;
|
|
19
|
+
position: absolute;
|
|
20
|
+
top: 0;
|
|
21
|
+
left: 0;
|
|
22
|
+
width: var(--ribbon-width);
|
|
23
|
+
height: var(--ribbon-height);
|
|
24
|
+
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
25
|
+
font-size: 16px;
|
|
26
|
+
line-height: 1rem;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
z-index: 1001;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.ribbon__container {
|
|
32
|
+
position: absolute;
|
|
33
|
+
top: var(--ribbon-top);
|
|
34
|
+
left: var(--ribbon-left);
|
|
35
|
+
width: 260px;
|
|
36
|
+
padding: 7px 40px;
|
|
37
|
+
transform: rotate(-45deg);
|
|
38
|
+
background: #333;
|
|
39
|
+
color: #fff;
|
|
40
|
+
font-size: 1rem;
|
|
41
|
+
text-align: center;
|
|
42
|
+
text-decoration: none;
|
|
43
|
+
box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.ribbon__container a {
|
|
47
|
+
display: block;
|
|
48
|
+
color: inherit;
|
|
49
|
+
text-decoration: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.ribbon__container a:hover {
|
|
53
|
+
color: inherit;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.ribbon__container::before,
|
|
57
|
+
.ribbon__container::after {
|
|
58
|
+
display: block;
|
|
59
|
+
position: absolute;
|
|
60
|
+
top: 1px;
|
|
61
|
+
left: 0;
|
|
62
|
+
width: 100%;
|
|
63
|
+
height: 1px;
|
|
64
|
+
background: #fff;
|
|
65
|
+
content: '';
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.ribbon__container::after {
|
|
69
|
+
top: auto;
|
|
70
|
+
bottom: 1px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.ribbon__container--orange {
|
|
74
|
+
background: #f80;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.ribbon__container--blue {
|
|
78
|
+
background: #49a;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.ribbon__container--green {
|
|
82
|
+
background: #090;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.ribbon__container--red {
|
|
86
|
+
background: #a00;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.ribbon__container--purple {
|
|
90
|
+
background: #551a8b;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.ribbon__container--black {
|
|
94
|
+
background: #333;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.ribbon__container--white {
|
|
98
|
+
background: #fff;
|
|
99
|
+
color: #333;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.ribbon__container--white a {
|
|
103
|
+
color: #333;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.ribbon__container__environment {
|
|
107
|
+
display: block;
|
|
108
|
+
text-transform: uppercase;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.ribbon__container__version,
|
|
112
|
+
.ribbon__container__git {
|
|
113
|
+
display: block;
|
|
114
|
+
font-size: 11px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.ribbon--sticky {
|
|
118
|
+
position: fixed;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.ribbon--top-right {
|
|
122
|
+
right: 0;
|
|
123
|
+
left: inherit;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.ribbon--top-right .ribbon__container {
|
|
127
|
+
right: var(--ribbon-left);
|
|
128
|
+
left: inherit;
|
|
129
|
+
transform: rotate(45deg);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.ribbon--bottom-left {
|
|
133
|
+
top: inherit;
|
|
134
|
+
bottom: 0;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.ribbon--bottom-left .ribbon__container {
|
|
138
|
+
top: inherit;
|
|
139
|
+
bottom: var(--ribbon-top);
|
|
140
|
+
transform: rotate(45deg);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.ribbon--bottom-right {
|
|
144
|
+
top: inherit;
|
|
145
|
+
right: 0;
|
|
146
|
+
bottom: 0;
|
|
147
|
+
left: inherit;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.ribbon--bottom-right .ribbon__container {
|
|
151
|
+
top: inherit;
|
|
152
|
+
right: var(--ribbon-left);
|
|
153
|
+
bottom:var(--ribbon-top);
|
|
154
|
+
left: inherit;
|
|
155
|
+
transform: rotate(-45deg);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* 3 lines */
|
|
159
|
+
|
|
160
|
+
.ribbon--3-lines {
|
|
161
|
+
width: calc(var(--ribbon-width) + 15px);
|
|
162
|
+
height: calc(var(--ribbon-height) + 15px);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.ribbon--3-lines.ribbon--top-left,
|
|
166
|
+
.ribbon--4-lines.ribbon--top-left {
|
|
167
|
+
top: var(--ribbon-offset);
|
|
168
|
+
left: var(--ribbon-offset);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.ribbon--3-lines.ribbon--top-right,
|
|
172
|
+
.ribbon--4-lines.ribbon--top-right {
|
|
173
|
+
top: var(--ribbon-offset);
|
|
174
|
+
right: var(--ribbon-offset);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.ribbon--3-lines.ribbon--bottom-left,
|
|
178
|
+
.ribbon--4-lines.ribbon--bottom-left {
|
|
179
|
+
bottom: var(--ribbon-offset);
|
|
180
|
+
left: var(--ribbon-offset);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.ribbon--3-lines.ribbon--bottom-right,
|
|
184
|
+
.ribbon--4-lines.ribbon--bottom-right {
|
|
185
|
+
right: var(--ribbon-offset);
|
|
186
|
+
bottom: var(--ribbon-offset);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/* 4 lines */
|
|
190
|
+
|
|
191
|
+
.ribbon--4-lines {
|
|
192
|
+
width: calc(var(--ribbon-width) + 30px);
|
|
193
|
+
height: calc(var(--ribbon-height) + 30px);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.ribbon--4-lines .ribbon__container {
|
|
197
|
+
width: 280px;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
@media only screen and (max-width: 40em) {
|
|
201
|
+
.ribbon--hide-for-small {
|
|
202
|
+
display: none;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
@@ -10,8 +10,14 @@
|
|
|
10
10
|
<% end %>
|
|
11
11
|
</span>
|
|
12
12
|
|
|
13
|
-
<% if config.infos_to_display.include?(:git_branch)
|
|
13
|
+
<% if config.infos_to_display.include?(:git_branch) %>
|
|
14
14
|
<span class="ribbon__container__git">
|
|
15
15
|
Branch: <strong><%= branch_name %></strong>
|
|
16
16
|
</span>
|
|
17
17
|
<% end %>
|
|
18
|
+
|
|
19
|
+
<% if config.extra_content.present? %>
|
|
20
|
+
<span class="ribbon__container__extra">
|
|
21
|
+
<%= config.extra_content %>
|
|
22
|
+
</span>
|
|
23
|
+
<% end %>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<% config = Ribbonit.configuration %>
|
|
2
2
|
|
|
3
|
-
<% if
|
|
3
|
+
<% if config.themes.keys.include? Rails.env.to_sym %>
|
|
4
4
|
|
|
5
5
|
<div id="ribbon" class="ribbon ribbon--<%= config.position %> <%= config.hide_for_small ? 'ribbon--hide-for-small' : '' %> <%= config.sticky ? 'ribbon--sticky' : '' %> ribbon--<%= line_count %>-lines">
|
|
6
6
|
<div class="ribbon__container ribbon__container--<%= config.themes[Rails.env.to_sym] %>">
|
|
7
7
|
<% if config.root_link %>
|
|
8
8
|
<%= link_to root_url do %>
|
|
9
|
-
<%= render '
|
|
9
|
+
<%= render 'lines', config: config %>
|
|
10
10
|
<% end %>
|
|
11
11
|
<% else %>
|
|
12
|
-
<%= render '
|
|
12
|
+
<%= render 'lines', config: config %>
|
|
13
13
|
<% end %>
|
|
14
14
|
</div>
|
|
15
15
|
</div>
|
|
@@ -9,6 +9,11 @@ Ribbonit.configure do |config|
|
|
|
9
9
|
#
|
|
10
10
|
config.infos_to_display = %i[rails_version ruby_version git_branch]
|
|
11
11
|
|
|
12
|
+
###
|
|
13
|
+
# Extra content to add at the end
|
|
14
|
+
#
|
|
15
|
+
config.extra_content = nil
|
|
16
|
+
|
|
12
17
|
###
|
|
13
18
|
# Wrap ribbon with link that goes to root_url ?
|
|
14
19
|
#
|
|
@@ -42,9 +47,4 @@ Ribbonit.configure do |config|
|
|
|
42
47
|
development: 'black',
|
|
43
48
|
staging: 'blue'
|
|
44
49
|
}
|
|
45
|
-
|
|
46
|
-
###
|
|
47
|
-
# Environment name
|
|
48
|
-
#
|
|
49
|
-
config.staging_name = 'staging'
|
|
50
50
|
end
|
|
@@ -8,23 +8,23 @@ module Ribbonit
|
|
|
8
8
|
def self.configure
|
|
9
9
|
yield configuration
|
|
10
10
|
end
|
|
11
|
-
end
|
|
12
11
|
|
|
13
|
-
class
|
|
14
|
-
|
|
12
|
+
class Configuration
|
|
13
|
+
include ActiveSupport::Configurable
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
config_accessor(:infos_to_display) do
|
|
16
|
+
%i[rails_version ruby_version]
|
|
17
|
+
end
|
|
18
|
+
config_accessor(:extra_content) { nil }
|
|
19
|
+
config_accessor(:root_link) { false }
|
|
20
|
+
config_accessor(:hide_for_small) { true }
|
|
21
|
+
config_accessor(:position) { 'top-left' }
|
|
22
|
+
config_accessor(:sticky) { true }
|
|
23
|
+
config_accessor(:themes) do
|
|
24
|
+
{
|
|
25
|
+
development: 'black',
|
|
26
|
+
staging: 'blue'
|
|
27
|
+
}
|
|
28
|
+
end
|
|
28
29
|
end
|
|
29
|
-
config_accessor(:staging_name) { 'staging' }
|
|
30
30
|
end
|
|
@@ -4,11 +4,8 @@ require 'ribbonit/view_helpers'
|
|
|
4
4
|
module Ribbonit
|
|
5
5
|
module Rails
|
|
6
6
|
class Engine < ::Rails::Engine
|
|
7
|
-
initializer 'ribbonit.view_helpers' do |
|
|
7
|
+
initializer 'ribbonit.view_helpers' do |_app|
|
|
8
8
|
ActionView::Base.send :include, ViewHelpers
|
|
9
|
-
ActiveSupport.on_load(:action_controller) do
|
|
10
|
-
append_view_path "#{Gem.loaded_specs['ribbonit'].full_gem_path}/lib/app/views/partials"
|
|
11
|
-
end
|
|
12
9
|
end
|
|
13
10
|
end
|
|
14
11
|
end
|
data/lib/ribbonit/version.rb
CHANGED
|
@@ -1,17 +1,26 @@
|
|
|
1
|
-
module Ribbonit
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
module Ribbonit
|
|
2
|
+
module ViewHelpers
|
|
3
|
+
def ribbonit
|
|
4
|
+
render 'ribbon'
|
|
5
|
+
end
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
def branch_name
|
|
8
|
+
`git rev-parse --abbrev-ref HEAD`.gsub('feature/', '')
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def line_count
|
|
12
|
+
height = 1
|
|
13
|
+
items = configuration.infos_to_display
|
|
14
|
+
height += 1 if items.include?(:ruby_version) || items.include?(:rails_version)
|
|
15
|
+
height += 1 if items.include?(:git_branch)
|
|
16
|
+
height += 1 if configuration.extra_content.present?
|
|
17
|
+
height
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
private
|
|
9
21
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
height += 1 if items.include?(:ruby_version) || items.include?(:rails_version)
|
|
14
|
-
height += 1 if items.include?(:git_branch) && Rails.env.development?
|
|
15
|
-
height
|
|
22
|
+
def configuration
|
|
23
|
+
Ribbonit.configuration
|
|
24
|
+
end
|
|
16
25
|
end
|
|
17
26
|
end
|
data/ribbonit.gemspec
CHANGED
|
@@ -19,9 +19,8 @@ Gem::Specification.new do |spec|
|
|
|
19
19
|
spec.require_paths = ['lib']
|
|
20
20
|
|
|
21
21
|
spec.add_dependency 'rails'
|
|
22
|
-
spec.add_dependency 'sassc-rails'
|
|
23
22
|
|
|
24
|
-
spec.add_development_dependency 'bundler', '
|
|
23
|
+
spec.add_development_dependency 'bundler', '>= 2.2.33'
|
|
25
24
|
spec.add_development_dependency 'rake', '~> 12.0'
|
|
26
25
|
spec.add_development_dependency 'rspec', '~> 3.6'
|
|
27
26
|
spec.add_development_dependency 'byebug'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ribbonit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Anthony Robin
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-12-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -24,34 +24,20 @@ dependencies:
|
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '0'
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: sassc-rails
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - ">="
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '0'
|
|
34
|
-
type: :runtime
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - ">="
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: '0'
|
|
41
27
|
- !ruby/object:Gem::Dependency
|
|
42
28
|
name: bundler
|
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
|
44
30
|
requirements:
|
|
45
|
-
- - "
|
|
31
|
+
- - ">="
|
|
46
32
|
- !ruby/object:Gem::Version
|
|
47
|
-
version:
|
|
33
|
+
version: 2.2.33
|
|
48
34
|
type: :development
|
|
49
35
|
prerelease: false
|
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
37
|
requirements:
|
|
52
|
-
- - "
|
|
38
|
+
- - ">="
|
|
53
39
|
- !ruby/object:Gem::Version
|
|
54
|
-
version:
|
|
40
|
+
version: 2.2.33
|
|
55
41
|
- !ruby/object:Gem::Dependency
|
|
56
42
|
name: rake
|
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -153,12 +139,13 @@ files:
|
|
|
153
139
|
- Gemfile
|
|
154
140
|
- README.md
|
|
155
141
|
- Rakefile
|
|
142
|
+
- app/assets/stylesheets/ribbon.css
|
|
143
|
+
- app/views/application/_lines.html.erb
|
|
144
|
+
- app/views/application/_ribbon.html.erb
|
|
156
145
|
- bin/console
|
|
157
146
|
- bin/rspec
|
|
158
147
|
- bin/rubocop
|
|
159
148
|
- bin/setup
|
|
160
|
-
- lib/app/views/partials/_lines.html.erb
|
|
161
|
-
- lib/app/views/partials/_ribbon.html.erb
|
|
162
149
|
- lib/generators/ribbonit/install_generator.rb
|
|
163
150
|
- lib/generators/ribbonit/templates/ribbonit.rb
|
|
164
151
|
- lib/ribbonit.rb
|
|
@@ -179,11 +166,10 @@ files:
|
|
|
179
166
|
- vendor/assets/images/positions/bottom-left.png
|
|
180
167
|
- vendor/assets/images/positions/bottom-right.png
|
|
181
168
|
- vendor/assets/images/positions/top-right.png
|
|
182
|
-
- vendor/assets/stylesheets/_ribbon.sass
|
|
183
169
|
homepage: https://github.com/anthony-robin/ribbonit
|
|
184
170
|
licenses: []
|
|
185
171
|
metadata: {}
|
|
186
|
-
post_install_message:
|
|
172
|
+
post_install_message:
|
|
187
173
|
rdoc_options: []
|
|
188
174
|
require_paths:
|
|
189
175
|
- lib
|
|
@@ -198,9 +184,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
198
184
|
- !ruby/object:Gem::Version
|
|
199
185
|
version: '0'
|
|
200
186
|
requirements: []
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
signing_key:
|
|
187
|
+
rubygems_version: 3.4.1
|
|
188
|
+
signing_key:
|
|
204
189
|
specification_version: 4
|
|
205
190
|
summary: Display Ribbon with Rails env
|
|
206
191
|
test_files: []
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
$ribbon_width: 165px
|
|
2
|
-
$ribbon_height: 165px
|
|
3
|
-
|
|
4
|
-
$top: 33px
|
|
5
|
-
$left: -66px
|
|
6
|
-
$offset: -5px
|
|
7
|
-
|
|
8
|
-
.ribbon,
|
|
9
|
-
.ribbon__container
|
|
10
|
-
-webkit-box-sizing: border-box
|
|
11
|
-
box-sizing: border-box
|
|
12
|
-
|
|
13
|
-
.ribbon
|
|
14
|
-
display: block
|
|
15
|
-
position: absolute
|
|
16
|
-
top: 0
|
|
17
|
-
left: 0
|
|
18
|
-
width: $ribbon_width
|
|
19
|
-
height: $ribbon_height
|
|
20
|
-
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif
|
|
21
|
-
font-size: 16px
|
|
22
|
-
line-height: 1rem
|
|
23
|
-
overflow: hidden
|
|
24
|
-
z-index: 1001
|
|
25
|
-
|
|
26
|
-
// Container
|
|
27
|
-
&__container
|
|
28
|
-
position: absolute
|
|
29
|
-
top: $top
|
|
30
|
-
left: $left
|
|
31
|
-
width: 260px
|
|
32
|
-
padding: 7px 40px
|
|
33
|
-
transform: rotate(-45deg)
|
|
34
|
-
background: #333
|
|
35
|
-
color: #fff
|
|
36
|
-
font-size: 1rem
|
|
37
|
-
text-align: center
|
|
38
|
-
text-decoration: none
|
|
39
|
-
box-shadow: 1px 1px 3px rgba(#000, 0.8)
|
|
40
|
-
|
|
41
|
-
a
|
|
42
|
-
display: block
|
|
43
|
-
color: inherit
|
|
44
|
-
text-decoration: none
|
|
45
|
-
&:hover
|
|
46
|
-
color: inherit
|
|
47
|
-
|
|
48
|
-
&::before, &::after
|
|
49
|
-
display: block
|
|
50
|
-
position: absolute
|
|
51
|
-
top: 1px
|
|
52
|
-
left: 0
|
|
53
|
-
width: 100%
|
|
54
|
-
height: 1px
|
|
55
|
-
background: #fff
|
|
56
|
-
content: ''
|
|
57
|
-
|
|
58
|
-
&::after
|
|
59
|
-
top: auto
|
|
60
|
-
bottom: 1px
|
|
61
|
-
|
|
62
|
-
// Colors
|
|
63
|
-
&--orange
|
|
64
|
-
background: #f80
|
|
65
|
-
&--blue
|
|
66
|
-
background: #49a
|
|
67
|
-
&--green
|
|
68
|
-
background: #090
|
|
69
|
-
&--red
|
|
70
|
-
background: #a00
|
|
71
|
-
&--purple
|
|
72
|
-
background: #551a8b
|
|
73
|
-
&--black
|
|
74
|
-
background: #333
|
|
75
|
-
&--white
|
|
76
|
-
background: #fff
|
|
77
|
-
color: #333
|
|
78
|
-
a
|
|
79
|
-
color: #333
|
|
80
|
-
|
|
81
|
-
// Displayed informations
|
|
82
|
-
&__environment
|
|
83
|
-
display: block
|
|
84
|
-
text-transform: uppercase
|
|
85
|
-
|
|
86
|
-
&__version, &__git
|
|
87
|
-
display: block
|
|
88
|
-
font-size: 11px
|
|
89
|
-
|
|
90
|
-
// Sticky
|
|
91
|
-
&--sticky
|
|
92
|
-
position: fixed
|
|
93
|
-
|
|
94
|
-
// Position
|
|
95
|
-
&--top-right
|
|
96
|
-
right: 0
|
|
97
|
-
left: inherit
|
|
98
|
-
.ribbon__container
|
|
99
|
-
right: $left
|
|
100
|
-
left: inherit
|
|
101
|
-
transform: rotate(45deg)
|
|
102
|
-
|
|
103
|
-
&--bottom-left
|
|
104
|
-
top: inherit
|
|
105
|
-
bottom: 0
|
|
106
|
-
.ribbon__container
|
|
107
|
-
top: inherit
|
|
108
|
-
bottom: $top
|
|
109
|
-
transform: rotate(45deg)
|
|
110
|
-
|
|
111
|
-
&--bottom-right
|
|
112
|
-
top: inherit
|
|
113
|
-
right: 0
|
|
114
|
-
bottom: 0
|
|
115
|
-
left: inherit
|
|
116
|
-
.ribbon__container
|
|
117
|
-
top: inherit
|
|
118
|
-
right: $left
|
|
119
|
-
bottom: $top
|
|
120
|
-
left: inherit
|
|
121
|
-
transform: rotate(-45deg)
|
|
122
|
-
|
|
123
|
-
// Ribbon size depending of displayed options
|
|
124
|
-
&--3-lines
|
|
125
|
-
width: $ribbon_width + 15px
|
|
126
|
-
height: $ribbon_height + 15px
|
|
127
|
-
&--top-left
|
|
128
|
-
top: $offset
|
|
129
|
-
left: $offset
|
|
130
|
-
&--top-right
|
|
131
|
-
top: $offset
|
|
132
|
-
right: $offset
|
|
133
|
-
&--bottom-left
|
|
134
|
-
bottom: $offset
|
|
135
|
-
left: $offset
|
|
136
|
-
&--bottom-right
|
|
137
|
-
right: $offset
|
|
138
|
-
bottom: $offset
|
|
139
|
-
|
|
140
|
-
@media only screen and (max-width: 40em)
|
|
141
|
-
.ribbon
|
|
142
|
-
&--hide-for-small
|
|
143
|
-
display: none
|