Skip to content

Commit

Permalink
Update _template files
Browse files Browse the repository at this point in the history
  • Loading branch information
y-martinez committed Aug 4, 2021
1 parent 17347b3 commit 1321a9c
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 98 deletions.
13 changes: 0 additions & 13 deletions _sources/lectures/_static/custom.css

This file was deleted.

84 changes: 46 additions & 38 deletions _templates/plugin_layouts/sphinx_bootstrap/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
<!DOCTYPE html>
{%- endblock %}

{%- block scripts %}
{# Override the scripts block from sphinx so we can force loading of jquery/underscore/doctools js files #}
{{ js_defer(script_files) }}
{{ super() }}
{%- endblock %}

{# Sidebar: Rework into our Boostrap nav section. #}
{% macro navBar() %}

Expand All @@ -26,25 +32,26 @@

<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type='button' class='navbar-toggle' data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="icon-bar" aria-label="navbar toggle" class="visuallyhidden">toggle navbar</span>
<button type='button' class='navbar-toggle' data-toggle="collapse" data-target=".navbar-ex1-collapse" aria-label="navbar toggle">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>

<div>
{% set logo = '_static/' + (logo if logo else 'img/logo_small.png') %}
{% if minimal_outside_links != 'True' %}
<a class="brand-logo" style='background: transparent url("{{pathto('_static/img/logo_small.png', 1)}}") no-repeat 0px 0px;' href="/{{appname}}/default/user/login">&nbsp; </a>
<a class="brand-logo" href="/{{appname}}/default/user/login" aria-label="Login"><img src="{{pathto(logo, 1)}}" alt=""></a>
{% else %}
<a class="brand-logo" style='background: transparent url("{{pathto('_static/img/logo_small.png', 1)}}") no-repeat 0px 0px;'>&nbsp;<span aria-label="logo" class="visuallyhidden">Runestone Logo</span> </a>
<div class="brand-logo"><img src="{{pathto(logo, 1)}}" alt=""></div>
{% endif %}
<a class="navbar-brand" href="{{ pathto(master_doc) }}" aria-label="index-page">
{% if dynamic_pages == 'True' %}
{% raw %}
{{ =course_name }}
{% endraw %}
{% else %}
{% if course_title -%}{{ course_title|e }}{%- else -%}{{ course_id|e }}{%- endif -%}
{% if theme_navbar_title -%}{{ theme_navbar_title|e }}{%- elif course_title -%}{{ course_title|e }}{%- else -%}{{ course_id|e }}{%- endif -%}
{% endif %}
</a>
</div>
Expand All @@ -62,7 +69,7 @@
{% if minimal_outside_links != 'True' %}
<li class="dropdown">
<a class="dropdown-toggle" href="#" data-toggle="dropdown">
<i class="glyphicon glyphicon-globe" style="opacity: 0.9"><span aria-label="Social" class="visuallyhidden">Social</span></i>
<i class="glyphicon glyphicon-globe" style="opacity: 0.9"><span class="visuallyhidden" aria-label="Social">Social</span></i>
</a>
<ul class="dropdown-menu social-menu">
<li>
Expand Down Expand Up @@ -99,7 +106,7 @@
<!-- search dropdown -->
<li class="dropdown">
<a class="dropdown-toggle" href="#" data-toggle="dropdown">
<i class="glyphicon glyphicon-search" style='opacity:0.9;'><span aria-label="Search" class="visuallyhidden">Search</span></i>
<i class="glyphicon glyphicon-search" style='opacity:0.9;'><span class="visuallyhidden" aria-label="Search">Search</span></i>
</a>
<ul class='dropdown-menu'>
{% if 'overview' in course_id %}
Expand Down Expand Up @@ -133,7 +140,7 @@
<!-- user account dropdown -->
<li class="dropdown">
<a class="dropdown-toggle" href="#" data-toggle="dropdown">
<i class="glyphicon glyphicon-user" style="opacity:0.9;"><span aria-label="User" class="visuallyhidden">User</span></i>
<i class="glyphicon glyphicon-user" style="opacity:0.9;"><span class="visuallyhidden" aria-label="User">User</span></i>
</a>
<ul class="dropdown-menu user-menu">
<li><span class='loggedinuser'></span></li>
Expand Down Expand Up @@ -167,8 +174,8 @@
<!-- <li id="scratch_ac_link"><a href="javascript:ACFactory.toggleScratchActivecode()">Scratch ActiveCode</a></li> -->

<!-- <li class="dropdown"> -->
<li id="scratch_ac_link" class="dropdown"><a href="javascript:ACFactory.toggleScratchActivecode()">
<i class="glyphicon glyphicon-pencil" style="opacity:0.9;"><span aria-label="Scratch Activecode" class="visuallyhidden">Scratch Activecode</span></i></a></li>
<li id="scratch_ac_link" class="dropdown"><a href="javascript:runestoneComponents.popupScratchAC()">
<i class="glyphicon glyphicon-pencil" style="opacity:0.9;"><span class="visuallyhidden" aria-label="Scratch Activecode" >Scratch Activecode</span></i></a></li>
<!-- </li> -->

<li class="divider-vertical"></li>
Expand All @@ -177,7 +184,7 @@
<!-- help menu dropdown -->
<li class="dropdown">
<a class="dropdown-toggle" href="#" data-toggle="dropdown">
<i class="glyphicon glyphicon-question-sign" style="opacity:0.9;"><span aria-label="Help" class="visuallyhidden">Help</span></i>
<i class="glyphicon glyphicon-question-sign" style="opacity:0.9;"><span class="visuallyhidden" aria-label="Help">Help</span></i>
</a>
<ul class="dropdown-menu user-menu">
<li><a href='http://runestoneinteractive.org/pages/faq.html'>FAQ</a></li>
Expand Down Expand Up @@ -208,27 +215,18 @@
<li>{% include "sourcelink.html" %}</li>
{% endif %}
</ul>

</div> <!-- navbar -->







</div> <!-- container -->
</div>
</div>
</div> <!-- navbar-collapse -->
</div> <!-- navbar -->
</div> <!-- container -->
{% endmacro %}

{%- block extrahead %}
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />

{% if not favicon %}
<link rel="shortcut icon" href="/{{appname}}/static/favicon.ico" type="image/ico" />
{% endif %}

<script type="text/javascript">
<script>
eBookConfig = {};
{% if dynamic_pages == 'True' %}
{% raw %}
Expand Down Expand Up @@ -268,7 +266,6 @@
eBookConfig.proxyuri_files = '{{proxy_uri_files}}';
eBookConfig.enable_chatcodes = {{enable_chatcodes}} ? {{ enable_chatcodes }} : false;


</script>

<!-- Ad Serving Headers Only serve ads to Anonymous Users -->
Expand Down Expand Up @@ -296,6 +293,11 @@
<div class="container" id="continue-reading"></div>

<div class="container" id="main-content" role="main">

{% with place='top' %}
{% include "subchapter.html" %}
{% endwith %}

<!-- Ad Serving for Runestone Campaign -->
{% if dynamic_pages == 'True' %}
{% raw %}
Expand All @@ -314,12 +316,12 @@

{% block body %}
{% endblock %}
<div id=scprogresscontainer>
You have attempted <span id=scprogresstotal></span> of <span id=scprogressposs></span> activities on this page <div id="subchapterprogress"></div>
<div id="scprogresscontainer">
You have attempted <span id="scprogresstotal"></span> of <span id="scprogressposs"></span> activities on this page <div id="subchapterprogress" aria-label="Page progress"></div>
</div>
{% block nextprevious %}
{% include "subchapter.html" %}
{% endblock %}
{% with place='bottom'%}
{% include "subchapter.html" %}
{% endwith %}
</div>
{%- endblock %}

Expand All @@ -341,9 +343,9 @@
<p>
{%- if show_copyright %}
{%- if hasdoc('copyright') %}
{% trans path=pathto('copyright'), copyright=copyright|e %}&copy; <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %}
{% trans path=pathto('copyright'), copyright=copyright %}&copy; <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %}
{%- else %}
{% trans copyright=copyright|e %}&copy; Copyright {{ copyright }}.{% endtrans %}
{% trans copyright=copyright %}&copy; Copyright {{ copyright }}.{% endtrans %}
{%- endif %}
{%- endif %}
{%- if last_updated %}
Expand All @@ -360,13 +362,13 @@
{% if dynamic_pages == 'True' %}
{% raw %}
{{ if request.application == 'runestone':}}
<script type="text/javascript">
<script>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '{{ =settings.google_ga }}']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
var ga = document.createElement('script'); ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
Expand All @@ -382,10 +384,16 @@
</script>

<script async src="https://hypothes.is/embed.js"></script>
<!--provide space to prevent hypothes.is sidebar from obscuring content-->
<style>@media screen and (max-width:767px) { body { padding-right: 21px; }}</style>

{% endif %}
{% endif %}

<script> runestoneComponents.getSwitch(); </script>
<script>
window.addEventListener('load', (event) => {
runestoneComponents.getSwitch();
});
</script>

{% endblock %}
2 changes: 1 addition & 1 deletion _templates/plugin_layouts/sphinx_bootstrap/progress.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
document.getElementById("progressBar").style.width = book.curChapterPercent-1 + "%";
}
}
document.addEventListener('DOMContentLoaded', function() {
window.addEventListener('load', function() {
loadProgressBar();
}, false);
</script>
Expand Down
8 changes: 5 additions & 3 deletions _templates/plugin_layouts/sphinx_bootstrap/relations.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
<li class="divider-vertical"></li>
{%- endif %}

<script type="text/javascript">
<script>
opts = {'placement':'bottom',
'selector': '',
'delay': { show: 100, hide: 50}
};

$('#relations-prev').tooltip(opts);
$('#relations-next').tooltip(opts);
window.addEventListener('load', (event) => {
$('#relations-prev').tooltip(opts);
$('#relations-next').tooltip(opts);
});
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
.attr("border", 0);
};

$(document).ready(function () {
$(function () {

/*
* Scroll the window to avoid the topnav bar
Expand Down
55 changes: 15 additions & 40 deletions _templates/plugin_layouts/sphinx_bootstrap/subchapter.html
Original file line number Diff line number Diff line change
@@ -1,49 +1,24 @@
<ul role="navigation" class="nextprev-list nextprev-list-{{place}}" aria-label="Change page">
{%- if prev %}
<ul>
<li id="relations-prev" style="opacity:0.4" onmouseover="mouseOverPrev()" onmouseout="mouseOutPrev()"class="navLink" title='Previous Section - {{ prev.title|extractText|extractTextII }}' data-toggle="tooltip">
<a href="{{ prev.link|e }}" aria-label="{{ prev.title|extractText|extractTextII }}">
<div style="background-color: white; border-style:solid; border-color:lightgrey; border-width:2px; width:100px; height:50px">
<i class='prevNav glyphicon glyphicon-chevron-left' style="top:50%; transform:translateY(-50%)translateX(-50%); left: 50%; color:black;"></i>
</div>
</a>
</li>
</ul>

{% endif %}
<li id="relations-prev-{{place}}" class="relations-prev navLink" title='Previous Section - {{ prev.title|extractText|extractTextII }}' data-toggle="tooltip">
<a href="{{ prev.link|e }}" aria-label="Previous - {{ prev.title|extractText|extractTextII }}">
<i class='prevNav glyphicon glyphicon-chevron-left' style="top:50%; transform:translateY(-50%)translateX(-50%); left: 50%; color:black;"></i>
</a>
</li>
{% endif %}

{%- if next %}
<ul>
<li id="relations-next" style="opacity:0.4" onmouseover="mouseOverNext()" onmouseout="mouseOutNext()" class="navLink" title='Next Section - {{ next.title|extractText|extractTextII }}' data-toggle="tooltip" >
<a href="{{ next.link|e }}" aria-label="{{ next.title|extractText|extractTextII }}">
<div style="background-color: white; border-style:solid; border-color:lightgrey; border-width:2px; width:100px; height:50px">
<i id="relationsNextIcon" class='nextNav glyphicon glyphicon-chevron-right' style="top:50%; transform:translateY(-50%)translateX(-50%); left: 50%; color:black; "></i>
</div>
<li id="relations-next-{{place}}" class="relations-next navLink" title='Next Section - {{ next.title|extractText|extractTextII }}' data-toggle="tooltip" >
<a href="{{ next.link|e }}" aria-label="Next - {{ next.title|extractText|extractTextII }}">
<i id="relationsNextIcon" class='nextNav glyphicon glyphicon-chevron-right' style="top:50%; transform:translateY(-50%)translateX(-50%); left: 50%; color:black; "></i>
</a>
</li>
</ul>

{%- endif %}

<script type="text/javascript">

$('#relations-prev').tooltip({'placement':'right', 'selector': '', 'delay': { show: 100, hide: 50}});
$('#relations-next').tooltip({'placement':'left', 'selector': '', 'delay': { show: 100, hide: 50}});

</script>
</ul>

<script>
function mouseOverPrev() {
document.getElementById("relations-prev").style.opacity=1;
}

function mouseOutPrev() {
document.getElementById("relations-prev").style.opacity=0.4;
}
function mouseOverNext() {
document.getElementById("relations-next").style.opacity=1;
}

function mouseOutNext() {
document.getElementById("relations-next").style.opacity=0.4;
}
window.addEventListener('load', (event) => {
$('#relations-prev-{{place}}').tooltip({'placement': 'right', 'delay': { show: 100, hide: 50}});
$('#relations-next-{{place}}').tooltip({'placement': 'left', 'delay': { show: 100, hide: 50}});
});
</script>
4 changes: 2 additions & 2 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
# ,'runestone.video','runestone.reveal','runestone.poll','runestone.tabbedStuff','runestone.disqus','runestone.codelens','runestone.activecode', 'runestone.assess', 'runestone.animation','runestone.meta', 'runestone.parsons', 'runestone.blockly', 'runestone.livecode','runestone.accessibility']

# Add any paths that contain templates here, relative to this directory.
templates_path = [pkg_resources.resource_filename("runestone", "common/project_template/_templates")]
templates_path = ["./_templates"]

print(templates_path)

Expand Down Expand Up @@ -227,7 +227,7 @@
# html_style = "style.css"

# Add any paths that contain custom themes here, relative to this directory.
html_theme_path = [pkg_resources.resource_filename("runestone", "common/project_template/_templates/plugin_layouts")]
html_theme_path = ["./_templates/plugin_layouts"]

print(html_theme_path)

Expand Down

0 comments on commit 1321a9c

Please sign in to comment.