From 58917fe378a37446cfa559c8271e2108c774e51b Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Thu, 22 Nov 2012 08:58:08 +1100 Subject: [PATCH] Convert enterprise select and name entry into form fields --- app/views/admin/enterprise_fees/index.html.haml | 11 ++++++++++- app/views/admin/enterprise_fees/index.rep | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/views/admin/enterprise_fees/index.html.haml b/app/views/admin/enterprise_fees/index.html.haml index 4e7bdd6187..484be94643 100644 --- a/app/views/admin/enterprise_fees/index.html.haml +++ b/app/views/admin/enterprise_fees/index.html.haml @@ -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 diff --git a/app/views/admin/enterprise_fees/index.rep b/app/views/admin/enterprise_fees/index.rep index d1b7bb46dc..fe0db9eb97 100644 --- a/app/views/admin/enterprise_fees/index.rep +++ b/app/views/admin/enterprise_fees/index.rep @@ -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