From: Paul Martin Date: Wed, 6 Apr 2016 07:27:20 +0000 (+0100) Subject: Fix for #1042 - Filestore items now shown as icons X-Git-Tag: v1.8.0~13^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F1044%2Fhead;p=gitblit.git Fix for #1042 - Filestore items now shown as icons --- diff --git a/src/main/java/com/gitblit/wicket/WicketUtils.java b/src/main/java/com/gitblit/wicket/WicketUtils.java index 0d48e2be..d9ff34a2 100644 --- a/src/main/java/com/gitblit/wicket/WicketUtils.java +++ b/src/main/java/com/gitblit/wicket/WicketUtils.java @@ -73,8 +73,8 @@ public class WicketUtils { container.add(new SimpleAttributeModifier("style", background)); } - public static void setHtmlTooltip(Component container, String value) { - container.add(new SimpleAttributeModifier("title", value)); + public static Component setHtmlTooltip(Component container, String value) { + return container.add(new SimpleAttributeModifier("title", value)); } public static void setInputPlaceholder(Component container, String value) { diff --git a/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.html b/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.html index 254d7d0c..20bf19f2 100644 --- a/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.html +++ b/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.html @@ -45,7 +45,7 @@ [change type] [commit path] - + | | | | diff --git a/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java b/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java index eaff2067..f127517d 100644 --- a/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java +++ b/src/main/java/com/gitblit/wicket/pages/CommitDiffPage.java @@ -148,6 +148,8 @@ public class CommitDiffPage extends RepositoryPage { setChangeTypeTooltip(changeType, entry.changeType); item.add(changeType); item.add(new DiffStatPanel("diffStat", entry.insertions, entry.deletions, true)); + item.add(WicketUtils.setHtmlTooltip(new Label("filestore", ""), getString("gb.filestore")) + .setVisible(entry.isFilestoreItem())); boolean hasSubmodule = false; String submodulePath = null; @@ -200,8 +202,6 @@ public class CommitDiffPage extends RepositoryPage { // quick links if (entry.isSubmodule()) { - item.add(new Label("filestore", getString("gb.filestore")).setVisible(false)); - item.add(new ExternalLink("raw", "").setEnabled(false)); // submodule item.add(new ExternalLink("patch", "").setEnabled(false)); @@ -219,8 +219,6 @@ public class CommitDiffPage extends RepositoryPage { && !entry.changeType.equals(ChangeType.DELETE))); if (entry.isFilestoreItem()) { - item.add(new Label("filestore", getString("gb.filestore")).setVisible(true)); - item.add(new Link("view", null) { private static final long serialVersionUID = 1L; @@ -269,9 +267,6 @@ public class CommitDiffPage extends RepositoryPage { getRequestCycle().setRequestTarget(new ResourceStreamRequestTarget(resourceStream, entry.path)); }}); } else { - - item.add(new Label("filestore", getString("gb.filestore")).setVisible(false)); - item.add(new BookmarkablePageLink("view", BlobPage.class, WicketUtils .newPathParameter(repositoryName, entry.commitId, entry.path)) .setEnabled(!entry.changeType.equals(ChangeType.DELETE))); diff --git a/src/main/java/com/gitblit/wicket/pages/CommitPage.html b/src/main/java/com/gitblit/wicket/pages/CommitPage.html index 23e94380..2cfbbea4 100644 --- a/src/main/java/com/gitblit/wicket/pages/CommitPage.html +++ b/src/main/java/com/gitblit/wicket/pages/CommitPage.html @@ -79,7 +79,7 @@ [change type] [commit path] - + | | | | diff --git a/src/main/java/com/gitblit/wicket/pages/CommitPage.java b/src/main/java/com/gitblit/wicket/pages/CommitPage.java index 417afe30..3998204d 100644 --- a/src/main/java/com/gitblit/wicket/pages/CommitPage.java +++ b/src/main/java/com/gitblit/wicket/pages/CommitPage.java @@ -16,43 +16,28 @@ package com.gitblit.wicket.pages; import java.io.OutputStream; -import java.sql.Blob; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.concurrent.Callable; import org.apache.wicket.PageParameters; -import org.apache.wicket.behavior.SimpleAttributeModifier; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.link.BookmarkablePageLink; -import org.apache.wicket.markup.html.link.DownloadLink; import org.apache.wicket.markup.html.link.ExternalLink; import org.apache.wicket.markup.html.link.Link; -import org.apache.wicket.markup.html.link.ResourceLink; 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.AbstractReadOnlyModel; -import org.apache.wicket.model.IModel; import org.apache.wicket.model.StringResourceModel; -import org.apache.wicket.request.target.basic.RedirectRequestTarget; import org.apache.wicket.request.target.resource.ResourceStreamRequestTarget; -import org.apache.wicket.util.resource.AbstractResourceStream; import org.apache.wicket.util.resource.AbstractResourceStreamWriter; import org.apache.wicket.util.resource.IResourceStream; -import org.bouncycastle.jcajce.provider.symmetric.Threefish; import org.eclipse.jgit.diff.DiffEntry.ChangeType; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.revwalk.RevCommit; import com.gitblit.Constants; -import com.gitblit.GitBlit; -import com.gitblit.manager.FilestoreManager; -import com.gitblit.manager.GitblitManager; -import com.gitblit.models.FilestoreModel; import com.gitblit.models.GitNote; -import com.gitblit.models.RepositoryModel; import com.gitblit.models.PathModel.PathChangeModel; import com.gitblit.models.SubmoduleModel; import com.gitblit.models.UserModel; @@ -185,13 +170,14 @@ public class CommitPage extends RepositoryPage { @Override public void populateItem(final Item item) { final PathChangeModel entry = item.getModelObject(); - final String filestoreItemUrl = entry.isFilestoreItem() ? JGitUtils.getLfsRepositoryUrl(getContextUrl(), repositoryName, entry.getFilestoreOid()) : null; 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)); + item.add(WicketUtils.setHtmlTooltip(new Label("filestore", ""), getString("gb.filestore")) + .setVisible(entry.isFilestoreItem())); boolean hasSubmodule = false; String submodulePath = null; @@ -256,8 +242,6 @@ public class CommitPage extends RepositoryPage { if (entry.isSubmodule()) { item.add(new ExternalLink("raw", "").setEnabled(false)); - item.add(new Label("filestore", getString("gb.filestore")).setVisible(false)); - // submodule item.add(new BookmarkablePageLink("diff", BlobDiffPage.class, WicketUtils .newPathParameter(repositoryName, entry.commitId, entry.path)) @@ -276,10 +260,6 @@ public class CommitPage extends RepositoryPage { && !entry.changeType.equals(ChangeType.DELETE))); if (entry.isFilestoreItem()) { - item.add(new Label("filestore", getString("gb.filestore")).setVisible(true)); - - - item.add(new Link("view", null) { private static final long serialVersionUID = 1L; @@ -329,8 +309,6 @@ public class CommitPage extends RepositoryPage { }}); } else { - item.add(new Label("filestore", getString("gb.filestore")).setVisible(false)); - item.add(new BookmarkablePageLink("view", BlobPage.class, WicketUtils .newPathParameter(repositoryName, entry.commitId, entry.path)) .setEnabled(!entry.changeType.equals(ChangeType.DELETE))); diff --git a/src/main/java/com/gitblit/wicket/pages/TreePage.html b/src/main/java/com/gitblit/wicket/pages/TreePage.html index c07f9c50..322c9011 100644 --- a/src/main/java/com/gitblit/wicket/pages/TreePage.html +++ b/src/main/java/com/gitblit/wicket/pages/TreePage.html @@ -23,7 +23,7 @@ - + [path size] [path permissions] [path links] diff --git a/src/main/java/com/gitblit/wicket/pages/TreePage.java b/src/main/java/com/gitblit/wicket/pages/TreePage.java index 3961e044..eecad26e 100644 --- a/src/main/java/com/gitblit/wicket/pages/TreePage.java +++ b/src/main/java/com/gitblit/wicket/pages/TreePage.java @@ -98,15 +98,15 @@ public class TreePage extends RepositoryPage { final PathModel entry = item.getModelObject(); item.add(new Label("pathPermissions", JGitUtils.getPermissionsFromMode(entry.mode))); - + item.add(WicketUtils.setHtmlTooltip(new Label("filestore", ""), getString("gb.filestore")) + .setVisible(entry.isFilestoreItem())); + if (entry.isParentPath) { // parent .. path item.add(WicketUtils.newBlankImage("pathIcon")); item.add(new Label("pathSize", "")); item.add(new LinkPanel("pathName", null, entry.name, TreePage.class, - WicketUtils - .newPathParameter(repositoryName, id, entry.path))); - item.add(new Label("filestore", getString("gb.filestore")).setVisible(false)); + WicketUtils.newPathParameter(repositoryName, id, entry.path))); item.add(new Label("pathLinks", "")); } else { if (entry.isTree()) { @@ -117,8 +117,6 @@ public class TreePage extends RepositoryPage { WicketUtils.newPathParameter(repositoryName, id, entry.path))); - item.add(new Label("filestore", getString("gb.filestore")).setVisible(false)); - // links Fragment links = new Fragment("pathLinks", "treeLinks", this); links.add(new BookmarkablePageLink("tree", TreePage.class, @@ -146,8 +144,6 @@ public class TreePage extends RepositoryPage { getShortObjectId(submoduleId), TreePage.class, WicketUtils.newPathParameter(submodulePath, submoduleId, "")).setEnabled(hasSubmodule)); - item.add(new Label("filestore", getString("gb.filestore")).setVisible(false)); - Fragment links = new Fragment("pathLinks", "submoduleLinks", this); links.add(new BookmarkablePageLink("view", SummaryPage.class, WicketUtils.newRepositoryParameter(submodulePath)).setEnabled(hasSubmodule)); @@ -175,8 +171,6 @@ public class TreePage extends RepositoryPage { Fragment links = new Fragment("pathLinks", "blobLinks", this); if (entry.isFilestoreItem()) { - item.add(new Label("filestore", getString("gb.filestore")).setVisible(true)); - item.add(new LinkPanel("pathName", "list", displayPath, new Link("link", null) { private static final long serialVersionUID = 1L; @@ -250,8 +244,6 @@ public class TreePage extends RepositoryPage { }}); } else { - item.add(new Label("filestore", getString("gb.filestore")).setVisible(false)); - item.add(new LinkPanel("pathName", "list", displayPath, BlobPage.class, WicketUtils.newPathParameter(repositoryName, id, path))); diff --git a/src/main/resources/gitblit.css b/src/main/resources/gitblit.css index 5b82e874..01991909 100644 --- a/src/main/resources/gitblit.css +++ b/src/main/resources/gitblit.css @@ -2356,3 +2356,7 @@ div.markdown table.text th, div.markdown table.text td { .file-negative { color:#D51900; } + +.filestore-item { + color:#815b3a; +} \ No newline at end of file