enabling the "jump to" functionality of the core's ProjectsController

pull/6827/head
Jens Ulferts 13 years ago
parent 319358653d
commit 8062d7e009
  1. 8
      app/controllers/my_projects_overviews_controller.rb
  2. 21
      spec/controllers/my_projects_overview_controller_spec.rb

@ -22,6 +22,7 @@ class MyProjectsOverviewsController < ApplicationController
before_filter :find_page_blocks, :find_project_details
before_filter :find_attachments
before_filter :authorize
before_filter :jump_to_project_menu_item, :only => :index
BLOCKS = { 'issuesassignedtome' => :label_assigned_to_me_issues,
'issuesreportedbyme' => :label_reported_issues,
@ -198,4 +199,11 @@ class MyProjectsOverviewsController < ApplicationController
def default_breadcrumb
l(:label_overview)
end
def jump_to_project_menu_item
if params[:jump]
# try to redirect to the requested menu item
redirect_to_project_menu_item(@project, params[:jump]) && return
end
end
end

@ -13,18 +13,33 @@ describe MyProjectsOverviewsController do
@params = {}
end
let(:project) { Factory.create(:project) }
describe 'index' do
let(:params) { { "id" => project.id.to_s } }
describe "WHEN calling the page" do
integrate_views
before do
@project = Factory.create(:project)
@params[:id] = @project.id
get 'index', params
end
it 'renders the overview page' do
get 'index', @params
response.should be_success
response.should render_template 'index'
end
end
describe "WHEN calling the page
WHEN providing a jump parameter" do
before do
params["jump"] = "issues"
get 'index', params
end
it { response.should redirect_to({ :controller => "issues", :action => "index", :project_id => project }) }
end
end
end

Loading…
Cancel
Save