prettier repo list
[pharext/pharext.org] / app / views / github / index.phtml
index 987ea8e4c63e9782aacc89e4c07e046a4c55d2d5..070db76b1c4ff3dd7e42e884bf3b4de68085c062 100644 (file)
@@ -7,22 +7,26 @@
        </h1>
 </div>
 
-<?php if (isset($exception)) : ?>
-       <?= $this->fetch("alert") ?>
-<?php elseif (isset($repos)) : ?>
-
 <table class="table table-hover">
        <thead>
                <tr>
-                       <th>Repo</th>
-                       <th class="text-center">Fork</th>
+                       <th colspan="2">Repo</th>
                        <th class="text-right">Last Pushed</th>
-                       <th class="text-right">Hook</th>
+                       <th class="text-center">Hook</th>
                </tr>
        </thead>
        <tbody>
                <?php foreach ($repos as $repo) : ?>
                <tr class="<?= $this->check($repo) ? "success" : "" ?>">
+                       <td>
+                               <?php if ($repo->fork) : ?>
+                                       <span title="fork" class="octicon octicon-repo-forked" aria-hidden="true"></span>
+                               <?php elseif ($repo->private) : ?>
+                                       <span title="fork" class="octicon octicon-key" aria-hidden="true"></span>
+                               <?php else : ?>
+                                       <span title="repo" class="octicon octicon-repo" aria-hidden="true"></span>
+                               <?php endif; ?>
+                       </td>
                        <th>
                                <a href="<?= $baseUrl->mod("./github/repo/".$repo->full_name) ?>">
                                        <big class="text-primary" title="<?= $this->e($repo->description) ?>"><?= $this->e($repo->name) ?></big>
                                <br>
                                <small><?= $this->e($this->shorten($repo->description)) ?></small>
                        </th>
-                       <td class="text-center"><?php if ($repo->fork) : ?>
-                               <span title="fork" class="octicon octicon-repo-forked" aria-hidden="true"></span>
-                               <?php endif; ?>
-                       </td>
                        <td class="text-right"><time datetime="<?= $this->e($repo->pushed_at) ?>"><?= $this->e($this->utc($repo->pushed_at)->format("Y-m-d H:i T")) ?></time></td>
-                       <td class="text-right">
-                               <a class="btn btn-primary <?= $this->check($repo) ? "disabled":"" ?>"
-                                  href="<?= $baseUrl->mod("./github/repo/".$repo->full_name) ?>">
-                                       <span class="glyphicon glyphicon-plus" title="Add pharext hook"></span></a>
-                               <a class="btn btn-danger <?= !$this->check($repo) ? "disabled":"" ?>"
-                                  href="<?= $baseUrl->mod(["path" => "github/repo", "query" => "hook=del&repo=". urlencode($repo->full_name)]) ?>">
-                                       <span class="glyphicon glyphicon-remove" title="Remove hook"></span></a>
+                       <td class="text-center">
+                               <?php if ($this->check($repo)) : ?>
+                               <form class="form" style="display: inline-block" method="post" action="<?= $baseUrl->mod("./github/repo/". $repo->full_name ."/hook/del") ?>"> 
+                                       <input type="hidden" name="returnback" value="1">
+                                       <button type="submit" class="btn btn-block btn-danger">
+                                               <span class="glyphicon glyphicon-remove"></span>
+                                               Remove Hook
+                                       </button>
+                               </form>
+                               <?php else : ?>
+                               <form class="form-inline" style="display: inline-block" method="post" action="<?= $baseUrl->mod("./github/repo/". $repo->full_name ."/hook/add") ?>">
+                                               <div class="checkbox">
+                                                       <label for="hook-tag">
+                                                               <input id="hook-tag" type="checkbox" name="tag" value="1" checked>
+                                                               Release
+                                                       </label>
+                                               </div>
+                                               <div class="checkbox">
+                                                       <label for="hook-release">
+                                                               <input id="hook-release" type="checkbox" name="release" value="1" checked>
+                                                               Upload
+                                                       </label>
+                                               </div>
+                                       <input type="hidden" name="returnback" value="1">
+                                       <button type="submit" class="btn btn-block btn-primary">
+                                               <span class="glyphicon glyphicon-plus"></span>
+                                               Enable Hook
+                                       </button>
+                               </form>
+                               <?php endif; ?>
+                       </div>
                        </td>
                </tr>
                <?php endforeach; ?>
 
 <nav>
        <ul class="pager">
-               <?php
-               $first= $this->link("first");
-               $prev = $this->link("prev");
-               $next = $this->link("next");
-               $last = $this->link("last");
-               ?>
-               <li class="<?= $first ?"":"disabled" ?>"><a href="?page=<?= $first ?>" title="First Page"><span class="glyphicon glyphicon-fast-backward"></span></a></li>
-               <li class="<?= $prev ?"":"disabled" ?>"><a href="?page=<?= $prev ?>" rel="prev" title="Previous Page"><span class="glyphicon glyphicon-chevron-left"></span> Previous</a></li>
-               <li class="<?= $next ?"":"disabled" ?>"><a href="?page=<?= $next ?>" rel="next" title="Next Page">Next <span class="glyphicon glyphicon-chevron-right"></span></a></li>
-               <li class="<?= $last ?"":"disabled" ?>"><a href="?page=<?= $last ?>" title="Last Page"><span class="glyphicon glyphicon-fast-forward"></span></a></li>
+               <li class="<?= $links->getFirst() ?"":"disabled" ?>"><a href="?page=<?= $links->getPage("first") ?>" title="First Page"><span class="glyphicon glyphicon-fast-backward"></span></a></li>
+               <li class="<?= $links->getPrev() ?"":"disabled" ?>"><a href="?page=<?= $links->getPage("prev") ?>" rel="prev" title="Previous Page"><span class="glyphicon glyphicon-chevron-left"></span> Previous</a></li>
+               <li class="<?= $links->getNext() ?"":"disabled" ?>"><a href="?page=<?= $links->getPage("next") ?>" rel="next" title="Next Page">Next <span class="glyphicon glyphicon-chevron-right"></span></a></li>
+               <li class="<?= $links->getLast() ?"":"disabled" ?>"><a href="?page=<?= $links->getPage("last") ?>" title="Last Page"><span class="glyphicon glyphicon-fast-forward"></span></a></li>
        </ul>
 </nav>
-<?php endif; ?>