https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292010-09-28T08:43:34ZRedmineRedmine - Defect #6513: "Move" and "Copy" are not displayed when deployed in subdirectoryhttps://www.redmine.org/issues/6513?journal_id=208002010-09-28T08:43:34ZFelix Schäfer
<ul></ul><p>I can confirm that, I'll try to have a look later.</p> Redmine - Defect #6513: "Move" and "Copy" are not displayed when deployed in subdirectoryhttps://www.redmine.org/issues/6513?journal_id=208162010-09-28T21:17:57ZFelix Schäfer
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>7</i></li><li><strong>Assignee</strong> set to <i>Eric Davis</i></li><li><strong>Target version</strong> set to <i>1.0.3</i></li></ul><p>Eric: patch below, I'll let you take care of the tests though as it was your change ;-) Make sure to document the relative_url_root stuff in the environments if it's not the case already.</p>
<p>Here's a patch (read on though):</p>
<pre><code class="diff syntaxhl"><span class="gh">diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 6ba40eb..f4ad798 100644
</span><span class="gd">--- a/app/helpers/application_helper.rb
</span><span class="gi">+++ b/app/helpers/application_helper.rb
</span><span class="p">@@ -41,7 +41,7 @@</span> module ApplicationHelper
def link_to_if_authorized(name, options = {}, html_options = nil, *parameters_for_method_reference)
if options.is_a?(String)
begin
<span class="gd">- route = ActionController::Routing::Routes.recognize_path(options.gsub(/\?.*/,''), :method => options[:method] || :get)
</span><span class="gi">+ route = ActionController::Routing::Routes.recognize_path(options.match(/\A#{ActionController::Base.relative_url_root}(.*)\?.*\z/)[1], :method => options[:method] || :get)
</span> link_controller = route[:controller]
link_action = route[:action]
rescue ActionController::RoutingError # Parse failed, not a route</code></pre>
<p>This will require you to make rails aware of the subdirectory though, I know passenger takes care of this, webrick doesn't. You can pass the subdirectory information either through an environment variable: <code>RAILS_RELATIVE_URL_ROOT="/redmine"</code> or through an entry in the <code>config/environment.rb</code>:</p>
<pre><code class="ruby syntaxhl"><span class="n">config</span><span class="p">.</span><span class="nf">action_controller</span><span class="p">.</span><span class="nf">relative_url_root</span> <span class="o">=</span> <span class="s2">"/redmine"</span></code></pre> Redmine - Defect #6513: "Move" and "Copy" are not displayed when deployed in subdirectoryhttps://www.redmine.org/issues/6513?journal_id=210472010-10-05T17:32:26ZFernando Hartmann
<ul></ul><p>This problem happens to me.</p>
<p>+1</p> Redmine - Defect #6513: "Move" and "Copy" are not displayed when deployed in subdirectoryhttps://www.redmine.org/issues/6513?journal_id=213112010-10-13T00:32:35ZFelix Schäfer
<ul></ul><p>Eric, you broke it, you fix it ;-) Seriously though, it seems more people get hit by this, anything amiss for commit?</p> Redmine - Defect #6513: "Move" and "Copy" are not displayed when deployed in subdirectoryhttps://www.redmine.org/issues/6513?journal_id=213142010-10-13T03:34:57ZEric Davis
<ul></ul><p>Felix Schäfer wrote:</p>
<blockquote>
<p>anything amiss for commit?</p>
</blockquote>
<p>Time. I want to test it out, since that method is starting to get pretty nasty.</p>
<p>I'm thinking it might be a good idea to take another look at how Redmine is doing permissions and see if these things could be handled there (instead of running through the entire Routing system each time)...</p> Redmine - Defect #6513: "Move" and "Copy" are not displayed when deployed in subdirectoryhttps://www.redmine.org/issues/6513?journal_id=213192010-10-13T07:34:58ZFelix Schäfer
<ul></ul><p>Eric Davis wrote:</p>
<blockquote>
<p>Time. I want to test it out, since that method is starting to get pretty nasty.</p>
</blockquote>
<p>I was thinking more in the lines of code (no pun intended).</p>
<blockquote>
<p>I'm thinking it might be a good idea to take another look at how Redmine is doing permissions and see if these things could be handled there (instead of running through the entire Routing system each time)…</p>
</blockquote>
<p>Nothing I'd be against, but I'd still want this fixed as soon as possible even if it's with a somewhat bloated solution rather than holding off until we have a good one (and IIRC you were the that made that change in the first place ;-) ). Now, we have 2 options until we find a better solution: go with this, or I'd be willing to find all places making problems so that we can revert the changes to that method.</p> Redmine - Defect #6513: "Move" and "Copy" are not displayed when deployed in subdirectoryhttps://www.redmine.org/issues/6513?journal_id=214232010-10-15T01:03:41ZEric Davis
<ul></ul><p>Felix Schäfer wrote:</p>
<blockquote>
<p>Nothing I'd be against, but I'd still want this fixed as soon as possible even if it's with a somewhat bloated solution rather than holding off until we have a good one</p>
</blockquote>
<p>True.</p>
<blockquote>
<p>(and IIRC you were the that made that change in the first place ;-) ).</p>
</blockquote>
<p>Hey, someone needs to keep you working. ;)</p>
<blockquote>
<p>Now, we have 2 options until we find a better solution: go with this, or I'd be willing to find all places making problems so that we can revert the changes to that method.</p>
</blockquote>
<p>I think reverting is a step back. This code is some of Redmine's older code that has been needed to be upgraded for years. I'll try to take a look at it this weekend and make a decision.</p> Redmine - Defect #6513: "Move" and "Copy" are not displayed when deployed in subdirectoryhttps://www.redmine.org/issues/6513?journal_id=214532010-10-15T23:06:59ZEric Davis
<ul><li><strong>Status</strong> changed from <i>7</i> to <i>Resolved</i></li><li><strong>Resolution</strong> set to <i>Fixed</i></li></ul><p>Decided to just revert the changes and go back to the older <code>link_to_if_authorized</code>. I don't have the time or desire to go through the entire permissions system to get it to support REST urls properly.</p>
<p><a class="changeset" title="Revert part of r4064. Having link_to_if_authorized support urls has too many edge cases and isn'..." href="https://www.redmine.org/projects/redmine/repository/svn/revisions/4257">r4257</a> <a class="changeset" title="Revert part of r3936. link_to_if_authorized no longer supports paths for the link options." href="https://www.redmine.org/projects/redmine/repository/svn/revisions/4258">r4258</a></p> Redmine - Defect #6513: "Move" and "Copy" are not displayed when deployed in subdirectoryhttps://www.redmine.org/issues/6513?journal_id=219862010-11-01T00:22:29ZEric Davis
<ul><li><strong>Status</strong> changed from <i>Resolved</i> to <i>Closed</i></li></ul><p>Merged into 1.0-stable for release in 1.0.3</p>