-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Navigation URLs aren't generated correctly when using Passenger's RackBaseURI #101
Comments
Example: We're at http://dev.tanga.com/new-admin/admin. The Dashboard link is http://dev.tanga.com/admin. https://img.skitch.com/20110526-1j7diudrmkcjycb5dtcfu1sy8n.png However, the links in the rest of the page (below the header navigation) work just fine: https://img.skitch.com/20110526-n9ip2qjjiixqbsa9hj6iqg342s.png. The link is http://dev.tanga.com/new-admin/admin. |
We definitely hit this too; I put in a quick fix that solved it for us, but the URL generation here is pretty gross. |
would using logout_path not work? (or whatever it's called) |
I've also hit this problem when mounting the app under a sub-directory on Heroku using Rack::Builder#map
All the links below the header work fine, but the tab links do not include the sub-directory as described above. The quick fix mentioned by @andrewcarpenter will not work in Rails 3 since This is the same issue as #280 |
Is this issue happening with 0.3.0? |
I've just updated to 0.3.2 and this is still broken in my app. Has an explicit commit been made to fix this or are you just checking to see if it's still an open issue? |
I'm also still getting this. |
Tested on 0.3.3, same issue occurring. Have an app that is deployed in a sub-ur (http://example.com/app1/admin/) via mod_passenger's RailsBaseURI. |
I meet the same issue as 0.3.4 is used. The result displayed in #header is really bad. How can we fix it? |
Also having this issue |
me too as 0.3.4 |
+1 |
+2 (I have two apps) with nginx + passenger |
Thank you, sir! |
I'm using v 0.6.0 and having the same issue. This problem returns? |
@josecoelho can you provide some more detail of what you're running into? |
I have deployed on a suburl via mod_passenger's RailsBaseURI. E.g.: http://192.168.1.2/myapp/ All other links of my application, are using the correct route to suburl. But tabbed menu links have the route to the root. I found this commit b506c2e that removes the fix made on commit that fixes this issue. I need to configure someting else to made this work? Thanks a lot |
Any idea on @josecoelho issue? Same problem here! |
@josecoelho so it's only nested menu items whose URLs aren't in the |
No. The problem is on all superior menu items, nested or not. |
What do you mean by "superior" menu items? |
Sorry about my english. :) All top menu itens have the route problem on suburls. It was fixed on 3e7ac40 but the fix was undone on b506c2e Some examples of menu item definition:
|
I'm still not sure what you mean. Could you provide examples of what the URLs should be, and what they are? By top / superior menu items do you mean the parent? menu parent: 'Cadastros' So Cadastros would be a parent menu item, with nested / children menu items below it. |
Sorry about that... On an application configured to run via mod_passenger's with RailsBaseURI as /myapp This code: ActiveAdmin.register Client do
menu :label => "Pessoas"
end Should result on a top menu item: <a href="/myapp/admin/clients">Pessoas</a> But, is ignoring RailsBaseURI configuration and rendering this: <a href="/admin/clients">Pessoas</a> The same problem occur with menu itens having parents. |
+1 |
@siruguri how are you using AA 0.6.1 with Rails 4.1? The 0.6.x line doesn't support Rails 4 at all. |
My apologies - it's 1.0.0 pre. I was confused by the output of On Thu, Apr 10, 2014 at 9:28 PM, Sean Linsley notifications@github.comwrote:
|
Nrgh. My bad. I hadn't installed Polyamorous and Ransack in my Gemfile. It works after I did that. I am not sure how that mattered and why AA was working without those gems. Or it might have been some weird gem update problem - I kept getting a 0.6.1 when I did |
Rails.application.routes.default_url_options[:script_name] = '/my_app' worked for me. 1.0.0 pre with Rails 4.1.1 |
Works for me too, but a redirect occurs at login and logout! |
+1 for |
I haven't tried to get assets working - and also I switched to RailsAdmin :) On Fri, Aug 1, 2014 at 12:10 PM, Alexander notifications@github.com wrote:
|
Any news on this, just ran into it, internal nav links ignore my passenger base URI and cause a 404 unless I manually add /server/ before admin. |
@patsy-issa Have you tried this code? #101 (comment) |
@kuboon Just added it in now, works like a charm, avoided it in the first place when I read that it broke assets. Cheers. |
Can someone confirm that |
Now I get a bit deeper into |
Encountered this problem with AA 0.6.0 and Rails 3.2. This fix: correctly resolved the issue fo rme. |
@armahillo 's solution worked for me. Actually, all I needed was the 1st part--didn't need to use |
The only solution that worked for me with Rails 4.2 and AA from github is to manually set the menu urls like mentioned here #101 (comment) |
yeah, not the best solution but also fixed the issue for me |
my solution:
Rails.application.routes.default_url_options[:script_name] = ENV['RAILS_RELATIVE_URL_ROOT']
protected
def after_sign_in_path_for(resource)
ENV['RAILS_RELATIVE_URL_ROOT']
end
def after_sign_out_path_for(resource)
new_user_session_path
end
def authenticate_user!
if user_signed_in?
super
else
redirect_to new_user_session_path
end
end app mounted in sub-uri "/record"
|
@semen225 2 suggestions:
Also,
|
I hope this helps someone in the future because I've been struggling with this for a bit. Especially since things like So what I did was this, even though it's a hack: #Add this to app/assets/javascripts/active_admin.js.coffee, below the #= require active_admin/base line
#= require_self
(($) ->
$(document).ready ->
$('#header li a').each ->
href = $(this).attr('href')
url_suffix = href.replace(/.*\/admin\//, '')
current_location = document.location.pathname
location_prefix = current_location.replace(/admin\/?.*/, "admin/")
$(this).attr('href', location_prefix + url_suffix)
)(jQuery) That will rewrite the top bar's "href"s after the page has loaded, anchoring around the 'admin/' section of the path and assuming that everything in front of it is constant for the app. This also fixes the link to your own profile, for example, which remained broken otherwise. edit: changed regex slightly to also work on any links that may accidentally already have been correct. |
@timoschilling Recent work and documentation seem to indicate that |
+1 |
I have the Rails 3 application containing active_admin mounted as a suburi (i.e. http://domain.com/sub-uri/).
The links in ActiveAdmin below the navigation header work properly (http://domain.com/sub-uri/admin/path).
But the links in the header navigation section don't include the suburi. They look like http://domain.com/admin/path.
The text was updated successfully, but these errors were encountered: