mirror of
https://github.com/discourse/discourse.git
synced 2025-01-30 16:33:59 +08:00
DEV: Convert share-source to gjs (#25964)
This commit is contained in:
parent
f087234ff7
commit
03de0421af
|
@ -34,12 +34,8 @@
|
|||
|
||||
<div class="link-share-actions">
|
||||
<div class="sources">
|
||||
{{#each this.sources as |s|}}
|
||||
<ShareSource
|
||||
@source={{s}}
|
||||
@title={{this.topic.title}}
|
||||
@action={{action "share"}}
|
||||
/>
|
||||
{{#each this.sources as |source|}}
|
||||
<ShareSource @source={{source}} @action={{this.share}} />
|
||||
{{/each}}
|
||||
|
||||
{{#if this.allowInvites}}
|
||||
|
|
|
@ -11,11 +11,7 @@
|
|||
|
||||
<div class="sources">
|
||||
{{#each this.sources as |source|}}
|
||||
<ShareSource
|
||||
@source={{source}}
|
||||
@title={{this.topic.title}}
|
||||
@action={{action "share"}}
|
||||
/>
|
||||
<ShareSource @source={{source}} @action={{this.share}} />
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
|
@ -1,4 +1,5 @@
|
|||
import Component from "@ember/component";
|
||||
import { action } from "@ember/object";
|
||||
import { alias } from "@ember/object/computed";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import Sharing from "discourse/lib/sharing";
|
||||
|
@ -58,12 +59,11 @@ export default Component.extend({
|
|||
}, 200);
|
||||
},
|
||||
|
||||
actions: {
|
||||
share(source) {
|
||||
Sharing.shareSource(source, {
|
||||
url: this.shareUrl,
|
||||
title: this.get("topic.title"),
|
||||
});
|
||||
},
|
||||
@action
|
||||
share(source) {
|
||||
Sharing.shareSource(source, {
|
||||
url: this.shareUrl,
|
||||
title: this.topic.get("title"),
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
import { fn } from "@ember/helper";
|
||||
import DButton from "discourse/components/d-button";
|
||||
import or from "truth-helpers/helpers/or";
|
||||
|
||||
const ShareSource = <template>
|
||||
<DButton
|
||||
@action={{fn @action @source}}
|
||||
@translatedTitle={{@source.title}}
|
||||
@icon={{or @source.icon @source.htmlIcon}}
|
||||
class="btn-default share-{{@source.id}}"
|
||||
...attributes
|
||||
/>
|
||||
</template>;
|
||||
|
||||
export default ShareSource;
|
|
@ -1,6 +0,0 @@
|
|||
<DButton
|
||||
@action={{fn (action "share") this.source}}
|
||||
@translatedTitle={{this.source.title}}
|
||||
@icon={{or this.source.icon this.source.htmlIcon}}
|
||||
class={{concat "btn-default share-" this.source.id}}
|
||||
/>
|
|
@ -1,10 +0,0 @@
|
|||
import Component from "@ember/component";
|
||||
export default Component.extend({
|
||||
tagName: "",
|
||||
|
||||
actions: {
|
||||
share(source) {
|
||||
this.action(source);
|
||||
},
|
||||
},
|
||||
});
|
Loading…
Reference in New Issue
Block a user