Skip to content

Commit

Permalink
Switch to Robotics Stack Exchange
Browse files Browse the repository at this point in the history
Manually merged #320

Signed-off-by: Tully Foote <[email protected]>
  • Loading branch information
tfoote committed Jan 2, 2024
1 parent a36ff2e commit 786fdbb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
7 changes: 3 additions & 4 deletions _includes/package_body.html
Original file line number Diff line number Diff line change
Expand Up @@ -433,14 +433,13 @@ <h3 class="panel-title">Plugins</h3>
<div class="tab-pane" id="{{distro}}-questions">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Recent questions tagged <kbd>{{package.name}}</kbd> at <strong><a href="https://answers.ros.org" target="_blank">answers.ros.org</a></strong></h3>
</div>
<h3 class="panel-title">Recent questions tagged <kbd>{{package.name}}</kbd> at <strong><a href="https://robotics.stackexchange.com/" target="_blank">Robotics Stack Exchange</a></strong></h3> </div>
<div id="{{distro}}-question-list" class="panel-body" style="display: none;"></div>
<div id="{{distro}}-no-question-list" class="panel-body" style="display: none;">
<p>No questions yet, you can ask one <a href="https://answers.ros.org/questions/ask/?tags={{package.name}},{{distro}}">here</a>.</p>
<p>No questions yet, you can ask one <a href="https://robotics.stackexchange.com/questions/tagged/{{package.name}}+{{distro}}">here</a>.</p>
</div>
<div id="{{distro}}-get-question-fail" class="panel-body alert alert-warning" style="display: none;">
<p>Failed to get question list, you can ticket an issue <a href="https://github.com/ros2/rosindex/issues/new" target="_blank" class="alert-link">here</a> </p>
<p>Failed to get question list, you can ticket an issue <a href="https://github.com/ros-infrastructure/rosindex/issues/new" target="_blank" class="alert-link">here</a> </p>
</div>
</div>
</div>
Expand Down
20 changes: 11 additions & 9 deletions _includes/package_qna_updater.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% comment %} Template for Q&A content {% endcomment %}
<script id="question-list-template" type="text/html">
<p>
Browse <a href="https://answers.ros.org/questions/scope:all/sort:activity-desc/tags:{{package.name}}/page:1/">recent questions</a>
or see the <a href="https://answers.ros.org/questions/scope:all/sort:votes-desc/tags:{{package.name}}/page:1/">higest voted ones</a>.
Browse <a href="https://robotics.stackexchange.com/questions/tagged/{{package.name}}?tab=Newest">recent questions</a>
or see the <a href="https://robotics.stackexchange.com/questions/tagged/{{package.name}}?tab=Votes">higest voted ones</a>.
</p>
{% raw %}
<div class="list-group">
Expand All @@ -17,7 +17,7 @@ <h4 class="w-75 float-left">{{title}}</h4>
{{&description}}
</div>
<a class="question-description-toggle" id="question-description-{{id}}-toggle">Show more</a>
<a class="question-link" target="_blank" href="{{link}}">View on answers.ros.org</a>
<a class="question-link" target="_blank" href="{{link}}">View on Robotics Stack Exchange</a>
</div>
{{/questions}}
</div>
Expand All @@ -42,7 +42,7 @@ <h4 class="w-75 float-left">{{title}}</h4>
})();
jQuery(function() {
jQuery.getFeed({
url: "https://answers.ros.org/feeds/rss/?tags={{package.name}}",
url: "https://robotics.stackexchange.com/feeds/tag/{{package.name}}",
success: function(feed) {
{% for distro in page.all_distros %}
if (feed.items.length > 0) {
Expand All @@ -57,11 +57,12 @@ <h4 class="w-75 float-left">{{title}}</h4>
var rendered = Mustache.render(template, {questions: questions});
jQuery("#{{distro}}-question-list").html(rendered);
jQuery("#{{distro}}-question-list pre").addClass("prettyprint");
jQuery("#{{distro}}-question-list img").each(function() {
if (jQuery(this).attr("src").startsWith("/upfiles")) {
jQuery(this).attr("src", "https://answers.ros.org" + jQuery(this).attr("src"));
}
});
// TODO(tfoote) Resolve images
// jQuery("#{{distro}}-question-list img").each(function() {
// if (jQuery(this).attr("src").startsWith("/upfiles")) {
// jQuery(this).attr("src", "https://answers.ros.org" + jQuery(this).attr("src"));
// }
// });
jQuery("#{{distro}}-question-list .question-description").each(function() {
jQuery(this).click( function() {
if (jQuery(this).hasClass("question-description-collapsed")) {
Expand All @@ -88,6 +89,7 @@ <h4 class="w-75 float-left">{{title}}</h4>
{% endfor %}
},
error: function(res, err) {
// TODO(tfoote) resolve 404 errors which are what R.SE gives for non-extant tags, which in this context are just empty lists.
{% for distro in page.all_distros %}
console.error("Failed to get feed for {{distro}}:", err)
jQuery("#{{distro}}-get-question-fail").show();
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ <h2>More resources</h2>
<a href="https://discourse.ros.org/">ROS Discourse</a>
</p>
<p>
<a href="https://answers.ros.org/questions/">ROS Answers</a>
<a href="https://robotics.stackexchange.com/">Robotics Stack Exchange</a>
</p>
<p>
<a href="https://www.ros.org/">ros.org</a>
Expand Down

0 comments on commit 786fdbb

Please sign in to comment.