Merge pull request #997 from chrishunt/update-commit-onebox

Update GitHub commit Onebox
This commit is contained in:
Sam 2013-06-09 22:26:28 -07:00
commit ad0c1c60b9
2 changed files with 23 additions and 35 deletions

View File

@ -3,18 +3,35 @@
<div class="source">
<div class="info">
<a href="{{html_url}}" class="track-link" target="_blank">
{{#favicon}}<img class="favicon" src="{{favicon}}"> {{/favicon}}{{host}}
{{#favicon}}
<img class="favicon" src="{{favicon}}">
{{/favicon}}
{{host}}
</a>
</div>
</div>
{{/host}}
<div class="onebox-result-body">
{{#author.avatar_url}}<a href="{{author.html_url}}" target="_blank"><img alt="{{author.login}}" src="{{author.avatar_url}}"></a>{{/author.avatar_url}}
<h4><a href="{{author.html_url}}" target="_blank">{{author.login}}</a></h4>
{{{commit.message}}}
<div class="github-commit-stats">Changed <strong>{{files.length}} files</strong> with <strong>{{stats.additions}} additions</strong> and <strong>{{stats.deletions}} deletions</strong>.</div>
{{#author.avatar_url}}
<a href="{{author.html_url}}" target="_blank">
<img alt="{{author.login}}" src="{{author.avatar_url}}">
</a>
{{/author.avatar_url}}
<h4>
<a href="{{html_url}}" target="_blank">{{commit.message}}</a>
</h4>
<div class="date">
<a href="{{html_url}}" target="_blank">{{commit_date}}</a>
by <a href="{{author.html_url}}" target="_blank">{{author.login}}</a>
on <a href="{{html_url}}" target="_blank">{{commit_date}}</a>
</div>
<div class="github-commit-stats">
changed <strong>{{files.length}} files</strong>
with <strong>{{stats.additions}} additions</strong>
and <strong>{{stats.deletions}} deletions</strong>.
</div>
</div>
<div class="clearfix"></div>

View File

@ -13,33 +13,4 @@ describe Oneboxer::GithubCommitOnebox do
it "translates the URL" do
@o.translate_url.should == "https://api.github.com/repos/discourse/discourse/commits/ee76f1926defa8309b3a7ea64a25707519529a13"
end
it "generates the expected onebox for GitHub Commit" do
@o.onebox.should == expected_github_commit_result
end
private
def expected_github_commit_result
<<EXPECTED
<div class="onebox-result">
<div class="source">
<div class="info">
<a href="https://github.com/discourse/discourse/commit/ee76f1926defa8309b3a7ea64a25707519529a13" class="track-link" target="_blank">
<img class="favicon" src="/assets/favicons/github.png"> github.com
</a>
</div>
</div>
<div class="onebox-result-body">
<a href="https://github.com/eviltrout" target="_blank"><img alt="eviltrout" src="https://secure.gravatar.com/avatar/c6e17f2ae2a215e87ff9e878a4e63cd9?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png"></a>
<h4><a href="https://github.com/eviltrout" target="_blank">eviltrout</a></h4>
Debugging Tool for Hot Topics
<div class="github-commit-stats">Changed <strong>16 files</strong> with <strong>245 additions</strong> and <strong>43 deletions</strong>.</div>
<div class="date">
<a href="https://github.com/discourse/discourse/commit/ee76f1926defa8309b3a7ea64a25707519529a13" target="_blank">08:52PM - 02 Apr 13</a>
</div>
</div>
<div class="clearfix"></div>
</div>
EXPECTED
end
end