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

Add binding for treeview's expanded state. Fix issue with resetClassNames #215

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions mixins/view_support.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Flame.ViewSupport = {
// Remove classNames up to Flame.View to make it easier to define custom
// styles for buttons, checkboxes etc...
// We only want to do this in the init of class that sets the flag
if (this.get('resetClassNames') && Object.getPrototypeOf) {
if (this.get('resetClassNames')) {
var superClassNames = this._collectSuperClassNames();
var classNames = this.get('classNames').removeObjects(superClassNames);
this.set('classNames', classNames);
Expand Down Expand Up @@ -48,7 +48,10 @@ Flame.ViewSupport = {
*/
_collectSuperClassNames: function() {
var superClassNames = [];
var superClass = Object.getPrototypeOf(Object.getPrototypeOf(this));
var superClass = Object.getPrototypeOf(this);
// Find first superclass that doesn't have the resetClassNames property
while (superClass && superClass.resetClassNames && superClass.constructor !== Flame.View) superClass = Object.getPrototypeOf(superClass);
// Collect the classNames from super classes
while (superClass && superClass.constructor !== Flame.View) {
superClassNames.pushObjects(superClass.classNames || []);
superClass = Object.getPrototypeOf(superClass);
Expand Down
1 change: 1 addition & 0 deletions views/lazy_tree_item_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Flame.LazyTreeItemView = Flame.LazyListItemView.extend({
classNames: ['flame-tree-item-view'],
classNameBindings: ['isExpanded'],
itemContent: '{{view.content}}',
isExpanded: false,

Expand Down