-
-
Notifications
You must be signed in to change notification settings - Fork 398
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
Enable groups for constants (Resolves #610) #1056
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This mostly looks good but seems to break tests. If those are fixed and comments are addressed I would not be opposed to merging this.
else if (next.hasClass('summary')) { | ||
var list = $('<dl class="constants summary compact" />'); | ||
list.html(next.html()); | ||
list.find('.docstring').remove(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are individual elements being removed here (including elements below). Why not just use CSS to style this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current implementation of the method-summaries remove some tags as well so I just copied it but I think your right.
# The scope of the constants is always +:class+ | ||
# | ||
# @return [Symbol] +:class+ | ||
def scope |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how this method is being used. Is there a reason this was added?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there are no groups, but you have constants it raises an exception NoMethodError: undefined method
scope'` like it did with the classvariable in the failing test altough I'm not sure why this is triggered but I'll definitely look into it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably happens because of some shared logic in the templates. You may want to change the code in the template itself rather than adding new APIs. I'm not sure a #scope method makes sense for a ConstantObject.
Hi @lsegal, thanks for your feedback. Wasn't sure if my approach would fit into the lib as it's quite some code and I had some problems figuring out where to put my stuff. But I'll now go on and fix the tests, add a new one for the constant groups and look into your comments. |
blow the dust away Sorry for the long break but I finally looked into this PR again and this time finished it. I reworked the logic, fixed the extisting tests and added a new one. So I guess @lsegal I'm ready for another review. Attached are two screenshots with a collapsed and an expanded view. If the constants are collapsed the value is shown as tooltip as seen in the first screenshot. PS: As far as I can tell the failing test on ruby-head is unrelated to this PR. |
Sleeping over it I remembered that I didn't test/considered deprecated constants. They work as well but I thought that it would be cool if you can see some indication in the collapsed mode as well - so I added a bit of js and css to make it red and add the Word "Deprecated." in the tooltip as well. See the attached image. |
Rebased and everything green now. |
Is this repo still alive? |
Not dead, just slower, lately. I will likely make some time on this at some point this month. |
Thanks for the hard work on this, @Kjarrigan! |
When can we expect a new release version ? |
@lsegal Thanks for the merge! |
The grouping is done by |
Description
I started contributing to gosu this month and while working on some issues there I stumbled upon a huge list of constants in the docs and it would be really helpfull if we could group and collapse them. @jlnr found an old issue #610 which stated that this is a feature I have to implement on my own. So this is my first approach. Its definitely not finished yet, but the easy part is done and its functional but not that pretty yet. So I would like to get some feedback if my basic idea was right and if I can look further into this to make it pretty.
Screenshots
ToDo
Completed Tasks
bundle exec rake
locally (if code is attached to PR).