@@ -31,7 +31,7 class CustomFieldsController < ApplicationController | |||||
31 | end |
|
31 | end | |
32 |
|
32 | |||
33 | def create |
|
33 | def create | |
34 |
if |
|
34 | if @custom_field.save | |
35 | flash[:notice] = l(:notice_successful_create) |
|
35 | flash[:notice] = l(:notice_successful_create) | |
36 | call_hook(:controller_custom_fields_new_after_save, :params => params, :custom_field => @custom_field) |
|
36 | call_hook(:controller_custom_fields_new_after_save, :params => params, :custom_field => @custom_field) | |
37 | redirect_to custom_fields_path(:tab => @custom_field.class.name) |
|
37 | redirect_to custom_fields_path(:tab => @custom_field.class.name) | |
@@ -44,7 +44,7 class CustomFieldsController < ApplicationController | |||||
44 | end |
|
44 | end | |
45 |
|
45 | |||
46 | def update |
|
46 | def update | |
47 |
if |
|
47 | if @custom_field.update_attributes(params[:custom_field]) | |
48 | flash[:notice] = l(:notice_successful_update) |
|
48 | flash[:notice] = l(:notice_successful_update) | |
49 | call_hook(:controller_custom_fields_edit_after_save, :params => params, :custom_field => @custom_field) |
|
49 | call_hook(:controller_custom_fields_edit_after_save, :params => params, :custom_field => @custom_field) | |
50 | redirect_to custom_fields_path(:tab => @custom_field.class.name) |
|
50 | redirect_to custom_fields_path(:tab => @custom_field.class.name) | |
@@ -54,10 +54,11 class CustomFieldsController < ApplicationController | |||||
54 | end |
|
54 | end | |
55 |
|
55 | |||
56 | def destroy |
|
56 | def destroy | |
57 | @custom_field.destroy |
|
57 | begin | |
58 | redirect_to custom_fields_path(:tab => @custom_field.class.name) |
|
58 | @custom_field.destroy | |
59 | rescue |
|
59 | rescue | |
60 | flash[:error] = l(:error_can_not_delete_custom_field) |
|
60 | flash[:error] = l(:error_can_not_delete_custom_field) | |
|
61 | end | |||
61 | redirect_to custom_fields_path(:tab => @custom_field.class.name) |
|
62 | redirect_to custom_fields_path(:tab => @custom_field.class.name) | |
62 | end |
|
63 | end | |
63 |
|
64 |
General Comments 0
You need to be logged in to leave comments.
Login now