-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
One model, two dashboards #2595
Comments
I did a commit in my fork. Could prepare a PR if I am not missing something |
This is an interesting idea. I have a similar use case. Is this solution working well for you? |
This is an interesting idea! If it's working well for you, could you look at creating a PR for it? We can then pick up the discussion from there. |
I’ve solved this using a different approach. Is there anything else I can help with regarding this issue? |
Oh, interesting. I'd be interested to hear if that works well for everyone else here. |
Thanks @nickcharlton
I will take a look at creating a pr for this.
Yes @emersonthis I've been using it on production for a few months now, and I am happy with it. |
What would you like to be able to do? Can you provide some examples?
The job to be done for me is to use Administrate not only for administrators. I would like to use Administrate both for the administrators and for the end users.
I am trying to create a model Campaign with properties that could be seen and edited by admins and that could be seen and edited by normal users.
How could we go about implementing that?
I solution I see is: One model, Two Namespaced Dashboards
Here are the possible steps
The problem that I am facing is that once the /brands dashboard is called Brands::CampaignDashboard because of the namespace 'brands', the administrate is looking for "brands/campaign" model and "new_brands_brand_campaign_* paths and urls.
This is caused by
where the resource_name for Brands::CampaignDashboard is always 'brands/campaign' and not 'campaign'
What I think should happen is not to use the dashboard.class as a way to get the resource but to use the model specified by the dashboard.
Here is a script to create the project and reproduce the issue
open http://localhost:3002/brands/campaigns/
There will be an error
Stop server
open http://localhost:3002/brands/campaigns/
/brands/campaigns allows for creating and updating of campaigns but without the admin_property
/admin/campaigns allows for creating and updating of campaigns but with the admin_property
I went down the path of overriding polymorphic_path, creating brands/campaign.rb models, but could not get it working. Too involved.
The text was updated successfully, but these errors were encountered: