-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue-resource-example.html
105 lines (103 loc) · 4.87 KB
/
vue-resource-example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<!DOCTYPE html>
<html lang="en">
<head>
<title>vue-resource example</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--<meta name="description" content="JBay Solutions - Play Java Application Seed">-->
<meta name="author" content="JBay Solutions - www.jbaysolutions.com">
<link rel="stylesheet" media="screen" href="css/font-awesome.min.css">
<link rel="stylesheet" media="screen" href="css/bootstrap.min.css">
<style type="text/css">
[v-cloak] {
display: none;
}
</style>
</head>
<body>
<section id="main">
<div class="container-fluid">
<br/><br/>
<div class="row">
<div id="resourceGetContainer" v-cloak class="col-sm-12" name="get">
<div class="panel panel-primary">
<div class="panel-heading">
<h2>vue-resource GET example</h2>
</div>
<div class="panel-body">
<div class="form-inline">
<div class="form-group">
<label>Github organization</label>
<input class="form-control" type="text" v-model="organization" @keyup.enter="loadRepositories"/>
<button class="btn btn-primary" :disabled="loading" @click="loadRepositories">Go</button>
</div>
</div>
<b>Status:</b> {{status}}<br/>
<b>Status text:</b> {{statusText}}
<br/><br/>
<table class="table table-bordered table-condensed table-striped">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Description</th>
<th>Language</th>
<th>Created</th>
<th>Last update</th>
<th>Watchers</th>
<th>Stars</th>
<th>Forks</th>
</tr>
</thead>
<tbody>
<tr v-for="repo in repoList">
<td>{{repo.id}}</td>
<td><a href="{{repo.html_url}}" target="_blank">{{repo.name}}</a></td>
<td>{{repo.description}}</td>
<td>{{repo.language}}</td>
<td>{{repo.created_at}}</td>
<td>{{repo.updated_at}}</td>
<td>{{repo.watchers_count}}</td>
<td>{{repo.stargazers_count}}</td>
<td>{{repo.forks_count}}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div id="resourcePostContainer" v-cloak class="col-sm-12" name="post">
<div class="panel panel-primary">
<div class="panel-heading">
<h2>vue-resource POST example</h2>
</div>
<div class="panel-body">
<div class="form-inline">
<div class="form-group">
<label>Title</label>
<input class="form-control" type="text" v-model="post.title" @keyup.enter="createPost"/>
</div>
<div class="form-group">
<label>Body</label>
<input class="form-control" type="text" v-model="post.body" @keyup.enter="createPost"/>
<button class="btn btn-primary" :disabled="loading" @click="createPost">Create POST</button>
</div>
</div>
<br/><br/>
<b>Status:</b> {{status}}<br/>
<b>Status text:</b> {{statusText}}
<br/><br/>
<div v-if="status == 201">
<b>Created Post with data:</b><br/>
<pre>{{post | json}}</pre>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<script src="js/vue.js" type="text/javascript"></script>
<script src="js/vue-resource.js" type="text/javascript"></script>
<script src="vue-resource-example.js" type="text/javascript"></script>
</body>
</html>