James Moger
2015-11-22 ed552ba47c02779c270ffd62841d6d1048dade70
commit | author | age
f13c4c 1 /*
JM 2  * Copyright 2011 gitblit.com.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
c1c3c6 16 package com.gitblit.wicket.panels;
JM 17
18 import org.apache.wicket.markup.html.basic.Label;
19 import org.eclipse.jgit.revwalk.RevCommit;
20
baa7fd 21 import com.gitblit.Constants;
JM 22 import com.gitblit.utils.StringUtils;
c1c3c6 23 import com.gitblit.wicket.WicketUtils;
JM 24 import com.gitblit.wicket.pages.CommitPage;
25
26 public class CommitHeaderPanel extends BasePanel {
27
28     private static final long serialVersionUID = 1L;
29
4ab184 30     public CommitHeaderPanel(String id, String title) {
JM 31         super(id);
32         add(new Label("shortmessage", title));
33         add(new Label("commitid"));
34         add(new Label("author"));
35         add(new Label("date"));
f56547 36         add(new Label("authorAvatar"));
4ab184 37     }
008322 38
c1c3c6 39     public CommitHeaderPanel(String id, String repositoryName, RevCommit c) {
JM 40         super(id);
baa7fd 41         add(new LinkPanel("shortmessage", "title", StringUtils.trimString(c.getShortMessage(),
JM 42                 Constants.LEN_SHORTLOG), CommitPage.class,
2a7306 43                 WicketUtils.newObjectParameter(repositoryName, c.getName())));
62cec2 44         add(new Label("commitid", c.getName()));
bc9d4a 45         add(new Label("author", c.getAuthorIdent().getName()));
9adf62 46         add(WicketUtils.createDateLabel("date", c.getAuthorIdent().getWhen(), getTimeZone(), getTimeUtils()));
b57b9e 47         add(new AvatarImage("authorAvatar", c.getAuthorIdent()));
c1c3c6 48     }
JM 49 }