styled buttons for library downloads, update content

This commit is contained in:
Justin Cooper 2019-04-17 10:10:20 -05:00
parent 889f9079da
commit 79c6a4fdc5
4 changed files with 44 additions and 20 deletions

View file

@ -6,28 +6,35 @@ document.addEventListener('DOMContentLoaded', function() {
} }
function buildReleaseLinks(data) { function buildReleaseLinks(data) {
console.log(data);
let releaseList = document.querySelector('.release-list'); let releaseList = document.querySelector('.release-list');
data.assets.forEach(function(asset) { data.assets.forEach(function(asset) {
let name = asset.name; let name = asset.name;
if (name.slice(-6) === 'ignore') { if (name.slice(-6) === 'ignore') {
// any .ignore files in the assets list
return; return;
} }
let versionId = name.replace(/(-[\d]+.zip$)/, ''); let versionId = name.replace(/(-[\d]+.zip$)/, '');
let versionElement = document.getElementById(versionId);
if (!versionElement) {
// likely an older version we don't want to link to, such as 2.x
return;
}
let iconElement = document.createElement('i');
iconElement.className = "fas fa-download";
console.log(name);
return;
let divElement = document.createElement('div');
let linkElement = document.createElement('a'); let linkElement = document.createElement('a');
linkElement.title = asset.name; linkElement.title = "Library Bundle Download";
linkElement.href = asset.browser_download_url; linkElement.href = asset.browser_download_url;
linkElement.className = "purple-button-link";
let linkText = document.createTextNode(asset.name); let linkText = document.createTextNode(asset.name);
linkElement.appendChild(linkText); linkElement.appendChild(linkText);
liElement.appendChild(linkElement); linkElement.appendChild(iconElement);
releaseList.appendChild(liElement); versionElement.appendChild(linkElement);
}); });
} }

View file

@ -19,3 +19,17 @@ h1, h2, h3, h4, h5 {
max-width: 100%; max-width: 100%;
height: auto; height: auto;
} }
a.purple-button-link {
display: inline-block;
width: auto;
padding: 15px 30px 15px 30px;
color: #fff;
border-radius: 5px;
border: none;
background-color: $purple;
i {
padding-left: 10px;
}
}

View file

@ -63,8 +63,8 @@ permalink: /libraries/contributing
Every repo should have a <code>libraryname_simpletest.py</code> file in the examples folder at a Every repo should have a <code>libraryname_simpletest.py</code> file in the examples folder at a
minimum. Any other included examples should be prefixed with <code>libraryname_</code> so all minimum. Any other included examples should be prefixed with <code>libraryname_</code> so all
examples found in any given repo folder start with the library name followed by an underscore. examples found in any given repo folder start with the library name followed by an underscore.
The GitHub end of things is a simple fix, however, please be aware <b>many examples are linked in The GitHub end of things is a simple fix, however, please be aware many examples are linked in
Learn guides</b>. You should mention in your pull request that it is possible that guides will Learn guides. You should mention in your pull request that it is possible that guides will
require updating to match the new example name. require updating to match the new example name.
</p> </p>
<!-- The rest of the script info goes here --> <!-- The rest of the script info goes here -->

View file

@ -21,7 +21,7 @@ permalink: /libraries
<p> <p>
The full list of all the CircuitPython libraries contained in the following bundles The full list of all the CircuitPython libraries contained in the following bundles
can be found on the can be found on the
<a href="https://circuitpython.readthedocs.io/projects/bundle/en/latest/drivers.html">libraries page</a>. <a href="https://circuitpython.readthedocs.io/projects/bundle/en/latest/drivers.html" title="">libraries page</a>.
<h2>Download and Installation Instructions</h2> <h2>Download and Installation Instructions</h2>
<p> <p>
The libraries in each release are compiled to .mpy for all recent major versions The libraries in each release are compiled to .mpy for all recent major versions
@ -32,7 +32,7 @@ permalink: /libraries
.mpy library bundle! .mpy library bundle!
</p> </p>
<p> <p>
To install, download the appropriate bundle for your version of CircuitPython. <b>To install</b>, download the appropriate bundle for your version of CircuitPython.
Unzip the file, open the resulting folder and find the lib folder. Open the lib Unzip the file, open the resulting folder and find the lib folder. Open the lib
folder and find the library files you need to load. Create a lib folder on your folder and find the library files you need to load. Create a lib folder on your
CIRCUITPY drive. Copy the individual library files you need to the lib folder CIRCUITPY drive. Copy the individual library files you need to the lib folder
@ -80,13 +80,20 @@ permalink: /libraries
If you'd like to contribute to the CircuitPython project, the CircuitPython If you'd like to contribute to the CircuitPython project, the CircuitPython
libraries are a great way to begin. Everyone is welcome to contribute! libraries are a great way to begin. Everyone is welcome to contribute!
Regardless of your experience level, we have many resources to get you Regardless of your experience level, we have many resources to get you
started. Check out the link below for more detailed information about how started. Check out the Contributing page for detailed information!
you can contribute to CircuitPython libraries! </p>
<p>
Find out more about how you can
<a href="{{ "/libraries/contributing" | relative_url }}" title="Contributing Page">contribute to CircuitPython libraries</a>.
</p> </p>
<!-- (can we even include the date like this?) --> <!-- (can we even include the date like this?) -->
<h2>Library Activity for Week of {{ site.data.libraries.updated_at | date: "%a, %b %d, %Y" }}</h2> <h2>Library Activity for Week of {{ site.data.libraries.updated_at | date: "%a, %b %d, %Y" }}</h2>
<p> <p>
Thank you to this week's contributors! Thank you to this week's contributors:
{% for contributor in site.data.libraries.contributors %}
<a href="https://github.com/{{contributor}}" title="Contributor Name">{{contributor}}</a>{% if forloop.last != true %}, {% endif %}
{% endfor %}
</p> </p>
<!-- pull the first section of the script report into this spot - (the PR's merged authors/reviewers and Issues opened/closed bit) --> <!-- pull the first section of the script report into this spot - (the PR's merged authors/reviewers and Issues opened/closed bit) -->
<p> <p>
@ -96,7 +103,7 @@ permalink: /libraries
<h3>New Libraries</h3> <h3>New Libraries</h3>
<ul> <ul>
{% for library in site.data.libraries.library_updates.new %} {% for library in site.data.libraries.library_updates.new %}
<li><a href="{{library[1]}}">{{library[0]}}</a></li> <li><a href="{{library[1]}}" title="New Library Location">{{library[0]}}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>
@ -104,14 +111,10 @@ permalink: /libraries
<h3>Updated Libraries</h3> <h3>Updated Libraries</h3>
<ul> <ul>
{% for library in site.data.libraries.library_updates.updated %} {% for library in site.data.libraries.library_updates.updated %}
<li><a href="{{library[1]}}">{{library[0]}}</a></li> <li><a href="{{library[1]}}" title="Updated Library Location">{{library[0]}}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>
<p>
Find out more about how you can
<a href="{{ "/libraries/contributing" | relative_url }}">contribute to CircuitPython libraries</a>.</p>
</p>
</div> </div>
</div> </div>