From 0e2733a7cba5d992745d432f16e911a4c4dd216a Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 26 Nov 2011 17:56:52 +0000 Subject: [PATCH] View cleanup. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7939 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/application_helper.rb | 7 +++++++ app/views/groups/_general.html.erb | 2 +- app/views/groups/index.html.erb | 2 +- app/views/groups/new.html.erb | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6878932ef..45ce61175 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -871,6 +871,13 @@ module ApplicationHelper form_for(*args, &proc) end + def labelled_form_for(*args, &proc) + args << {} unless args.last.is_a?(Hash) + options = args.last + options.merge!({:builder => TabularFormBuilder}) + form_for(*args, &proc) + end + def back_url_hidden_field_tag back_url = params[:back_url] || request.env['HTTP_REFERER'] back_url = CGI.unescape(back_url.to_s) diff --git a/app/views/groups/_general.html.erb b/app/views/groups/_general.html.erb index f13ef32df..a9d05b7ca 100644 --- a/app/views/groups/_general.html.erb +++ b/app/views/groups/_general.html.erb @@ -1,4 +1,4 @@ -<% labelled_tabular_form_for :group, @group, :url => group_path(@group), :html => {:method => :put} do |f| %> +<% labelled_form_for @group do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> <%= submit_tag l(:button_save) %> <% end %> diff --git a/app/views/groups/index.html.erb b/app/views/groups/index.html.erb index 48b9ab42d..418563abd 100644 --- a/app/views/groups/index.html.erb +++ b/app/views/groups/index.html.erb @@ -14,7 +14,7 @@ <% @groups.each do |group| %> - <%= link_to h(group), :action => 'edit', :id => group %> + <%= link_to h(group), edit_group_path(group) %> <%= group.users.size %> <%= link_to l(:button_delete), group, :confirm => l(:text_are_you_sure), :method => :delete, :class => 'icon icon-del' %> diff --git a/app/views/groups/new.html.erb b/app/views/groups/new.html.erb index c200f5bdf..a4426f2d1 100644 --- a/app/views/groups/new.html.erb +++ b/app/views/groups/new.html.erb @@ -1,6 +1,6 @@

<%= link_to l(:label_group_plural), groups_path %> » <%= l(:label_group_new) %>

-<% form_for(@group, :builder => TabularFormBuilder, :lang => current_language) do |f| %> +<% labelled_form_for @group do |f| %> <%= render :partial => 'form', :locals => { :f => f } %>

<%= f.submit l(:button_create) %>