forked from CaryLandholt/AngularFun
-
Notifications
You must be signed in to change notification settings - Fork 2
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
13 changed files
with
234 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
public/javascripts | ||
public/stylesheets | ||
public/img |
Binary file not shown.
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 @@ | ||
require('coffee-script') | ||
server = require("./server"); | ||
config = require("./foo"); | ||
server.startServer(config); |
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,23 @@ | ||
{ | ||
"server": { | ||
"useDefaultServer": false, | ||
"useReload": false, | ||
"path": "./server.coffee", | ||
"port": 3000, | ||
"base": "", | ||
"views": { | ||
"compileWith": "jade", | ||
"extension": "jade", | ||
"path": "./views" | ||
} | ||
}, | ||
"watch": { | ||
"sourceDir": "./assets", | ||
"compiledDir": "./public", | ||
"javascriptDir": "javascripts", | ||
"exclude": {}, | ||
"throttle": 0, | ||
"compiledJavascriptDir": "./public/javascripts" | ||
}, | ||
"isOptimize": 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,12 @@ | ||
{ | ||
"name": "Mimosa-LESSCoffeeScriptHTML-BootstrapAngular", | ||
"version": "0.0.1", | ||
"dependencies": { | ||
"consolidate": "~0.4.0", | ||
"jade": "~0.26.3", | ||
"express": "~3.0.0beta4", | ||
"watch-connect": "~0.3.4", | ||
"coffee-script": "1.3.3" | ||
}, | ||
"engine": "node >= 0.8.1" | ||
} |
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,74 @@ | ||
express = require 'express' | ||
reloadOnChange = require 'watch-connect' | ||
engines = require 'consolidate' | ||
|
||
exports.startServer = (config) -> | ||
|
||
publicPath = config.watch.compiledDir | ||
useReload = config.server.useReload | ||
|
||
nextId = 0 | ||
|
||
people = [ | ||
{"id": "#{nextId++}", "name": "Saasha", "age": "5"} | ||
{"id": "#{nextId++}", "name": "Planet", "age": "7"} | ||
] | ||
|
||
isUniqueName = (name) -> | ||
(name for person in people when person.name is name).length is 0 | ||
|
||
app = express() | ||
server = app.listen config.server.port, -> | ||
console.log "Express server listening on port %d in %s mode", config.server.port, app.settings.env | ||
|
||
app.configure -> | ||
app.set 'port', config.server.port | ||
app.set 'views', config.server.views.path | ||
app.engine config.server.views.extension, engines[config.server.views.compileWith] | ||
app.set 'view engine', config.server.views.extension | ||
app.use express.favicon() | ||
app.use express.bodyParser() | ||
app.use express.methodOverride() | ||
if useReload | ||
options = | ||
server:server | ||
watchdir:publicPath | ||
skipAdding:true | ||
exclude:["almond\\.js"] | ||
additionaldirs:["#{__dirname}/views"] | ||
app.use reloadOnChange(options) | ||
app.use express.compress() | ||
app.use app.router | ||
app.use express.static(publicPath) | ||
|
||
app.configure 'development', -> | ||
app.use express.errorHandler() | ||
|
||
index = (useReload, optimize) -> | ||
options = | ||
reload: config.server.useReload | ||
optimize: config.isOptimize ? false | ||
cachebust: if process.env.NODE_ENV isnt "production" then "?b=#{(new Date()).getTime()}" else '' | ||
(req, res) -> res.render 'index', options | ||
|
||
app.get '/', index(useReload, config.isOptimize) | ||
|
||
app.get '/people', (req, res) -> res.json people | ||
|
||
app.post '/people', (req, res) -> | ||
name = req.body.name | ||
message = | ||
"title": "Duplicate!" | ||
"message": "#{name} is a duplicate. Please enter a new name." | ||
return res.send(message, 403) if not isUniqueName name | ||
person = | ||
"id": "#{nextId++}" | ||
"name": "#{name}" | ||
"age": "0" | ||
people.push person | ||
res.json person | ||
|
||
app.get '/people/details/:id', (req, res) -> | ||
id = req.params.id | ||
current = person for person in people when parseInt(person.id, 10) is parseInt(id, 10) | ||
res.json current |
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,89 @@ | ||
doctype 5 | ||
html(lang="en") | ||
head | ||
meta(charset='utf-8') | ||
meta(http-equiv='X-UA-Compatible', content='IE=edge,chrome=1') | ||
title Angular Demo | ||
meta(name='description', content='') | ||
meta(name='viewport', content='width=device-width') | ||
|
||
link(rel='stylesheet', href='/stylesheets/vendor/bootstrap.css' + cachebust) | ||
link(rel='stylesheet', href='/stylesheets/styles.css' + cachebust) | ||
|
||
if optimize | ||
script(src='/javascripts/main-built.js') | ||
else | ||
script(src='/javascripts/vendor/require.js', data-main='/javascripts/main.js') | ||
|
||
if reload | ||
script(src='/socket.io/socket.io.js') | ||
script(src='/socket-enable.js') | ||
|
||
body(ng-cloak='ng-cloak') | ||
ng:view | ||
.container | ||
.hero-unit | ||
h1 | ||
| Playing with | ||
a(href='http://angularjs.org', target='_blank') AngularJS | ||
p | ||
| and also | ||
a(href='http://requirejs.org/', target='_blank') RequireJS | ||
p | ||
| and also | ||
a(href='https://github.com/dbashford/mimosa', target='_blank') Mimosa | ||
p Compiles both Stylus and Less (Bootstrap) and CoffeeScript. 2 lines of config. | ||
.row | ||
.span8 | ||
tabs | ||
tab(data-tab-id='twitter', caption='Twitter') | ||
section(ng-controller='twitter') | ||
.alert.alert-info(ng-show='!searchTerm.length') | ||
h4.alert-heading Heads up! | ||
span Enter Twitter search criteria. | ||
form.well.form-search(ng-submit='search(searchTerm)') | ||
input.input-medium.search-query(type='text', ng-model='searchTerm', autofocus='autofocus') | ||
button.btn(type='submit') | ||
i.icon-search | ||
| Search | ||
include partials/tweets | ||
|
||
tab(data-tab-id='gitHub', caption='GitHub') | ||
section(ng-controller='gitHub') | ||
.alert.alert-info(ng-show='!searchTerm.length') | ||
h4.alert-heading Heads up! | ||
span Enter GitHub search criteria. | ||
form.well.form-search(ng-submit='search(searchTerm)') | ||
input.input-medium.search-query(type='text', ng-model='searchTerm') | ||
button.btn(type='submit') | ||
i.icon-search | ||
| Search | ||
include partials/repos | ||
|
||
tab(data-tab-id='people', caption='People') | ||
.row | ||
.span4 | ||
section(ng-controller='people') | ||
.alert.alert-error(ng-show='!!error') | ||
h4.alert-heading(ng-bind='error.title') | ||
span(ng-bind='error.message') | ||
form.well.form-search(ng-submit='insertPerson(name)') | ||
input.input-medium.search-query(type='text', ng-model='name') | ||
button.btn(type='submit') | ||
i.icon-plus | ||
| Insert | ||
myinput(model='name', kind='text', caption='My Caption', placeholder='Enter something here', help-text='Help me out, bro!') | ||
include partials/people | ||
.span4 | ||
section(ng-controller='personDetails') | ||
| Age: | ||
span(ng-bind='person.result.age') | ||
.span4 | ||
h2 Search History | ||
section(ng-controller='searchHistory') | ||
form.well.form-search | ||
input.input-medium.search-query(type='text', placeholder='Type filter...', ng-model='query') | ||
label(ng-bind-template='Displaying: {{(searchHistory | filter:query).length}}') | ||
ol(ng-hide='!searchHistory.length') | ||
li(ng-repeat='item in searchHistory | filter:query | orderBy:\'timeStamp\':true', ng-bind-template='{{item.source}}/{{item.criteria}}') | ||
|
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 @@ | ||
ul(ng-hide='!people.result.length') | ||
li.row(ng-repeat='person in people.result | orderBy:\'name\'') | ||
a(ng-href='#/people/details/{{person.id}}', ng-bind='person.name') |
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 @@ | ||
ul(ng-hide='!repos.result.data.length') | ||
li(ng-repeat='repo in repos.result.data') | ||
div | ||
b(ng-bind='repo.owner.login') | ||
a(ng-href='{{repo.url}}', ng-bind='repo.name', target='_blank') | ||
div(ng-bind='repo.description') |
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,9 @@ | ||
ul(ng-hide='!tweets.result.results.length') | ||
li.row(ng-repeat='tweet in tweets.result.results') | ||
.span1.thumbnail | ||
img(ng-src='{{tweet.profile_image_url}}') | ||
.span10 | ||
div | ||
b(ng-bind='tweet.from_user_name') | ||
a(ng-href='https://twitter.com/{{tweet.from_user}}', ng-bind='tweet.from_user | twitterfy', target='_blank') | ||
div(ng-bind='tweet.text') |
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,4 +1,4 @@ | ||
exports.config = | ||
#modules:['lint','require','server','minify','web-package'] | ||
modules:['lint','require','server','minify','web-package'] | ||
minify: | ||
exclude:["\.min\.", "main.js"] | ||
exclude:["\\.min\\.", "main.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