Refactored more link panels into fragments.
6 files deleted
8 files modified
| | |
| | | gb.ticgit = ticgit
|
| | | gb.pageFirst = first
|
| | | gb.pagePrevious prev
|
| | | gb.pageNext = next |
| | | gb.pageNext = next
|
| | | gb.parent = parent |
| | |
| | |
|
| | | <!-- commit nav links -->
|
| | | <div class="page_nav2">
|
| | | parent: <span wicket:id="parentLink">[parent link]</span> | <span wicket:id="patchLink">[patch link]</span>
|
| | | <wicket:message key="gb.parent"></wicket:message>: <span wicket:id="parentLink">[parent link]</span> | <span wicket:id="patchLink">[patch link]</span> | <span wicket:id="commitdiffLink">[commitdiff link]</span>
|
| | | </div>
|
| | |
|
| | | <!-- shortlog header -->
|
| | |
| | | import org.apache.wicket.markup.repeater.Item;
|
| | | import org.apache.wicket.markup.repeater.data.DataView;
|
| | | import org.apache.wicket.markup.repeater.data.ListDataProvider;
|
| | | import org.apache.wicket.model.StringResourceModel;
|
| | | import org.eclipse.jgit.lib.Repository;
|
| | | import org.eclipse.jgit.revwalk.RevCommit;
|
| | |
|
| | |
| | | public CommitPage(PageParameters params) {
|
| | | super(params);
|
| | |
|
| | | final String commitId = params.getString("h", "");
|
| | |
|
| | | Repository r = getRepository();
|
| | | RevCommit c = JGitUtils.getCommit(r, commitId);
|
| | | RevCommit c = JGitUtils.getCommit(r, objectId);
|
| | |
|
| | | List<String> parents = new ArrayList<String>();
|
| | | if (c.getParentCount() > 0) {
|
| | |
| | | // commit page links
|
| | | if (parents.size() == 0) {
|
| | | add(new Label("parentLink", "none"));
|
| | | add(new Label("commitdiffLink", getString("gb.commitdiff")));
|
| | | } else {
|
| | | add(new LinkPanel("parentLink", null, parents.get(0).substring(0, 8), CommitPage.class, newCommitParameter(parents.get(0))));
|
| | | add(new LinkPanel("commitdiffLink", null, new StringResourceModel("gb.commitdiff", this, null), DiffPage.class, WicketUtils.newObjectParameter(repositoryName, objectId)));
|
| | | }
|
| | | add(new Label("patchLink", getString("gb.patch")));
|
| | |
|
| | |
| | | </tr>
|
| | | </tbody>
|
| | | </table>
|
| | | |
| | | <wicket:fragment wicket:id="adminLinks">
|
| | | <!-- page nav links --> |
| | | <div class="page_nav">
|
| | | <a wicket:id="newRepository"><wicket:message key="gb.newRepository"></wicket:message></a> | <a wicket:id="newUser"><wicket:message key="gb.newUser"></wicket:message></a>
|
| | | </div> |
| | | </wicket:fragment>
|
| | | </wicket:extend>
|
| | | </body>
|
| | | </html> |
| | |
| | | import org.apache.wicket.extensions.markup.html.repeater.util.SortParam;
|
| | | import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider;
|
| | | import org.apache.wicket.markup.html.basic.Label;
|
| | | import org.apache.wicket.markup.html.link.BookmarkablePageLink;
|
| | | import org.apache.wicket.markup.html.panel.Fragment;
|
| | | import org.apache.wicket.markup.repeater.Item;
|
| | | import org.apache.wicket.markup.repeater.data.DataView;
|
| | | import org.apache.wicket.model.IModel;
|
| | |
| | | import com.gitblit.wicket.LinkPanel;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.models.RepositoryModel;
|
| | | import com.gitblit.wicket.panels.AdminLinksPanel;
|
| | |
|
| | |
|
| | | public class RepositoriesPage extends BasePage {
|
| | |
| | | super();
|
| | | setupPage("", "");
|
| | |
|
| | | add(new AdminLinksPanel("adminPanel").setVisible(StoredSettings.getBoolean("allowAdministration", false)));
|
| | | Fragment adminLinks = new Fragment("adminPanel", "adminLinks", this);
|
| | | adminLinks.add(new BookmarkablePageLink<Void>("newRepository", RepositoriesPage.class));
|
| | | adminLinks.add(new BookmarkablePageLink<Void>("newUser", RepositoriesPage.class));
|
| | | add(adminLinks.setVisible(StoredSettings.getBoolean("allowAdministration", false)));
|
| | |
|
| | | add(new Label("repositoriesMessage", StoredSettings.getString("repositoriesMessage", "")).setEscapeModelStrings(false));
|
| | |
|
| | |
| | | <td><span wicket:id="pathName"></span></td>
|
| | | <td class="size"><span wicket:id="pathSize">[path size]</span></td>
|
| | | <td class="mode"><span wicket:id="pathPermissions">[path permissions]</span></td>
|
| | | <td class="rightAlign"><span wicket:id="treeLinks">[path links]</span></td>
|
| | | <td class="rightAlign"><span wicket:id="pathLinks">[path links]</span></td>
|
| | | </tr>
|
| | | </table>
|
| | |
|
| | | <!-- tree links -->
|
| | | <wicket:fragment wicket:id="treeLinks">
|
| | | <div class="link">
|
| | | <a wicket:id="tree"><wicket:message key="gb.tree"></wicket:message></a> | <a wicket:id="history"><wicket:message key="gb.history"></wicket:message></a>
|
| | | </div>
|
| | | </wicket:fragment>
|
| | | |
| | | <!-- blob links -->
|
| | | <wicket:fragment wicket:id="blobLinks">
|
| | | <div class="link">
|
| | | <a wicket:id="view"><wicket:message key="gb.view"></wicket:message></a> | <a wicket:id="raw"><wicket:message key="gb.raw"></wicket:message></a> | <a wicket:id="history"><wicket:message key="gb.history"></wicket:message></a>
|
| | | </div> |
| | | </wicket:fragment>
|
| | | |
| | | </wicket:extend>
|
| | | </body>
|
| | | </html> |
| | |
| | |
|
| | | import org.apache.wicket.PageParameters;
|
| | | import org.apache.wicket.markup.html.basic.Label;
|
| | | import org.apache.wicket.markup.html.link.BookmarkablePageLink;
|
| | | import org.apache.wicket.markup.html.panel.Fragment;
|
| | | import org.apache.wicket.markup.repeater.Item;
|
| | | import org.apache.wicket.markup.repeater.data.DataView;
|
| | | import org.apache.wicket.markup.repeater.data.ListDataProvider;
|
| | |
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.models.PathModel;
|
| | | import com.gitblit.wicket.panels.PathBreadcrumbsPanel;
|
| | | import com.gitblit.wicket.panels.TreeBlobLinksPanel;
|
| | | import com.gitblit.wicket.panels.TreeLinksPanel;
|
| | |
|
| | |
|
| | | public class TreePage extends RepositoryPage {
|
| | |
| | | // parent .. path
|
| | | item.add(new Label("pathSize", ""));
|
| | | item.add(new LinkPanel("pathName", null, entry.name, TreePage.class, newPathParameter(entry.path)));
|
| | | item.add(new Label("treeLinks", ""));
|
| | | item.add(new Label("pathLinks", ""));
|
| | | } else {
|
| | | if (entry.isTree()) {
|
| | | // folder/tree link
|
| | | item.add(new Label("pathSize", ""));
|
| | | item.add(new LinkPanel("pathName", null, entry.name, TreePage.class, newPathParameter(entry.path)));
|
| | | item.add(new TreeLinksPanel("treeLinks", repositoryName, entry));
|
| | | |
| | | // links
|
| | | Fragment links = new Fragment("pathLinks", "treeLinks", this);
|
| | | links.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils.newPathParameter(repositoryName, entry.commitId, entry.path)));
|
| | | links.add(new BookmarkablePageLink<Void>("history", TreePage.class).setEnabled(false));
|
| | | item.add(links);
|
| | | } else {
|
| | | // blob link
|
| | | item.add(new Label("pathSize", byteFormat.format(entry.size)));
|
| | | item.add(new LinkPanel("pathName", "list", entry.name, BlobPage.class, newPathParameter(entry.path)));
|
| | | item.add(new TreeBlobLinksPanel("treeLinks", repositoryName, entry));
|
| | | |
| | | // links
|
| | | Fragment links = new Fragment("pathLinks", "blobLinks", this);
|
| | | links.add(new BookmarkablePageLink<Void>("view", BlobPage.class, WicketUtils.newPathParameter(repositoryName, entry.commitId, entry.path)));
|
| | | links.add(new BookmarkablePageLink<Void>("raw", BlobPage.class).setEnabled(false));
|
| | | links.add(new BookmarkablePageLink<Void>("history", BlobPage.class).setEnabled(false));
|
| | | item.add(links);
|
| | | }
|
| | | }
|
| | | String clazz = counter % 2 == 0 ? "dark" : "light";
|
| | | WicketUtils.setCssClass(item, clazz);
|
| | | WicketUtils.setAlternatingBackground(item, counter);
|
| | | counter++;
|
| | | }
|
| | | };
|
| | |
| | |
|
| | | private final String ROOT = "--ROOT--";
|
| | |
|
| | | public PathBreadcrumbsPanel(String id, final String repositoryName, String pathName, final String commitId) {
|
| | | public PathBreadcrumbsPanel(String id, final String repositoryName, String pathName, final String objectId) {
|
| | | super(id);
|
| | | List<BreadCrumb> crumbs = new ArrayList<BreadCrumb>();
|
| | | crumbs.add(new BreadCrumb("[" + repositoryName + "]", ROOT, false));
|
| | |
| | | public void populateItem(final Item<BreadCrumb> item) {
|
| | | final BreadCrumb entry = item.getModelObject();
|
| | | String path = entry.getPath();
|
| | | String parameters = "p=" + repositoryName + ",h=" + commitId;
|
| | | if (path != null) {
|
| | | parameters += ",f=" + path;
|
| | | if (entry.isLeaf) {
|
| | | item.add(new Label("pathLink", entry.name));
|
| | | item.add(new Label("pathSeparator", "").setVisible(false));
|
| | | } else {
|
| | | item.add(new LinkPanel("pathLink", null, entry.name, TreePage.class, WicketUtils.newPathParameter(repositoryName, objectId, path)));
|
| | | item.add(new Label("pathSeparator", "/"));
|
| | | }
|
| | |
|
| | | item.add(new LinkPanel("pathLink", null, entry.name, TreePage.class, WicketUtils.newPathParameter(repositoryName, commitId, path)));
|
| | | item.add(new Label("pathSeparator", entry.isLeaf ? "" : "/"));
|
| | | }
|
| | | };
|
| | | add(pathsView);
|