summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/wicket/panels/LinkPanel.java
diff options
context:
space:
mode:
authorPaul Martin <paul@paulsputer.com>2016-03-21 17:41:19 +0000
committerPaul Martin <paul@paulsputer.com>2016-03-21 17:41:19 +0000
commit77c38a1865564a4ea4544bfb1f52bedf4326d481 (patch)
treeabf5ccbb6c8126d9c4050bc317a41ee11129a4aa /src/main/java/com/gitblit/wicket/panels/LinkPanel.java
parent252dc07d7f85cc344b5919bb7c6166ef84b2102e (diff)
downloadgitblit-77c38a1865564a4ea4544bfb1f52bedf4326d481.tar.gz
gitblit-77c38a1865564a4ea4544bfb1f52bedf4326d481.zip
Fix for #1018 and #1025 browser LFS links
+ View and Raw both download the actual file + Blame will show the metafile
Diffstat (limited to 'src/main/java/com/gitblit/wicket/panels/LinkPanel.java')
-rw-r--r--src/main/java/com/gitblit/wicket/panels/LinkPanel.java22
1 files changed, 22 insertions, 0 deletions
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<String>(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"));