]> source.dussan.org Git - redmine.git/commitdiff
Highlight "Spent time" in main menu when creating a time entries query.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 17 Jun 2018 08:29:05 +0000 (08:29 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 17 Jun 2018 08:29:05 +0000 (08:29 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@17397 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/queries_controller.rb
test/functional/queries_controller_test.rb

index 9a6102a16c5efcd8b6ae7fa57a493a17f576c070..647d322ed1b7ca061dcb0e556a8f583443aa16fb 100644 (file)
@@ -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
index 04fdd8ef731fd70e5e8c6c9c64fc83c5a107eb19..93229c423f6769520e059dc431579b26631562ec 100644 (file)
@@ -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