summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Zschocke <f.zschocke+git@gmail.com>2022-11-21 20:52:10 +0100
committerFlorian Zschocke <f.zschocke+git@gmail.com>2022-12-03 14:33:31 +0100
commitf4c4030cf6e192217a53c470674a14f811868b7a (patch)
treedde8aec4efa031a8c3a2f1c56267de3ceb0da5da
parente4c23697dae5a27ec992608f0778ed7ac47a41e1 (diff)
downloadgitblit-f4c4030cf6e192217a53c470674a14f811868b7a.tar.gz
gitblit-f4c4030cf6e192217a53c470674a14f811868b7a.zip
Replace SWF clippy with clipboard.js on ticket page
The ticket page also has some copy-to-clipboard buttons, which get updated to work with JS instead of SWF.
-rw-r--r--src/main/java/com/gitblit/wicket/pages/TicketPage.html20
-rw-r--r--src/main/java/com/gitblit/wicket/pages/TicketPage.java11
2 files changed, 12 insertions, 19 deletions
diff --git a/src/main/java/com/gitblit/wicket/pages/TicketPage.html b/src/main/java/com/gitblit/wicket/pages/TicketPage.html
index 46c0f7ee..fd64b776 100644
--- a/src/main/java/com/gitblit/wicket/pages/TicketPage.html
+++ b/src/main/java/com/gitblit/wicket/pages/TicketPage.html
@@ -586,20 +586,14 @@ pt push</pre>
<img wicket:id="copyIcon" wicket:message="title:gb.copyToClipboard"></img>
</span>
</wicket:fragment>
-
-<!-- flash-based button-press copy & paste -->
-<wicket:fragment wicket:id="clippyPanel">
- <object wicket:message="title:gb.copyToClipboard" style="vertical-align:middle;"
- wicket:id="clippy"
- width="14"
- height="14"
- bgcolor="#ffffff"
- quality="high"
- wmode="transparent"
- scale="noscale"
- allowScriptAccess="sameDomain"></object>
-</wicket:fragment>
+
+ <!-- JavaScript automatic copy to clipboard -->
+ <wicket:fragment wicket:id="clippyPanel">
+ <span class="tooltipped tooltipped-n">
+ <img class="ctcbtn" wicket:id="copyIcon" wicket:message="title:gb.copyToClipboard" />
+ </span>
+ </wicket:fragment>
</wicket:extend>
</body>
diff --git a/src/main/java/com/gitblit/wicket/pages/TicketPage.java b/src/main/java/com/gitblit/wicket/pages/TicketPage.java
index 1750b859..d6d188df 100644
--- a/src/main/java/com/gitblit/wicket/pages/TicketPage.java
+++ b/src/main/java/com/gitblit/wicket/pages/TicketPage.java
@@ -102,7 +102,6 @@ import com.gitblit.wicket.panels.CommentPanel;
import com.gitblit.wicket.panels.DiffStatPanel;
import com.gitblit.wicket.panels.IconAjaxLink;
import com.gitblit.wicket.panels.LinkPanel;
-import com.gitblit.wicket.panels.ShockWaveComponent;
import com.gitblit.wicket.panels.SimpleAjaxLink;
/**
@@ -1644,12 +1643,12 @@ public class TicketPage extends RepositoryPage {
protected Fragment createCopyFragment(String wicketId, String text) {
if (app().settings().getBoolean(Keys.web.allowFlashCopyToClipboard, true)) {
- // clippy: flash-based copy & paste
+ // javascript: browser JS API based copy to clipboard
Fragment copyFragment = new Fragment(wicketId, "clippyPanel", this);
- String baseUrl = WicketUtils.getGitblitURL(getRequest());
- ShockWaveComponent clippy = new ShockWaveComponent("clippy", baseUrl + "/clippy.swf");
- clippy.setValue("flashVars", "text=" + StringUtils.encodeURL(text));
- copyFragment.add(clippy);
+ ContextImage img = WicketUtils.newImage("copyIcon", "clippy.png");
+ // Add the ID of the target element that holds the text to copy to clipboard
+ img.add(new SimpleAttributeModifier("data-clipboard-text", text));
+ copyFragment.add(img);
return copyFragment;
} else {
// javascript: manual copy & paste with modal browser prompt dialog