mirror of
https://github.com/discourse/discourse.git
synced 2025-02-12 06:45:14 +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="link-share-actions">
|
||||||
<div class="sources">
|
<div class="sources">
|
||||||
{{#each this.sources as |s|}}
|
{{#each this.sources as |source|}}
|
||||||
<ShareSource
|
<ShareSource @source={{source}} @action={{this.share}} />
|
||||||
@source={{s}}
|
|
||||||
@title={{this.topic.title}}
|
|
||||||
@action={{action "share"}}
|
|
||||||
/>
|
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
{{#if this.allowInvites}}
|
{{#if this.allowInvites}}
|
||||||
|
|
|
@ -11,11 +11,7 @@
|
||||||
|
|
||||||
<div class="sources">
|
<div class="sources">
|
||||||
{{#each this.sources as |source|}}
|
{{#each this.sources as |source|}}
|
||||||
<ShareSource
|
<ShareSource @source={{source}} @action={{this.share}} />
|
||||||
@source={{source}}
|
|
||||||
@title={{this.topic.title}}
|
|
||||||
@action={{action "share"}}
|
|
||||||
/>
|
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -1,4 +1,5 @@
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
|
import { action } from "@ember/object";
|
||||||
import { alias } from "@ember/object/computed";
|
import { alias } from "@ember/object/computed";
|
||||||
import { isEmpty } from "@ember/utils";
|
import { isEmpty } from "@ember/utils";
|
||||||
import Sharing from "discourse/lib/sharing";
|
import Sharing from "discourse/lib/sharing";
|
||||||
|
@ -58,12 +59,11 @@ export default Component.extend({
|
||||||
}, 200);
|
}, 200);
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
@action
|
||||||
share(source) {
|
share(source) {
|
||||||
Sharing.shareSource(source, {
|
Sharing.shareSource(source, {
|
||||||
url: this.shareUrl,
|
url: this.shareUrl,
|
||||||
title: this.get("topic.title"),
|
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