Assign users default time log categories

These will be used to show the amount logged against specific time
budgets on each project. It’s potentially a little naïve but we can
start with the simpler approach and see.

Refs #2165
This commit is contained in:
Trevor Vallender 2023-11-30 19:38:02 +00:00
parent 08b49a4263
commit a697bbf7be
6 changed files with 15 additions and 1 deletions

View File

@ -1,4 +1,3 @@
<p>
<%= form.label :job_id %>
<%= form.collection_select :job_id, Job.project_or_parent(@project), :id, :name %>
</p>

View File

@ -0,0 +1,3 @@
<p>
<%= form.label :time_budget_category_id %>
<%= form.collection_select :time_budget_category_id, TimeBudgetCategory.all, :id, :name, include_blank: true %>

View File

@ -1,6 +1,11 @@
en:
activerecord:
attributes:
user:
time_budget_category_id: Log time as
field_jobs: Jobs
field_job: Job
enumeration_time_budget_category: Time budget categories
enumeration_job_category: Job categories

View File

@ -0,0 +1,5 @@
class AddTimeBudgetCategoryIdToUsers < ActiveRecord::Migration[6.1]
def change
add_column :users, :time_budget_category_id, :integer
end
end

View File

@ -10,6 +10,7 @@ Redmine::Plugin.register :jobs do
menu :project_menu, :jobs, { controller: 'jobs', action: 'index' }, caption: 'Jobs', after: :issues, param: :project_id
TimeEntry.safe_attributes 'job_id'
User.safe_attributes 'time_budget_category_id'
Rails.application.config.before_initialize do
Rails.logger.info "Patch Jobs"

View File

@ -1,4 +1,5 @@
class JobsHookListener < Redmine::Hook::ViewListener
render_on :view_timelog_edit_form_bottom, partial: "timelogs/edit_form_bottom"
render_on :view_users_form, partial: "users/edit_form"
end