oas_rails 1.2.1 → 1.3.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 +4 -4
- data/app/helpers/oas_rails/oas_rails_helper.rb +128 -3
- data/app/views/oas_rails/oas_rails/index.html.erb +0 -116
- data/lib/generators/oas_rails/config/templates/oas_rails_initializer.rb +6 -2
- data/lib/oas_rails/configuration.rb +1 -1
- data/lib/oas_rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15455928e0a53535150429ec602f524de831cea66a6374f3aa8db0165ec796c7
|
4
|
+
data.tar.gz: cc45a9cdfffd9d381cda110febdb70b5af5244e6eb3b9aefc625818a69ef459e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8aff770635944c8804508bf5bb1b9ce08875ac9de85c500e4c7a8334beb893f6e07a1a142d9c2c3be5851ead48ae829f8dbf20a18438667e7b91b3b445921af9
|
7
|
+
data.tar.gz: 4596939365bffae793d1381655adefd9c7497b16a072722b6c003c88ec372d54bdf866cb3c84eccf43ac8fdbdd4e5410fbc114a2a6593c79a7998b21786fe4c9
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module OasRails
|
2
|
-
module OasRailsHelper
|
3
|
-
def
|
2
|
+
module OasRailsHelper # rubocop:disable Metrics/ModuleLength
|
3
|
+
def rapidoc_configuration_defaults
|
4
4
|
{
|
5
5
|
"spec-url" => "#{OasRails::Engine.routes.find_script_name({})}.json",
|
6
6
|
"show-header" => "false",
|
@@ -11,11 +11,136 @@ module OasRails
|
|
11
11
|
"schema-style" => "table",
|
12
12
|
"sort-tags" => "true",
|
13
13
|
"persist-auth" => "true"
|
14
|
-
}
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
def rapidoc_configuration_attributes
|
18
|
+
rapidoc_configuration_defaults.merge(
|
19
|
+
rapidoc_theme(OasRails.config.rapidoc_theme),
|
20
|
+
OasRails.config.rapidoc_configuration
|
21
|
+
).map { |k, v| %(#{k}=#{ERB::Util.html_escape(v)}) }.join(' ')
|
15
22
|
end
|
16
23
|
|
17
24
|
def rapidoc_logo_url
|
18
25
|
OasRails.config.rapidoc_logo_url
|
19
26
|
end
|
27
|
+
|
28
|
+
THEMES = {
|
29
|
+
'dark' => {
|
30
|
+
'theme' => 'dark',
|
31
|
+
'bg-color' => '#333',
|
32
|
+
'text-color' => '#BBB'
|
33
|
+
},
|
34
|
+
'light' => {
|
35
|
+
'theme' => 'light',
|
36
|
+
'bg-color' => '#FFF',
|
37
|
+
'text-color' => '#444'
|
38
|
+
},
|
39
|
+
'night' => {
|
40
|
+
'theme' => 'dark',
|
41
|
+
'bg-color' => '#14191f',
|
42
|
+
'text-color' => '#aec2e0'
|
43
|
+
},
|
44
|
+
'mud' => {
|
45
|
+
'theme' => 'dark',
|
46
|
+
'bg-color' => '#403635',
|
47
|
+
'text-color' => '#c3b8b7'
|
48
|
+
},
|
49
|
+
'cofee' => {
|
50
|
+
'theme' => 'dark',
|
51
|
+
'bg-color' => '#36312C',
|
52
|
+
'text-color' => '#ceb8a0'
|
53
|
+
},
|
54
|
+
'forest' => {
|
55
|
+
'theme' => 'dark',
|
56
|
+
'bg-color' => '#384244',
|
57
|
+
'text-color' => '#BDD6DB'
|
58
|
+
},
|
59
|
+
'olive' => {
|
60
|
+
'theme' => 'dark',
|
61
|
+
'bg-color' => '#2a2f31',
|
62
|
+
'text-color' => '#acc7c8'
|
63
|
+
},
|
64
|
+
'outerspace' => {
|
65
|
+
'theme' => 'dark',
|
66
|
+
'bg-color' => '#2D3133',
|
67
|
+
'text-color' => '#CAD9E3'
|
68
|
+
},
|
69
|
+
'ebony' => {
|
70
|
+
'theme' => 'dark',
|
71
|
+
'bg-color' => '#2B303B',
|
72
|
+
'text-color' => '#dee3ec'
|
73
|
+
},
|
74
|
+
'snow' => {
|
75
|
+
'theme' => 'light',
|
76
|
+
'bg-color' => '#FAFAFA',
|
77
|
+
'text-color' => '#555'
|
78
|
+
},
|
79
|
+
'green' => {
|
80
|
+
'theme' => 'light',
|
81
|
+
'bg-color' => '#f9fdf7',
|
82
|
+
'text-color' => '#375F1B'
|
83
|
+
},
|
84
|
+
'blue' => {
|
85
|
+
'theme' => 'light',
|
86
|
+
'bg-color' => '#ecf1f7',
|
87
|
+
'text-color' => '#133863'
|
88
|
+
},
|
89
|
+
'beige' => {
|
90
|
+
'show-header' => 'true',
|
91
|
+
'theme' => 'light',
|
92
|
+
'bg-color' => '#fdf8ed',
|
93
|
+
'text-color' => '#342809'
|
94
|
+
},
|
95
|
+
'graynav' => {
|
96
|
+
'show-header' => 'false',
|
97
|
+
'theme' => 'light',
|
98
|
+
'nav-bg-color' => '#3e4b54',
|
99
|
+
'nav-accent-color' => '#fd6964',
|
100
|
+
'primary-color' => '#ea526f'
|
101
|
+
},
|
102
|
+
'purplenav' => {
|
103
|
+
'show-header' => 'false',
|
104
|
+
'theme' => 'light',
|
105
|
+
'nav-accent-color' => '#ffd8e7',
|
106
|
+
'nav-bg-color' => '#666699',
|
107
|
+
'primary-color' => '#ea526f',
|
108
|
+
'bg-color' => '#fff9fb'
|
109
|
+
},
|
110
|
+
'lightgraynav' => {
|
111
|
+
'show-header' => 'false',
|
112
|
+
'theme' => 'light',
|
113
|
+
'nav-bg-color' => '#fafafa',
|
114
|
+
'nav-hover-text-color' => '#9b0700',
|
115
|
+
'nav-hover-bg-color' => '#ffebea',
|
116
|
+
'primary-color' => '#F63C41',
|
117
|
+
'bg-color' => '#ffffff'
|
118
|
+
},
|
119
|
+
'darkbluenav' => {
|
120
|
+
'show-header' => 'false',
|
121
|
+
'theme' => 'light',
|
122
|
+
'bg-color' => '#f9f9fa',
|
123
|
+
'nav-bg-color' => '#3f4d67',
|
124
|
+
'nav-text-color' => '#a9b7d0',
|
125
|
+
'nav-hover-bg-color' => '#333f54',
|
126
|
+
'nav-hover-text-color' => '#fff',
|
127
|
+
'nav-accent-color' => '#f87070',
|
128
|
+
'primary-color' => '#5c7096'
|
129
|
+
},
|
130
|
+
'rails' => {
|
131
|
+
'theme' => 'light',
|
132
|
+
'bg-color' => '#FFFFFF',
|
133
|
+
'nav-bg-color' => '#101828',
|
134
|
+
'nav-text-color' => '#fff',
|
135
|
+
'nav-hover-bg-color' => '#261B23',
|
136
|
+
'nav-hover-text-color' => '#fff',
|
137
|
+
'nav-accent-color' => '#D30001',
|
138
|
+
'primary-color' => '#D30001'
|
139
|
+
}
|
140
|
+
}.freeze
|
141
|
+
|
142
|
+
def rapidoc_theme(theme_name)
|
143
|
+
THEMES[theme_name] || {}
|
144
|
+
end
|
20
145
|
end
|
21
146
|
end
|
@@ -7,122 +7,6 @@
|
|
7
7
|
<meta charset="utf-8">
|
8
8
|
<!-- Important: rapi-doc uses utf8 characters -->
|
9
9
|
<script type="module" src="/oas-rails-assets/rapidoc-min.js"></script>
|
10
|
-
<script>
|
11
|
-
function applyTheme() {
|
12
|
-
const theme = "<%= OasRails.config.rapidoc_theme %>";
|
13
|
-
const docEl = document.querySelector('rapi-doc');
|
14
|
-
|
15
|
-
// Reset all theme-related attributes
|
16
|
-
docEl.removeAttribute('theme');
|
17
|
-
docEl.removeAttribute('bg-color');
|
18
|
-
docEl.removeAttribute('text-color');
|
19
|
-
docEl.removeAttribute('nav-bg-color');
|
20
|
-
docEl.removeAttribute('nav-text-color');
|
21
|
-
docEl.removeAttribute('nav-hover-bg-color');
|
22
|
-
docEl.removeAttribute('nav-hover-text-color');
|
23
|
-
docEl.removeAttribute('nav-accent-color');
|
24
|
-
docEl.removeAttribute('primary-color');
|
25
|
-
|
26
|
-
console.log(theme === 'dark')
|
27
|
-
|
28
|
-
if (theme === 'dark'){
|
29
|
-
docEl.setAttribute('theme','dark');
|
30
|
-
docEl.setAttribute('bg-color','#333');
|
31
|
-
docEl.setAttribute('text-color','#BBB');
|
32
|
-
} else if (theme === 'light'){
|
33
|
-
docEl.setAttribute('theme','light');
|
34
|
-
docEl.setAttribute('bg-color','#FFF');
|
35
|
-
docEl.setAttribute('text-color','#444');
|
36
|
-
} else if (theme === 'night') {
|
37
|
-
docEl.setAttribute('theme','dark');
|
38
|
-
docEl.setAttribute('bg-color','#14191f');
|
39
|
-
docEl.setAttribute('text-color','#aec2e0');
|
40
|
-
} else if (theme === 'mud') {
|
41
|
-
docEl.setAttribute('theme','dark');
|
42
|
-
docEl.setAttribute('bg-color','#403635');
|
43
|
-
docEl.setAttribute('text-color','#c3b8b7');
|
44
|
-
} else if (theme === 'cofee') {
|
45
|
-
docEl.setAttribute('theme','dark');
|
46
|
-
docEl.setAttribute('bg-color','#36312C');
|
47
|
-
docEl.setAttribute('text-color','#ceb8a0');
|
48
|
-
} else if (theme === 'forest') {
|
49
|
-
docEl.setAttribute('theme','dark');
|
50
|
-
docEl.setAttribute('bg-color','#384244');
|
51
|
-
docEl.setAttribute('text-color','#BDD6DB');
|
52
|
-
} else if (theme === 'olive') {
|
53
|
-
docEl.setAttribute('theme','dark');
|
54
|
-
docEl.setAttribute('bg-color','#2a2f31');
|
55
|
-
docEl.setAttribute('text-color','#acc7c8');
|
56
|
-
} else if (theme === 'outerspace') {
|
57
|
-
docEl.setAttribute('theme','dark');
|
58
|
-
docEl.setAttribute('bg-color','#2D3133');
|
59
|
-
docEl.setAttribute('text-color','#CAD9E3');
|
60
|
-
} else if (theme === 'ebony') {
|
61
|
-
docEl.setAttribute('theme','dark');
|
62
|
-
docEl.setAttribute('bg-color','#2B303B');
|
63
|
-
docEl.setAttribute('text-color','#dee3ec');
|
64
|
-
} else if (theme === 'snow') {
|
65
|
-
docEl.setAttribute('theme','light');
|
66
|
-
docEl.setAttribute('bg-color','#FAFAFA');
|
67
|
-
docEl.setAttribute('text-color','#555');
|
68
|
-
} else if (theme === 'green') {
|
69
|
-
docEl.setAttribute('theme','light');
|
70
|
-
docEl.setAttribute('bg-color','#f9fdf7');
|
71
|
-
docEl.setAttribute('text-color','#375F1B');
|
72
|
-
} else if (theme === 'blue') {
|
73
|
-
docEl.setAttribute('theme','light');
|
74
|
-
docEl.setAttribute('bg-color','#ecf1f7');
|
75
|
-
docEl.setAttribute('text-color','#133863');
|
76
|
-
} else if (theme === 'beige') {
|
77
|
-
docEl.setAttribute('show-header','true');
|
78
|
-
docEl.setAttribute('theme','light');
|
79
|
-
docEl.setAttribute('bg-color','#fdf8ed');
|
80
|
-
docEl.setAttribute('text-color','#342809');
|
81
|
-
} else if (theme === 'graynav') {
|
82
|
-
docEl.setAttribute('show-header','false');
|
83
|
-
docEl.setAttribute('theme','light');
|
84
|
-
docEl.setAttribute('nav-bg-color','#3e4b54');
|
85
|
-
docEl.setAttribute('nav-accent-color','#fd6964');
|
86
|
-
docEl.setAttribute('primary-color','#ea526f');
|
87
|
-
} else if (theme === 'purplenav') {
|
88
|
-
docEl.setAttribute('show-header','false');
|
89
|
-
docEl.setAttribute('theme','light');
|
90
|
-
docEl.setAttribute('nav-accent-color','#ffd8e7');
|
91
|
-
docEl.setAttribute('nav-bg-color','#666699');
|
92
|
-
docEl.setAttribute('primary-color','#ea526f');
|
93
|
-
docEl.setAttribute('bg-color','#fff9fb');
|
94
|
-
} else if (theme === 'lightgraynav') {
|
95
|
-
docEl.setAttribute('show-header','false');
|
96
|
-
docEl.setAttribute('theme','light');
|
97
|
-
docEl.setAttribute('nav-bg-color','#fafafa');
|
98
|
-
docEl.setAttribute('nav-hover-text-color','#9b0700');
|
99
|
-
docEl.setAttribute('nav-hover-bg-color','#ffebea');
|
100
|
-
docEl.setAttribute('primary-color','#F63C41');
|
101
|
-
docEl.setAttribute('bg-color','#ffffff');
|
102
|
-
} else if (theme === 'darkbluenav') {
|
103
|
-
docEl.setAttribute('show-header','false');
|
104
|
-
docEl.setAttribute('theme','light');
|
105
|
-
docEl.setAttribute('bg-color','#f9f9fa');
|
106
|
-
docEl.setAttribute('nav-bg-color','#3f4d67');
|
107
|
-
docEl.setAttribute('nav-text-color','#a9b7d0');
|
108
|
-
docEl.setAttribute('nav-hover-bg-color','#333f54');
|
109
|
-
docEl.setAttribute('nav-hover-text-color','#fff');
|
110
|
-
docEl.setAttribute('nav-accent-color','#f87070');
|
111
|
-
docEl.setAttribute('primary-color','#5c7096');
|
112
|
-
} else if (theme === 'rails') {
|
113
|
-
docEl.setAttribute('theme','light');
|
114
|
-
docEl.setAttribute('bg-color','#FFFFFF');
|
115
|
-
docEl.setAttribute('nav-bg-color','#101828');
|
116
|
-
docEl.setAttribute('nav-text-color','#fff');
|
117
|
-
docEl.setAttribute('nav-hover-bg-color','#261B23');
|
118
|
-
docEl.setAttribute('nav-hover-text-color','#fff');
|
119
|
-
docEl.setAttribute('nav-accent-color','#D30001');
|
120
|
-
docEl.setAttribute('primary-color','#D30001');
|
121
|
-
}
|
122
|
-
}
|
123
|
-
|
124
|
-
document.addEventListener('DOMContentLoaded', applyTheme);
|
125
|
-
</script>
|
126
10
|
</head>
|
127
11
|
<body>
|
128
12
|
<rapi-doc <%= rapidoc_configuration_attributes %> >
|
@@ -70,14 +70,18 @@ OasRails.configure do |config|
|
|
70
70
|
# Default: false
|
71
71
|
# config.layout = "application"
|
72
72
|
|
73
|
-
# Override general
|
73
|
+
# Override general rapidoc settings
|
74
74
|
# config.rapidoc_configuration
|
75
75
|
# default: {}
|
76
76
|
|
77
|
-
# Add a logo to
|
77
|
+
# Add a logo to rapidoc
|
78
78
|
# config.rapidoc_logo_url
|
79
79
|
# default: nil
|
80
80
|
|
81
|
+
# Override specific rapidoc theme settings
|
82
|
+
# config.rapidoc_theme_configuration
|
83
|
+
# default: {}
|
84
|
+
|
81
85
|
# Excluding custom controllers or controllers#action
|
82
86
|
# Example: ["projects", "users#new"]
|
83
87
|
# config.ignored_actions = []
|
@@ -10,8 +10,8 @@ module OasRails
|
|
10
10
|
@autodiscover_request_body = true
|
11
11
|
@autodiscover_responses = true
|
12
12
|
@ignored_actions = []
|
13
|
-
@rapidoc_theme = :rails
|
14
13
|
@layout = nil
|
14
|
+
@rapidoc_theme = :rails
|
15
15
|
@rapidoc_configuration = {}
|
16
16
|
@rapidoc_logo_url = nil
|
17
17
|
@source_oas_path = nil
|
data/lib/oas_rails/version.rb
CHANGED