Skip to content

Commit c31b843

Browse files
Add contributions to acknowledgement page (backport #217) (#219)
* Add contributions to acknowledgement page (#217) (cherry picked from commit b1b7e26) # Conflicts: # .github/workflows/pr-stats.yml * Fix typo * Delete .github/workflows/pr-stats.yml --------- Co-authored-by: Christoph Fröhlich <christophfroehlich@users.noreply.github.com>
1 parent 4606a83 commit c31b843

File tree

9 files changed

+552
-88
lines changed

9 files changed

+552
-88
lines changed

.github/workflows/ci-format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
reviewer-stats
2525
path: ~/reviews
2626
- name: Copy stats
27-
run: ./make_help_scripts/add_review_stats
27+
run: ./make_help_scripts/add_pr_stats
2828
- uses: pre-commit/action@v3.0.0
2929
with:
3030
extra_args: --all-files --hook-stage manual

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ First, you need to fetch the reviewer stats from ros2_control org. To do so, you
2626

2727
```bash
2828
export GITHUB_TOKEN=<your token>
29-
python3 ./make_help_scripts/create_reviewer_stats.py
29+
python3 ./make_help_scripts/create_pr_stats.py
3030
```
3131
which will create `~/reviews/reviewers_stats_with_graph.html`. Then you can build the documentation as usual, it will copy the file from this folder.
3232

_static/tabs.js

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
try {
2+
var session = window.sessionStorage || {};
3+
} catch (e) {
4+
var session = {};
5+
}
6+
7+
window.addEventListener("DOMContentLoaded", () => {
8+
const allTabs = document.querySelectorAll('.sphinx-tabs-tab');
9+
const tabLists = document.querySelectorAll('[role="tablist"]');
10+
11+
allTabs.forEach(tab => {
12+
tab.addEventListener("click", changeTabs);
13+
});
14+
15+
tabLists.forEach(tabList => {
16+
tabList.addEventListener("keydown", keyTabs);
17+
});
18+
19+
// Restore group tab selection from session
20+
const lastSelected = session.getItem('sphinx-tabs-last-selected');
21+
if (lastSelected != null) selectNamedTabs(lastSelected);
22+
});
23+
24+
/**
25+
* Key focus left and right between sibling elements using arrows
26+
* @param {Node} e the element in focus when key was pressed
27+
*/
28+
function keyTabs(e) {
29+
const tab = e.target;
30+
let nextTab = null;
31+
if (e.keyCode === 39 || e.keyCode === 37) {
32+
tab.setAttribute("tabindex", -1);
33+
// Move right
34+
if (e.keyCode === 39) {
35+
nextTab = tab.nextElementSibling;
36+
if (nextTab === null) {
37+
nextTab = tab.parentNode.firstElementChild;
38+
}
39+
// Move left
40+
} else if (e.keyCode === 37) {
41+
nextTab = tab.previousElementSibling;
42+
if (nextTab === null) {
43+
nextTab = tab.parentNode.lastElementChild;
44+
}
45+
}
46+
}
47+
48+
if (nextTab !== null) {
49+
nextTab.setAttribute("tabindex", 0);
50+
nextTab.focus();
51+
}
52+
}
53+
54+
/**
55+
* Select or deselect clicked tab. If a group tab
56+
* is selected, also select tab in other tabLists.
57+
* @param {Node} e the element that was clicked
58+
*/
59+
function changeTabs(e) {
60+
// Use this instead of the element that was clicked, in case it's a child
61+
const notSelected = this.getAttribute("aria-selected") === "false";
62+
const positionBefore = this.parentNode.getBoundingClientRect().top;
63+
const notClosable = !this.parentNode.classList.contains("closeable");
64+
65+
deselectTabList(this);
66+
67+
if (notSelected || notClosable) {
68+
selectTab(this);
69+
const name = this.getAttribute("name");
70+
selectNamedTabs(name, this.id);
71+
72+
if (this.classList.contains("group-tab")) {
73+
// Persist during session
74+
session.setItem('sphinx-tabs-last-selected', name);
75+
}
76+
}
77+
78+
const positionAfter = this.parentNode.getBoundingClientRect().top;
79+
const positionDelta = positionAfter - positionBefore;
80+
// Scroll to offset content resizing
81+
window.scrollTo(0, window.scrollY + positionDelta);
82+
}
83+
84+
/**
85+
* Select tab and show associated panel.
86+
* @param {Node} tab tab to select
87+
*/
88+
function selectTab(tab) {
89+
tab.setAttribute("aria-selected", true);
90+
91+
// Show the associated panel
92+
document
93+
.getElementById(tab.getAttribute("aria-controls"))
94+
.removeAttribute("hidden");
95+
}
96+
97+
/**
98+
* Hide the panels associated with all tabs within the
99+
* tablist containing this tab.
100+
* @param {Node} tab a tab within the tablist to deselect
101+
*/
102+
function deselectTabList(tab) {
103+
const parent = tab.parentNode;
104+
const grandparent = parent.parentNode;
105+
106+
Array.from(parent.children)
107+
.forEach(t => t.setAttribute("aria-selected", false));
108+
109+
Array.from(grandparent.children)
110+
.slice(1) // Skip tablist
111+
.forEach(panel => panel.setAttribute("hidden", true));
112+
}
113+
114+
/**
115+
* Select grouped tabs with the same name, but no the tab
116+
* with the given id.
117+
* @param {Node} name name of grouped tab to be selected
118+
* @param {Node} clickedId id of clicked tab
119+
*/
120+
function selectNamedTabs(name, clickedId=null) {
121+
const groupedTabs = document.querySelectorAll(`.sphinx-tabs-tab[name="${name}"]`);
122+
const tabLists = Array.from(groupedTabs).map(tab => tab.parentNode);
123+
124+
tabLists
125+
.forEach(tabList => {
126+
// Don't want to change the tabList containing the clicked tab
127+
const clickedTab = tabList.querySelector(`[id="${clickedId}"]`);
128+
if (clickedTab === null ) {
129+
// Select first tab with matching name
130+
const tab = tabList.querySelector(`.sphinx-tabs-tab[name="${name}"]`);
131+
deselectTabList(tab);
132+
selectTab(tab);
133+
}
134+
})
135+
}
136+
137+
// TODO(christophfroehlich) this has to be uncommented for jQuery of our code to work on the same page
138+
139+
// if (typeof exports === 'undefined') {
140+
// exports = {};
141+
// }
142+
143+
// exports.keyTabs = keyTabs;
144+
// exports.changeTabs = changeTabs;
145+
// exports.selectTab = selectTab;
146+
// exports.deselectTabList = deselectTabList;
147+
// exports.selectNamedTabs = selectNamedTabs;

doc/acknowledgements/acknowledgements.rst

Lines changed: 54 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,71 @@ Acknowledgements
55

66
Maintainers
77
----------------
8-
The following people were maintaining the ``ros2_control`` framework, showing their all-time review activity:
8+
The following people were maintaining the ``ros2_control`` framework, showing their review activity and contributions:
99

10-
.. raw:: html
11-
:file: maintainers_stats.html
10+
.. tabs::
1211

13-
Activity during the past 12 months:
12+
.. tab:: Recent Contributions
1413

15-
.. raw:: html
16-
:file: maintainers_stats_recent.html
14+
Contributions during the past 12 months
1715

18-
Reviewers' Stats
19-
----------------
20-
The following people have contributed to the development of this project by giving valuable reviews for pull requests, see :ref:`doc/contributing/contributing:contributing` for more information.
16+
.. raw:: html
17+
:file: contributors_maintainers_stats_recent.html
18+
19+
.. tab:: All-Time Contrib
20+
21+
All-time contributions
22+
23+
.. raw:: html
24+
:file: contributors_maintainers_stats.html
25+
26+
.. tab:: Recent Reviews
2127

22-
.. raw:: html
23-
:file: reviewers_stats.html
28+
Reviews during the past 12 months
2429

25-
Activity during the past 12 months:
30+
.. raw:: html
31+
:file: reviewers_maintainers_stats_recent.html
2632

27-
.. raw:: html
28-
:file: reviewers_stats_recent.html
33+
.. tab:: All-Time Reviews
34+
35+
All-time reviews
36+
37+
.. raw:: html
38+
:file: reviewers_maintainers_stats.html
2939

3040
Contributors
3141
----------------
42+
The following people have contributed to the development of this project by providing valuable reviews or by submitting pull requests, see :ref:`doc/contributing/contributing:contributing` for more information.
43+
44+
.. tabs::
45+
46+
.. tab:: Recent Contributions
47+
48+
Contributions during the past 12 months
49+
50+
.. raw:: html
51+
:file: contributors_stats_recent.html
52+
53+
.. tab:: All-Time Contrib
54+
55+
All-time contributions
56+
57+
.. raw:: html
58+
:file: contributors_stats.html
59+
60+
.. tab:: Recent Reviews
61+
62+
Reviews during the past 12 months
63+
64+
.. raw:: html
65+
:file: reviewers_stats_recent.html
66+
67+
.. tab:: All-Time Reviews
68+
69+
All-time reviews
3270

33-
The following links lists people who have contributed to the development of this project by submitting pull requests to the respective repository, see :ref:`doc/contributing/contributing:contributing` for more information.
34-
35-
* `ros2_control <https://github.com/ros-controls/ros2_control/graphs/contributors>`_
36-
* `ros2_controllers <https://github.com/ros-controls/ros2_controllers/graphs/contributors>`_
37-
* `ros2_control_demos <https://github.com/ros-controls/ros2_control_demos/graphs/contributors>`_
38-
* `control_toolbox <https://github.com/ros-controls/control_toolbox/graphs/contributors>`_
39-
* `gazebo_ros2_control <https://github.com/ros-controls/gazebo_ros2_control/graphs/contributors>`_
40-
* `gz_ros2_control <https://github.com/ros-controls/gz_ros2_control/graphs/contributors>`_
41-
* `realtime_tools <https://github.com/ros-controls/realtime_tools/graphs/contributors>`_
42-
* `kinematics_interface <https://github.com/ros-controls/kinematics_interface/graphs/contributors>`_
43-
* `control_msgs <https://github.com/ros-controls/control_msgs/graphs/contributors>`_
71+
.. raw:: html
72+
:file: reviewers_stats.html
4473

4574

4675
Companies and Institutions
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ DIR="${BASH_SOURCE%/*}"
66
if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi
77
. "$DIR/deploy_defines" || { echo "Could not source deploy_defines script. This is needed for correct execution. Exiting!"; exit; }
88

9-
add_reviewer_stats_file
9+
add_pr_stats_file

make_help_scripts/add_sub_repos

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ add_sub_repositories () {
2323
}
2424

2525
add_sub_repositories
26-
add_reviewer_stats_file
26+
add_pr_stats_file

make_help_scripts/add_tmp_commits

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ add_sub_repositories_and_commit () {
4646
rm -rf .git/
4747
cd ../../
4848
done
49-
add_reviewer_stats_file
49+
add_pr_stats_file
5050
git add .
5151
# we don't want to use-precommit to check if subrepos are correct
5252
git commit -m "Add temporary changes for multi version" --no-verify 1> /dev/null

0 commit comments

Comments
 (0)