From bac1199247edc7ddacb7d74d2607664d90747b99 Mon Sep 17 00:00:00 2001 From: Rodrigo Souto Date: Tue, 31 Jul 2012 16:27:12 +0000 Subject: [PATCH] [multiples-templates] Fixing redirect action and template_id param --- app/controllers/admin/templates_controller.rb | 6 +++--- app/helpers/application_helper.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin/templates_controller.rb b/app/controllers/admin/templates_controller.rb index d3a532c..c188d0c 100644 --- a/app/controllers/admin/templates_controller.rb +++ b/app/controllers/admin/templates_controller.rb @@ -9,7 +9,7 @@ class TemplatesController < AdminController template = User.new(:login => identifier, :email => identifier+'@templates.noo', :password => password, :password_confirmation => password, :person_data => {:name => params[:name], :is_template => true}) template.save! session[:notice] = _('New template created') - redirect_to :action => 'edit_templates' + redirect_to :action => 'index' rescue @error = _('Name has already been taken') end @@ -21,7 +21,7 @@ class TemplatesController < AdminController begin create_organization_template(Community) session[:notice] = _('New template created') - redirect_to :action => 'edit_templates' + redirect_to :action => 'index' rescue @error = _('Name has already been taken') end @@ -33,7 +33,7 @@ class TemplatesController < AdminController begin create_organization_template(Enterprise) session[:notice] = _('New template created') - redirect_to :action => 'edit_templates' + redirect_to :action => 'index' rescue @error = _('Name has already been taken') end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f0c35c2..6d64f14 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1333,7 +1333,7 @@ module ApplicationHelper end def template_options(klass, field_name) - return hidden_field_tag("#{field_name}[template_id]", klass.templates.first) if klass.templates.count == 1 + return hidden_field_tag("#{field_name}[template_id]", klass.templates.first.id) if klass.templates.count == 1 counter = 0 radios = klass.templates.map do |template| -- libgit2 0.21.2