This repository has been archived by the owner on Nov 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:chaplinjs/facebook-example
Conflicts: coffee/controllers/likes_controller.coffee coffee/controllers/navigation_controller.coffee coffee/controllers/posts_controller.coffee coffee/controllers/session_controller.coffee coffee/controllers/sidebar_controller.coffee coffee/lib/services/facebook.coffee coffee/lib/services/google.coffee coffee/lib/services/service_provider.coffee coffee/lib/support.coffee coffee/lib/utils.coffee coffee/lib/view_helper.coffee coffee/models/like.coffee coffee/models/likes.coffee coffee/models/navigation.coffee coffee/models/post.coffee coffee/models/posts.coffee coffee/models/user.coffee coffee/views/compact_like_view.coffee coffee/views/full_like_view.coffee coffee/views/likes_view.coffee coffee/views/login_view.coffee coffee/views/navigation_view.coffee coffee/views/post_view.coffee coffee/views/posts_view.coffee coffee/views/sidebar_view.coffee index.html
- Loading branch information
Showing
4 changed files
with
103 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
define [ | ||
'chaplin/mediator' | ||
'chaplin/application' | ||
'controllers/session_controller' | ||
'controllers/navigation_controller' | ||
'controllers/sidebar_controller' | ||
'routes' | ||
], (mediator, Application, SessionController, NavigationController, SidebarController, routes) -> | ||
'use strict' | ||
|
||
# The application object | ||
class FacebookBrowser extends Application | ||
|
||
# Set your application name here so the document title is set to | ||
# “Controller title – Site title” (see ApplicationView#adjustTitle) | ||
title: 'Chaplin Example Application with Facebook login' | ||
|
||
initialize: -> | ||
###console.debug 'ExampleApplication#initialize'### | ||
|
||
# This creates the ApplicationController and ApplicationView | ||
super | ||
|
||
@initControllers() | ||
@initMediator() | ||
# Register all routes and start routing | ||
@initRouter routes | ||
|
||
initControllers: -> | ||
|
||
# Instantiate common controllers | ||
# ------------------------------ | ||
|
||
# These controllers are active during the whole application runtime. | ||
new SessionController() | ||
new NavigationController() | ||
new SidebarController() | ||
|
||
# Create aditional mediator properties | ||
# ------------------------------------ | ||
|
||
initMediator: -> | ||
# Create a user property | ||
mediator.user = null | ||
# Seal the mediator | ||
mediator.seal() | ||
|
||
# Finish | ||
# ------ | ||
|
||
# Freeze the application instance to prevent further changes | ||
Object.freeze? this |
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 @@ | ||
define [ | ||
'views/view', | ||
'chaplin/views/collection_view' | ||
], (View, ChaplinCollectionView) -> | ||
'use strict' | ||
|
||
class CollectionView extends ChaplinCollectionView | ||
|
||
# Borrow the method from the View prototype | ||
getTemplateFunction: View::getTemplateFunction |
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,39 @@ | ||
define [ | ||
'handlebars', | ||
'chaplin/views/view', | ||
'lib/view_helper' # Just load the view helpers, no return value | ||
], (Handlebars, ChaplinView) -> | ||
'use strict' | ||
|
||
class View extends ChaplinView | ||
|
||
getTemplateFunction: -> | ||
|
||
# Template compilation | ||
# -------------------- | ||
|
||
# This demo uses Handlebars templates to render views. | ||
# The template is loaded with Require.JS and stored as string on | ||
# the view prototype. On rendering, it is compiled on the | ||
# client-side. The compiled template function replaces the string | ||
# on the view prototype. | ||
# | ||
# In the end you might want to precompile the templates to JavaScript | ||
# functions on the server-side and just load the JavaScript code. | ||
# Several precompilers create a global JST hash which stores the | ||
# template functions. You can get the function by the template name: | ||
# | ||
# templateFunc = JST[@templateName] | ||
|
||
template = @template | ||
|
||
if typeof template is 'string' | ||
# Compile the template string to a function and save it | ||
# on the prototype. This is a workaround since an instance | ||
# shouldn’t change its prototype normally. | ||
templateFunc = Handlebars.compile template | ||
@constructor::template = templateFunc | ||
else | ||
templateFunc = template | ||
|
||
templateFunc |
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