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 end
def create def create
if @job = Job.create(job_params) @job = Job.new(job_params)
if @job.save
redirect_to project_job_path(@job.project, @job) redirect_to project_job_path(@job.project, @job)
else else
render :edit @project = @job.project
render :new
end end
end end

View File

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

View File

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

View File

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

View File

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