Permalink
Browse files

minor tweaks

  • Loading branch information...
1 parent 844af5f commit edea4196151f6ba77e25b3bc6a24fb34c5c3d3f6 @benbalter committed Dec 23, 2012
Showing with 59 additions and 14 deletions.
  1. +28 −6 _includes/js/application.js
  2. +4 −2 _layouts/page.html
  3. +27 −6 cs/application.coffee

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -1,6 +1,8 @@
{% include header.html %}
-<div class="content page page{{ page.id | replace:"/","-" }}" id="content">
+<div class="content" id="content">
+ <div class="page page{{ page.id | replace:"/","-" }}">
+
<div class="row-fluid">
<div class="span2">&nbsp;</div>
<div class="span8">
@@ -11,8 +13,8 @@
{% include improve.html %}
-
</div>
+ </div>
</div>
</div>
View
@@ -83,8 +83,21 @@ class Application.Collections.Posts extends Backbone.Collection
url: ->
Application.url + "/" + 'posts.json'
- comparator: "date"
+ comparator: (a, b) ->
+ a = a.get 'date'
+ b = b.get 'date'
+ if a is b
+ c = 1
+
+ else if a > b
+ c = -1
+
+ else if a < b
+ c = 1
+
+ c
+
class Application.Collections.Pages extends Backbone.Collection
model: Application.Models.Page
url: ->
@@ -178,6 +191,7 @@ class Application.Views.Index extends Backbone.View
render: ->
@$el.html @template
+ @collection.sort()
@collection.slice(0,10).forEach (post) ->
post.fetch()
view = new Application.Views.PostExcerpt( model: post )
@@ -223,20 +237,27 @@ class router extends Backbone.Router
Application.posts.add post
view = new Application.Views.Single model: post
post.fetch error: @redirect
-
+ @setNav ''
+
page: (id) ->
page = new Application.Models.Page id: id
Application.pages.add page
view = new Application.Views.Single model: page
page.fetch error: @redirect
+ @setNav id.replace "/",""
index: ->
- view = new Application.Views.Index({ collection: Application.posts })
- Application.posts.fetch success: ->
+ view = new Application.Views.Index collection: Application.posts
+ Application.posts.fetch error: @redirect, success: ->
view.render()
+ @setNav 'home'
redirect: ->
- document.location = Application.url + Backbone.history.fragment
+ document.location = Application.url + "/" + Backbone.history.fragment
+
+ setNav: (id) ->
+ $('.nav .active').removeClass 'active'
+ $('.nav #' + id).addClass 'active'
# Init
@@ -254,7 +275,7 @@ jQuery(document).ready ->
false
window.resume_resize = ->
- $('.resume .bar').height( $('.content').height() - 25)
+ $('.page-resume .bar').height( $('.content').height() - 25)
$(window).resize( resume_resize )
resume_resize()

0 comments on commit edea419

Please sign in to comment.