show already uploaded asset
[pharext/pharext.org] / app / views / github / repo.phtml
1 <?php $this->layout("layout") ?>
2
3 <div class="page-header">
4 <h1>
5 <?php if (isset($repo)) : ?>
6 <?php if ($repo->fork) : ?>
7 <span title="fork" class="mega-octicon octicon-repo-forked" aria-hidden="true"></span>
8 <?php elseif ($repo->private) : ?>
9 <span title="fork" class="mega-octicon octicon-key" aria-hidden="true"></span>
10 <?php else : ?>
11 <span title="repo" class="mega-octicon octicon-repo" aria-hidden="true"></span>
12 <?php endif; ?>
13 <?= $this->e($repo->name) ?>
14 <?php elseif (isset($name)) : ?>
15 <?= $this->e($name) ?>
16 <?php else : ?>
17 Unknown Repository
18 <?php endif; ?>
19 - <small>Github</small>
20 </h1>
21 </div>
22
23 <div class="row">
24 <div class="col-md-6">
25 <div class="well">
26 <p><?= $this->e($repo->description) ?></p>
27 </div>
28 </div>
29 <div class="col-md-6">
30 <div class="row text-center">
31 <div class="col-md-4">
32 <span title="Number of watchers" class="mega-octicon octicon-eye" aria-hidden="true"></span>
33 <br>
34 <span class="label label-success">
35 <?= $repo->watchers_count ?> Watchers
36 </span>
37 </div>
38 <div class="col-md-4">
39 <span title="Number of stars" class="mega-octicon octicon-star" aria-hidden="true"></span>
40 <br>
41 <span class="label label-primary">
42 <?= $repo->stargazers_count ?> Stars
43 </span>
44 </div>
45 <div class="col-md-4">
46 <span title="Number of forks" class="mega-octicon octicon-repo-forked" aria-hidden="true"></span>
47 <br>
48 <span class="label label-default">
49 <?= $repo->forks_count ?> Forks
50 </span>
51 </div>
52 </div>
53 </div>
54 </div>
55
56 <div class="row">
57 <div class="col-md-6">
58 <div class="row">
59 <div class="col-md-8">
60 <p>Has a <code>config*.m4</code> file?</p>
61 </div>
62 <div class="col-md-4 text-center">
63 <p>
64 <?php if (!empty($repo->config_m4)) : ?>
65 <span class="label label-info">YES</span>
66 <?php else : ?>
67 <span class="label label-warning">NO</span>
68 <?php endif; ?>
69 </p>
70 </div>
71 </div>
72
73 <div class="row">
74 <div class="col-md-8">
75 <p>Has a <code>package*.xml</code> file?</p>
76 </div>
77 <div class="col-md-4 text-center">
78 <p>
79 <?php if (!empty($repo->package_xml)) : ?>
80 <span class="label label-info">YES</span>
81 <?php else : ?>
82 <span class="label label-warning">NO</span>
83 <?php endif; ?>
84 </p>
85 </div>
86 </div>
87
88 <div class="row">
89 <div class="col-md-8">
90 <p>Has a <code>pharext_package.php</code> file?</p>
91 </div>
92 <div class="col-md-4 text-center">
93 <p>
94 <?php if (!empty($repo->pharext_package_php)) : ?>
95 <span class="label label-info">YES</span>
96 <?php else : ?>
97 <span class="label label-warning">NO</span>
98 <?php endif; ?>
99 </p>
100 </div>
101 </div>
102
103 <div class="row">
104 <div class="col-md-8">
105 <p>Is the <code>pharext</code> hook enabled?</p>
106 </div>
107 <div class="col-md-4 text-center">
108 <?php if ($this->check($repo)) : ?>
109 <span class="label label-info">YES</span>
110 <?php else : ?>
111 <span class="label label-warning">NO</span>
112 <?php endif; ?>
113 </div>
114 </div>
115 </div>
116
117 <div class="col-md-6">
118 <div class="row">
119 <form method="post" action="<?= $baseUrl->mod("./github/repo/". $repo->full_name ."/hook/" . ($this->check($repo) ? "upd" : "add")) ?>">
120 <div class="col-md-12">
121 <div class="checkbox">
122 <label for="hook-tag">
123 <input id="hook-tag" type="checkbox" name="tag" value="1" <?= ($hook = $this->check($repo)) && in_array("create", $hook->events) ? "checked":"" ?>>
124 Automatically create a release when I push a tag.
125 </label>
126 </div>
127 <div class="checkbox">
128 <label for="hook-release">
129 <input id="hook-release" type="checkbox" name="release" value="1" <?= ($hook = $this->check($repo)) && in_array("release", $hook->events) ? "checked":"" ?>>
130 Automatically upload a PHARext package as an asset to a release.
131 </label>
132 </div>
133 </div>
134 <?php if ($this->check($repo)) : ?>
135 <div class="col-md-6">
136 <button type="submit" class="btn btn-lg btn-block btn-info">
137 <span class="glyphicon glyphicon-ok-circle"></span>
138 Update Hook
139 </button>
140 </div>
141 <?php else : ?>
142 <div class="col-md-12">
143 <button type="submit" class="btn btn-lg btn-block btn-success">
144 <span class="octicon octicon-plug"></span>
145 Enable Hook
146 </button>
147 </div>
148 <?php endif; ?>
149 </form>
150 <!-- column wrapping! -->
151 <?php if ($this->check($repo)) : ?>
152 <div class="col-md-6">
153 <form method="post" action="<?= $baseUrl->mod("./github/repo/". $repo->full_name ."/hook/del") ?>">
154 <button class="btn btn-lg btn-block btn-danger">
155 <span class="glyphicon glyphicon-remove-circle"></span>
156 Remove Hook
157 </button>
158 </form>
159 </div>
160 <?php endif; ?>
161 </div>
162 </div>
163 </div>
164
165 <h2>Release History</h2>
166 <?php if (empty($repo->tags) || !count((array) $repo->tags)) : ?>
167 <div class="alert alert-warning" role="alert">
168 <p class="text-danger">No releases or tags found.</p>
169 </div>
170 <?php endif; ?>
171
172 <?php foreach ($repo->tags as $name => $v) : ?>
173 <div class="panel panel-<?= empty($v->release) ? "info": "primary" ?>">
174 <div class="panel-heading">
175 <h3 class="panel-title">
176 <?php if (empty($v->release)) : ?>
177 <?= $this->e($v->tag->name) ?>
178 <span class="label label-default pull-right">Tag</span>
179 <?php else : ?>
180 <?= $this->e($v->release->name ?: $v->tag->name) ?>
181 <span class="label label-info pull-right">Release</span>
182 <?php endif; ?>
183 </h3>
184 </div>
185 <div class="panel-body">
186 <div class="row">
187 <div class="col-md-8">
188 <?php if (!empty($v->release)) : ?>
189 <p><?= $this->md($v->release->body) ?></p>
190 <?php endif; ?>
191 <ul class="list-inline">
192 <li>
193 <span class="octicon octicon-tag" title="Tag"></span>
194 <span class="label label-default"><?= $this->e($v->tag->name) ?></span>
195 </li>
196
197 <?php if (!empty($v->release)) : ?>
198 <li>
199 <span class="octicon octicon-git-branch" title="Branch"></span>
200 <span class="label label-default"><?= $this->e($v->release->target_commitish) ?></span>
201 </li>
202 <li>
203 <span class="octicon octicon-clock" title="Date"></span>
204 <span class="label label-default">
205 <time datetime="<?= $v->release->published_at ?>">
206 <?= $this->utc($v->release->published_at)->format("Y-m-d H:i T") ?>
207 </time>
208 </span>
209 <?php endif; ?>
210 </ul>
211 </div>
212 <div class="col-md-4">
213 <?php if (!empty($v->release->assets)) : ?>
214 <ul class="list-inline pull-right">
215 <?php foreach ($v->release->assets as $asset) : ?>
216 <?php if (fnmatch("*.ext.phar", $asset->name)) : ?>
217 <li>
218 <a class="btn btn-success" href="<?= $this->e($asset->browser_download_url) ?>">
219 <span class="octicon octicon-package"></span>
220 <?= $this->e($asset->name) ?>
221 </a>
222 </li>
223 <?php endif; ?>
224 <?php endforeach; ?>
225 </ul>
226 <?php endif; ?>
227 </div>
228 </div>
229 </div>
230 </div>
231 <?php endforeach; ?>
232