From e53660b7177c94aa97030f0f64fe701acb496dc3 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 17 Jun 2018 08:29:05 +0000 Subject: [PATCH] Highlight "Spent time" in main menu when creating a time entries query. git-svn-id: http://svn.redmine.org/redmine/trunk@17397 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/queries_controller.rb | 4 ++++ test/functional/queries_controller_test.rb | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/app/controllers/queries_controller.rb b/app/controllers/queries_controller.rb index 9a6102a16..647d322ed 100644 --- a/app/controllers/queries_controller.rb +++ b/app/controllers/queries_controller.rb @@ -104,6 +104,10 @@ class QueriesController < ApplicationController render_404 end + def current_menu_item + @query ? @query.queried_class.to_s.underscore.pluralize.to_sym : nil + end + private def find_query diff --git a/test/functional/queries_controller_test.rb b/test/functional/queries_controller_test.rb index 04fdd8ef7..93229c423 100644 --- a/test/functional/queries_controller_test.rb +++ b/test/functional/queries_controller_test.rb @@ -77,6 +77,16 @@ class QueriesControllerTest < Redmine::ControllerTest assert_select 'input[name=type][value=?]', 'TimeEntryQuery' end + def test_new_time_entry_query_should_select_spent_time_from_main_menu + @request.session[:user_id] = 2 + get :new, :params => { + :project_id => 1, + :type => 'TimeEntryQuery' + } + assert_response :success + assert_select '#main-menu a.time-entries.selected' + end + def test_new_time_entry_query_with_issue_tracking_module_disabled_should_be_allowed Project.find(1).disable_module! :issue_tracking -- 2.39.5