Fixed bug in with new shared multiple suppliers feature.
This commit is contained in:
parent
25fbb47320
commit
f4a0e29297
3 changed files with 10 additions and 4 deletions
|
@ -18,7 +18,7 @@ class SuppliersController < ApplicationController
|
||||||
def new
|
def new
|
||||||
if params[:shared_supplier_id]
|
if params[:shared_supplier_id]
|
||||||
shared_supplier = SharedSupplier.find(params[:shared_supplier_id])
|
shared_supplier = SharedSupplier.find(params[:shared_supplier_id])
|
||||||
@supplier = shared_supplier.build_supplier(shared_supplier.autofill_attributes)
|
@supplier = shared_supplier.suppliers.new(shared_supplier.autofill_attributes)
|
||||||
else
|
else
|
||||||
@supplier = Supplier.new
|
@supplier = Supplier.new
|
||||||
end
|
end
|
||||||
|
|
6
app/helpers/suppliers_helper.rb
Normal file
6
app/helpers/suppliers_helper.rb
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
module SuppliersHelper
|
||||||
|
|
||||||
|
def associated_supplier_names(shared_supplier)
|
||||||
|
"(#{shared_supplier.suppliers.map(&:name).join(', ')})"
|
||||||
|
end
|
||||||
|
end
|
|
@ -22,9 +22,9 @@
|
||||||
%td= shared_supplier.note
|
%td= shared_supplier.note
|
||||||
%td= shared_supplier.delivery_days
|
%td= shared_supplier.delivery_days
|
||||||
%td
|
%td
|
||||||
- if shared_supplier.suppliers
|
- if shared_supplier.suppliers.any?
|
||||||
%i.icon-ok
|
%i.icon-ok
|
||||||
= '(' + shared_supplier.suppliers.map{|s| s.name}.join(', ') + ')'
|
= associated_supplier_names(shared_supplier)
|
||||||
= link_to "abonnieren", new_supplier_path(:shared_supplier_id => shared_supplier), class: 'btn'
|
= link_to "erneut abonnieren", new_supplier_path(:shared_supplier_id => shared_supplier), class: 'btn'
|
||||||
- else
|
- else
|
||||||
= link_to "abonnieren", new_supplier_path(:shared_supplier_id => shared_supplier), class: 'btn'
|
= link_to "abonnieren", new_supplier_path(:shared_supplier_id => shared_supplier), class: 'btn'
|
||||||
|
|
Loading…
Reference in a new issue