Helpful skills
');
+ for (var i = 0; i < needsItem.skills.length; i++) {
+ div.find("ul.jogl-need-skills").append('
' + needsItem.skills[i] + '');
+ }
+ }
+ div.append('
How to help');
+
+ // Make all links in news items open in a new tab.
+ div.find('a').prop('target', "_blank").prop('rel', "noopener");
+}
+
+function joglCompletedNeedContent(div, needsItem) {
+ const needURL = 'https://app.jogl.io/need/' + needsItem.id;
+ // header
+ div.append('
');
+
+ // Content. Add links to bare URLs, and prepend JOGL domains to bare path links.
+ var needsContent = linkify(needsItem.content);
+ needsContent = addJoglLinks(needsContent);
+ div.append('
' + needsContent + '
');
+
+ // Make all links in news items open in a new tab.
+ div.find('a').prop('target', "_blank").prop('rel', "noopener");
+}
+
+function addJogl(joglId) {
+ const joglProjectURL = 'https://jogl-backend.herokuapp.com/api/projects/' + joglId + '/';
+ $.getJSON(joglProjectURL, function( projData ) {
+
+ // Load news.
+ const joglNewsURL = 'https://jogl-backend.herokuapp.com/api/feeds/' + projData.feed_id;
+ $.getJSON(joglNewsURL, function( feedData ) {
+ if (feedData.length == 0) {
+ // "No news" default text.
+ $("#jogl-news").append('No news items yet for
this project\'s JOGL page.')
+
+ } else {
+ //$("#jogl-news").append(
+ // '
Comment on news items using this activity\'s JOGL project page
');
+
+ // Add news items.
+ var infoTopNews = null; // populate top project news item for info tab
+ for (var i = 0; i < feedData.length; i++) {
+ var newsItemDiv = $('
');
+ $("#jogl-news").append(newsItemDiv);
+ if (i != 0) {
+ newsItemDiv.append('
'); // separator for multiple items
+ };
+ joglNewsItemContent(newsItemDiv, feedData[i]); // add additional content to news item
+ if (!infoTopNews && feedData[i].from.object_type == "project") {
+ infoTopNews = true;
+ $("#info-jogl-news").append("
Latest News
");
+ newsItemDiv.clone().appendTo( "#info-jogl-news" ); // copy first item to info div
+ }
+ };
+ };
+ });
+
+ // Load needs.
+ const joglNeedsURL = 'https://jogl-backend.herokuapp.com/api/projects/' + joglId + '/needs';
+ $.getJSON(joglNeedsURL, function (needsData) {
+
+ // Sort needs and split into "active" and "completed".
+ needsData.sort(function (N1, N2) { return sortNeeds(N1, N2); });
+ var activeNeeds = needsData.filter(function (N) { return N.status == "active"; });
+ var completedNeeds = needsData.filter(function (N) { return N.status == "completed"; });
+
+ if (activeNeeds.length == 0 && completedNeeds.length == 0) {
+ $("#jogl-needs").append("
No needs currently listed for this project.
");
+ }
+
+ // Active needs.
+ if (activeNeeds.length > 0) {
+ $("#jogl-needs").append('
Active Needs
');
+ for (var i = 0; i < activeNeeds.length; i++) {
+ var needsItemDiv = $('
');
+ $("#jogl-needs").append(needsItemDiv);
+ if (i !== 0) {
+ needsItemDiv.append('
');
+ } else {
+ $("#info-jogl-needs").append("
Active needs
");
+ }
+ joglActiveNeedContent(needsItemDiv, activeNeeds[i]);
+ if (i < 3) {
+ needsItemDiv.clone().appendTo("#info-jogl-needs");
+ }
+ };
+ };
+
+ // Completed needs.
+ if (completedNeeds.length > 0) {
+ $("#jogl-needs").append('
Completed Needs
');
+ for (var i = 0; i < completedNeeds.length; i++) {
+ var needsItemDiv = $('
');
+ $("#jogl-needs").append(needsItemDiv);
+ if (i !== 0) {
+ needsItemDiv.append('
');
+ }
+ joglCompletedNeedContent(needsItemDiv, completedNeeds[i]);
+ };
+ };
+ });
+ });
+}
+
+// Run this during page load to immediately load the target panel.
$(function () {
var default_panel = "#activity-panel-info";
@@ -44,3 +230,11 @@ $(function () {
// Run this to handle an existing hash on page load.
hashHandler();
});
+
+$(document).ready(function () {
+ // Add JOGL data after page load, if JOGL URL is defined.
+ if (typeof joglURL !== 'undefined') {
+ var joglId = /([0-9]+)/g.exec(joglURL)[1];
+ addJogl(joglId);
+ };
+})
\ No newline at end of file
diff --git a/static/scss/oh-proj-theming.scss b/static/scss/oh-proj-theming.scss
index 9509c29f3..db537f54c 100644
--- a/static/scss/oh-proj-theming.scss
+++ b/static/scss/oh-proj-theming.scss
@@ -22,6 +22,8 @@ $text-h1-mult: 2.0;
$text-h2-mult: 1.6;
$text-h3-mult: 1.35;
$text-h4-mult: 1.15;
+$text-h5-mult: 1.05;
+$text-h6-mult: 0.95;
$text-sm-mult: 1.05;
$text-md-mult: 1.1;
$text-lg-mult: 1.15;
@@ -53,6 +55,12 @@ body {
h4 {
font-size: $xs-text-base * $text-h4-mult;
}
+ h5 {
+ font-size: $xs-text-base * $text-h5-mult;
+ }
+ h6 {
+ font-size: $xs-text-base * $text-h6-mult;
+ }
}
footer {
font-size: $xs-text-base * $text-footer-mult;
@@ -72,6 +80,12 @@ footer {
h4 {
font-size: $xs-text-base * $text-h4-mult * $text-sm-mult;
}
+ h5 {
+ font-size: $xs-text-base * $text-h5-mult * $text-sm-mult;
+ }
+ h6 {
+ font-size: $xs-text-base * $text-h6-mult * $text-sm-mult;
+ }
}
footer {
font-size: $xs-text-base * $text-footer-mult * $text-sm-mult;
@@ -92,6 +106,12 @@ footer {
h4 {
font-size: $xs-text-base * $text-h4-mult * $text-md-mult;
}
+ h5 {
+ font-size: $xs-text-base * $text-h5-mult * $text-md-mult;
+ }
+ h6 {
+ font-size: $xs-text-base * $text-h6-mult * $text-md-mult;
+ }
}
footer {
font-size: $xs-text-base * $text-footer-mult * $text-md-mult;
@@ -112,6 +132,12 @@ footer {
h4 {
font-size: $xs-text-base * $text-h4-mult * $text-lg-mult;
}
+ h5 {
+ font-size: $xs-text-base * $text-h5-mult * $text-lg-mult;
+ }
+ h6 {
+ font-size: $xs-text-base * $text-h6-mult * $text-lg-mult;
+ }
}
footer {
font-size: $xs-text-base * $text-footer-mult * $text-lg-mult;
@@ -132,6 +158,12 @@ footer {
h4 {
font-size: $xs-text-base * $text-h4-mult * $text-xl-mult;
}
+ h5 {
+ font-size: $xs-text-base * $text-h5-mult * $text-xl-mult;
+ }
+ h6 {
+ font-size: $xs-text-base * $text-h6-mult * $text-xl-mult;
+ }
}
footer {
font-size: $xs-text-base * $text-footer-mult * $text-xl-mult;
@@ -348,4 +380,10 @@ btn.btn-xs {
}
.activity-badge-h3rem {
height:3rem;
-}
\ No newline at end of file
+}
+
+/* make lists visually consistent */
+ul, li {
+ margin-left: 0;
+ padding-left: 40px;
+}