Copy to clipboard feature

stable
Daniel García 2018-08-14 13:07:35 +02:00 committed by Alex Hermida
parent 0d90eaed55
commit f2a43dc56a
6 changed files with 15 additions and 13 deletions

View File

@ -450,15 +450,20 @@ class BitbucketController extends mixOf(taiga.Controller, taiga.PageMixin, taiga
module.controller("BitbucketController", BitbucketController)
SelectInputText = ->
SelectInputText = ($translate, $confirm)->
link = ($scope, $el, $attrs) ->
$el.on "click", ".select-input-content", () ->
$el.find("input").select()
$el.find(".help-copy").addClass("visible")
source = $el.find("input")
if !source.val()
return
source.select()
document.execCommand 'copy'
$confirm.notify("success", $translate.instant("COMMON.COPIED_TO_CLIPBOARD"))
return {link:link}
module.directive("tgSelectInputText", SelectInputText)
module.directive("tgSelectInputText", ["$translate", "$tgConfirm", SelectInputText])
#############################################################################

View File

@ -13,7 +13,8 @@
"UNLINK": "Unlink",
"CREATE": "Create",
"ADD": "Add",
"COPY_TO_CLIPBOARD": "Copy to clipboard: Ctrl+C",
"COPY_TO_CLIPBOARD": "Copy to clipboard",
"COPIED_TO_CLIPBOARD": "Text has been copied to clipboard",
"EDIT": "Edit",
"DRAG": "Drag",
"TAG_LINE": "Your agile, free, and open source project management tool",

View File

@ -39,9 +39,8 @@ div.wrapper.roles(
ng-model="bitbucket.webhooks_url"
placeholder="{{'ADMIN.THIRD_PARTIES.PAYLOAD_URL' | translate}}"
)
.option-wrapper.select-input-content
.option-wrapper.select-input-content(title="{{'COMMON.COPY_TO_CLIPBOARD' | translate}}")
tg-svg(svg-icon="icon-clipboard")
.help-copy(translate="COMMON.COPY_TO_CLIPBOARD")
fieldset
label(for="valid-origin-ips", translate="ADMIN.THIRD_PARTIES.VALID_IPS")

View File

@ -38,9 +38,8 @@ div.wrapper.roles(
ng-model="github.webhooks_url"
placeholder="{{'ADMIN.THIRD_PARTIES.PAYLOAD_URL' | translate}}"
)
.option-wrapper.select-input-content
.option-wrapper.select-input-content(title="{{'COMMON.COPY_TO_CLIPBOARD' | translate}}")
tg-svg(svg-icon="icon-clipboard")
.help-copy(translate="COMMON.COPY_TO_CLIPBOARD")
button.button-green.submit-button(
type="submit"

View File

@ -38,9 +38,8 @@ div.wrapper.roles(
ng-model="gitlab.webhooks_url"
placeholder="{{'ADMIN.THIRD_PARTIES.PAYLOAD_URL' | translate}}"
)
.option-wrapper.select-input-content
.option-wrapper.select-input-content(title="{{'COMMON.COPY_TO_CLIPBOARD' | translate}}")
tg-svg(svg-icon="icon-clipboard")
.help-copy(translate="COMMON.COPY_TO_CLIPBOARD")
fieldset
label(for="valid-origin-ips", translate="ADMIN.THIRD_PARTIES.VALID_IPS")

View File

@ -38,9 +38,8 @@ div.wrapper.roles(
ng-model="gogs.webhooks_url"
placeholder="{{'ADMIN.THIRD_PARTIES.PAYLOAD_URL' | translate}}"
)
.option-wrapper.select-input-content
.option-wrapper.select-input-content(title="{{'COMMON.COPY_TO_CLIPBOARD' | translate}}")
tg-svg(svg-icon="icon-clipboard")
.help-copy(translate="COMMON.COPY_TO_CLIPBOARD")
button.button-green.submit-button(
type="submit"