diff --git a/apps/block_scout_web/assets/css/components/_nav_tabs.scss b/apps/block_scout_web/assets/css/components/_nav_tabs.scss index d52ddd23c0..90e4d0e736 100644 --- a/apps/block_scout_web/assets/css/components/_nav_tabs.scss +++ b/apps/block_scout_web/assets/css/components/_nav_tabs.scss @@ -29,3 +29,13 @@ background-color: darken($primary, 10%); border-color: darken($primary, 10%); } + +.api-doc-tab { + padding-bottom: 5px; + color: $primary !important; + background-color: transparent !important; +} + +.api-doc-tab.active { + border-bottom: 1px solid $primary; +} diff --git a/apps/block_scout_web/lib/block_scout_web/templates/api_docs/_action_tile.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/api_docs/_action_tile.html.eex index 7a5139bef3..4d9eebfbe3 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/api_docs/_action_tile.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/api_docs/_action_tile.html.eex @@ -19,198 +19,190 @@ -
- - - - - - - - - - - - - - - - - + + +
<%= for required_param <- @action.required_params do %> -
- - + + <% end %> <%= for optional_param <- @action.optional_params do %> - - - + + <% end %> - -
NameDescription
- module - - * required - - string - (query) - +
+
+
Name
+
Description
+
+
+
+
+ Module + + * required + +
+ string (query) +
+
A string with the name of the module to be invoked. Must be set to: <%= @module_name %> -
- action - - * required - - string - (query) - + + +
+
+
+ Action + + * required + +
+ string (query) +
+
A string with the name of the action to be invoked. Must be set to: <%= @action.name %> -
- <%= required_param.key %> - - * required - - <%= required_param.type %> - (query) - +
+
+ <%= required_param.key %> + + * required + +
+ <%= required_param.type %> (query) +
+
<%= required_param.description %>
" data-required="true" type="text" class="collapse form-control form-control-danger is-invalid" placeholder="<%= input_placeholder(required_param) %>" data-parameter-key="<%= required_param.key %>">
-
- <%= optional_param.key %> - <%= optional_param.type %> - (query) - +
+
+
<%= optional_param.key %>
+ <%= optional_param.type %> (query) + +
+
<%= optional_param.description %> " type="text" class="collapse form-control" placeholder="<%= input_placeholder(optional_param) %>" data-parameter-key="<%= optional_param.key %>"> -
- -
- - -
- -
+
+
+ +
+
+ +
+
+ + +

Responses

" class="collapse"> - -
Curl
-
-
" class="text-white m-2">
+
+
Curl
+
+
" class="m-2">
+
-
Request URL
-
-
" class="text-white m-2">
+
+
Request URL
+
+
" class="m-2">
+
- -
Server Response
- -
- - - - - - - - - - - - - -
CodeDetails
"> - -
Response Body
-
-
" class="text-white m-2">
-
-
+
+
Server Response
+
+
+
Code
+
Details
+
+
+
"> +
+
+
Response Body
+
+
" class="m-2">
+
+
+
+
Responses
-
- - - - - - - - - <%= for {response, index} <- Enum.with_index(@action.responses) do %> - - - - - <% end %> - -
CodeDescription
- <%= response.code %> - -
-
<%= response.description %>
-
- - +
+
" + role="tabpanel" + aria-labelledby="<%= "#{@module_name}-#{@action.name}-example-value-tab" %>"> +
+

+                       
+
+ + <%= if index == 0 do %> +
" role="tabpanel" - aria-labelledby="<%= "#{@module_name}-#{@action.name}-example-value-tab" %>"> -
-

-                         
+ aria-labelledby="<%= "#{@module_name}-#{@action.name}-model-tab" %>"> + <%= render "_model_table.html", model: response.model %>
+ <% end %> +
+ + + <% end %> - <%= if index == 0 do %> -
" - role="tabpanel" - aria-labelledby="<%= "#{@module_name}-#{@action.name}-model-tab" %>"> - <%= render "_model_table.html", model: response.model %> -
- <% end %> - - - -
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/api_docs/_model_table.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/api_docs/_model_table.html.eex index 8ec76907df..5b8ea45185 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/api_docs/_model_table.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/api_docs/_model_table.html.eex @@ -1,70 +1,56 @@ -
-
+

<%= @model.name %> {

-
- - - <%= for {key, details} <- @model.fields do %> - - - - - - <% end %> - -
- <%= key %> - - - <%= details.type %> - <%= if details[:definition] do %> - - <% end %> - - <%= if details[:type] == "array" do %> - - [<%= details.array_type.name %>] - - <% end %> - <%= if details[:enum] do %> - enum: <%= details.enum %> + <%= for {key, details} <- @model.fields do %> +
+
+ <%= key %> +
+
+ + <%= details.type %> + <%= if details[:definition] do %> + + <% end %> + + <%= if details[:type] == "array" do %> + + [<%= details.array_type.name %>] + + <% end %> + <%= if details[:enum] do %> + enum: <%= details.enum %> +
+
enum +
interpretation +
+ <%= for {enum, interpretation} <- details[:enum_interpretation] do %> +
+
+ "<%= enum %>" +
+
+ <%= interpretation %> +
+
+ <% end %> - - - - - - - - - <%= for {enum, interpretation} <- details[:enum_interpretation] do %> - - - - - <% end %> - -
enuminterpretation
- "<%= enum %>" - - <%= interpretation %> -
- <% end %> - <%= if details[:example] do %> - example: <%= details.example %> - <% end %> - <%= if details[:description] do %> - description: <%= details.description %> - <% end %> -
+ <% end %> + <%= if details[:example] do %> + example: <%= details.example %> + <% end %> + <%= if details[:description] do %> + description: <%= details.description %> + <% end %> + + + + <% end %> +

}

-

}

-
-
<%= if @model.fields[:result][:type] == "array" do %> <%= render "_model_table.html", model: @model.fields[:result].array_type %>