Skip to content
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
16 changes: 16 additions & 0 deletions js/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,3 +359,19 @@ if (link.text() == "SyntaxError") {
console.log("There is an issue with the intermediate/speech_command_recognition_with_torchaudio.html menu item.");
link.text("Speech Command Recognition with torchaudio");
}

$(".stars-outer > i").hover(function() {
$(this).prevAll().addBack().toggleClass("fas star-fill");
});

$(".stars-outer > i").on("click", function() {
$(this).prevAll().each(function() {
$(this).addBack().addClass("fas star-fill");
});

$(".stars-outer > i").each(function() {
$(this).unbind("mouseenter mouseleave").css({
"pointer-events": "none"
});
});
})
18 changes: 11 additions & 7 deletions pytorch_sphinx_theme/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,18 @@

{% if theme_pytorch_project == 'tutorials' %}

<hr class="helpful-hr hr-top">
<div class="helpful-container">
<div class="helpful-question">Was this helpful?</div>
<div class="helpful-question yes-link" data-behavior="was-this-helpful-event" data-response="yes">Yes</div>
<div class="helpful-question no-link" data-behavior="was-this-helpful-event" data-response="no">No</div>
<div class="was-helpful-thank-you">Thank you</div>
<hr class="rating-hr hr-top">
<div class="rating-container">
<div class="rating-prompt">Rate this Tutorial</div>
<div class="stars-outer">
<i class="far fa-star" title="1 Star" data-behavior="tutorial-rating" data-count="1"></i>
<i class="far fa-star" title="2 Stars" data-behavior="tutorial-rating" data-count="2"></i>
<i class="far fa-star" title="3 Stars" data-behavior="tutorial-rating" data-count="3"></i>
<i class="far fa-star" title="4 Stars" data-behavior="tutorial-rating" data-count="4"></i>
<i class="far fa-star" title="5 Stars" data-behavior="tutorial-rating" data-count="5"></i>
</div>
</div>
<hr class="helpful-hr hr-bottom"/>
<hr class="rating-hr hr-bottom"/>

{% else %}

Expand Down
1 change: 1 addition & 0 deletions pytorch_sphinx_theme/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
<script src="{{ pathto('_static/js/modernizr.min.js', 1) }}"></script>

{% include "fonts.html" %}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.2/css/all.css" integrity="sha384-vSIIfh2YWi9wW0r9iZe7RJPrKwp6bG+s9QZMoITbCckVJqGCCRhc+ccxNcdpHuYu" crossorigin="anonymous">
</head>

<div class="container-fluid header-holder tutorials-header" id="header-holder">
Expand Down
81 changes: 50 additions & 31 deletions pytorch_sphinx_theme/static/css/theme.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions pytorch_sphinx_theme/static/js/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -1055,4 +1055,20 @@ if (link.text() == "SyntaxError") {
link.text("Speech Command Recognition with torchaudio");
}

$(".stars-outer > i").hover(function() {
$(this).prevAll().addBack().toggleClass("fas star-fill");
});

$(".stars-outer > i").on("click", function() {
$(this).prevAll().each(function() {
$(this).addBack().addClass("fas star-fill");
});

$(".stars-outer > i").each(function() {
$(this).unbind("mouseenter mouseleave").css({
"pointer-events": "none"
});
});
})

},{"jquery":"jquery"}]},{},[1,2,3,4,5,6,7,8,9,10,"pytorch-sphinx-theme"]);
25 changes: 20 additions & 5 deletions scss/_sphinx_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -138,27 +138,27 @@ ul.pytorch-breadcrumbs {

.rst-content footer {

.helpful-hr.hr-top {
.rating-hr.hr-top {
margin-bottom: rem(-1px);
}

.helpful-hr.hr-bottom {
.rating-hr.hr-bottom {
margin-top: rem(-1px);
}

.helpful-container {
.rating-container {
display: inline-flex;
font-size: rem(18px);

.helpful-question, .was-helpful-thank-you {
.rating-prompt, .was-helpful-thank-you {
padding: rem(10px) rem(20px) rem(10px) rem(20px);
}

.was-helpful-thank-you {
display: none;
}

.helpful-question.yes-link, .helpful-question.no-link {
.rating-prompt.yes-link, .rating-prompt.no-link {
color: $orange;
cursor: pointer;

Expand All @@ -167,6 +167,21 @@ ul.pytorch-breadcrumbs {
color: $white;
}
}

.stars-outer {
display: inline-block;
position: relative;
font-family: FontAwesome;
padding: rem(10px) rem(20px) rem(10px) rem(20px);

i {
cursor: pointer;
}

.star-fill {
color: $red_orange;
}
}
}

div[role="contentinfo"] {
Expand Down