From 60071c4d5f44f9bd035d54ad1e0ae013cf49be6d Mon Sep 17 00:00:00 2001
From: mrbytes <eguervos@msn.com>
Date: Sat, 12 Oct 2013 04:37:45 -0400
Subject: [PATCH] Translation esES updated - Fixes syntax - Better translation
---
src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java | 53 +++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 45 insertions(+), 8 deletions(-)
diff --git a/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java b/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java
index 4c802d7..7ad6615 100644
--- a/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java
+++ b/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java
@@ -16,6 +16,7 @@
package com.gitblit.wicket.pages;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import org.apache.wicket.PageParameters;
@@ -29,10 +30,13 @@
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
+import com.gitblit.Constants;
import com.gitblit.GitBlit;
+import com.gitblit.models.GitNote;
import com.gitblit.models.PathModel.PathChangeModel;
import com.gitblit.models.SubmoduleModel;
import com.gitblit.utils.DiffUtils;
+import com.gitblit.utils.DiffUtils.DiffOutput;
import com.gitblit.utils.DiffUtils.DiffOutputType;
import com.gitblit.utils.JGitUtils;
import com.gitblit.wicket.CacheControl;
@@ -40,7 +44,10 @@
import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.panels.CommitHeaderPanel;
import com.gitblit.wicket.panels.CommitLegendPanel;
+import com.gitblit.wicket.panels.DiffStatPanel;
+import com.gitblit.wicket.panels.GravatarImage;
import com.gitblit.wicket.panels.LinkPanel;
+import com.gitblit.wicket.panels.RefsPanel;
@CacheControl(LastModified.BOOT)
public class CommitDiffPage extends RepositoryPage {
@@ -52,7 +59,7 @@
RevCommit commit = getCommit();
- String diff = DiffUtils.getCommitDiff(r, commit, DiffOutputType.HTML);
+ final DiffOutput diff = DiffUtils.getCommitDiff(r, commit, DiffOutputType.HTML);
List<String> parents = new ArrayList<String>();
if (commit.getParentCount() > 0) {
@@ -75,23 +82,53 @@
add(new CommitHeaderPanel("commitHeader", repositoryName, commit));
+ // add commit diffstat
+ int insertions = 0;
+ int deletions = 0;
+ for (PathChangeModel pcm : diff.stat.paths) {
+ insertions += pcm.insertions;
+ deletions += pcm.deletions;
+ }
+ add(new DiffStatPanel("diffStat", insertions, deletions));
+
addFullText("fullMessage", commit.getFullMessage());
- // changed paths list
- List<PathChangeModel> paths = JGitUtils.getFilesInCommit(r, commit);
+ // git notes
+ List<GitNote> notes = JGitUtils.getNotesOnCommit(r, commit);
+ ListDataProvider<GitNote> notesDp = new ListDataProvider<GitNote>(notes);
+ DataView<GitNote> notesView = new DataView<GitNote>("notes", notesDp) {
+ private static final long serialVersionUID = 1L;
- add(new CommitLegendPanel("commitLegend", paths));
- ListDataProvider<PathChangeModel> pathsDp = new ListDataProvider<PathChangeModel>(paths);
+ @Override
+ 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(),
+ Constants.SearchType.AUTHOR));
+ item.add(new GravatarImage("noteAuthorAvatar", entry.notesRef.getAuthorIdent()));
+ item.add(WicketUtils.createTimestampLabel("authorDate", entry.notesRef
+ .getAuthorIdent().getWhen(), getTimeZone(), getTimeUtils()));
+ item.add(new Label("noteContent", GitBlit.self().processPlainCommitMessage(repositoryName,
+ entry.content)).setEscapeModelStrings(false));
+ }
+ };
+ add(notesView.setVisible(notes.size() > 0));
+
+ // changed paths list
+ add(new CommitLegendPanel("commitLegend", diff.stat.paths));
+ ListDataProvider<PathChangeModel> pathsDp = new ListDataProvider<PathChangeModel>(diff.stat.paths);
DataView<PathChangeModel> pathsView = new DataView<PathChangeModel>("changedPath", pathsDp) {
private static final long serialVersionUID = 1L;
int counter;
+ @Override
public void populateItem(final Item<PathChangeModel> item) {
final PathChangeModel entry = item.getModelObject();
Label changeType = new Label("changeType", "");
WicketUtils.setChangeTypeCssClass(changeType, entry.changeType);
setChangeTypeTooltip(changeType, entry.changeType);
item.add(changeType);
+ item.add(new DiffStatPanel("diffStat", entry.insertions, entry.deletions, true));
boolean hasSubmodule = false;
String submodulePath = null;
@@ -141,20 +178,20 @@
.newPathParameter(repositoryName, entry.commitId, entry.path))
.setEnabled(!entry.changeType.equals(ChangeType.ADD)));
}
-
+
WicketUtils.setAlternatingBackground(item, counter);
counter++;
}
};
add(pathsView);
- add(new Label("diffText", diff).setEscapeModelStrings(false));
+ add(new Label("diffText", diff.content).setEscapeModelStrings(false));
}
@Override
protected String getPageName() {
return getString("gb.commitdiff");
}
-
+
@Override
protected Class<? extends BasePage> getRepoNavPageClass() {
return LogPage.class;
--
Gitblit v1.9.1