oas_rails 1.1.1 → 1.2.1

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: fdf9973a8c14f6808ef6369e2fdaf1a54bdc2194e5c09ccf2e9609892023a3f7
4
- data.tar.gz: 1098d9e9c65ec23087457adafc46cbb39de47e329041a07606141ccc1edf649f
3
+ metadata.gz: 4c5fa151b7fbb378c089146a161abd8e5c2608fd33708af1204ef1f367887a43
4
+ data.tar.gz: c2911b48d406aa6fac30c441314cfcb6c32449c15b6c46643b8683fadf2d104c
5
5
  SHA512:
6
- metadata.gz: 80a3d2a75ace97f2676ddaf97c8e354d6404f09ec494cbe01cbde26071741e67754730f2681b56b9aeb49778b34cad276cc89aaa1c48a94b509f203051f44421
7
- data.tar.gz: 071e435e34fd6b37711a9bf1a010686c58a672e8b1256a36cbac78279f5a4bc805fe1f59e33b43efc3ec825a54bf9fd74251b421ca561a25b2b3345e8dc23146
6
+ metadata.gz: ff4c0d2c8c6c801226e50307f46c024d66f53c7d9bc11b6f71717553ed7c4009ba3b48367e930cb09eb6eb3b01b5d16a0c48cf742cf9014616c456c9c4c60ff1
7
+ data.tar.gz: 60eefa488fa9b40e6984a884c9170740bd898358f1b8b0d0d218a5673771e3a316cd62cdf061bc1f147a7638eee54996fe0f136520d44dabe646ca0378a29f46
@@ -1,4 +1,21 @@
1
1
  module OasRails
2
2
  module OasRailsHelper
3
+ def rapidoc_configuration_attributes
4
+ {
5
+ "spec-url" => "#{OasRails::Engine.routes.find_script_name({})}.json",
6
+ "show-header" => "false",
7
+ "font-size" => "largest",
8
+ "show-method-in-nav-bar" => "as-colored-text",
9
+ "nav-item-spacing" => "relaxed",
10
+ "allow-spec-file-download" => "true",
11
+ "schema-style" => "table",
12
+ "sort-tags" => "true",
13
+ "persist-auth" => "true"
14
+ }.merge(OasRails.config.rapidoc_configuration).map { |k, v| %(#{k}=#{ERB::Util.html_escape(v)}) }.join(' ')
15
+ end
16
+
17
+ def rapidoc_logo_url
18
+ OasRails.config.rapidoc_logo_url
19
+ end
3
20
  end
4
21
  end
@@ -0,0 +1,6 @@
1
+ <style>
2
+ rapi-doc::part(btn btn-outline) {
3
+ width: 220px;
4
+ min-width: 170px;
5
+ }
6
+ </style>
@@ -125,24 +125,15 @@
125
125
  </script>
126
126
  </head>
127
127
  <body>
128
- <rapi-doc
129
- spec-url="<%= OasRails::Engine.routes.find_script_name({}) %>.json"
130
- show-header="false"
131
- font-size="largest"
132
- show-method-in-nav-bar="as-colored-text"
133
- nav-item-spacing="relaxed"
134
- allow-spec-file-download="true"
135
- schema-style="table"
136
- sort-tags="true"
137
- persist-auth="true"
138
- >
128
+ <rapi-doc <%= rapidoc_configuration_attributes %> >
129
+ <% if rapidoc_logo_url %>
130
+ <img
131
+ slot="nav-logo"
132
+ src="<%= rapidoc_logo_url %>"
133
+ />
134
+ <% end %>
139
135
  </rapi-doc>
140
136
 
141
- <style>
142
- rapi-doc::part(btn btn-outline) {
143
- width: 220px;
144
- min-width: 170px;
145
- }
146
- </style>
137
+ <%= render partial: 'rapidoc_style_parts' %>
147
138
  </body>
148
139
  </html>
@@ -70,6 +70,14 @@ OasRails.configure do |config|
70
70
  # Default: false
71
71
  # config.layout = "application"
72
72
 
73
+ # Override general rapi-doc settings
74
+ # config.rapidoc_configuration
75
+ # default: {}
76
+
77
+ # Add a logo to rapi-doc
78
+ # config.rapidoc_logo_url
79
+ # default: nil
80
+
73
81
  # Excluding custom controllers or controllers#action
74
82
  # Example: ["projects", "users#new"]
75
83
  # config.ignored_actions = []
@@ -1,6 +1,6 @@
1
1
  module OasRails
2
2
  class Configuration < OasCore::Configuration
3
- attr_accessor :autodiscover_request_body, :autodiscover_responses, :ignored_actions, :rapidoc_theme, :layout, :source_oas_path
3
+ attr_accessor :autodiscover_request_body, :autodiscover_responses, :ignored_actions, :rapidoc_theme, :layout, :source_oas_path, :rapidoc_configuration, :rapidoc_logo_url
4
4
  attr_reader :route_extractor, :include_mode
5
5
 
6
6
  def initialize
@@ -12,6 +12,8 @@ module OasRails
12
12
  @ignored_actions = []
13
13
  @rapidoc_theme = :rails
14
14
  @layout = nil
15
+ @rapidoc_configuration = {}
16
+ @rapidoc_logo_url = nil
15
17
  @source_oas_path = nil
16
18
 
17
19
  # TODO: implement
@@ -1,3 +1,3 @@
1
1
  module OasRails
2
- VERSION = "1.1.1"
2
+ VERSION = "1.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oas_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - a-chacon
@@ -55,10 +55,8 @@ files:
55
55
  - app/helpers/oas_rails/application_helper.rb
56
56
  - app/helpers/oas_rails/oas_rails_helper.rb
57
57
  - app/helpers/oas_rails/test_helper.rb
58
- - app/jobs/oas_rails/application_job.rb
59
- - app/mailers/oas_rails/application_mailer.rb
60
- - app/models/oas_rails/application_record.rb
61
58
  - app/views/layouts/oas_rails/application.html.erb
59
+ - app/views/oas_rails/oas_rails/_rapidoc_style_parts.html.erb
62
60
  - app/views/oas_rails/oas_rails/index.html.erb
63
61
  - app/views/oas_rails/test/show.html.erb
64
62
  - config/routes.rb
@@ -1,4 +0,0 @@
1
- module OasRails
2
- class ApplicationJob < ActiveJob::Base
3
- end
4
- end
@@ -1,6 +0,0 @@
1
- module OasRails
2
- class ApplicationMailer < ActionMailer::Base
3
- default from: "from@example.com"
4
- layout "mailer"
5
- end
6
- end
@@ -1,5 +0,0 @@
1
- module OasRails
2
- class ApplicationRecord < ActiveRecord::Base
3
- self.abstract_class = true
4
- end
5
- end