Skip to content

Commit

Permalink
Several fixes:
Browse files Browse the repository at this point in the history
  * Fix version dropdown
  * Do not crash package if Hex package information is not available
  • Loading branch information
josevalim committed Jan 11, 2022
1 parent 0d4ca8b commit 30ddadd
Show file tree
Hide file tree
Showing 17 changed files with 32 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<form autocomplete="off">
<select class="sidebar-projectVersionsDropdown" dir="rtl">
<select class="sidebar-projectVersionsDropdown">
{{#each nodes}}
<option translate="no" value="{{url}}"{{#if isCurrentVersion}} selected disabled{{/if}}>
{{version}}
Expand Down
6 changes: 4 additions & 2 deletions assets/js/quick-switch.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ export function initialize () {
}

function addEventListeners () {
qs(QUICK_SWITCH_LINK_SELECTOR).addEventListener('click', event => {
openQuickSwitchModal()
qsAll(QUICK_SWITCH_LINK_SELECTOR).forEach(element => {
element.addEventListener('click', event => {
openQuickSwitchModal()
})
})
}

Expand Down
8 changes: 5 additions & 3 deletions assets/js/settings.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import settingsModalBodyTemplate from './handlebars/templates/settings-modal-body.handlebars'
import { qs } from './helpers'
import { qs, qsAll } from './helpers'
import { openModal } from './modal'
import { shouldUseNightMode } from './night'
import { settingsStore } from './settings-store'
Expand Down Expand Up @@ -31,8 +31,10 @@ export function initialize () {
}

function addEventListeners () {
qs(SETTINGS_LINK_SELECTOR).addEventListener('click', event => {
openSettingsModal()
qsAll(SETTINGS_LINK_SELECTOR).forEach(element => {
element.addEventListener('click', event => {
openSettingsModal()
})
})
}

Expand Down
6 changes: 1 addition & 5 deletions assets/js/tooltips/hints.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,7 @@ export function extractFunctionHint (element) {
* @returns {Hint}
*/
export function extractModuleHint (content) {
const heading = content.querySelector('h1')
// Get just the text content ignoring other elements.
while (heading.firstElementChild) {
heading.removeChild(heading.firstElementChild)
}
let heading = content.querySelector('h1 span')
const title = heading.textContent

const firstParagraph = content.querySelector('#moduledoc p')
Expand Down
11 changes: 7 additions & 4 deletions assets/less/sidebar.less
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,16 @@

.sidebar-projectVersionsDropdown {
cursor: pointer;
position: relative;
margin: 0;
padding: 0 12px 0 0;
padding: 0 0 0 12px;
border: none;
-moz-appearance: none;
-webkit-appearance: none;
appearance: none;
background-color: transparent;
color: @white;
z-index: 2;

option {
color: initial;
Expand All @@ -100,11 +102,12 @@

.sidebar-projectVersion form::after {
position: absolute;
right: 0;
top: 1px;
left: 0;
top: 2px;
content: '\25BC';
z-index: -1;
z-index: 1;
font-size: 8px;
color: @white;
}

.sidebar-projectVersionsDropdown::-ms-expand {
Expand Down
2 changes: 1 addition & 1 deletion assets/less/variables/common.less
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
@nightBackground: #030913; // gray 900
@nightCodeBackground: #0D1829; // gray 800
@nightCodeBorder: #304254; // gray 600
@nightTextBody: #BAC5D0;
@nightTextBody: #CAD5E0; // gray 200
@nightTextHeaders: #F0F5F9; // gray 50
@nightHeader: #0D1829; // gray 800
@nightDeprecated: #333019;
Expand Down
2 changes: 1 addition & 1 deletion assets/test/tooltips/hints.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe('hints extraction', () => {
const modulePageObject = parseHTML(`
<div>
<h1>
Some module <small class="app-vsn">(ExDoc v0.0.1)</small>
<span>Some module</span> <small class="app-vsn">(ExDoc v0.0.1)</small>
<a href="https://github.com/" title="View Source" class="view-source" rel="help">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
Expand Down
2 changes: 2 additions & 0 deletions formatters/html/dist/app-008923d27aea1c274153.js

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions formatters/html/dist/app-973561a99a0985d496b3.js

This file was deleted.

2 changes: 0 additions & 2 deletions formatters/html/dist/elixir-925acc81db1bc46f1558.css

This file was deleted.

2 changes: 2 additions & 0 deletions formatters/html/dist/elixir-e03c3d7588cc75980d77.css

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions formatters/html/dist/erlang-af4097a665e030ec41c8.css

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions formatters/html/dist/erlang-d0a1de5e2f9743ebbcf5.css

This file was deleted.

4 changes: 2 additions & 2 deletions lib/ex_doc/formatter/html/templates/extra_template.eex
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<%= head_template(config, %{title: node.title, type: :extra}) %>
<%= sidebar_template(config, nodes_map) %>

<h1 id="content">
<%= node.title_content %>
<h1>
<span><%= node.title_content %></span>
<%= settings_button_template() %>
<%= if node.source_url do %>
<a href="<%= node.source_url %>" title="View Source" class="view-source" rel="help">
Expand Down
4 changes: 2 additions & 2 deletions lib/ex_doc/formatter/html/templates/not_found_template.eex
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<%= head_template(config, %{title: "404", type: :extra}) %>
<%= sidebar_template(config, nodes_map) %>

<h1 id="content">
Page not found
<h1>
<span>Page not found</span>
<%= settings_button_template() %>
</h1>

Expand Down
4 changes: 2 additions & 2 deletions lib/ex_doc/formatter/html/templates/search_template.eex
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<%= sidebar_template(config, nodes_map) %>

<div id="search">
<h1 id="content">
Page not found
<h1>
<span>Page not found</span>
<%= settings_button_template() %>
</h1>

Expand Down

0 comments on commit 30ddadd

Please sign in to comment.