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

Changing activeClass, added disabled state, moved to Mixin, ember-cli 2.4.1, and more! #12

Merged
merged 9 commits into from
Mar 26, 2016

Conversation

Panman82
Copy link
Contributor

@Panman82 Panman82 commented Mar 4, 2016

Finally got around to creating the PR for issue #10. This encompasses everything mentioned there, with your concerns resolved (I'm hoping anyway). Here are the commit messages and details:

Update to ember-cli 2.4.1
Updated the ember-cli dep to 2.4.1 and ran ember init to update other deps and file changes.

Remove ember-data
Removed ember-data from the devDependencies, not needed for this addon..

Remove un-needed .gitkeep files
Really minor, just removing un-needed .gitkeep files since the addon and app folders contain stuff.

Make 'childLinkViews' an Ember Array
Make the childLinkViews property an Ember Array, instead of having the Computed Properties convert it (setup for future commits). This commit includes a few other related changes;

  • Create the initial array in the init() hook
  • Run _super() on the didRender() hook
  • Change var to let for variable declarations

Add ability to change the 'activeClass' name
Previously, the active class name was hard coded to ‘active’. Now it will pull the child {{link-to}} activeClass name by default. Or, users can specify what it will be by defining the activeClass on the {{active-link}}. Also added tests for this and updated the README (which has been expanded to show more examples).

Add support for the disabled state
As a negative to active, add a disabled state that adds a class when ALL child links are also disabled. Similarly, the class name draws from the child {{link-to}} but can be overridden. Users can always opt-out by defining disabledClass=false. Also added tests for this and updated the README.

Expose the child link selector
While probably a rare case, expose the selector used to find child links. That way if folks are using <button>s instead, they could update the linkSelector. Also added tests for this and updated the README.

Move functionality to mixin
By moving the main functionality of this addon into a Mixin, Components from other addons can implement these features. For example, other UI libraries might provide a dropdown Component where this might be a helpful addition.

Minor README tweaks
Just a few tweaks to the README; broke-up long lines, extra spacing between headers, added the Development section (in new addons), adjusted the tests link, and removed the Building section (doesn’t make sense for this addon).

Impacts on existing issues and PRs:
Resolves #3
Resolves #10
Closes #8

Panman82 added 9 commits March 4, 2016 10:32
Updated the ember-cli dep to 2.4.1 and ran `ember init` to update other
deps and file changes.
Removed `ember-data` from the `devDependencies`, not needed for this
addon..
Really minor, just removing un-needed `.gitkeep` files since the addon
and app folders contain stuff.
Make the `childLinkViews` property an Ember Array, instead of having
the Computed Properties convert it (setup for future commits). This
commit includes a few other related changes;

* Create the initial array in the `init()` hook
* Run `_super()` on the `didRender()` hook
* Change `var` to `let` for variable declarations
Previously, the active class name was hard coded to ‘active’. Now it
will pull the child `{{link-to}}` `activeClass` name by default. Or,
users can specify what it will be by defining the `activeClass` on the
`{{active-link}}`. Also added tests for this and updated the README
(which has been expanded to show more examples).
As a negative to active, add a disabled state that adds a class when
ALL child links are also disabled. Similarly, the class name draws from
the child `{{link-to}}` but can be overridden. Users can always opt-out
by defining `disabledClass=false`. Also added tests for this and
updated the README.
While probably a rare case, expose the selector used to find child
links. That way if folks are using `<button>`s instead, they could
update the `linkSelector`. Also added tests for this and updated the
README.
By moving the main functionality of this addon into a Mixin, Components
from other addons can implement these features. For example, other UI
libraries might provide a dropdown Component where this might be a
helpful addition.
Just a few tweaks to the README; broke-up long lines, extra spacing
between headers, added the Development section (in new addons),
adjusted the tests link, and removed the Building section (doesn’t make
sense for this addon).
@Panman82
Copy link
Contributor Author

@alexspeller Just want to ping ya for feedback. Been a couple weeks now and just didn't want to lose sight of this PR. I'll jump on Slack for a few hours if you'd rather chat. Again, no hurry, just keeping this on my todo list.

Edit: Just realized you're probably offline for the day (with the time difference and all). I'll try to be online tomorrow morning at some point.

}),

didRender: function() {
init() {
this._super( ...arguments );
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to call super here. init on Ember.Component is an empty function.

@alexspeller alexspeller merged commit 59a3ed1 into alexspeller:master Mar 26, 2016
@alexspeller
Copy link
Owner

Really sorry this took so long to merge, it's a great PR and I have just been incredibly ill. Thanks!

@alexspeller
Copy link
Owner

version 0.1.0 is pushed to npm now :)

@Panman82 Panman82 deleted the mutation branch March 27, 2016 01:39
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.

Proposed changes, and how to structure PR's Changing active class
2 participants