Skip to content

Commit

Permalink
appify
Browse files Browse the repository at this point in the history
  • Loading branch information
maccman committed Jan 1, 2012
1 parent 6b6dd8a commit 80bc068
Show file tree
Hide file tree
Showing 52 changed files with 1,254 additions and 307 deletions.
7 changes: 5 additions & 2 deletions Gemfile
Expand Up @@ -12,12 +12,15 @@ group :assets do
end

gem 'jquery-rails'
gem 'omniauth'
gem 'omniauth-google'
gem 'omniauth-google-oauth2'

group :development do
gem 'sqlite3'
end

group :production do
gem 'pg'
gem 'psych'
end
# gem 'psych'
end
25 changes: 22 additions & 3 deletions Gemfile.lock
@@ -1,6 +1,6 @@
GIT
remote: git://github.com/maccman/spine-rails.git
revision: 0825b5ba0f44725cc026601a1c88808f19037627
revision: fc469c14379d57af842794d211044cce495fc9c0
specs:
spine-rails (0.0.9)
rails (>= 3.1.0)
Expand Down Expand Up @@ -37,6 +37,7 @@ GEM
activesupport (3.2.0.rc1)
i18n (~> 0.6)
multi_json (~> 1.0)
addressable (2.2.6)
arel (3.0.0.rc1)
builder (3.0.0)
coffee-rails (3.2.0)
Expand All @@ -56,6 +57,11 @@ GEM
eventmachine (0.12.10)
execjs (1.2.13)
multi_json (~> 1.0)
faraday (0.7.5)
addressable (~> 2.2.6)
multipart-post (~> 1.1.3)
rack (>= 1.1.0, < 2)
hashie (1.2.0)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.0.rc4)
Expand All @@ -69,10 +75,22 @@ GEM
treetop (~> 1.4.8)
mime-types (1.17.2)
multi_json (1.0.4)
multipart-post (1.1.4)
oauth2 (0.5.1)
faraday (~> 0.7.4)
multi_json (~> 1.0.3)
omniauth (1.0.1)
hashie (~> 1.2)
rack
omniauth-google-oauth2 (0.1.8)
omniauth (~> 1.0)
omniauth-oauth2
omniauth-oauth2 (1.0.0)
oauth2 (~> 0.5.0)
omniauth (~> 1.0)
pg (0.12.0)
rake-compiler (~> 0.7)
polyglot (0.3.3)
psych (1.2.2)
rack (1.3.6)
rack-cache (1.1)
rack (>= 0.4)
Expand Down Expand Up @@ -130,8 +148,9 @@ DEPENDENCIES
coffee-rails (~> 3.2.0)
eco
jquery-rails
omniauth
omniauth-google-oauth2
pg
psych
rails (= 3.2.0.rc1)
spine-rails!
sqlite3
Expand Down
Binary file added app/assets/images/blacky.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/images/larrow.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/images/new.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/images/rarrow.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/star.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/starb.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/stard.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/whitey.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions app/assets/javascripts/app/controllers/activity.js.coffee
@@ -0,0 +1,10 @@
class App.Activity extends Spine.Controller
# elements:
# '.items': items
#
# events:
# 'click .item': 'itemClick'

constructor: ->
super
# ...
13 changes: 13 additions & 0 deletions app/assets/javascripts/app/controllers/messages.js.coffee
@@ -0,0 +1,13 @@
$ = Spine.$

class App.Messages extends Spine.Controller
className: 'messages'

constructor: ->
super
@render()

render: ->
@append new App.Messages.Aside
@append $('<div />').addClass('vdivide')
@append new App.Messages.Article
50 changes: 50 additions & 0 deletions app/assets/javascripts/app/controllers/messages/article.js.coffee
@@ -0,0 +1,50 @@
records = [
{
subject: 'New Email idea',
body: 'This is the new email idea',
avatar_url: 'https://secure.gravatar.com/avatar/11d44fdc7a81963600d079813ede2b69'
},

{
subject: 'New Email idea',
body: 'This is the new email idea',
avatar_url: 'https://secure.gravatar.com/avatar/11d44fdc7a81963600d079813ede2b69',
me: true
}
]

compose = {
avatar_url: 'https://secure.gravatar.com/avatar/11d44fdc7a81963600d079813ede2b69'
}

class Item extends Spine.Controller
className: 'item'

render: ->
@el.toggleClass('me', @record.me or false)
@html @view('messages/article/item')(@record)

class Compose extends Spine.Controller
className: 'item me compose'

constructor: ->
super
@render()

render: ->
@html @view('messages/article/compose')(compose)

class App.Messages.Article extends Spine.Controller
elements:
'.items': 'items'

constructor: ->
super

@replace @view('messages/article')()

@add(records)

add: (records) ->
for record in records
@items.append(new Item(record: record).render())
26 changes: 26 additions & 0 deletions app/assets/javascripts/app/controllers/messages/aside.js.coffee
@@ -0,0 +1,26 @@
records = [
{
subject: 'New Email idea',
body: 'This is the new email idea',
avatar_url: 'https://secure.gravatar.com/avatar/11d44fdc7a81963600d079813ede2b69'
}
]

class Item extends Spine.Controller
className: 'item active'

render: ->
@html @view('messages/aside/item')(@record)

class App.Messages.Aside extends Spine.Controller
elements:
'.items': 'items'

constructor: ->
super
@replace @view('messages/aside')()
@add(records)

add: (records) ->
for record in records
@items.append(new Item(record: record).render())
7 changes: 7 additions & 0 deletions app/assets/javascripts/app/controllers/nav.js.coffee
@@ -0,0 +1,7 @@
class App.Nav extends Spine.Controller
constructor: ->
super
@render()

render: ->
@replace @view('nav')()
10 changes: 10 additions & 0 deletions app/assets/javascripts/app/controllers/starred.js.coffee
@@ -0,0 +1,10 @@
class App.Starred extends Spine.Controller
# elements:
# '.items': items
#
# events:
# 'click .item': 'itemClick'

constructor: ->
super
# ...
23 changes: 19 additions & 4 deletions app/assets/javascripts/app/index.js.coffee
Expand Up @@ -4,6 +4,8 @@
#= require spine/manager
#= require spine/ajax
#= require spine/route
#= require gfx
#= require gfx/effects

#= require_tree ./lib
#= require_self
Expand All @@ -15,10 +17,23 @@ class App extends Spine.Controller
constructor: ->
super

# Initialize controllers:
# @append(@items = new App.Items)
# ...
@append new App.Nav
@append new App.Stack

Spine.Route.setup()
Spine.Route.setup()

class App.Stack extends Spine.Stack
constructor: ->
super

@activity = new App.Activity(stack: @)
@messages = new App.Messages(stack: @)
@starred = new App.Starred(stack: @)

@add(@activity)
@add(@messages)
@add(@starred)

@messages.active()

window.App = App
3 changes: 3 additions & 0 deletions app/assets/javascripts/app/models/conversation.js.coffee
@@ -0,0 +1,3 @@
class App.Conversation extends Spine.Model
@configure 'Conversation', 'from'
@extend Spine.Model.Ajax
3 changes: 3 additions & 0 deletions app/assets/javascripts/app/models/message.js.coffee
@@ -0,0 +1,3 @@
class App.Message extends Spine.Model
@configure 'Message', 'subject', 'body'
@extend Spine.Model.Ajax
8 changes: 8 additions & 0 deletions app/assets/javascripts/app/views/messages/article.jst.eco
@@ -0,0 +1,8 @@
<article>
<header>
<span data-type="archive">Archive</span>
<span data-type="activity">Activity</span>
</header>

<div class="items"></div>
</article>
@@ -0,0 +1,5 @@
<img src="<%= @avatar_url %>">

<div class="body">
<textarea autofocus></textarea>
</div>
@@ -0,0 +1,3 @@
<img src="<%= @avatar_url %>" />
<div class="body"><%= @body %></div>
<nav><a class="favourite"></a></nav>
12 changes: 12 additions & 0 deletions app/assets/javascripts/app/views/messages/aside.jst.eco
@@ -0,0 +1,12 @@
<aside>
<header>
<h2>Hermes</h2>
<img src="/assets/new.png">
</header>

<div class="search">
<input type="search" results="0" placeholder="Search..." incremental="true">
</div>

<div class="items"></div>
</aside>
6 changes: 6 additions & 0 deletions app/assets/javascripts/app/views/messages/aside/item.jst.eco
@@ -0,0 +1,6 @@
<img src="<%= @avatar_url %>">

<div>
<span class="subject"><%= @subject %></span>
<span class="body"><%= @body %></span>
</div>
17 changes: 17 additions & 0 deletions app/assets/javascripts/app/views/nav.jst.eco
@@ -0,0 +1,17 @@
<nav class="nav">
<div class="avatar">
<img src="https://secure.gravatar.com/avatar/baf018e2cc4616e4776d323215c7136c">
</div>

<div class="item">
<img src="/assets/messages.png">
</div>

<div class="item">
<img src="/assets/starred.png">
</div>

<div class="item">
<img src="/assets/broadcast.png">
</div>
</nav>
5 changes: 5 additions & 0 deletions app/assets/stylesheets/app/messages.css.styl
@@ -0,0 +1,5 @@
@import 'mixins'

#app .messages
box-flex(1)
hbox()

0 comments on commit 80bc068

Please sign in to comment.