Commit bac1199247edc7ddacb7d74d2607664d90747b99
Committed by
Daniela Feitosa
1 parent
96098b34
Exists in
master
and in
29 other branches
[multiples-templates] Fixing redirect action and template_id param
Showing
2 changed files
with
4 additions
and
4 deletions
Show diff stats
app/controllers/admin/templates_controller.rb
... | ... | @@ -9,7 +9,7 @@ class TemplatesController < AdminController |
9 | 9 | template = User.new(:login => identifier, :email => identifier+'@templates.noo', :password => password, :password_confirmation => password, :person_data => {:name => params[:name], :is_template => true}) |
10 | 10 | template.save! |
11 | 11 | session[:notice] = _('New template created') |
12 | - redirect_to :action => 'edit_templates' | |
12 | + redirect_to :action => 'index' | |
13 | 13 | rescue |
14 | 14 | @error = _('Name has already been taken') |
15 | 15 | end |
... | ... | @@ -21,7 +21,7 @@ class TemplatesController < AdminController |
21 | 21 | begin |
22 | 22 | create_organization_template(Community) |
23 | 23 | session[:notice] = _('New template created') |
24 | - redirect_to :action => 'edit_templates' | |
24 | + redirect_to :action => 'index' | |
25 | 25 | rescue |
26 | 26 | @error = _('Name has already been taken') |
27 | 27 | end |
... | ... | @@ -33,7 +33,7 @@ class TemplatesController < AdminController |
33 | 33 | begin |
34 | 34 | create_organization_template(Enterprise) |
35 | 35 | session[:notice] = _('New template created') |
36 | - redirect_to :action => 'edit_templates' | |
36 | + redirect_to :action => 'index' | |
37 | 37 | rescue |
38 | 38 | @error = _('Name has already been taken') |
39 | 39 | end | ... | ... |
app/helpers/application_helper.rb
... | ... | @@ -1333,7 +1333,7 @@ module ApplicationHelper |
1333 | 1333 | end |
1334 | 1334 | |
1335 | 1335 | def template_options(klass, field_name) |
1336 | - return hidden_field_tag("#{field_name}[template_id]", klass.templates.first) if klass.templates.count == 1 | |
1336 | + return hidden_field_tag("#{field_name}[template_id]", klass.templates.first.id) if klass.templates.count == 1 | |
1337 | 1337 | |
1338 | 1338 | counter = 0 |
1339 | 1339 | radios = klass.templates.map do |template| | ... | ... |