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) module.controller("BitbucketController", BitbucketController)
SelectInputText = -> SelectInputText = ($translate, $confirm)->
link = ($scope, $el, $attrs) -> link = ($scope, $el, $attrs) ->
$el.on "click", ".select-input-content", () -> $el.on "click", ".select-input-content", () ->
$el.find("input").select() source = $el.find("input")
$el.find(".help-copy").addClass("visible") if !source.val()
return
source.select()
document.execCommand 'copy'
$confirm.notify("success", $translate.instant("COMMON.COPIED_TO_CLIPBOARD"))
return {link:link} return {link:link}
module.directive("tgSelectInputText", SelectInputText) module.directive("tgSelectInputText", ["$translate", "$tgConfirm", SelectInputText])
############################################################################# #############################################################################

View File

@ -13,7 +13,8 @@
"UNLINK": "Unlink", "UNLINK": "Unlink",
"CREATE": "Create", "CREATE": "Create",
"ADD": "Add", "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", "EDIT": "Edit",
"DRAG": "Drag", "DRAG": "Drag",
"TAG_LINE": "Your agile, free, and open source project management tool", "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" ng-model="bitbucket.webhooks_url"
placeholder="{{'ADMIN.THIRD_PARTIES.PAYLOAD_URL' | translate}}" 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") tg-svg(svg-icon="icon-clipboard")
.help-copy(translate="COMMON.COPY_TO_CLIPBOARD")
fieldset fieldset
label(for="valid-origin-ips", translate="ADMIN.THIRD_PARTIES.VALID_IPS") 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" ng-model="github.webhooks_url"
placeholder="{{'ADMIN.THIRD_PARTIES.PAYLOAD_URL' | translate}}" 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") tg-svg(svg-icon="icon-clipboard")
.help-copy(translate="COMMON.COPY_TO_CLIPBOARD")
button.button-green.submit-button( button.button-green.submit-button(
type="submit" type="submit"

View File

@ -38,9 +38,8 @@ div.wrapper.roles(
ng-model="gitlab.webhooks_url" ng-model="gitlab.webhooks_url"
placeholder="{{'ADMIN.THIRD_PARTIES.PAYLOAD_URL' | translate}}" 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") tg-svg(svg-icon="icon-clipboard")
.help-copy(translate="COMMON.COPY_TO_CLIPBOARD")
fieldset fieldset
label(for="valid-origin-ips", translate="ADMIN.THIRD_PARTIES.VALID_IPS") 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" ng-model="gogs.webhooks_url"
placeholder="{{'ADMIN.THIRD_PARTIES.PAYLOAD_URL' | translate}}" 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") tg-svg(svg-icon="icon-clipboard")
.help-copy(translate="COMMON.COPY_TO_CLIPBOARD")
button.button-green.submit-button( button.button-green.submit-button(
type="submit" type="submit"