| | |
| | | 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.eclipse.jgit.lib.Repository;
|
| | |
|
| | | import com.gitblit.Constants;
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.models.Activity;
|
| | | import com.gitblit.models.RepositoryCommit;
|
| | |
| | |
|
| | | /**
|
| | | * Renders activity in day-blocks in reverse-chronological order.
|
| | | * |
| | | *
|
| | | * @author James Moger
|
| | | * |
| | | *
|
| | | */
|
| | | public class ActivityPanel extends BasePanel {
|
| | |
|
| | |
| | | super(wicketId);
|
| | |
|
| | | Collections.sort(recentActivity);
|
| | | |
| | | final int shortHashLen = GitBlit.getInteger(Keys.web.shortCommitIdLength, 6);
|
| | |
|
| | | final int shortHashLen = app().settings().getInteger(Keys.web.shortCommitIdLength, 6);
|
| | | DataView<Activity> activityView = new DataView<Activity>("activity",
|
| | | new ListDataProvider<Activity>(recentActivity)) {
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | @Override
|
| | | public void populateItem(final Item<Activity> activityItem) {
|
| | | final Activity entry = activityItem.getModelObject();
|
| | | activityItem.add(WicketUtils.createDatestampLabel("title", entry.startDate, getTimeZone(), getTimeUtils()));
|
| | |
| | | new ListDataProvider<RepositoryCommit>(entry.getCommits())) {
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | @Override
|
| | | public void populateItem(final Item<RepositoryCommit> commitItem) {
|
| | | final RepositoryCommit commit = commitItem.getModelObject();
|
| | |
|
| | |
| | | .getWhen(), getTimeZone(), getTimeUtils()));
|
| | |
|
| | | // avatar
|
| | | commitItem.add(new GravatarImage("avatar", commit.getAuthorIdent(), 40));
|
| | | commitItem.add(new AvatarImage("avatar", commit.getAuthorIdent(), 40));
|
| | |
|
| | | // merge icon
|
| | | if (commit.getParentCount() > 1) {
|
| | |
| | | String author = commit.getAuthorIdent().getName();
|
| | | LinkPanel authorLink = new LinkPanel("author", "list", author,
|
| | | GitSearchPage.class, WicketUtils.newSearchParameter(commit.repository,
|
| | | commit.getName(), author, Constants.SearchType.AUTHOR), true);
|
| | | null, author, Constants.SearchType.AUTHOR), true);
|
| | | setPersonSearchTooltip(authorLink, author, Constants.SearchType.AUTHOR);
|
| | | commitItem.add(authorLink);
|
| | |
|
| | |
| | | commitItem.add(repositoryLink);
|
| | |
|
| | | // repository branch
|
| | | LinkPanel branchLink = new LinkPanel("branch", "list", commit.branch,
|
| | | LinkPanel branchLink = new LinkPanel("branch", "list", Repository.shortenRefName(commit.branch),
|
| | | LogPage.class, WicketUtils.newObjectParameter(commit.repository,
|
| | | commit.branch), true);
|
| | | WicketUtils.setCssStyle(branchLink, "color: #008000;");
|
| | |
| | | WicketUtils.newObjectParameter(commit.repository, commit.getName()))
|
| | | .setEnabled(commit.getParentCount() > 0));
|
| | | commitItem.add(new BookmarkablePageLink<Void>("tree", TreePage.class,
|
| | | WicketUtils.newObjectParameter(commit.repository, commit.getName()))); |
| | | WicketUtils.newObjectParameter(commit.repository, commit.getName())));
|
| | | }
|
| | | };
|
| | | activityItem.add(commits);
|