Skip to content

Commit

Permalink
Version 0.2.0 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
asaf committed Aug 3, 2014
1 parent 151653e commit 6e8c607
Show file tree
Hide file tree
Showing 20 changed files with 2,834 additions and 594 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ember-components",
"version": "0.1.0",
"version": "0.2.0",
"description": "A suite of components for Ember.js",
"homepage": "http://ember-addons.github.io/ember-components",
"authors": [
Expand Down
6 changes: 2 additions & 4 deletions dist/amd/accordion/accordion-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,12 @@ define(
hide: function() {
var $accordionBody;
$accordionBody = this.$('.panel-collapse');
$accordionBody.removeClass('in');
return $accordionBody.height($accordionBody.height())[0].offsetHeight;
return $accordionBody.removeClass('in');
},
show: function() {
var $accordionBody;
$accordionBody = this.$('.panel-collapse');
$accordionBody.addClass('in');
return $accordionBody.height($accordionBody[0]['scrollHeight']);
return $accordionBody.addClass('in');
}
});

Expand Down
44 changes: 27 additions & 17 deletions dist/amd/list/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ define(

List = Component.extend(WithConfigMixin, {
tagName: 'ul',
attributeBindings: ['style'],
classNameBindings: ['styleClasses'],
styleClasses: (function() {
var _ref;
Expand All @@ -36,6 +37,11 @@ define(
*/
selected: void 0,

/**
* True if this list supports selection
*/
selection: true,

/**
* List can be bound to models, models can be a property or an object that the list is bound to.
* When model changes, the list will give an opportunity to every item within the list to react upon the model change,
Expand Down Expand Up @@ -97,24 +103,28 @@ define(
*/
select: function(item) {
var _ref;
if (!item || this.get('selected') === item) {
return;
}
Em.debug("Selecting tab: " + (item.get('index')));
if ((_ref = this.get('selected')) != null ? _ref.sendAction : void 0) {
this.get('selected').sendAction('on-deselect', this.get('selected'));
if (!this.get('selection')) {
return item.sendAction('on-click', item);
} else {
if (!item || this.get('selected') === item) {
return;
}
Em.debug("Selecting tab: " + (item.get('index')));
if ((_ref = this.get('selected')) != null ? _ref.sendAction : void 0) {
this.get('selected').sendAction('on-deselect', this.get('selected'));
}
this.set('selected', item);
this.get('selected').sendAction('on-select', this.get('selected'));
this.set('selected-idx', item.get('index'));
return this.get('items').forEach((function(_this) {
return function(i) {
if (_this.get('selected') === i) {
return;
}
return i.sendAction('on-selection-change', i, _this.get('selected'));
};
})(this));
}
this.set('selected', item);
this.get('selected').sendAction('on-select', this.get('selected'));
this.set('selected-idx', item.get('index'));
return this.get('items').forEach((function(_this) {
return function(i) {
if (_this.get('selected') === i) {
return;
}
return i.sendAction('on-selection-change', i, _this.get('selected'));
};
})(this));
},
notifyModelsChange: (function() {
return run.next(this, function() {
Expand Down
78 changes: 64 additions & 14 deletions dist/amd/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
define(
["./tabs/tabs","./tabs/tabs-css","./tabs/tab-list","./tabs/tab","./tabs/tab-panel","./wysiwyg/wysiwyg","./wysiwyg/toolbar","./wysiwyg/action-group","./wysiwyg/action","./wysiwyg/actiontmpl","./wysiwyg/editor","./accordion/accordion","./accordion/accordion-item","./accordion/accordion-item-tmpl","./tree/node","./tree/tree-node","./tree/tree-node-tmpl","./tree/tree-branch","./tree/tree-branch-tmpl","./tree/tree-branch-css","./list/list","./list/list-item","ember","exports"],
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __dependency10__, __dependency11__, __dependency12__, __dependency13__, __dependency14__, __dependency15__, __dependency16__, __dependency17__, __dependency18__, __dependency19__, __dependency20__, __dependency21__, __dependency22__, __dependency23__, __exports__) {
["./tabs/tabs","./tabs/tabs-css","./tabs/tab-list","./tabs/tab","./tabs/tab-panel","./wysiwyg/wysiwyg","./wysiwyg/toolbar","./wysiwyg/action-group","./wysiwyg/action","./wysiwyg/actiontmpl","./wysiwyg/editor","./accordion/accordion","./accordion/accordion-item","./accordion/accordion-item-tmpl","./tree/tree","./tree/tree-tmpl","./tree/tree-css","./tree/node","./tree/tree-node","./tree/tree-node-tmpl","./tree/tree-node-icon-action","./tree/tree-branch","./tree/tree-branch-tmpl","./list/list","./list/list-item","./modal/modal","./modal/modal-css","./modal/modal-form","./modal/modal-emform","./modal/modal-title","./modal/modal-body","./modal/modal-footer","./modal/modal-toggler","./modal/modal-tmpl","./modal/modal-confirm","./modal/modal-confirm-tmpl","./button/button","./button/button-tmpl","ember","exports"],
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __dependency10__, __dependency11__, __dependency12__, __dependency13__, __dependency14__, __dependency15__, __dependency16__, __dependency17__, __dependency18__, __dependency19__, __dependency20__, __dependency21__, __dependency22__, __dependency23__, __dependency24__, __dependency25__, __dependency26__, __dependency27__, __dependency28__, __dependency29__, __dependency30__, __dependency31__, __dependency32__, __dependency33__, __dependency34__, __dependency35__, __dependency36__, __dependency37__, __dependency38__, __dependency39__, __exports__) {
"use strict";
var TabsComponent = __dependency1__["default"] || __dependency1__;

Expand Down Expand Up @@ -30,16 +30,32 @@ define(

var AccordionItemTmpl = __dependency14__["default"] || __dependency14__;

var TreeNode = __dependency15__["default"] || __dependency15__;
var TreeNodeComponent = __dependency16__["default"] || __dependency16__;
var TreeNodeTmpl = __dependency17__["default"] || __dependency17__;
var TreeBranchComponent = __dependency18__["default"] || __dependency18__;
var TreeBranchTmpl = __dependency19__["default"] || __dependency19__;
var TreeBranchStyle = __dependency20__["default"] || __dependency20__;
var ListComponent = __dependency21__["default"] || __dependency21__;
var ListItemComponent = __dependency22__["default"] || __dependency22__;
var Application = __dependency23__.Application;
var Namespace = __dependency23__.Namespace;
var TreeComponent = __dependency15__["default"] || __dependency15__;
var TreeTmpl = __dependency16__["default"] || __dependency16__;
var TreeStyle = __dependency17__["default"] || __dependency17__;
var TreeNode = __dependency18__["default"] || __dependency18__;
var TreeNodeComponent = __dependency19__["default"] || __dependency19__;
var TreeNodeTmpl = __dependency20__["default"] || __dependency20__;
var TreeNodeIconAction = __dependency21__["default"] || __dependency21__;
var TreeBranchComponent = __dependency22__["default"] || __dependency22__;
var TreeBranchTmpl = __dependency23__["default"] || __dependency23__;
var ListComponent = __dependency24__["default"] || __dependency24__;
var ListItemComponent = __dependency25__["default"] || __dependency25__;
var ModalComponent = __dependency26__["default"] || __dependency26__;
var ModalCss = __dependency27__["default"] || __dependency27__;
var ModalFormComponent = __dependency28__["default"] || __dependency28__;
var ModalEmFormComponent = __dependency29__["default"] || __dependency29__;
var ModalTitleComponent = __dependency30__["default"] || __dependency30__;
var ModalBodyComponent = __dependency31__["default"] || __dependency31__;
var ModalFooterComponent = __dependency32__["default"] || __dependency32__;
var ModalTogglerComponent = __dependency33__["default"] || __dependency33__;
var ModalTmpl = __dependency34__["default"] || __dependency34__;
var ModalConfirmComponent = __dependency35__["default"] || __dependency35__;
var ModalConfirmTmpl = __dependency36__["default"] || __dependency36__;
var ButtonComponent = __dependency37__["default"] || __dependency37__;
var ButtonTmplComponent = __dependency38__["default"] || __dependency38__;
var Application = __dependency39__.Application;
var Namespace = __dependency39__.Namespace;

Application.initializer({
name: 'em-components',
Expand All @@ -56,6 +72,7 @@ define(
tabListTag: ['ul']
},
tree: {
classes: ['em-tree-branch', 'em-tree', 'fa-ul'],
branchClasses: ['em-tree-branch', 'fa-ul'],
nodeClasses: ['em-tree-node'],
nodeOpenClasses: [],
Expand Down Expand Up @@ -97,6 +114,12 @@ define(
panelTogglerClasses: ['accordion-toggle'],
panelBodyContainerClasses: ['panel-collapse', 'collapse'],
panelBodyClasses: ['panel-body']
},
modal: {
classes: ['em-modal', 'modal', 'fade'],
bodyClasses: ['modal-body'],
titleClasses: ['modal-header'],
footerClasses: ['modal-footer']
}
});
Config.addConfig('foundation', {
Expand All @@ -122,13 +145,29 @@ define(
c.register('component:em-accordion', AccordionComponent);
c.register('component:em-accordion-item', AccordionItemComponent);
c.register('template:em-accordion-item-tmpl', AccordionItemTmpl);
c.register('component:em-tree', TreeComponent);
c.register('template:em-tree', TreeTmpl);
c.register('component:em-tree-node', TreeNodeComponent);
c.register('template:em-tree-node', TreeNodeTmpl);
c.register('component:em-tree-node-icon-action', TreeNodeIconAction);
c.register('component:em-tree-branch', TreeBranchComponent);
c.register('template:em-tree-branch', TreeBranchTmpl);
c.register('template:components/em-tree-branch-css', TreeBranchStyle);
c.register('template:components/em-tree-css', TreeStyle);
c.register('component:em-list', ListComponent);
return c.register('component:em-list-item', ListItemComponent);
c.register('component:em-list-item', ListItemComponent);
c.register('component:em-modal', ModalComponent);
c.register('template:components/em-modal-css', ModalCss);
c.register('component:em-modal-form', ModalFormComponent);
c.register('component:em-modal-emform', ModalEmFormComponent);
c.register('component:em-modal-title', ModalTitleComponent);
c.register('component:em-modal-body', ModalBodyComponent);
c.register('component:em-modal-footer', ModalFooterComponent);
c.register('component:em-modal-toggler', ModalTogglerComponent);
c.register('template:em-modal', ModalTmpl);
c.register('component:em-modal-confirm', ModalConfirmComponent);
c.register('template:em-modal-confirm', ModalConfirmTmpl);
c.register('component:em-button', ButtonComponent);
return c.register('template:em-button', ButtonTmplComponent);
}
});

Expand All @@ -143,9 +182,20 @@ define(
__exports__.WysiwygEditorComponent = WysiwygEditorComponent;
__exports__.AccordionComponent = AccordionComponent;
__exports__.AccordionItemComponent = AccordionItemComponent;
__exports__.TreeComponent = TreeComponent;
__exports__.TreeNodeComponent = TreeNodeComponent;
__exports__.TreeBranchComponent = TreeBranchComponent;
__exports__.TreeNode = TreeNode;
__exports__.TreeNodeIconAction = TreeNodeIconAction;
__exports__.ListComponent = ListComponent;
__exports__.ListItemComponent = ListItemComponent;
__exports__.ModalComponent = ModalComponent;
__exports__.ModalTitleComponent = ModalTitleComponent;
__exports__.ModalBodyComponent = ModalBodyComponent;
__exports__.ModalFooterComponent = ModalFooterComponent;
__exports__.ModalTogglerComponent = ModalTogglerComponent;
__exports__.ModalConfirmComponent = ModalConfirmComponent;
__exports__.ModalFormComponent = ModalFormComponent;
__exports__.ModalEmFormComponent = ModalEmFormComponent;
__exports__.ButtonComponent = ButtonComponent;
});
26 changes: 24 additions & 2 deletions dist/amd/tree/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ define(
function(__dependency1__, __exports__) {
"use strict";
var Ember = __dependency1__["default"] || __dependency1__;
var Node;
var Node, findChildrenOfNodeBy;

Node = Ember.Object.extend({
children: void 0,
Expand Down Expand Up @@ -64,8 +64,30 @@ define(
}).property('children.length'),
isLevel1: (function() {
return this.get('level') === 0;
}).property('children.length')
}).property('children.length'),
findChildBy: function(key, name) {
return findChildrenOfNodeBy(this, key, name);
}
});

__exports__["default"] = Node;

findChildrenOfNodeBy = function(currChild, key, value) {
var c, _i, _len, _ref, _ref1;
if (currChild.get(key) === value) {
return currChild;
} else if (((_ref = currChild.get('children')) != null ? _ref.length : void 0) > 0) {
_ref1 = currChild.get('children');
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
c = _ref1[_i];
if (c.get(key) === value) {
return c;
} else {
findChildrenOfNodeBy(c, key, value);
}
}
return null;
}
return null;
};
});
2 changes: 1 addition & 1 deletion dist/amd/tree/tree-branch-tmpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ define(
["exports"],
function(__exports__) {
"use strict";
__exports__["default"] = Ember.Handlebars.compile("{{#each nodes}}\n {{em-tree-node node=this async=controller.async targetObject=controller.targetObject}}\n{{/each}}");
__exports__["default"] = Ember.Handlebars.compile("{{#each children}}\n {{em-tree-node model=this tree=view.tree async=controller.async targetObject=controller.targetObject}}\n{{/each}}");
});
13 changes: 4 additions & 9 deletions dist/amd/tree/tree-branch.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,15 @@ define(
TreeBranch = Component.extend(WithConfigMixin, {

/**
* The node to render its children within this branch
* this property is expected to be defined by the user
* The model to render its children within this branch
* this property is set during component markup creation
*/
node: void 0,

/**
* The root node of the tree
*/
rootNode: computed.alias('node.root'),
model: void 0,

/**
* A list of {{#crossLink "TreeNode"}}nodes{{/crossLink}} instances.
*/
nodes: computed.alias('node.children'),
children: computed.alias('model.children'),

/**
* True if node's children should be loaded asynchronously
Expand Down
2 changes: 1 addition & 1 deletion dist/amd/tree/tree-node-tmpl.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6e8c607

Please sign in to comment.