[#3294] Allow the query string to control if the new deliverable form is visible.
This commit is contained in:
1 parent
aa541f42bb
commit
d552aa7f6f
3 files changed
+13
-1
No files matched your search
@@ -27,6 +27,8 @@ class DeliverablesController < ApplicationController
|
|||||||
|
|
||||||
@budget = Budget.new(@project.id)
|
@budget = Budget.new(@project.id)
|
||||||
|
|
||||||
|
@display_form = params[:new].present?
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { render :action => 'index', :layout => !request.xhr? }
|
format.html { render :action => 'index', :layout => !request.xhr? }
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if allowed_management? %>
|
<% if allowed_management? %>
|
||||||
<div id="new-deliverable" style="display:none;">
|
<div id="new-deliverable" style="<%= @display_form ? '' : 'display:none;' -%>">
|
||||||
<h2><%= l(:label_new_deliverable) %></h2>
|
<h2><%= l(:label_new_deliverable) %></h2>
|
||||||
<% remote_form_for :deliverable, @deliverable, :url => {:controller => 'deliverables', :action => 'create', :id => @project },
|
<% remote_form_for :deliverable, @deliverable, :url => {:controller => 'deliverables', :action => 'create', :id => @project },
|
||||||
:method => :post, :builder => TabularFormBuilder, :lang => current_language,
|
:method => :post, :builder => TabularFormBuilder, :lang => current_language,
|
||||||
|
|||||||
@@ -31,6 +31,16 @@ describe DeliverablesController,"#index when logged in" do
|
|||||||
assigns[:deliverables].should_not be_nil
|
assigns[:deliverables].should_not be_nil
|
||||||
end
|
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
|
it "should only show the deliverables for the current project only" do
|
||||||
# TODO: Get spec working for full finder
|
# TODO: Get spec working for full finder
|
||||||
Deliverable.should_receive(:find)
|
Deliverable.should_receive(:find)
|
||||||
|
|||||||
Reference in new issue
Block a user