[#4181] Added link to delete a deliverable.
This commit is contained in:
1 parent
78a04c04bd
commit
d53f6bc021
4 files changed
+32
-1
No files matched your search
@@ -12,6 +12,10 @@ class DeliverablesController < InheritedResources::Base
|
|||||||
create! { contract_url(@project, @contract) }
|
create! { contract_url(@project, @contract) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
destroy! { contract_url(@project, @contract) }
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def begin_of_association_chain
|
def begin_of_association_chain
|
||||||
|
|||||||
@@ -31,6 +31,8 @@
|
|||||||
<th><%= l(:field_labor) %></th>
|
<th><%= l(:field_labor) %></th>
|
||||||
<th><%= l(:field_overhead) %></th>
|
<th><%= l(:field_overhead) %></th>
|
||||||
<th><%= l(:field_fixed) %></th>
|
<th><%= l(:field_fixed) %></th>
|
||||||
|
<th> </th>
|
||||||
|
<th><%= l(:button_delete) %></th>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% resource.deliverables.each do |deliverable| %>
|
<% resource.deliverables.each do |deliverable| %>
|
||||||
@@ -44,6 +46,9 @@
|
|||||||
<td class="labor">---</td>
|
<td class="labor">---</td>
|
||||||
<td class="overhead">---</td>
|
<td class="overhead">---</td>
|
||||||
<td class="fixed">---</td>
|
<td class="fixed">---</td>
|
||||||
|
<td> </td>
|
||||||
|
<td><%= link_to(l(:button_delete), contract_deliverable_path(@project, resource, deliverable), :method => :delete, :confirm => l(:text_are_you_sure), :class => 'icon icon-del') %></td>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ Redmine::Plugin.register :redmine_contracts do
|
|||||||
project_module :contracts do
|
project_module :contracts do
|
||||||
permission(:manage_budget, {
|
permission(:manage_budget, {
|
||||||
:contracts => [:index, :new, :create, :show, :edit, :update, :destroy],
|
:contracts => [:index, :new, :create, :show, :edit, :update, :destroy],
|
||||||
:deliverables => [:new, :create]
|
:deliverables => [:new, :create, :destroy]
|
||||||
}, :public => true)
|
}, :public => true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class DeliverablesDeleteTest < ActionController::IntegrationTest
|
||||||
|
include Redmine::I18n
|
||||||
|
|
||||||
|
def setup
|
||||||
|
@project = Project.generate!(:identifier => 'main')
|
||||||
|
@contract = Contract.generate!(:project => @project, :name => 'A Contract', :payment_terms => 'net_15')
|
||||||
|
@manager = User.generate!
|
||||||
|
@deliverable = FixedDeliverable.generate!(:contract => @contract, :manager => @manager)
|
||||||
|
end
|
||||||
|
|
||||||
|
should "allow anyone to delete the deliverable" do
|
||||||
|
visit_contract_page(@contract)
|
||||||
|
|
||||||
|
click_link_within "#fixed_deliverable_#{@deliverable.id}", 'Delete'
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'contracts/show'
|
||||||
|
|
||||||
|
assert_nil Deliverable.find_by_id(@deliverable.id), "Deliverable not deleted"
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in new issue
Block a user