Various small fixes

Particularly prevents blowing up on validation error

Completes #2187
This commit is contained in:
Trevor Vallender 2023-12-04 13:04:51 +00:00
parent 3e04193d16
commit 244c8f1a07
5 changed files with 6 additions and 10 deletions

View File

@ -26,10 +26,12 @@ class JobsController < ApplicationController
end
def create
if @job = Job.create(job_params)
@job = Job.new(job_params)
if @job.save
redirect_to project_job_path(@job.project, @job)
else
render :edit
@project = @job.project
render :new
end
end

View File

@ -24,7 +24,7 @@
<%= f.hidden_field :project_id, value: @job.project.id %>
<fieldset>
<legend>Budget</legend>
<legend>Budget (hours)</legend>
<%= f.fields_for :time_budgets do |ff| %>
<p>
<%= ff.label :hours, ff.object.category&.name || "Unassigned" %>

View File

@ -3,10 +3,6 @@
<td><%= job.category&.name || "Unassigned" %></td>
<td><%= format_date(job.starts_on) %></td>
<td><%= format_date(job.ends_on) %></td>
<td><%= job.project_id %></td>
<td>
<%= l_hours_short(job.total_time_budget) %>
</td>
<td>
<%= total_progress_bar(job) %>
</td>

View File

@ -15,8 +15,6 @@
<th>Category</th>
<th>Starts on</th>
<th>Ends on</th>
<th>Project</th>
<th>External project</th>
<th>Progress</th>
</tr>
</thead>

View File

@ -19,7 +19,7 @@
<div class="label">Starts on:</div>
<div class="value"><%= format_date(@job.starts_on) %></div>
<div class="label">Ends on:</div>
<div class="value"><%= format_date(@job.starts_on) %></div>
<div class="value"><%= format_date(@job.ends_on) %></div>
</div>
</div>
<div class="splitcontentright">