[#3294] Allow the query string to control if the new deliverable form is visible.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
</div>
|
||||
|
||||
<% 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>
|
||||
<% remote_form_for :deliverable, @deliverable, :url => {:controller => 'deliverables', :action => 'create', :id => @project },
|
||||
:method => :post, :builder => TabularFormBuilder, :lang => current_language,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user