Permalink
Browse files

less repetition, more markdown

  • Loading branch information...
1 parent a385101 commit 939babb75902abad41632c332d7c0b84e011dcdc Visnu Pitiyanuvath committed Aug 11, 2011
Showing with 143 additions and 218 deletions.
  1. +23 −0 helpers/index.coffee
  2. +2 −0 public/stylesheets/application.styl
  3. +118 −218 views/index/locations.jade
View
@@ -12,16 +12,22 @@ gravatar_url = (md5, size) ->
"http://gravatar.com/avatar/#{md5}?s=#{size}&d=retro"
module.exports = (app) ->
+
app.helpers
+
inspect: require('util').inspect
_: _
+
markdown: (str) -> if str? then md.parse str, md.flags.noHTML else ''
+
relativeDate: require 'relative-date'
+
pluralize: (n, counter) ->
if n is 1
"1 #{counter}"
else
"#{n} #{counter}s"
+
avatar_url: (person, size = 30) ->
if person.github?.gravatarId
id = person.github.gravatarId # HACK getter bugs
@@ -32,7 +38,9 @@ module.exports = (app) ->
gravatar_url md5(person.email.trim().toLowerCase()), size
else
'/images/gravatar_fallback.png'
+
sponsors: require '../models/sponsor'
+
locations: (people) ->
_(people).chain()
.pluck('location')
@@ -44,20 +52,35 @@ module.exports = (app) ->
, {})
.values()
.value().join '; '
+
+ address: (addr, host = 'maps.google.com') ->
+ """
+ <a href="http://#{host}/maps?q=#{addr}">
+ <img class="map" src="http://maps.googleapis.com/maps/api/staticmap?center=#{addr}&zoom=15&size=226x140&sensor=false&markers=size:small|#{addr}"/>
+ </a>
+ """
+
voting: app.enabled 'voting'
Vote: mongoose.model 'Vote'
app.dynamicHelpers
+
session: (req, res) -> req.session
+
req: (req, res) -> req
+
_csrf: (req, res) ->
"""<input type="hidden" name="_csrf" value="#{req.session._csrf}"/>"""
+
title: (req, res) ->
(title) ->
req.pageTitle = title if title
req.pageTitle
+
admin: (req, res) -> req.user?.admin
+
flash: (req, res) -> req.flash()
+
canEdit: (req, res) ->
(thing) ->
if u = req.user
@@ -371,6 +371,8 @@ form.vote[action^="/votes"] .enabled /* TODO fix for IE */
margin 0.5em 0
h3, h5, p
margin-left 240px
+ h5
+ line-height 150%
#page.index-how-to-win
.slide
Oops, something went wrong.

0 comments on commit 939babb

Please sign in to comment.