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

[discussion] update to recent activeadmin features #5

Open
Fivell opened this issue Feb 21, 2017 · 4 comments
Open

[discussion] update to recent activeadmin features #5

Fivell opened this issue Feb 21, 2017 · 4 comments

Comments

@Fivell
Copy link

Fivell commented Feb 21, 2017

Hello @zorab47 , hope you're doing well and someday this gem will be merged to activeadmin.
I just wanted to notify you about next changes that can reflect to this gem.

  1. about pages
    pages are supports belongs_to, so there is no reason to skip pages from active_admin-subnav take a look add belongs to to page resources  activeadmin/activeadmin#4759

  2. about extra setup

# Provide access to the parent resource record: Site.
# Without this extra setup the parent record will not be accessible. Any
# calls to `#parent` will return the Arbre parent element and not the
# ActiveAdmin resource.

can you explain why this needed ? and why it is not possible to use helpers.parent in arbre https://github.com/Fivell/activeadmin/blob/05877d45d464d1911ca7d53072c81516c7614281/features/registering_pages.feature#L181

  1. about controller hack

https://github.com/zorab47/active_admin-subnav/blob/master/lib/active_admin/subnav/extensions/base_controller.rb#L11

Can you please explain why this needed, maybe we'll find more clean workaround for this

Thanks

@zorab47
Copy link
Owner

zorab47 commented Feb 22, 2017

I'm happy to help get this integrated into ActiveAdmin. Answers are below:

  1. Pages aren't skipped. They just require a bit more setup due to item 2 (calling #parent in Arbre context)
  2. It has to do with the Arbre context and variable resolution. My thought is Arbre is intercepting the call for 'parent' though its use of method_missing and returns the parent HTML node. It should be the same issue discussed in Add the belongs_to functionality to Page resources activeadmin/activeadmin#2770. Solving this issue would be very helpful in many places.
    • It is possible to use helpers.parent, but it seems strange when the docs for inherited_resources's belongs_to suggest using the controller#parent method directly.
    • I didn't realize that Arbre provided the helpers method for this purpose until you mentioned it.
  3. The controller hack is to ensure the ID of the parent resource is available when generating URLs for the sub menu items (if I remember correctly).

Have you experienced the issue related to calling #parent in an Arbre context? Perhaps my resources are configured in a strange way??

@Fivell
Copy link
Author

Fivell commented Feb 22, 2017

@zorab47 , yes I had, but after I figured out that parent can be called on helpers.
So helpers.parent works instead of parent

@Fivell
Copy link
Author

Fivell commented Feb 22, 2017

@zorab47 , I will setup your gem when I have free time and check if something can be improved.

@zorab47
Copy link
Owner

zorab47 commented May 24, 2017

FYI, I've released a new version with compatibility with ActiveAdmin 1.0.0.

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

No branches or pull requests

2 participants