Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move contribution links to the bottom of the documentation pages #973

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 27 additions & 18 deletions include/shared-manual.inc
Original file line number Diff line number Diff line change
Expand Up @@ -323,30 +323,13 @@ function manual_setup($setup): void {
];
site_header($setup["this"][1] . " - Manual ", $config);

$id = substr($setup['this'][0], 0, -4);
$repo = strtolower($config['lang']); // pt_BR etc.

$edit_url = "https://github.com/php/doc-{$repo}";
// If the documentation source information is available (generated using
// doc-base/configure.php and PhD) then try and make a source-specific URL.
if (isset($setup['source'])) {
$source_lang = $setup['source']['lang'];
if ($source_lang === $repo || $source_lang === 'base') {
$edit_url = "https://github.com/php/doc-{$source_lang}/blob/master/{$setup['source']['path']}";
}
}

$languageChooser = manual_language_chooser($config['lang'], $config['thispage']);

echo <<<PAGE_TOOLS
<div class="page-tools">
<div class="change-language">
{$languageChooser}
</div>
<div class="edit-bug">
<a href="{$edit_url}">Submit a Pull Request</a>
<a href="https://github.com/php/doc-{$repo}/issues/new?body=From%20manual%20page:%20https:%2F%2Fphp.net%2F$id%0A%0A---">Report a Bug</a>
</div>
</div>
PAGE_TOOLS;
}
Expand Down Expand Up @@ -381,9 +364,35 @@ CHANGE_LANG;
return trim($r);
}

function manual_footer(): void {
function manual_footer($setup): void {
global $USERNOTES, $__RELATED;

$id = substr($setup['this'][0], 0, -4);
$repo = strtolower($setup["head"][1]); // pt_BR etc.

$edit_url = "https://github.com/php/doc-{$repo}";
// If the documentation source information is available (generated using
// doc-base/configure.php and PhD) then try and make a source-specific URL.
if (isset($setup['source'])) {
$source_lang = $setup['source']['lang'];
if ($source_lang === $repo || $source_lang === 'base') {
$edit_url = "https://github.com/php/doc-{$source_lang}/blob/master/{$setup['source']['path']}";
}
}

echo <<<CONTRIBUTE
<div class="contribute">
<h3 class="title">Improve This Page</h3>
<div class="edit-bug">
<a href="https://github.com/php/doc-base/blob/master/README.md" title="This will take you to our contribution guidelines on GitHub." target="_blank" rel="noopener noreferrer">Learn how improve this page</a>
<a href="{$edit_url}">Submit a Pull Request</a>
<a href="https://github.com/php/doc-{$repo}/issues/new?body=From%20manual%20page:%20https:%2F%2Fphp.net%2F$id%0A%0A---">Report a Bug</a>
</div>
</div>
CONTRIBUTE;

manual_notes($USERNOTES);
site_footer([
'related_menu' => $__RELATED['toc'],
Expand Down
15 changes: 10 additions & 5 deletions styles/theme-base.css
Original file line number Diff line number Diff line change
Expand Up @@ -419,14 +419,19 @@ hr {
.page-tools {
text-align: right;
}

.page-tools #changelang-langs,
.page-tools .edit-bug {
.page-tools #changelang-langs {
font-size:.75rem;
}
.page-tools .edit-bug a {

.contribute {
border: 1px solid #888;
border-radius: 3px;
margin: 0px -10px 0px -10px;
padding: 0 10px 5px 10px;
background-color: #E2E2E2;
}
.contribute .edit-bug a {
border: 0;
margin-left: 1rem;
}

/**
Expand Down
Loading