This repository has been archived by the owner on Feb 13, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
5,118 additions
and
3,292 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
require [ | ||
'underscore' | ||
'backbone' | ||
'router' | ||
], (_, Backbone, Router) -> | ||
initialize: -> Router.initialize() | ||
#= require env | ||
#= require_tree ./models | ||
#= require_tree ./collections | ||
#= require_tree ./views | ||
#= require_tree ./templates | ||
#= require router | ||
|
||
class @Diet.App | ||
initialize: -> | ||
@router = new window.Diet.Router | ||
Backbone.history.start() | ||
|
||
@app = new @Diet.App | ||
@app.initialize() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,2 @@ | ||
#= require vendor/require | ||
#= require ./env | ||
|
||
require [ | ||
'underscore' | ||
], (_) -> | ||
console.log _ | ||
#= require haml | ||
#= require app |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#= require lodash | ||
#= require backbone | ||
|
||
class @Diet.Collections.Feeds extends @Diet.Collection | ||
model: window.Diet.Models.Feed | ||
url: window.Diet.config.api_endpoint + '/subscriptions' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,31 @@ | ||
require.config | ||
baseUrl: 'javascripts' | ||
#= require lodash | ||
#= require backbone | ||
|
||
paths: | ||
underscore: 'vendor/underscore' | ||
backbone: 'vendor/backbone' | ||
templates: 'templates' | ||
# Override ajax requests to include cookies. | ||
ajax = Backbone.ajax | ||
Backbone.ajax = (request) -> | ||
request.xhrFields = withCredentials: true | ||
ajax(request) | ||
|
||
@Diet = | ||
api_base: $('meta[name=api-base]').attr('content') | ||
# Holds all models, collections and views. | ||
Models: { } | ||
Collections: { } | ||
Views: { } | ||
|
||
# Base model for all models to extend. | ||
Model: Backbone.Model.extend() | ||
|
||
$.ajaxSetup xhrFields: withCredentials: true | ||
# Base view for all views to extend. | ||
View: Backbone.View.extend | ||
|
||
# Public: Render a hamljs view. | ||
template: (name, context = {}) -> | ||
window.JST["templates/#{name}"](context) | ||
|
||
# Base collection for all collections to extend. | ||
Collection: Backbone.Collection.extend() | ||
|
||
# Where config is stored. | ||
config: | ||
api_endpoint: $('meta[name=api_endpoint]').attr('content') |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
require [ | ||
'underscore', | ||
'backbone' | ||
], (_, Backbone) -> | ||
Feed = Backbone.Model.extend() | ||
#= require lodash | ||
#= require backbone | ||
|
||
Feed | ||
class @Diet.Models.Feed extends @Diet.Model | ||
defaults: | ||
active: false |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
require [ | ||
'underscore' | ||
'backbone' | ||
], (_, Backbone) -> | ||
AppRouter = Backbone.Router.extend | ||
routes: | ||
'items': 'items' | ||
|
||
items: -> | ||
console.log 'foo' | ||
|
||
initialize: -> | ||
router = new AppRouter | ||
Backbone.history.start() | ||
#= require lodash | ||
#= require backbone | ||
|
||
class @Diet.Router extends Backbone.Router | ||
routes: | ||
'' : 'index' | ||
|
||
index: -> | ||
app = window.app | ||
|
||
app.feeds = new window.Diet.Collections.Feeds | ||
|
||
app.view = new window.Diet.Views.App | ||
app.view.render() | ||
|
||
app.feeds.fetch(reset: true) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#sidebar | ||
%ul#feeds | ||
#subscribe | ||
#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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
%a{href: '#', title: title} | ||
%img{src: favicon}> | ||
= title |
Oops, something went wrong.