From 77c38a1865564a4ea4544bfb1f52bedf4326d481 Mon Sep 17 00:00:00 2001 From: Paul Martin Date: Mon, 21 Mar 2016 17:41:19 +0000 Subject: Fix for #1018 and #1025 browser LFS links + View and Raw both download the actual file + Blame will show the metafile --- .../java/com/gitblit/wicket/panels/LinkPanel.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/main/java/com/gitblit/wicket/panels/LinkPanel.java') diff --git a/src/main/java/com/gitblit/wicket/panels/LinkPanel.java b/src/main/java/com/gitblit/wicket/panels/LinkPanel.java index 06159ac3..aa09be09 100644 --- a/src/main/java/com/gitblit/wicket/panels/LinkPanel.java +++ b/src/main/java/com/gitblit/wicket/panels/LinkPanel.java @@ -15,6 +15,9 @@ */ package com.gitblit.wicket.panels; +import java.io.OutputStream; +import java.util.concurrent.Callable; + import org.apache.wicket.Component; import org.apache.wicket.PageParameters; import org.apache.wicket.behavior.SimpleAttributeModifier; @@ -26,8 +29,13 @@ import org.apache.wicket.markup.html.link.Link; import org.apache.wicket.markup.html.panel.Panel; import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; +import org.apache.wicket.request.target.resource.ResourceStreamRequestTarget; +import org.apache.wicket.util.resource.AbstractResourceStreamWriter; +import org.apache.wicket.util.resource.IResourceStream; +import com.gitblit.models.UserModel; import com.gitblit.utils.StringUtils; +import com.gitblit.wicket.GitBlitWebSession; import com.gitblit.wicket.WicketUtils; public class LinkPanel extends Panel { @@ -108,6 +116,20 @@ public class LinkPanel extends Panel { add(link); } + public LinkPanel(String wicketId, String linkCssClass, String label, Link link) { + super(wicketId); + + this.labelModel = new Model(label); + + if (linkCssClass != null) { + link.add(new SimpleAttributeModifier("class", linkCssClass)); + } + + link.add(new Label("icon").setVisible(false)); + link.add(new Label("label", labelModel)); + add(link); + } + public void setNoFollow() { Component c = get("link"); c.add(new SimpleAttributeModifier("rel", "nofollow")); -- cgit v1.2.3