Convert enterprise select and name entry into form fields

This commit is contained in:
Rohan Mitchell
2012-11-22 08:58:08 +11:00
parent dd155532f8
commit 58917fe378
2 changed files with 11 additions and 1 deletions

View File

@@ -18,7 +18,16 @@
%th
%tbody
%tr{'ng-repeat' => 'enterprise_fee in enterprise_fees'}
%td {{ enterprise_fee.id }}
%td
%select{:id => 'enterprise_fee_set_collection_attributes_{{ $index }}_enterprise_id', :name => "enterprise_fee_set[collection_attributes][{{ $index }}][enterprise_id]", 'ng-model' => 'enterprise_fee'}
%option{:value => ""}
- Enterprise.all.each do |enterprise|
%option{:value => enterprise.id, 'ng-selected' => "enterprise_fee.enterprise_id == #{enterprise.id}"}= enterprise.name
%td {{ enterprise_fee.fee_type }}
%td= text_field_tag 'enterprise_fee_set[collection_attributes][{{ $index }}][name]', '{{ enterprise_fee.name }}', :id => 'enterprise_fee_set_collection_attributes_{{ $index }}_name'
%td {{ enterprise_fee.calculator_type }}
= enterprise_fee_set_form.fields_for :collection do |f|
- enterprise_fee = f.object
%tr

View File

@@ -3,4 +3,5 @@ r.list_of :enterprise_fees, @collection do
r.element :enterprise_id
r.element :fee_type
r.element :name
r.element :calculator_type
end