Skip to content

Commit a3f93a1

Browse files
Merge pull request #1078 from nextcloud/backport/1076/stable22
[stable22] Allow to open links in new tab
2 parents 1b1f3d9 + 28a3453 commit a3f93a1

File tree

4 files changed

+29
-12
lines changed

4 files changed

+29
-12
lines changed

css/styles.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,12 @@
175175
.notification-actions {
176176
overflow: hidden;
177177

178+
.button {
179+
line-height: normal;
180+
vertical-align: baseline;
181+
padding: 8px 16px;
182+
}
183+
178184
.action-button.primary {
179185
color: var(--color-primary-text);
180186
}

js/notifications-main.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/notifications-main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Components/Action.vue

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<template>
2-
<button class="action-button pull-right"
2+
<a v-if="isWebLink"
3+
class="button action-button pull-right"
4+
:class="{ primary: primary }"
5+
:href="link">
6+
{{ label }}
7+
</a>
8+
<button v-else
9+
class="action-button pull-right"
310
:class="{ primary: primary }"
411
:data-type="type"
512
:data-href="link"
@@ -38,18 +45,22 @@ export default {
3845
},
3946
},
4047
48+
computed: {
49+
isWebLink() {
50+
return this.typeWithDefault === 'WEB'
51+
},
52+
53+
typeWithDefault() {
54+
return this.type || 'GET'
55+
},
56+
},
57+
4158
methods: {
4259
async onClickActionButton() {
43-
const type = this.type || 'GET'
44-
if (type === 'WEB') {
45-
window.location = this.link
46-
return
47-
}
48-
4960
try {
5061
// execute action
5162
await axios({
52-
method: type,
63+
method: this.typeWithDefault,
5364
url: this.link,
5465
})
5566
@@ -61,7 +72,7 @@ export default {
6172
notification: this.$parent,
6273
action: {
6374
url: this.link,
64-
type,
75+
type: this.typeWithDefault,
6576
},
6677
}))
6778
// do not do anything but log, the action went fine

0 commit comments

Comments
 (0)