| | |
| | | package com.gitblit.wicket.pages;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Arrays;
|
| | | import java.util.List;
|
| | |
|
| | | import org.apache.wicket.PageParameters;
|
| | |
| | | import com.gitblit.DownloadZipServlet;
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.models.GitNote;
|
| | | import com.gitblit.models.PathModel.PathChangeModel;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.JGitUtils.SearchType;
|
| | |
| | | import com.gitblit.wicket.panels.CommitHeaderPanel;
|
| | | import com.gitblit.wicket.panels.CommitLegendPanel;
|
| | | import com.gitblit.wicket.panels.LinkPanel;
|
| | | import com.gitblit.wicket.panels.RefsPanel;
|
| | |
|
| | | public class CommitPage extends RepositoryPage {
|
| | |
|
| | |
| | | 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("parentLink", null, getShortObjectId(parents.get(0)),
|
| | | CommitPage.class, newCommitParameter(parents.get(0))));
|
| | | add(new LinkPanel("commitdiffLink", null, new StringResourceModel("gb.commitdiff",
|
| | | this, null), CommitDiffPage.class, WicketUtils.newObjectParameter(
|
| | | repositoryName, objectId)));
|
| | |
| | |
|
| | | addFullText("fullMessage", c.getFullMessage(), true);
|
| | |
|
| | | // git notes
|
| | | List<GitNote> notes = JGitUtils.getNotesOnCommit(r, c);
|
| | | ListDataProvider<GitNote> notesDp = new ListDataProvider<GitNote>(notes);
|
| | | DataView<GitNote> notesView = new DataView<GitNote>("notes", notesDp) {
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | public void populateItem(final Item<GitNote> item) {
|
| | | GitNote entry = item.getModelObject();
|
| | | item.add(new RefsPanel("refName", repositoryName, Arrays.asList(entry.notesRef)));
|
| | | item.add(createPersonPanel("authorName", entry.notesRef.getAuthorIdent(),
|
| | | SearchType.AUTHOR));
|
| | | item.add(WicketUtils.createTimestampLabel("authorDate", entry.notesRef
|
| | | .getAuthorIdent().getWhen(), getTimeZone()));
|
| | | item.add(new Label("noteContent", GitBlit.self().processCommitMessage(
|
| | | repositoryName, entry.content)).setEscapeModelStrings(false));
|
| | | }
|
| | | };
|
| | | add(notesView.setVisible(notes.size() > 0));
|
| | |
|
| | | // changed paths list
|
| | | List<PathChangeModel> paths = JGitUtils.getFilesInCommit(r, c);
|
| | | add(new CommitLegendPanel("commitLegend", paths));
|
| | |
| | | }
|
| | |
|
| | | item.add(new BookmarkablePageLink<Void>("diff", BlobDiffPage.class,
|
| | | newPathParameter(entry.path)).setEnabled(!entry.changeType.equals(ChangeType.ADD) && !entry.changeType.equals(ChangeType.DELETE)));
|
| | | newPathParameter(entry.path)).setEnabled(!entry.changeType
|
| | | .equals(ChangeType.ADD) && !entry.changeType.equals(ChangeType.DELETE)));
|
| | | item.add(new BookmarkablePageLink<Void>("view", BlobPage.class,
|
| | | newPathParameter(entry.path)));
|
| | | item.add(new BookmarkablePageLink<Void>("blame", BlobPage.class).setEnabled(false));
|
| | | item.add(new BookmarkablePageLink<Void>("blame", BlamePage.class,
|
| | | newPathParameter(entry.path)));
|
| | | item.add(new BookmarkablePageLink<Void>("history", HistoryPage.class,
|
| | | newPathParameter(entry.path)).setEnabled(!entry.changeType.equals(ChangeType.ADD)));
|
| | | newPathParameter(entry.path)).setEnabled(!entry.changeType
|
| | | .equals(ChangeType.ADD)));
|
| | |
|
| | | WicketUtils.setAlternatingBackground(item, counter);
|
| | | counter++;
|