Skip to content
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

Open
wants to merge 3 commits into
base: source
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions about.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<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><a href="community-groups.html" data-i18n="menu-community-groups">Community Groups</a></li>
<li class="current-page"><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>
Expand Down
1 change: 1 addition & 0 deletions building-workshops.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<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><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 class="current-page"><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>
Expand Down
1 change: 1 addition & 0 deletions chapters.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<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 class="current-page"><a href="chapters.html" data-i18n="menu-chapters">Chapters</a></li>
<li><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>
Expand Down
109 changes: 109 additions & 0 deletions community-groups.html
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&apos;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>
Copy link
Member

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 reasons

Copy link
Member Author

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

<li><a href="https://github.com/nodeschool" target="_blank">gh/nodeschool</a></li>
Copy link
Member

Choose a reason for hiding this comment

The 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>
Copy link
Member

Choose a reason for hiding this comment

The 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>
Copy link
Member

Choose a reason for hiding this comment

The 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>
7 changes: 7 additions & 0 deletions community-groups/military.json
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"
}
1 change: 1 addition & 0 deletions events.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<li><a href="index.html" data-i18n="menu-index">Home</a></li>
<li class="current-page"><a href="events.html" data-i18n="menu-events">Events</a></li>
<li><a href="chapters.html" data-i18n="menu-chapters">Chapters</a></li>
<li><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>
Expand Down
1 change: 1 addition & 0 deletions hexdex.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<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 class="current-page"><a href="chapters.html" data-i18n="menu-chapters">Chapters</a></li>
<li><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>
Expand Down
3 changes: 2 additions & 1 deletion host.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<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><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 class="current-page"><a href="host.html" data-i18n="menu-host">Host</a></li>
Expand All @@ -31,7 +32,7 @@
<h1 data-i18n="host-header">Hosting a NodeSchool Event</h1>
<p data-i18n="host-info">NodeSchool is a fully community driven effort and is 100% open source. This means that anyone can use the NodeSchool materials and/or host an event.</p>
<p data-i18n="host-info-cost">The only expectations for event hosts is that events be not-for-profit (free or low cost) and that governance of events should have an open membership model (so that nobody can 'control' the events).</p>
<p data-i18n="host-info-wiki">We have created the <a href="https://github.com/nodeschool/organizers/wiki">Organizers Wiki</a> to hold all the knowledge from the Chapter organizers around the world.</p>
<p data-i18n="host-info-wiki">We have created the <a href="https://github.com/nodeschool/organizers/wiki">Organizers Wiki</a> to hold all the knowledge from the Chapter and Community Group organizers around the world.</p>
<p data-i18n="host-info-wiki-link">Check out <a href="https://github.com/nodeschool/organizers/wiki">the wiki</a> for info on how to create a chapter, run a successful event and build a local NodeSchool community!</p>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ <h1 class="name">nodeschool</h1>
<li><a href="#workshoppers" data-i18n="menu-tutorials">Tutorials</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><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>
Expand Down
1 change: 1 addition & 0 deletions mentor-at-event.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<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><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 class="current-page"><a href="host.html" data-i18n="menu-host">Host</a></li>
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"build-copy": "node ./scripts/build-copy.js $$",
"build-html": "node ./scripts/build-html.js $$",
"build-chapters": "node ./scripts/build-chapters.js $$",
"build-community-groups": "node ./scripts/build-community-groups.js $$",
"build-dependencies": "bash ./scripts/build-dependencies.sh $$",
"generate-css": "bash ./scripts/generate-css.sh",
"generate-language": "node ./scripts/generate-lang.js",
Expand Down
68 changes: 68 additions & 0 deletions scripts/build-community-groups.js
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 = {}
Copy link
Member

Choose a reason for hiding this comment

The 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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #537

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This goes beyond this PR imho

Copy link
Member

Choose a reason for hiding this comment

The 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);
});
}
3 changes: 2 additions & 1 deletion scripts/build.sh
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 -- $@
1 change: 1 addition & 0 deletions scripts/generate-css.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# -u = utilize plugin

stylus -u autoprefixer-stylus -c -m ./styles/chapters.styl -o ./chapters.css
stylus -u autoprefixer-stylus -c -m ./styles/community-groups.styl -o ./community-groups.css
stylus -u autoprefixer-stylus -c -m ./styles/events.styl -o ./events.css
stylus -u autoprefixer-stylus -c -m ./styles/mapbox.styl -o ./mapbox.css
stylus -u autoprefixer-stylus -c -m ./styles/style.styl -o ./style.css
31 changes: 31 additions & 0 deletions styles/community-groups.styl
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;
}
}
1 change: 1 addition & 0 deletions styles/style.styl
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ ul {
color: $mineshaftGray;
font-weight: 700;
letter-spacing: 0.1em;
width: 95%;

li {
display: inline-block;
Expand Down