From 0208ea0248782a994771cadf0af6a4125fdde723 Mon Sep 17 00:00:00 2001 From: Mario Lubenka Date: Tue, 19 Oct 2021 19:32:11 +0200 Subject: "Copy branch name" button in pull request (#17323) * Drop data-original from clipboard data-original attribute was removed. Instead, the original value from data-content is set after success/fail message was displayed. Signed-off-by: Mario Lubenka * "Copy branch name" button in pull request Signed-off-by: Mario Lubenka * Update templates/repo/issue/view_title.tmpl Co-authored-by: silverwind * Apply suggestions from code review Co-authored-by: zeripath Co-authored-by: wxiaoguang Co-authored-by: silverwind Co-authored-by: zeripath --- web_src/js/features/clipboard.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'web_src/js') diff --git a/web_src/js/features/clipboard.js b/web_src/js/features/clipboard.js index 2c7ad013bd..8d28b4e281 100644 --- a/web_src/js/features/clipboard.js +++ b/web_src/js/features/clipboard.js @@ -4,16 +4,18 @@ function onSuccess(btn) { if (!btn.dataset.content) return; $(btn).popup('destroy'); + const oldContent = btn.dataset.content; btn.dataset.content = btn.dataset.success; $(btn).popup('show'); - btn.dataset.content = btn.dataset.original; + btn.dataset.content = oldContent; } function onError(btn) { if (!btn.dataset.content) return; + const oldContent = btn.dataset.content; $(btn).popup('destroy'); btn.dataset.content = btn.dataset.error; $(btn).popup('show'); - btn.dataset.content = btn.dataset.original; + btn.dataset.content = oldContent; } /** -- cgit v1.2.3