diff --git a/Readme.md b/Readme.md index 8e05b05..cda75dd 100644 --- a/Readme.md +++ b/Readme.md @@ -43,13 +43,13 @@ Execution, trying TDD for the first time: - [x] check and delete _data.json - - [ ] Migrate projects to the new site generator + - [x] Migrate projects to the new site generator - - [ ] Migrate projects page + - [x] Migrate projects page - - [ ] Migrate project page + - [x] Migrate project page - - [ ] Check and delete _data.json + - [x] Check and delete _data.json - [ ] Migrate posts to markdown with headers somehow diff --git a/projects.json b/projects.json new file mode 100644 index 0000000..78360f9 --- /dev/null +++ b/projects.json @@ -0,0 +1,60 @@ +{ + "projects": [ + { + "title": "bin", + "description": "my collection of scripts in ~/bin" + }, + { + "title": "config", + "description": "important dot files (zsh, emacs, vim, screen)" + }, + { + "title": "compiler", + "description": "a compiler targeting x86 in Ruby" + }, + { + "title": "lake", + "description": "a simple implementation of Scheme in C" + }, + { + "title": "strftime", + "description": "strftime for JavaScript" + }, + { + "title": "format", + "description": "printf for JavaScript" + }, + { + "title": "gitter", + "description": "a GitHub client for Node (v3 API)" + }, + { + "title": "mojo.el", + "description": "turn emacs into a sweet mojo editor" + }, + { + "title": "ThePusher", + "description": "Github post-receive hook router" + }, + { + "title": "NorthWatcher", + "description": "cron for filesystem changes" + }, + { + "title": "repl-edit", + "description": "edit Node repl commands with your text editor" + }, + { + "title": "cheat.el", + "description": "cheat from emacs" + }, + { + "title": "batteries", + "description": "a general purpose node library" + }, + { + "title": "samhuri.net", + "description": "this site" + } + ] +} diff --git a/public/css/style.less b/public/css/style.less index ff4de40..e9bb714 100644 --- a/public/css/style.less +++ b/public/css/style.less @@ -354,10 +354,13 @@ ul.archive { .project-listing { margin-bottom: 1rem; - h4, p { - margin: 0.5rem 0; + h4 { + margin: 0.5rem 0 1rem; } + p { + margin: 0.5rem 0 2rem; + } } .project-stats { @@ -370,10 +373,8 @@ ul.archive { } -body.projects:not(.index) .container { - /* FIXME: find out where this is used and do it differently ... this selector sucks */ - body { background-color: red; } - h2, h4 { +article.project { + h1, h4 { text-align: center; } } diff --git a/public/js/projects.js b/public/js/projects.js index 9fa866b..68bc0b9 100644 --- a/public/js/projects.js +++ b/public/js/projects.js @@ -1,12 +1,14 @@ ;(function() { - if (SJS.projectName) { - SJS.ready(initProject) + if (document.addEventListener) { + document.addEventListener('DOMContentLoaded', initProject, false) + } else if (window.attachEvent) { + window.attachEvent('onload', initProject) } function initProject() { - - var data = createObjectStore(SJS.projectName) + var projectName = document.getElementById('project').dataset.title + var data = createObjectStore(projectName) function html(id, h) { document.getElementById(id).innerHTML = h @@ -63,11 +65,10 @@ var Months = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split(' ') - var t = data.get('t-' + SJS.projectName) + var t = data.get('t-' + projectName) if (!t || +new Date() - t > 3600 * 1000) { - console.log('stale ' + String(t)) - data.set('t-' + SJS.projectName, +new Date()) - var repo = GITR.repo('samsonjs', SJS.projectName) + data.set('t-' + projectName, +new Date()) + var repo = GITR.repo('samsonjs', projectName) repo .fetch(function(err, repo) { if (err) { @@ -102,13 +103,13 @@ }) } else { try { - updateBranches(SJS.projectName, data.get('branches')) + updateBranches(projectName, data.get('branches')) updateLangs(data.get('langs')) updateContributors(data.get('contributors')) updateStars(data.get('stars').length) updateN('fork', data.get('forks').length) } catch (e) { - data.set('t-' + SJS.projectName, null) + data.set('t-' + projectName, null) initProject() } } diff --git a/public/projects/NorthWatcher.ejs b/public/projects/NorthWatcher.ejs deleted file mode 100644 index 68d64e5..0000000 --- a/public/projects/NorthWatcher.ejs +++ /dev/null @@ -1 +0,0 @@ -<%- partial('_project') %> diff --git a/public/projects/ThePusher.ejs b/public/projects/ThePusher.ejs deleted file mode 100644 index 68d64e5..0000000 --- a/public/projects/ThePusher.ejs +++ /dev/null @@ -1 +0,0 @@ -<%- partial('_project') %> diff --git a/public/projects/_data.json b/public/projects/_data.json deleted file mode 100644 index 00e44be..0000000 --- a/public/projects/_data.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "_scripts": [ - "https://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js", - "/js/gitter.js", - "/js/store.js", - "/js/projects.js" - ], - "index": { - "title": "Projects" - }, - "strftime": { - "title": "strftime", - "description": "strftime for JavaScript" - }, - "bin": { - "title": "bin", - "description": "~/bin" - }, - "compiler": { - "title": "compiler", - "description": "a compiler targeting x86 in Ruby" - }, - "config": { - "title": "config", - "description": "important dot files (zsh, emacs, vim, screen)" - }, - "format": { - "title": "format", - "description": "printf for JavaScript" - }, - "gitter": { - "title": "gitter", - "description": "a GitHub client for Node (v3 API)" - }, - "samhuri.net": { - "title": "samhuri.net", - "description": "this site" - }, - "samhuri": { - "hidden": true, - "title": "samhuri.net", - "description": "this site" - }, - "ThePusher": { - "title": "ThePusher", - "description": "Github post-receive hook router" - }, - "lake": { - "title": "lake", - "description": "A simple implementation of Scheme in C" - }, - "mojo.el": { - "title": "mojo.el", - "description": "turn emacs into a sweet mojo editor" - }, - "mojo": { - "hidden": true, - "title": "mojo.el", - "description": "turn emacs into a sweet mojo editor" - }, - "NorthWatcher": { - "title": "NorthWatcher", - "description": "cron for filesystem changes" - }, - "batteries": { - "title": "batteries", - "description": "a general purpose node library" - }, - "repl-edit": { - "title": "repl-edit", - "description": "edit Node repl commands with your text editor" - }, - "cheat.el": { - "title": "cheat.el", - "description": "cheat from emacs" - }, - "cheat": { - "hidden": true, - "title": "cheat.el", - "description": "cheat from emacs" - } -} diff --git a/public/projects/_project.ejs b/public/projects/_project.ejs deleted file mode 100644 index bbfdbde..0000000 --- a/public/projects/_project.ejs +++ /dev/null @@ -1,31 +0,0 @@ -

<%= description %>

- -
-

- GitHub - • - - • - -

- -

- Last updated on -

-
- -
-
-

Contributors

-
-
- -
-

Languages

-
-
-
- - diff --git a/public/projects/batteries.ejs b/public/projects/batteries.ejs deleted file mode 100644 index 68d64e5..0000000 --- a/public/projects/batteries.ejs +++ /dev/null @@ -1 +0,0 @@ -<%- partial('_project') %> diff --git a/public/projects/bin.ejs b/public/projects/bin.ejs deleted file mode 100644 index 68d64e5..0000000 --- a/public/projects/bin.ejs +++ /dev/null @@ -1 +0,0 @@ -<%- partial('_project') %> diff --git a/public/projects/cheat.el.ejs b/public/projects/cheat.el.ejs deleted file mode 100644 index 68d64e5..0000000 --- a/public/projects/cheat.el.ejs +++ /dev/null @@ -1 +0,0 @@ -<%- partial('_project') %> diff --git a/public/projects/compiler.ejs b/public/projects/compiler.ejs deleted file mode 100644 index 68d64e5..0000000 --- a/public/projects/compiler.ejs +++ /dev/null @@ -1 +0,0 @@ -<%- partial('_project') %> diff --git a/public/projects/config.ejs b/public/projects/config.ejs deleted file mode 100644 index 68d64e5..0000000 --- a/public/projects/config.ejs +++ /dev/null @@ -1 +0,0 @@ -<%- partial('_project') %> diff --git a/public/projects/format.ejs b/public/projects/format.ejs deleted file mode 100644 index 68d64e5..0000000 --- a/public/projects/format.ejs +++ /dev/null @@ -1 +0,0 @@ -<%- partial('_project') %> diff --git a/public/projects/gitter.ejs b/public/projects/gitter.ejs deleted file mode 100644 index 68d64e5..0000000 --- a/public/projects/gitter.ejs +++ /dev/null @@ -1 +0,0 @@ -<%- partial('_project') %> diff --git a/public/projects/index.ejs b/public/projects/index.ejs deleted file mode 100644 index f056747..0000000 --- a/public/projects/index.ejs +++ /dev/null @@ -1,8 +0,0 @@ -<% for (var name in public.projects._data) { %> -<% var project = public.projects._data[name] %> -<% if (name == 'index' || name[0] == '_' || project.hidden) continue %> -
-

<%= name %>

-

<%= project.description %>

-
-<% } %> diff --git a/public/projects/lake.ejs b/public/projects/lake.ejs deleted file mode 100644 index 68d64e5..0000000 --- a/public/projects/lake.ejs +++ /dev/null @@ -1 +0,0 @@ -<%- partial('_project') %> diff --git a/public/projects/mojo.el.ejs b/public/projects/mojo.el.ejs deleted file mode 100644 index 68d64e5..0000000 --- a/public/projects/mojo.el.ejs +++ /dev/null @@ -1 +0,0 @@ -<%- partial('_project') %> diff --git a/public/projects/repl-edit.ejs b/public/projects/repl-edit.ejs deleted file mode 100644 index 68d64e5..0000000 --- a/public/projects/repl-edit.ejs +++ /dev/null @@ -1 +0,0 @@ -<%- partial('_project') %> diff --git a/public/projects/samhuri.net.ejs b/public/projects/samhuri.net.ejs deleted file mode 100644 index 68d64e5..0000000 --- a/public/projects/samhuri.net.ejs +++ /dev/null @@ -1 +0,0 @@ -<%- partial('_project') %> diff --git a/public/projects/strftime.ejs b/public/projects/strftime.ejs deleted file mode 100644 index 68d64e5..0000000 --- a/public/projects/strftime.ejs +++ /dev/null @@ -1 +0,0 @@ -<%- partial('_project') %> diff --git a/templates/project.html b/templates/project.html new file mode 100644 index 0000000..a4d8dcb --- /dev/null +++ b/templates/project.html @@ -0,0 +1,42 @@ +{% extends "samhuri.net.html" %} +{% block body %} +
+ +

{{ project.title }}

+

{{ project.description }}

+ +
+

+ GitHub + • + + • + +

+ +

+ Last updated on +

+
+ +
+
+

Contributors

+
+
+ +
+

Languages

+
+
+
+
+
+

+
+ + + + + +{% endblock %} diff --git a/templates/projects.html b/templates/projects.html new file mode 100644 index 0000000..2c48385 --- /dev/null +++ b/templates/projects.html @@ -0,0 +1,16 @@ +{% extends "samhuri.net.html" %} +{% block body %} +
+

Projects

+ +{% for project in projects %} +
+

{{ project.title }}

+

{{ project.description }}

+
+{% endfor %} +
+
+

+
+{% endblock %} diff --git a/templates/samhuri.net.html b/templates/samhuri.net.html index 0ef6868..05b9246 100644 --- a/templates/samhuri.net.html +++ b/templates/samhuri.net.html @@ -29,18 +29,6 @@ - - {% if bodyClassNames %}