Permalink
Browse files

Better grouping logic

  • Loading branch information...
1 parent 6ee45ba commit 290ab7b43c3b491cacabbc726eaa9271f44e6e02 Zach Moazeni committed May 11, 2012
Showing with 59 additions and 46 deletions.
  1. +15 −7 coffee/site.coffee
  2. +16 −16 coffee/views.coffee
  3. +13 −8 js/site.js
  4. +15 −15 js/views.js
View
@@ -138,16 +138,19 @@ class Event extends Spine.Model
{
url:@payload.issue.html_url
comment:@payload.comment.body
+ type:"comment"
}
when "commit_comment"
{
url:@payload.comment.html_url
comment:@payload.comment.body
+ type:"comment"
}
when "pull_request_comment"
{
url:@payload.comment._links.html.href
comment:@payload.comment.body
+ type:"comment"
}
when "pull_request"
{
@@ -165,6 +168,7 @@ class Event extends Spine.Model
url:@payload.target.html_url
name:@payload.target.name
gravatar:@payload.target.avatar_url
+ type:"watch"
}
when "tag", "branch"
{
@@ -194,12 +198,16 @@ class Event extends Spine.Model
else null
if context
- [view, $.extend(context,
- id:@id
- repo:@repo.name
- repo_url:"https://github.com/#{@repo.name}"
- date:@created_at_short_string()
- )]
+ [
+ view,
+ $.extend({
+ id:@id
+ repo:@repo.name
+ repo_url:"https://github.com/#{@repo.name}"
+ date:@created_at_short_string()
+ type:view
+ }, context)
+ ]
else
[]
@@ -273,7 +281,7 @@ class window.App extends Spine.Controller
[viewType, viewArgs] = event.viewInfo()
if viewType
html = @view(viewType, viewArgs)
- html = $(html).addClass("hidden") if @isHidden(viewType)
+ html = $(html).addClass("hidden") if @isHidden(viewArgs["type"])
@joined.before(html)
@refreshTimeline()
@attachWaypoint()
View
@@ -56,8 +56,8 @@ views["show"] = """
<li class="active"><a href="#" data-type="gist">Gists</a></li>
<li class="active"><a href="#" data-type="branch">Branches</a></li>
<li class="active"><a href="#" data-type="tag">Tags</a></li>
- <li class="active"><a href="#" data-type="follow">Follows</a></li>
- <li class="active"><a href="#" data-type="issue_comment">Comments</a></li>
+ <li class="active"><a href="#" data-type="watch">Follows</a></li>
+ <li class="active"><a href="#" data-type="comment">Comments</a></li>
</ul>
</div>
@@ -75,15 +75,15 @@ views["spinner"] = """
"""
views["item"] = """
-<li class="item" data-id="{{id}}">
+<li class="item" data-id="{{id}}" data-type="{{type}}">
<span class="corner"></span>
{{title}}
<span class="date">{{date}}</span>
</li>
"""
views["push"] = """
-<li class="item" data-id="{{id}}" data-type="push">
+<li class="item" data-id="{{id}}" data-type="{{type}}">
<span class="corner"></span>
<h1>Pushed {{num}} commit(s) to <a href="{{repo_url}}">{{repo}}</a></h1>
<ol class="commits">
@@ -103,7 +103,7 @@ views["push"] = """
"""
views["gollum"] = """
-<li class="item" data-id="{{id}}" data-type="push">
+<li class="item" data-id="{{id}}" data-type="{{type}}">
<span class="corner"></span>
<h1>Updated {{num}} page(s) for <a href="{{repo_url}}">{{repo}}</a></h1>
<ol class="commits">
@@ -129,31 +129,31 @@ views["repository"] = """
"""
views["watch"] = """
-<li class="item" data-id="{{id}}" data-type="branch">
+<li class="item" data-id="{{id}}" data-type="{{type}}">
<span class="corner"></span>
<h1>Began watching <a href="{{repo_url}}">{{repo}}</a></h1>
<span class="date">{{date}}</span>
</li>
"""
views["branch"] = """
-<li class="item" data-id="{{id}}" data-type="branch">
+<li class="item" data-id="{{id}}" data-type="{{type}}">
<span class="corner"></span>
<h1>Branched <a href="{{url}}">{{name}}</a> from <a href="{{repo_url}}">{{repo}}</a></h1>
<span class="date">{{date}}</span>
</li>
"""
views["tag"] = """
-<li class="item" data-id="{{id}}" data-type="tag">
+<li class="item" data-id="{{id}}" data-type="{{type}}">
<span class="corner"></span>
<h1>Tagged <a href="{{url}}">{{name}}</a> from <a href="{{repo_url}}">{{repo}}</a></h1>
<span class="date">{{date}}</span>
</li>
"""
views["pull_request_comment"] = """
-<li class="item" data-id="{{id}}">
+<li class="item" data-id="{{id}}" data-type="{{type}}">
<span class="corner"></span>
<h1>Commented on a <a href="{{url}}">pull request</a> for <a href="{{repo_url}}">{{repo}}</a></h1>
<blockquote>{{comment}}</blockquote>
@@ -162,7 +162,7 @@ views["pull_request_comment"] = """
"""
views["issue"] = """
-<li class="item" data-id="{{id}}">
+<li class="item" data-id="{{id}}" data-type="{{type}}">
<span class="corner"></span>
<h1>Opened an <a href="{{url}}">issue</a> on <a href="{{repo_url}}">{{repo}}</a></h1>
<blockquote>{{title}}</blockquote>
@@ -172,15 +172,15 @@ views["issue"] = """
"""
views["gist"] = """
-<li class="item" data-id="{{id}}" data-type="gist">
+<li class="item" data-id="{{id}}" data-type="{{type}}">
<span class="corner"></span>
<h1>Created a <a href="{{url}}">gist</a></h1>
<span class="date">{{date}}</span>
</li>
"""
views["issue_comment"] = """
-<li class="item" data-id="{{id}}" data-type="issue_comment">
+<li class="item" data-id="{{id}}" data-type="{{type}}">
<span class="corner"></span>
<h1>Commented on an <a href="{{url}}">issue</a> on <a href="{{repo_url}}">{{repo}}</a></h1>
<blockquote>{{comment}}</blockquote>
@@ -189,7 +189,7 @@ views["issue_comment"] = """
"""
views["commit_comment"] = """
-<li class="item" data-id="{{id}}">
+<li class="item" data-id="{{id}}" data-type="{{type}}">
<span class="corner"></span>
<h1>Commented on a <a href="{{url}}">commit</a> on <a href="{{repo_url}}">{{repo}}</a></h1>
<blockquote>{{comment}}</blockquote>
@@ -198,7 +198,7 @@ views["commit_comment"] = """
"""
views["pull_request"] = """
-<li class="item" data-id="{{id}}">
+<li class="item" data-id="{{id}}" data-type="{{type}}">
<span class="corner"></span>
<h1>Opened a <a href="{{url}}">pull request</a> for <a href="{{repo_url}}">{{repo}}</a></h1>
<blockquote>{{comment}}</blockquote>
@@ -207,7 +207,7 @@ views["pull_request"] = """
"""
views["fork"] = """
-<li class="item" data-id="{{id}}" data-type="fork">
+<li class="item" data-id="{{id}}" data-type="{{type}}">
<span class="corner"></span>
<h1>Forked <a href="{{fork_url}}">{{fork_name}}</a> from <a href="{{repo_url}}">{{repo}}</a></h1>
{{description}}
@@ -216,7 +216,7 @@ views["fork"] = """
"""
views["follow"] = """
-<li class="item" data-id="{{id}}" data-type="follow">
+<li class="item" data-id="{{id}}" data-type="{{type}}">
<span class="corner"></span>
<h1>Started following <a href="{{url}}">{{name}}</a></h1>
{{#gravatar}}
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 290ab7b

Please sign in to comment.