Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make md-collapsible actionable #128

Merged
merged 2 commits into from
Jun 4, 2015
Merged

Conversation

foxnewsnetwork
Copy link
Contributor

As per this issue:
#112

now, md-collapsible can be made to split out an action when a user interacts with it:

{{#md-card-collapsible id="action-selection"}}
  {{#md-collapsible icon="mdi-image-filter-drama" title="Cloud" action="clicked" model="cloud"}}
    O misty eye of the mountain below
  {{/md-collapsible}}
  {{#md-collapsible icon="mdi-maps-place" title="Marker" action="clicked" model="marker"}}
    keep careful watch of my brothers' souls
  {{/md-collapsible}}
  {{#md-collapsible icon="mdi-social-whatshot" title="Fire" action="clicked" model="fire"}}
    and should the sky be filled with fire and smoke, keep watching over [indecipherable]
  {{/md-collapsible}}
{{/md-card-collapsible}}

If provided with action, it is now possible to handle this in your controller (or wherever):

export default Ember.Controller.extend({
  actions: {
    clicked(tabModel) {
      if(tabModel === this.get("activeSlide")) {
        this.set("activeSlide", null);
      } else {
        this.set("activeSlide", tabModel);
      }
    }
  }
});

If you passed in a model to the md-collapsible, it will be given to you as your first argument in your action handler. This way, you have some idea what model your user is trying to interact with.

@mike-north
Copy link
Owner

This looks great :) Thanks for your contribution

mike-north added a commit that referenced this pull request Jun 4, 2015
make md-collapsible actionable
@mike-north mike-north merged commit f6d2c35 into mike-north:master Jun 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants