Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Add support for params in menu items
 #1305

Merged
merged 4 commits into from Jul 25, 2016
Merged

Add support for params in menu items
 #1305

merged 4 commits into from Jul 25, 2016

Conversation

scfox
Copy link
Contributor

@scfox scfox commented Apr 12, 2016

feat(core): Add support for params in menu items


Proposed by @scfox

Fixes #1304

@@ -378,6 +379,10 @@
it('should set position to options position', function() {
expect(subItem1.position).toEqual(subItemOptions.position);
});

it('should set params to options params', function() {
expect(subItem1.params).toEqual(subItemOptions.params);
Copy link
Member

Choose a reason for hiding this comment

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

There's a trailing space here causing the build to fail.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 70.615% when pulling 1910d3f on scfox:master into f2a6bf9 on meanjs:master.

@scfox
Copy link
Contributor Author

scfox commented Apr 12, 2016

Sorry. I added that to force another commit to put in a better commit message, then realized you get a second chance on the pull request. Resolved now.

@@ -85,6 +85,7 @@
service.menus[menuId].items[itemIndex].items.push({
title: options.title || '',
state: options.state || '',
params: options.params || '',
Copy link
Member

Choose a reason for hiding this comment

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

Set this to an empty object, for consistency.

@mleanos
Copy link
Member

mleanos commented Apr 12, 2016

Overall, this looks good to me. I think this will be a great enhancement.

Would it be possible to add an E2E test for this as well? We don't have E2E coverage for the core module at this time. I'm not sure how complicated it will be to add E2E tests for the menu service, but it would be great to have.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 70.615% when pulling f796be8 on scfox:master into f2a6bf9 on meanjs:master.

@scfox
Copy link
Contributor Author

scfox commented Apr 12, 2016

I agree more E2E tests would be a good thing. I upgraded from an earlier mean.js stack and was happy to see they were incorporated now. But it is still on my TODO list to learn how to use them effectively, and I am definitely not the best to lay down precedence for how to test core E2E. I'm not even sure if E2E tests fit well for core type functionality, since it is more building block than actual UI in most cases. It might make more sense to simply add some different use cases to a module like articles that exercises the core functionality and run the E2E tests there. Someone with more experience with E2E might have more insight there.

@mleanos
Copy link
Member

mleanos commented Apr 12, 2016

I agree with the "core type functionality" not really fitting in well with E2E. However, the Menu service is a UI feature.

I think we can just roll with what you have here. I'll wait for others to provide feedback.

On a side note:
I think the Menu service can be refactored or enhanced a bit. I think there are some fundamental flaws in it's design. I detailed some of these in an issue a while back (I'll try to find it). Now that you have spent some time with the Menu service, do you see any issues or limitations with it? One thought I had was to wrap up the functionality into a directive. Any thoughts on that?

One other thing that might be confusing to our users is that the Menu's default to having roles of ['user', 'admin'], but our client-side routes default to "public". So there's a mismatch there. I'm wondering if we should address that in some way.

@ilanbiala
Copy link
Member

LGTM, but I would like to see some more tests if possible.

@scfox
Copy link
Contributor Author

scfox commented Apr 13, 2016

@mleanos I concur the menu service could stand for an overhaul / upgrade. It feels like the weakest part of the stack from the parts I've been working with anyway. It is a lot better than previous versions which were barely documented, but still not all that easy to work with. I've ended up only using it only for the high level navigation and building my own for a left navigation style based on Material elements. I think trying to leverage Material in a standard way would be the way to go now that Material is included in the mean.js stack.

@trendzetter
Copy link
Contributor

trendzetter commented Apr 19, 2016

@scfox I think your proposal for the params is great but I don't see material included in mean? Did I miss something? Is it workable combining material with bootstrap in mean?

@scfox
Copy link
Contributor Author

scfox commented Apr 27, 2016

@trendzetter My mistake, Material is not included in the current mean stack, I added it in myself. It is workable to combine though. Here is a tutorial on how to do it: http://www.bossable.com/1231/material-design-meanjs/
Seems like a good addition to consider, but totally separate topic than this small params support update.

@codydaig
Copy link
Member

What's the status of this PR?

@scfox
Copy link
Contributor Author

scfox commented Jun 30, 2016

I think it is ready to be pulled/merged. No other feedback came back on it.

@mleanos mleanos self-assigned this Jul 6, 2016
@mleanos
Copy link
Member

mleanos commented Jul 6, 2016

I just reviewed this again. LGTM.

@mleanos mleanos added this to the 0.5.0 milestone Jul 6, 2016
@lirantal
Copy link
Member

lirantal commented Jul 7, 2016

@mleanos , @scfox , can you also add a small documentation on how to use it? you can either do that by doing a Pull Request to our documentation gh-pages repo/branch ( @codydaig can help you with that ), or just put a snippet of code example here and one of us will take care of updating the docs properly.

Other than that, if LGTY then let's merge please.

@mleanos
Copy link
Member

mleanos commented Jul 8, 2016

@scfox Would you be able to create a PR that adds some documentation on how the parameters work? And perhaps an example of how to integrate it into a client-side route/state?

I wasn't able to install Jekyll on Windows when I last tried, so it's difficult for me to test locally. I'd be more than happy to review though.

@mleanos
Copy link
Member

mleanos commented Jul 25, 2016

Merging, since this PR adds a test for the new functionality. The documentation can wait for a new PR.

@scfox Thank you for this contribution. Would you be interested in adding a PR for an update to our documentation on the Menus Service?

@mleanos mleanos merged commit 5817a48 into meanjs:master Jul 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants