Actions
Patch #1507
closedDynamic project selector
Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Projects
Target version:
-
Start date:
2008-06-20
Due date:
% Done:
0%
Estimated time:
Description
Dirty and ugly hack to make project selector do not jump on project root, but on current action.
Index: app/views/layouts/_project_selector.rhtml =================================================================== --- app/views/layouts/_project_selector.rhtml (revision 1565) +++ app/views/layouts/_project_selector.rhtml (working copy) @@ -3,10 +3,21 @@ <option selected="selected"><%= l(:label_jump_to_a_project) %></option> <option disabled="disabled">---</option> <% user_projects_by_root.keys.sort.each do |root| %> - <%= content_tag('option', h(root.name), :value => url_for(:controller => 'projects', :action => 'show', :id => root)) %> + <%#= content_tag('option', h(root.name), :value => url_for(:controller => 'projects', :action => controller.action_name, :id => root)) %> + <% if params[:controller] != 'issues' %> + <%= content_tag('option', h(root.name), :value => url_for(:controller => 'projects', :action => controller.action_name, :id => root)) %> + <% else %> + <%= content_tag('option', h(root.name), :value => url_for(:controller => 'projects', :action => root.identifier, :id => 'issues')) %> + <% end %> <% user_projects_by_root[root].sort.each do |project| %> <% next if project == root %> - <%= content_tag('option', ('» ' + h(project.name)), :value => url_for(:controller => 'projects', :action => 'show', :id => project)) %> + <%#= content_tag('option', ('» ' + h(project.name)), :value => url_for(:controller => 'projects', :action => controller.action_name, :id => project)) %> + <% if params[:controller] != 'issues' %> + <%= content_tag('option', ('» ' + h(project.name)), :value => url_for(:controller => 'projects', :action => controller.action_name, :id => project)) %> + <% else %> + <%= content_tag('option', ('» ' + h(project.name)), :value => url_for(:controller => 'projects', :action => project.identifier, :id => 'issues')) %> + + <% end %> <% end %> <% end %> </select>
On nil destination action there is 403 status. You can disable this by next nasty hack:
Index: app/controllers/application.rb =================================================================== --- app/controllers/application.rb (revision 1565) +++ app/controllers/application.rb (working copy) @@ -132,9 +132,10 @@ end def render_403 - @project = nil - render :template => "common/403", :layout => !request.xhr?, :status => 403 - return false +#@project = nil +#render :template => "common/403", :layout => !request.xhr?, :status => 403 +#return false + redirect_to :controller => :projects, :action => :show,:id => @project end def render_404
Related issues
Updated by Jean-Philippe Lang over 16 years ago
On nil destination action there is 403 status. You can disable this by next nasty hack [...]
This hack generates infinite redirections when a user requests a project he is not authorized to view.
Updated by Michael Pirogov over 16 years ago
OK. It's officially unsupported and not recommended ;-)
Updated by Jean-Philippe Lang almost 16 years ago
- Status changed from New to Closed
Feature added in r2210.
Actions