[DOC-WEB] [web-doc] master: improve Outdated Files tool

1 view
Skip to first unread message

Nilgün Belma Bugüner

unread,
Jan 13, 2022, 7:49:46 PM1/13/22
to doc...@lists.php.net
Author: Nilgün Belma Bugüner (nilgun)
Date: 2022-01-14T03:49:35+03:00

Commit: https://github.com/php/web-doc/commit/bb9b7680bcf15144625257e05d05e602d213f116
Raw diff: https://github.com/php/web-doc/commit/bb9b7680bcf15144625257e05d05e602d213f116.diff

improve Outdated Files tool

Changed paths:
M shared/templates/footer.inc
M shared/templates/header.inc
M www/revcheck.php


Diff:

diff --git a/shared/templates/footer.inc b/shared/templates/footer.inc
index 4a95d5e..4934dc2 100644
--- a/shared/templates/footer.inc
+++ b/shared/templates/footer.inc
@@ -12,6 +12,16 @@
<script src='//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'></script>
<script src='//shared.php.net/js/external/mousetrap.min.js?filemtime=1421836947'></script>
<script src='//shared.php.net/js/common.js?filemtime=1421836947'></script>
+<script src="//cdn.jsdelivr.net/npm/clip...@2.0.8/dist/clipboard.min.js"></script>
+<script>
+ var clipboard = new ClipboardJS('.btn');
+ clipboard.on('success', function (e) {
+ console.log(e);
+ });
+ clipboard.on('error', function (e) {
+ console.log(e);
+ });
+</script>
</div><!-- .wrap -->
</body>
</html>
diff --git a/shared/templates/header.inc b/shared/templates/header.inc
index ffcf1ca..9d2d12f 100644
--- a/shared/templates/header.inc
+++ b/shared/templates/header.inc
@@ -14,7 +14,52 @@
<!--[if lt IE 9]>
<script src="//shared.php.net/js/html5shiv.js"></script>
<![endif]-->
- </head>
+
+<style type="text/css">
+table {
+ margin-left: auto;
+ margin-right: auto;
+ text-align: left;
+ border-spacing: 2px;
+ font-size:14px;
+}
+th {
+ color: white;
+ background-color: #666699;
+ padding: 0.2em;
+ text-align: center;
+ vertical-align: middle;
+}
+td {
+ padding: 0.2em 0.3em;
+}
+.oc {
+ white-space: nowrap;
+ overflow: hidden;
+ max-width: 6em;
+}
+.copy {
+ margin:0;
+ padding: 0;
+ font-size:small;
+ }
+.copy:hover {
+ text-transform: uppercase;
+}
+.copy:active {
+ background: aqua;
+ font-weight: bold;
+}
+.o {
+ white-space: nowrap;
+ overflow: hidden;
+ max-width: 3em;
+}
+.c {
+ text-align: center;
+}
+</style>
+</head>
<body id="doc">

<div class="wrap">
diff --git a/www/revcheck.php b/www/revcheck.php
index 42774f8..a43ddd9 100644
--- a/www/revcheck.php
+++ b/www/revcheck.php
@@ -324,7 +324,7 @@
echo '<p>Good, it seems that all files are up to date for these conditions.</p>';
} else {
echo <<<END_OF_MULTILINE
-<table border="0" cellpadding="4" cellspacing="1" style="text-align:center">
+<table>
<tr>
<th rowspan="2">Translated file</th>
<th rowspan="2">Changes</th>
@@ -361,7 +361,9 @@
//plaintext
$d2 = "?p=plain&amp;lang={$lang}&amp;hbp={$r['trans_rev']}&amp;f=$key&amp;c=off";

- $h1 = "<a href='https://github.com/php/doc-en/blob/{$r['en_rev']}/$key'>{$r['en_rev']}</a>";
+ $h1 = '<button class="btn copy" data-clipboard-text="';
+ $h1 .= $r['en_rev'] . '">Copy</button> ';
+ $h1 .= "<a href='https://github.com/php/doc-en/blob/{$r['en_rev']}/$key'>{$r['en_rev']}</a>";

$h2 = "<a href='https://github.com/php/doc-en/blob/{$r['trans_rev']}/$key'>{$r['trans_rev']}</a>";

@@ -370,13 +372,16 @@
$ch = "<span style='color: darkgreen;'>+{$r['additions']}</span> <span style='color: firebrick;'>-{$r['deletions']}</span>";

// Write out the line for the current file (get file name shorter)
- echo '<tr>' .
- "<td style='white-space:nowrap'>{$nm}</td>" .
- "<td style='font-size: 14px; text-align: right;'>{$ch}</td>" .
- "<td>{$h1}</td>" .
- "<td>{$h2}</td>" .
- "<td> {$r['maintainer']}</td>" .
- "<td> {$r['status']}</td></tr>\n";
+ echo <<<END_OF_MULTILINE
+<tr style='background-color: #dcdcdc;'>
+ <td style='white-space:nowrap'>{$nm}</td>
+ <td class='c'>{$ch}</td>
+ <td class="oc">{$h1}</td>
+ <td class='o'>{$h2}</td>
+ <td class='c'>{$r['maintainer']}</td>
+ <td class='c'>{$r['status']}</td>
+</tr>
+END_OF_MULTILINE;
}
echo '</table>';
}

--
Documentation Website Mailing List (http://doc.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply all
Reply to author
Forward
0 new messages