Skip to content

Commit

Permalink
commits example
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jan 23, 2014
1 parent d3ebd42 commit 6c4818b
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions examples/commits/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<!DOCTYPE html>

<style>
#demo {
font-family: 'Helvetica', Arial, sans-serif;
}
a {
text-decoration: none;
color: #f66;
}
li {
line-height: 1.5em;
margin-bottom: 20px;
}
.author, .date {
font-weight: bold;
}
</style>

<ul id="demo">
<h1>Latest Vue.js Commits</h1>
<li v-repeat="commits">
<a href="{{html_url}}" target="_blank" class="commit">{{sha.slice(0, 7)}}</a>
- <span class="message">{{commit.message | truncate}}</span><br>
by <span class="author">{{commit.author.name}}</span>
at <span class="date">{{commit.author.date | formatDate}}</span>
</li>
</ul>

<script src="../../dist/vue.js"></script>
<script>
var demo = new Vue({
el: '#demo',
filters: {
truncate: function (v) {
var newline = v.indexOf('\n')
return newline > 0 ? v.slice(0, newline) : v
},
formatDate: function (v) {
return v.replace(/T|Z/g, ' ')
}
},
created: function () {
var xhr = new XMLHttpRequest()
xhr.open('GET', 'https://api.github.com/repos/yyx990803/vue/commits?per_page=3')
xhr.onload = function () {
demo.commits = JSON.parse(xhr.responseText)
}
xhr.send()
}
})
</script>

0 comments on commit 6c4818b

Please sign in to comment.