diff --git a/README.md b/README.md
index cea0e33..f4ea185 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,7 @@ The tier line is only there when a tier was reached. Both lines use the product/
## Running a week
-**Tech bonuses** (top menu) lists the weeks run so far. Pick a week to see:
+**Tech bonuses** (top menu) opens this week, so far. For those who run the bonus, its title links to the weeks run so far and a week picker. A week shows:
* the shop's hours, the goal, the tiers reached and the hours to the next tier;
* each technician's hours and bonus, with an **Attended** box. Uncheck a technician who missed part of a scheduled shift;
@@ -55,7 +55,7 @@ Restart Redmine, then:
* Check the target and amounts.
* Pick the product/service.
3. **Administration » Bonus technicians**: add each technician and the Foreman. Give each one their role, the QuickBooks customer account their bonus is credited to, and the last day of their probation if they're in it.
-4. **Administration » Roles and permissions**: give **Run tech bonuses** to the roles that run the bonus, and **View tech bonuses** to those who only see it (e.g. the Foreman). They're global permissions, so they apply to any role the user has in any project.
+4. **Administration » Roles and permissions**: give **Run tech bonuses** to the roles that run the bonus, and **View tech bonuses** to those who only see a week's hours and bonuses (e.g. the Foreman), without the weeks run. They're global permissions, so they apply to any role the user has in any project.
**View tech bonuses** shows the weeks and each week's hours, tiers and bonuses, read-only. It doesn't show the technicians' customer accounts, the attendance boxes, or the credit memos' QuickBooks and PDF links, and it can't run a week or email a credit memo.
diff --git a/app/controllers/tech_bonuses_controller.rb b/app/controllers/tech_bonuses_controller.rb
index 5ebb319..c72d715 100644
--- a/app/controllers/tech_bonuses_controller.rb
+++ b/app/controllers/tech_bonuses_controller.rb
@@ -30,6 +30,11 @@ class TechBonusesController < ApplicationController
@week = RedmineQboBonus::Week.last_completed
end
+ # The top menu opens this week, so far
+ def current
+ redirect_to tech_bonus_week_path(RedmineQboBonus::Week.containing(Date.current).to_param)
+ end
+
def show
@report = RedmineQboBonus::WeekReport.new(@week)
@bonus_week = TechBonusWeek.for(@week)
diff --git a/app/views/tech_bonuses/show.html.erb b/app/views/tech_bonuses/show.html.erb
index cec9cb8..dfdcb25 100644
--- a/app/views/tech_bonuses/show.html.erb
+++ b/app/views/tech_bonuses/show.html.erb
@@ -11,7 +11,7 @@
| <%= link_to sprite_icon('time', l(:label_tech_bonus_time_report)), report_time_entries_path(report.redmine_report_params), class: 'icon icon-time' %>
-
diff --git a/config/routes.rb b/config/routes.rb
index 45551e5..0bd5d4c 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -12,6 +12,7 @@ RedmineApp::Application.routes.draw do
# Weekly bonus: the weeks run, a week's hours and bonuses (by its Sunday, e.g. /tech_bonuses/2026-11-15)
get 'tech_bonuses', to: 'tech_bonuses#index', as: :tech_bonuses
+ get 'tech_bonuses/current', to: 'tech_bonuses#current', as: :current_tech_bonus_week
get 'tech_bonuses/:week', to: 'tech_bonuses#show', as: :tech_bonus_week, constraints: { week: /\d{4}-\d{2}-\d{2}/ }
post 'tech_bonuses/:week', to: 'tech_bonuses#create', constraints: { week: /\d{4}-\d{2}-\d{2}/ }
get 'tech_bonuses/credits/:id/pdf', to: 'tech_bonuses#pdf', as: :tech_bonus_credit_pdf
diff --git a/init.rb b/init.rb
index ea3cf74..c469c64 100644
--- a/init.rb
+++ b/init.rb
@@ -29,12 +29,12 @@ Redmine::Plugin.register :redmine_qbo_bonus do
settings default: RedmineQboBonus::Settings::DEFAULTS.dup, partial: 'settings/qbo_bonus'
- # Seeing the weeks' hours and bonuses (e.g. the Foreman), without running them or opening the credit memos
- permission :view_tech_bonuses, { tech_bonuses: [:index, :show] }, global: true
- # Previewing a week's bonus, creating and emailing its credit memos
- permission :run_tech_bonuses, { tech_bonuses: [:index, :show, :create, :resend, :pdf] }, global: true
+ # Seeing a week's hours and bonuses (e.g. the Foreman), without the weeks run, running them or opening the credit memos
+ permission :view_tech_bonuses, { tech_bonuses: [:current, :show] }, global: true
+ # The weeks run, previewing a week's bonus, creating and emailing its credit memos
+ permission :run_tech_bonuses, { tech_bonuses: [:index, :current, :show, :create, :resend, :pdf] }, global: true
- menu :top_menu, :tech_bonuses, { controller: 'tech_bonuses', action: 'index' },
+ menu :top_menu, :tech_bonuses, { controller: 'tech_bonuses', action: 'current' },
caption: :label_tech_bonus_plural, after: :my_page,
if: proc { RedmineQboBonus.visible? }
diff --git a/test/integration/tech_bonuses_test.rb b/test/integration/tech_bonuses_test.rb
index a44b4d8..c28e69a 100644
--- a/test/integration/tech_bonuses_test.rb
+++ b/test/integration/tech_bonuses_test.rb
@@ -31,7 +31,15 @@ class TechBonusesTest < Redmine::IntegrationTest
Role.find(1).add_permission!(:run_tech_bonuses)
get '/tech_bonuses'
assert_response :success
- assert_select '#top-menu a.tech-bonuses'
+ assert_select '#top-menu a.tech-bonuses[href=?]', '/tech_bonuses/current'
+ end
+
+ def test_menu_opens_this_week
+ log_user('admin', 'admin')
+ travel_to Date.new(2026, 11, 18) do
+ get '/tech_bonuses/current'
+ assert_redirected_to '/tech_bonuses/2026-11-15'
+ end
end
def test_view_only
@@ -43,10 +51,13 @@ class TechBonusesTest < Redmine::IntegrationTest
reset!
log_user('jsmith', 'jsmith')
get '/tech_bonuses'
- assert_response :success
- assert_select '#top-menu a.tech-bonuses'
+ assert_response :forbidden
+ get '/tech_bonuses/current'
+ assert_response :redirect
get '/tech_bonuses/2026-11-08'
assert_response :success
+ assert_select '#top-menu a.tech-bonuses[href=?]', '/tech_bonuses/current'
+ assert_select 'h2 a[href=?]', '/tech_bonuses', count: 0
assert_select 'td', text: '$100.00'
assert_select 'td', text: '#1042'
assert_select 'input[name=?]', 'attended[]', count: 0