-
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.
upgrade to latest chaplin + brunch, add bower
- Loading branch information
Showing
23 changed files
with
122 additions
and
14,536 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
public/ | ||
node_modules/ | ||
tmp/ | ||
bower_components/ |
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,66 +1,29 @@ | ||
Chaplin = require 'chaplin' | ||
{Application} = require 'chaplin' | ||
mediator = require 'mediator' | ||
routes = require 'routes' | ||
Layout = require 'views/layout' | ||
Farm = require 'models/farm' | ||
SessionController = require 'controllers/session_controller' | ||
HeaderController = require 'controllers/header_controller' | ||
CustomersCollection = require 'models/customers_collection' | ||
|
||
# The application object | ||
module.exports = class Application extends Chaplin.Application | ||
module.exports = class Application extends Application | ||
# Set your application name here so the document title is set to | ||
# “Controller title – Site title” (see Layout#adjustTitle) | ||
title: 'Farm Tab' | ||
|
||
initialize: -> | ||
super | ||
|
||
# Initialize core components | ||
@initDispatcher() | ||
@initLayout() | ||
@initMediator() | ||
|
||
# Application-specific scaffold | ||
@initControllers() | ||
|
||
# Register all routes and start routing | ||
@initRouter routes | ||
# You might pass Router/History options as the second parameter. | ||
# Chaplin enables pushState per default and Backbone uses / as | ||
# the root per default. You might change that in the options | ||
# if necessary: | ||
# @initRouter routes, pushState: false, root: '/subdir/' | ||
|
||
# Freeze the application instance to prevent further changes | ||
Object.freeze? this | ||
|
||
# Override standard layout initializer | ||
# ------------------------------------ | ||
initLayout: -> | ||
# Use an application-specific Layout class. Currently this adds | ||
# no features to the standard Chaplin Layout, it’s an empty placeholder. | ||
@layout = new Layout {@title} | ||
|
||
# Instantiate common controllers | ||
# ------------------------------ | ||
initControllers: -> | ||
# These controllers are active during the whole application runtime. | ||
# You don’t need to instantiate all controllers here, only special | ||
# controllers which do not to respond to routes. They may govern models | ||
# and views which are needed the whole time, for example header, footer | ||
# or navigation views. | ||
# e.g. new NavigationController() | ||
new SessionController() | ||
new HeaderController() | ||
initLayout: (options = {}) -> | ||
options.title ?= @title | ||
@layout = new Layout options | ||
|
||
# Create additional mediator properties | ||
# ------------------------------------- | ||
initMediator: -> | ||
# Create a user property | ||
Chaplin.mediator.user = new Farm() | ||
Chaplin.mediator.user.customers = new CustomersCollection() | ||
mediator.user = new Farm() | ||
mediator.user.customers = new CustomersCollection() | ||
# Set up any semi-globals | ||
Chaplin.mediator.accessToken = 'somerandomcraptobesetlater' | ||
mediator.accessToken = 'somerandomcraptobesetlater' | ||
# Seal the mediator | ||
Chaplin.mediator.seal() | ||
super |
This file was deleted.
Oops, something went wrong.
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,10 @@ | ||
Controller = require 'controllers/base/controller' | ||
mediator = require 'mediator' | ||
|
||
module.exports = class AuthenticatedController extends Controller | ||
beforeAction: -> | ||
super | ||
if mediator.user | ||
return true | ||
else | ||
@redirectToRoute('login') |
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,3 +1,7 @@ | ||
Chaplin = require 'chaplin' | ||
SiteView = require 'views/site_view' | ||
|
||
module.exports = class Controller extends Chaplin.Controller | ||
|
||
beforeAction: (params, route) -> | ||
@compse 'site', SiteView |
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,18 +1,18 @@ | ||
Controller = require 'controllers/base/controller' | ||
AuthController = require 'controllers/base/auth_controller' | ||
mediator = require 'mediator' | ||
FarmView = require 'views/farm_view' | ||
Farm = require 'models/farm' | ||
|
||
module.exports = class FarmsController extends Controller | ||
module.exports = class FarmsController extends AuthController | ||
title: 'My Farm' | ||
historyURL: '' | ||
|
||
index: (params = {}) -> | ||
@model = mediator.user | ||
@user = mediator.user | ||
|
||
if @model.isNew() | ||
@model.fetch | ||
if @user.isNew() | ||
@user.fetch | ||
success: => | ||
@view or= new FarmView {@model} | ||
@view or= new FarmView {@user} | ||
else | ||
@view or= new FarmView {@model} | ||
@view or= new FarmView {@user} |
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,6 @@ | ||
$ = require 'jquery' | ||
Application = require 'application' | ||
routes = require 'routes' | ||
|
||
$ -> | ||
app = new Application() | ||
app.initialize() | ||
new Application { title: 'Farm Tab', routes } |
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,5 +1,5 @@ | ||
module.exports = (match) -> | ||
match '', 'farms', name: 'home' | ||
match '', 'farms#index', name: 'home' | ||
match 'customers', 'customers#index', name: 'customers' | ||
match 'customers/new', 'customers#create', name: 'new_customer' | ||
match 'customers/:id', 'customers#show', name: 'customer', constraints: { id: /^\d+$/ } |
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 @@ | ||
View = require 'views/base/view' | ||
template = require 'views/templates/site' | ||
|
||
class SiteView extends View |
Empty file.
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,34 @@ | ||
{ | ||
"author": "Adam Krebs", | ||
"name": "farmtab-mobile", | ||
"description": "A mobile payments CSA for market farmers", | ||
"version": "0.0.1", | ||
"homepage": "http://farmtab.com", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/akre54/FT" | ||
}, | ||
"ignore": [ | ||
"**/.*", | ||
"node_modules", | ||
"components" | ||
], | ||
"dependencies": { | ||
"chaplin": "~0.10.0", | ||
"console-polyfill": "~0.1.0", | ||
"lodash": "~1.3.1", | ||
"moment": "~2.0.0", | ||
"jquery": "~2.0.2", | ||
"bootstrap": "~2.3.2" | ||
}, | ||
"overrides": { | ||
"backbone": { | ||
"dependencies": { | ||
"lodash": "*", | ||
"jquery": "*" | ||
}, | ||
"main": "backbone.js" | ||
}, | ||
"moment": {"main": "moment.js"} | ||
} | ||
} |
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
Oops, something went wrong.