-
Notifications
You must be signed in to change notification settings - Fork 469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Feature/add community groups #536
base: source
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
<!DOCTYPE html> | ||
<html class="chapters"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<link rel="stylesheet" href="/style.css"> | ||
<link rel="stylesheet" href="/community-groups.css"> | ||
<link rel="shortcut icon" href="/favicon.ico"> | ||
<link href="//fonts.googleapis.com/css?family=Source+Sans+Pro:400,700|Source+Code+Pro" rel="stylesheet" type="text/css"> | ||
<link rel="stylesheet" href="/mapbox.css"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>NodeSchool - Chapters</title> | ||
</head> | ||
<body class="chapters"> | ||
<header> | ||
<div class="container"> | ||
<div class="full"> | ||
<a href="index.html"><img class="logo" src="/images/schoolhouse.svg" alt="nodeschoolhouse"></a> | ||
<ul class="nav"> | ||
<li><a href="index.html" data-i18n="menu-index">Home</a></li> | ||
<li><a href="events.html" data-i18n="menu-events">Events</a></li> | ||
<li><a href="chapters.html" data-i18n="menu-chapters">Chapters</a></li> | ||
<li class="current-page"><a href="community-groups.html" data-i18n="menu-community-groups">Community Groups</a></li> | ||
<li><a href="about.html" data-i18n="menu-about">About</a></li> | ||
<li><a href="building-workshops.html" data-i18n="menu-building-workshops">Build</a></li> | ||
<li><a href="host.html" data-i18n="menu-host">Host</a></li> | ||
</ul> | ||
</div> | ||
</div> | ||
</header> | ||
<div id="main" name="main" role="main"> | ||
<div class="container" style="background-color: #fff;"> | ||
<div class="full"> | ||
<h1 data-i18n="chapters-h1">NodeSchool Chapters</h1> | ||
<p data-i18n="chapters-header">Cities all over have started to host NodeSchool events regularly. Here's a list of chapters. See the <a href="hexdex.html">hexdex</a> for an index of chapter ⬢ hexagon logos.</p> | ||
|
||
<div id="chapter-list"> | ||
<div class="loading" data-i18n="index-chapter-list-loading"> | ||
Loading... | ||
</div> | ||
</div> | ||
|
||
<h2 id="region-other" data-i18n="chapters-other">Other region?</h2> | ||
<div class="other"> | ||
<span data-i18n="chapters-start">Can't find a NodeSchool chapter in your region?</span> <a href="https://github.com/nodeschool/discussions" data-i18n="chapters-start2">Open an issue on the discussions board</a> <span data-i18n="chapters-start3">to find other people around you. If there isn't an existing chapter nearby, start your own! Follow these instructions on</span> <a href="host.html" data-i18n="chapters-start4">how to host an event</a><span data-i18n="chapters-start5">.</span> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="container" style="background-color: #fff;"> | ||
<footer> | ||
<div class="third"> | ||
<p><strong>nodeschool.io</strong></p> | ||
<small>Photos by <a href="https://www.flickr.com/photos/matthewbergman" target="_blank">Matthew Bergman</a></small> | ||
</div> | ||
<div class="two-thirds"> | ||
<ul> | ||
<li><strong data-i18n="footer-contact-header">Contact</strong></li> | ||
<li><a href="https://twitter.com/nodeschool" target="_blank">t/@nodeschool</a></li> | ||
<li><a href="https://github.com/nodeschool" target="_blank">gh/nodeschool</a></li> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as L58 |
||
</ul> | ||
<ul> | ||
<li><strong data-i18n="footer-contribute-header">Contribute</strong></li> | ||
<li><a href="https://github.com/nodeschool/discussions/issues/new" target="_blank" data-i18n="footer-contribute-question">Open an Issue</a></li> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as L58 |
||
<li><a href="https://github.com/nodeschool/discussions/issues" target="_blank" data-i18n="footer-contribute-answer">Answer a Question</a></li> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as L58 |
||
</ul> | ||
<ul> | ||
<li><strong data-i18n="footer-about-header">About</strong></li> | ||
<li><a href="building-workshops.html" data-i18n="footer-about-build">Build a workshopper</a></li> | ||
<li><a href="host.html" data-i18n="footer-about-host">Host a workshop</a></li> | ||
</ul> | ||
</div> | ||
</footer> | ||
</div> | ||
|
||
<script id="tmpl-chapter-list" type="text/html"> | ||
<p style="font-size: 100%"><em>Chapter count: {{total}}</em></p> | ||
{{#regions}} | ||
<div class="chapter-list {{region}}"> | ||
<h2>{{region}} ({{count}})</h2> | ||
<ul> | ||
{{#chapters}} | ||
<li class="chapter"> | ||
{{#website}} | ||
<a target="_blank" href="{{website}}">{{location}}{{#country}}, {{country}}{{/country}}</a> | ||
{{/website}} | ||
{{^website}} | ||
<a target="_blank" href="{{repo}}">{{location}}{{#country}}, {{country}}{{/country}}</a> | ||
{{/website}} | ||
</li> | ||
{{/chapters}} | ||
</ul> | ||
</div> | ||
{{/regions}} | ||
</script> | ||
|
||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> | ||
<script type="text/javascript" src="/js/dependencies.js"></script> | ||
<script type="text/javascript" src="/js/chapters.js"></script> | ||
<script> | ||
!function(s,c,h,O,o,l){s.GoogleAnalyticsObject=h;s[h]||(s[h]=function(){ | ||
(s[h].q=s[h].q||[]).push(arguments)});s[h].l=+new Date;o=c.createElement(O); | ||
l=c.getElementsByTagName(O)[0];o.src='//www.google-analytics.com/analytics.js'; | ||
l.parentNode.insertBefore(o,l)}(window,document,'ga','script'); | ||
|
||
ga('create', 'UA-49267600-1', 'nodeschool.io'); | ||
ga('send', 'pageview'); | ||
</script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "Military", | ||
"organizers": ["hollomancer"], | ||
"website": "", | ||
"twitter": "", | ||
"repo": "https://github.com/nodeschool/military-community-group" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/env node | ||
const Fs = require('fs') | ||
const cmdwatcher = require('./util/cmdwatcher') | ||
const mkdirp = require('mkdirp') | ||
|
||
function groupByValue(list, grouper, groupName) { | ||
var grouped = {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. any reason why we choose to use semicolons for some portions but not for others? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See #537 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This goes beyond this PR imho There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i agree. thanks for opening #537. we should follow one style |
||
groupName = groupName || 'items' | ||
for (var i = 0; i < list.length; i++) { | ||
var key = list[i][grouper] | ||
if (typeof grouped[key] !== "object" || typeof grouped[key].push !== "function") { | ||
grouped[key] = [] | ||
} | ||
grouped[key].push(list[i]) | ||
} | ||
return Object.keys(grouped).map(function (group) { | ||
var formatted = {} | ||
formatted[grouper] = group | ||
formatted.count = grouped[group].length | ||
formatted[groupName] = grouped[group] | ||
return formatted | ||
}); | ||
} | ||
|
||
function sortByKey(list, key) { | ||
return list.sort(function (a, b) { | ||
return a[key] > b[key] ? 1 : 0 | ||
}) | ||
} | ||
|
||
function sortedGroupByValue(list, grouper, groupName) { | ||
return sortByKey(groupByValue(list, grouper, groupName), grouper); | ||
} | ||
|
||
var communityGroups = []; | ||
|
||
cmdwatcher('build-community-groups' | ||
, './community-groups/!(list).json', function (files) { | ||
files.forEach(function (f) { | ||
Fs.readFile(f, function (err, buf) { | ||
if (err) { | ||
return console.error(err); | ||
} | ||
var data = buf.toString(); | ||
try { | ||
var communityGroup = JSON.parse(data); | ||
} catch (e) { | ||
console.error("JSON parse error: " + f, e); | ||
} | ||
communityGroups.push(communityGroup); | ||
|
||
if (communityGroups.length === files.length) { | ||
writeCommunityGroups(communityGroups); | ||
} | ||
}); | ||
}); | ||
}); | ||
|
||
function writeCommunityGroups(communityGroups) { | ||
data = { | ||
total: communityGroups.length, | ||
regions: sortedGroupByValue(communityGroups, 'name', 'communityGroups') | ||
}; | ||
mkdirp.sync('.build/communityGroups') | ||
Fs.writeFile('.build/communityGroups/list.json', JSON.stringify(data, null, 2), function (err) { | ||
if (err) console.error(err); | ||
}); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
#!/bin/bash | ||
npm run build-chapters -- $@ | ||
npm run build-community-groups -- $@ | ||
npm run generate-css | ||
npm run build-dependencies | ||
npm run build-copy -- $@ | ||
npm run build-html -- $@ | ||
npm run build-html -- $@ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
@import 'settings/*' | ||
|
||
.chapter-list { | ||
ul { | ||
list-style: none; | ||
padding-left: 0; | ||
} | ||
|
||
li { | ||
width: 250px; | ||
margin: 5px; | ||
padding-bottom: 0; | ||
border: 2px solid $mineshaftGray; | ||
border-radius: 3px; | ||
display: inline-block; | ||
transition: background-color 300ms, border 500ms; | ||
|
||
&:hover { | ||
background-color: $broomYellow; | ||
border: 2px solid $broomYellow; | ||
} | ||
} | ||
|
||
a { | ||
display: block; | ||
color: $black; | ||
padding: 6px; | ||
border-bottom: none; | ||
text-decoration: none; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should use
rel="noreferrer noopener"
on_blank
targets for security reasonsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should fix this sooner, see #538