Fix permissions and form variables

This commit is contained in:
Trevor Vallender 2023-11-26 20:25:27 +00:00
parent c8c7c195e8
commit 1c032cc42e
5 changed files with 5 additions and 5 deletions

View File

@ -10,7 +10,7 @@ class JobsController < ApplicationController
end end
def new def new
@job = Job.new.with_all_time_budgets @job = Job.new(project_id: @project.id).with_all_time_budgets
end end
def edit def edit

View File

@ -1,4 +1,4 @@
<%= form_with model: @job, url: job_path(@job, project_id: @job.project.id), id: "job_form" do |f| %> <%= form_with model: @job, url: form_target, id: "job_form" do |f| %>
<%= error_messages_for @job %> <%= error_messages_for @job %>
<div class="box tabular"> <div class="box tabular">
<p> <p>

View File

@ -1,5 +1,5 @@
<% html_title "Edit #{@job.name}" %> <% html_title "Edit #{@job.name}" %>
<h2>Edit <%= @job.name %></h2> <h2>Edit <%= @job.name %></h2>
<%= render "form" %> <%= render partial: "form", locals: { form_target: job_path(@job, project_id: @job.project) } %>

View File

@ -1,3 +1,3 @@
<h2><%= link_to "Jobs", jobs_path(project_id: @project.id) %> » New</h2> <h2><%= link_to "Jobs", jobs_path(project_id: @project.id) %> » New</h2>
<%= render "form" %> <%= render partial: "form", locals: { form_target: jobs_path } %>

View File

@ -6,7 +6,7 @@ Redmine::Plugin.register :jobs do
url 'http://tsvallender.co.uk' url 'http://tsvallender.co.uk'
author_url 'http://tsvallender.co.uk' author_url 'http://tsvallender.co.uk'
permission :jobs, { jobs: [:index, :show, :new, :create, :edit, :update, :destroy] }, public: true permission :jobs, { jobs: [:index, :show, :new, :create, :edit, :update, :destroy] }, public: false
menu :project_menu, :jobs, { controller: 'jobs', action: 'index' }, caption: 'Jobs', after: :issues, param: :project_id menu :project_menu, :jobs, { controller: 'jobs', action: 'index' }, caption: 'Jobs', after: :issues, param: :project_id
TimeEntry.safe_attributes 'job_id' TimeEntry.safe_attributes 'job_id'