This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bindings: | |
'h2': 'title' | |
'p': 'intro' | |
'a': | |
attributes: [ | |
name: 'href' | |
observe: 'slug' | |
onGet: (val) -> "/articles/#{val}" | |
, | |
name: 'class' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define ['templates/navigation', 'views/navigation_item'], (template) -> | |
class Blog.Views.Navigation extends Backbone.Marionette.CompositeView | |
itemView: Blog.Views.NavigationItem | |
template: template | |
itemViewContainer: '.bb-items' | |
initialize: -> | |
appendHtml: (collectionView, itemView, index) -> | |
collectionView.$(@itemViewContainer).prepend(itemView.el) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define [ | |
'collections/articles' | |
'views/article' | |
'views/navigation' | |
'views/not_found' | |
], (articles) -> | |
Blog.App.vent.bind 'article', (slug) -> | |
article = articles.getArticle(slug) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define ['templates/layout'], (template) -> | |
class Blog.Layouts.Index extends Backbone.Marionette.Layout | |
template: template | |
regions: | |
navigation: 'nav' | |
article: 'article' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define ['marionette'], (Marionette) -> | |
class Blog | |
constructor: (@options = {}) -> | |
# Exposed objects under this class. | |
@Routers = {} | |
@Views = {} | |
@Collections = {} | |
@Models = {} | |
@Layouts = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
requirejs: | |
compile: | |
options: | |
name: "main" | |
baseUrl: "./blog/scripts/" | |
mainConfigFile: "./blog/scripts/main.js" | |
optimize: "none" | |
out: "./blog/scripts/blog.js" | |
deploy: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grunt.registerTask 'watch', ['connect', 'build', 'livereload-start', | |
'open', 'regarde'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grunt.registerTask 'build', ['coffee', 'sass', 'haml'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grunt.initConfig | |
coffee: | |
scripts: | |
files: | |
grunt.file.expandMapping(['src/scripts/**/*.coffee'], 'blog/scripts/', | |
rename: (destBase, destPath) -> | |
return destBase + destPath.slice(12, destPath.length) | |
.replace(/\.coffee$/, '.js') | |
) | |
main: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = (grunt) -> | |
grunt.loadNpmTasks 'grunt-contrib-coffee' | |
grunt.loadNpmTasks 'grunt-contrib-sass' | |
grunt.loadNpmTasks 'grunt-haml' | |