Skip to content

Instantly share code, notes, and snippets.

@basz
Created October 8, 2017 15:09
Show Gist options
  • Select an option

  • Save basz/b03cbd35c6775b7087d78acb57bc6ce7 to your computer and use it in GitHub Desktop.

Select an option

Save basz/b03cbd35c6775b7087d78acb57bc6ce7 to your computer and use it in GitHub Desktop.
{{#bs-dropdown direction="up" as |dd|}}
{{#dd.button title=(t 'commands.copy')
size="sm" type="secondary"
disabled=(not (get model.addresses model.activeLabelId))}}
{{fa-icon "copy"}}
<span class="d-none d-lg-inline-block">{{t 'commands.copy'}}</span>&nbsp;
{{/dd.button}}
{{#dd.menu as |ddm|}}
<p class="muted">Copy from existing address</p>
{{#each model.labels as |label|}}
{{#if (and (not-eq model.activeLabelId label) (get model.addresses label))}}
{{#ddm.item}}
// a button with an action, works but the dropdown isn't closed
{{#bs-button onClick=(action 'copyAddressFromInto' label model.activeLabelId) size="sm" type="link" toggle=false}}
{{t (concat 'menu.address-' label)}}
{{/bs-button}}
{{/ddm.item}}
{{/if}}
{{/each}}
{{/dd.menu}}
{{/bs-dropdown}}
{{#bs-dropdown direction="up" as |dd|}}
{{#dd.button title=(t 'commands.copy')
size="sm" type="secondary"
disabled=(not (get model.addresses model.activeLabelId))}}
{{fa-icon "copy"}}
<span class="d-none d-lg-inline-block">{{t 'commands.copy'}}</span>&nbsp;
{{/dd.button}}
{{#dd.menu as |ddm|}}
<p class="muted">Copy from existing address</p>
{{#each model.labels as |label|}}
{{#if (and (not-eq model.activeLabelId label) (get model.addresses label))}}
{{#ddm.item}}
// a link-to does not make sense because it doesn't call an action. It does close te dropdown though
{{#ddm.link-to 'account.customer-profile.settings'}}
{{t (concat 'menu.address-' label)}}
{{/ddm.link-to}}
{{/ddm.item}}
{{/if}}
{{/each}}
{{/dd.menu}}
{{/bs-dropdown}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment