From ae0be85f76a141c07f84e926ac41708587dcac78 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Mon, 19 Jan 2009 10:45:53 -0800 Subject: [PATCH] Using form partial for the new rate. #1916 --- app/views/rates/_form.html.erb | 4 ++-- app/views/rates/new.html.erb | 28 ++-------------------------- app/views/users/_rates.html.erb | 1 + 3 files changed, 5 insertions(+), 28 deletions(-) diff --git a/app/views/rates/_form.html.erb b/app/views/rates/_form.html.erb index 1a8dde5..db0849b 100644 --- a/app/views/rates/_form.html.erb +++ b/app/views/rates/_form.html.erb @@ -1,4 +1,4 @@ -<% form_tag('/todo') do |f| %> +<% form_for(@rate) do |f| %> @@ -12,7 +12,7 @@ <%= text_field_tag "date_from", nil, :size => 10 %><%= calendar_for('date_from') %>
<%= l(:label_date) %> - <%= + <%= # TODO: move to controller once a hook is in place for the Admin panel projects = Project.find(:all, :conditions => { :status => Project::STATUS_ACTIVE}, :include => :parent) select_tag("project",projects_options_for_select(projects)) %> diff --git a/app/views/rates/new.html.erb b/app/views/rates/new.html.erb index 0452d95..d32d31c 100644 --- a/app/views/rates/new.html.erb +++ b/app/views/rates/new.html.erb @@ -1,27 +1,3 @@ -

New rate

+

<%= l(:rate_label_new_rate) %>

-<% form_for(@rate) do |f| %> - <%= f.error_messages %> - -

- <%= f.label :amount %>
- <%= f.text_field :amount %> -

-

- <%= f.label :user_id %>
- <%= f.text_field :user_id %> -

-

- <%= f.label :project_id %>
- <%= f.text_field :project_id %> -

-

- <%= f.label :date_in_effect %>
- <%= f.date_select :date_in_effect %> -

-

- <%= f.submit "Create" %> -

-<% end %> - -<%= link_to 'Back', rates_path %> +<%= render :partial => 'rates/form' %> diff --git a/app/views/users/_rates.html.erb b/app/views/users/_rates.html.erb index 5af545e..56f9be1 100644 --- a/app/views/users/_rates.html.erb +++ b/app/views/users/_rates.html.erb @@ -1,5 +1,6 @@

<%= l(:rate_label_new_rate) %>

+<% @rate = Rate.new(:user => @user ) %> <%= render :partial => 'rates/form' %>

<%= l(:rate_label_rate_history) %>