Last active
July 17, 2019 01:56
-
-
Save Bestra/ca521cba74f883d429b8dfb8dee42bfa to your computer and use it in GitHub Desktop.
Generic Accordion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// components/accordion-item.js | |
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
item: null, | |
activeItem: null, | |
isExpanded: Ember.computed('activeItem', 'item', function() { | |
return this.get('activeItem') === this.get('item'); | |
}) | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// components/block-accordion.js | |
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
items: null, | |
activeItem: null, | |
actions: { | |
toggleActiveItem(item) { | |
if (this.get('activeItem') !== item) { | |
this.set('activeItem', item); | |
} else { | |
this.set('activeItem', null); | |
} | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// components/contextual-accordion.js | |
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
items: null, | |
activeItem: null, | |
actions: { | |
toggleActiveItem(item) { | |
if (this.get('activeItem') !== item) { | |
this.set('activeItem', item); | |
} else { | |
this.set('activeItem', null); | |
} | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
items: [ | |
{title: "Item 1", details: "Some details"}, | |
{title: "Item 2", details: "Some more details"}, | |
{title: "Item 3", details: "Yet other details"}, | |
] | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
blogPosts: [ | |
{ | |
title: "The whys and hows of services", | |
author: "Chris", | |
text: "Services, their whys, their hows." | |
}, | |
{ | |
title: "12 things about the router. Number 6 will shock you", | |
text: "Routing and routes and such.", | |
author: "Steve" | |
}, | |
{ | |
title: "I used handlebars. You won't guess what happens next", | |
text: "Templates and helpers and mustaches oh my.", | |
author: "Larry" | |
} | |
] | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= form_for @person do |f| %> | |
<%= f.text_field :first_name %> | |
<%= f.text_field :address %> | |
<%= f.submit "Create" %> | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import config from './config/environment'; | |
const Router = Ember.Router.extend({ | |
location: 'none', | |
rootURL: config.rootURL | |
}); | |
Router.map(function() { | |
this.route('blockAccordionDemo'); | |
this.route('contextualAccordionDemo'); | |
}); | |
export default Router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
margin: 12px 16px; | |
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
font-size: 12pt; | |
} | |
.header { | |
background: #eee; | |
padding: 10px; | |
} | |
.details { | |
padding: 10px 10px 20px 10px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.10.5", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.8.0", | |
"ember-data": "2.8.0", | |
"ember-template-compiler": "2.8.0", | |
"ember-testing": "2.8.0" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment