Skip to content
Browse files

implemented project finish view

  • Loading branch information...
1 parent 675e822 commit f0f026c0c2d3d2d1b041e52ce0ca9cc7b727cab5 @zflat zflat committed Jul 5, 2012
View
3 app/controllers/projects_controller.rb
@@ -96,6 +96,9 @@ def transition
#
# via GET
def finish
+ if project.nil?
+ redirect_to root and return
+ end
end
# Case the project is done
View
2 app/views/projects/_project_inspection_history.html.erb
@@ -6,7 +6,7 @@
<th>Date started</th>
<th>Completion</th>
<th>Grade</th>
- <th>Inspection</th>
+ <th>Action</th>
</thead>
<tbody>
<% project.detail.inspections.each do |inspection| %>
View
6 app/views/projects/_project_step.html.erb
@@ -23,8 +23,10 @@
<% if step == :done %>
<% if project.open? %>
<% if project.detail.pass_req? %>
- <h3>Depart bike</h3>
-
+ <h3>Finish project</h3>
+ <%= form_for(project, :url=>close_project_path(project), :method => :put) do |f| %>
+ <%= f.submit "Close project and depart", :class=>"btn btn-primary" %>
+ <% end %>
<% else %>
<h3>Project Requirements</h3>
<p>Project requirements must be met before project is complete.</p>
View
1 app/views/projects/_project_step_eab.html.erb
@@ -1,5 +1,4 @@
<% if step == :inspected %>
- <h3>Inspection history</h3>
<%= render :partial => "project_inspection_history" %>
<hr />
<% end # step == :inspected %>
View
17 app/views/projects/finish.html.erb
@@ -0,0 +1,17 @@
+<% if project.detail.pass_req? %>
+<h1>Confirm project close-out</h1>
+ <p>Would you like to close the <%= project.prog.title %> bike <%= project.bike.number %>?</p>
+ <%= form_for(project, :url=>close_project_path(project), :method => :put) do |f| %>
+ <%= f.submit "Yes, close project and depart", :class=>"btn btn-primary" %>
+ <% end %>
+<% else %>
+ <h1>Project not done yet</h2>
+ <p>The project does not meet all requirements for finishing.</p>
+ <p><%= link_to "Go to the project page and to complete the project requirements", project_path(project) %></p>
+ <h2>Override requirements to finish</h2>
+ <p>If you must override project requirements, you can finish the project</p>
+ <%= form_for(project, :url=>close_project_path(project), :method => :put) do |f| %>
+ <%= hidden_field_tag(:force, "all") %>
+ <%= f.submit "Close UNFINISHED project and depart", :class=>"btn btn-primary" %>
+ <% end %>
+<% end %>

0 comments on commit f0f026c

Please sign in to comment.
Something went wrong with that request. Please try again.