diff --git a/app/controllers/deliverables_controller.rb b/app/controllers/deliverables_controller.rb
index 820ffa2..ec46a3b 100644
--- a/app/controllers/deliverables_controller.rb
+++ b/app/controllers/deliverables_controller.rb
@@ -27,6 +27,8 @@ class DeliverablesController < ApplicationController
@budget = Budget.new(@project.id)
+ @display_form = params[:new].present?
+
respond_to do |format|
format.html { render :action => 'index', :layout => !request.xhr? }
end
diff --git a/app/views/deliverables/index.html.erb b/app/views/deliverables/index.html.erb
index aff93a3..fa7f601 100644
--- a/app/views/deliverables/index.html.erb
+++ b/app/views/deliverables/index.html.erb
@@ -3,7 +3,7 @@
<% if allowed_management? %>
-
+
<%= l(:label_new_deliverable) %>
<% remote_form_for :deliverable, @deliverable, :url => {:controller => 'deliverables', :action => 'create', :id => @project },
:method => :post, :builder => TabularFormBuilder, :lang => current_language,
diff --git a/spec/controllers/deliverables_controller_spec.rb b/spec/controllers/deliverables_controller_spec.rb
index a1e2d22..9c7839a 100644
--- a/spec/controllers/deliverables_controller_spec.rb
+++ b/spec/controllers/deliverables_controller_spec.rb
@@ -30,6 +30,16 @@ describe DeliverablesController,"#index when logged in" do
get :index, :id => @project.id
assigns[:deliverables].should_not be_nil
end
+
+ it "should set @display_form to false by default" do
+ get :index, :id => @project.id
+ assigns[:display_form].should eql(false)
+ end
+
+ it "should set @display_form to true if the 'new' parameter is used" do
+ get :index, :id => @project.id, :new => 'true'
+ assigns[:display_form].should eql(true)
+ end
it "should only show the deliverables for the current project only" do
# TODO: Get spec working for full finder