Skip to content

Commit

Permalink
Added simple theme support
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromegn committed May 2, 2012
1 parent c0bc509 commit 68f35bb
Show file tree
Hide file tree
Showing 4 changed files with 554 additions and 6 deletions.
1 change: 1 addition & 0 deletions app/models/repository.coffee
Expand Up @@ -44,6 +44,7 @@ class Repository
travis: false
ribbon: true
google_analytics: null
theme: null


constructor: (@name)->
Expand Down
10 changes: 5 additions & 5 deletions app/resources/repositories.coffee
Expand Up @@ -76,11 +76,11 @@ Server.get "/compiled", compile_route

Server.get "/", (req, res, next)->
Repository.populate "jeromegn/documentup", (err, repo)->
res.render "repositories/show", locals: repo
render_repo req, res, repo


render_repo = (res, repo)->
res.render "repositories/show", locals: repo, (err, html)->
render_repo = (req, res, repo)->
res.render "repositories/show", locals: repo, theme: req.query.theme || repo.config.theme, (err, html)->
respond_with_html res, html


Expand All @@ -93,9 +93,9 @@ Server.get "/:username/:repository", (req, res, next)->
repo.setConfig(config)
repo.save (err, repo)->
return next(err) if err
render_repo res, repo
render_repo req, res, repo
else
render_repo res, repo
render_repo req, res, repo


# Manual recompile
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/default.eco
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><%= @config.name || @name.split("/")[1] %></title>

<link rel="stylesheet" type="text/css" href="<% if @env == "production": %>http://documentup.com<% else: %>http://localhost:8080<% end %>/stylesheets/screen.css">
<link rel="stylesheet" type="text/css" href="<% if @env == "production": %>http://documentup.com<% else: %>http://localhost:8080<% end %>/stylesheets/<% if @theme: %>themes/<%= @theme %>.css<% else: %>screen.css<% end %>">

<% if @config.color: %>
<style type="text/css">
Expand Down

0 comments on commit 68f35bb

Please sign in to comment.