diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/admin_public_body_categories_controller.rb | 8 | ||||
-rw-r--r-- | app/controllers/admin_public_body_headings_controller.rb | 11 |
2 files changed, 8 insertions, 11 deletions
diff --git a/app/controllers/admin_public_body_categories_controller.rb b/app/controllers/admin_public_body_categories_controller.rb index fda09fa4a..5e305dde3 100644 --- a/app/controllers/admin_public_body_categories_controller.rb +++ b/app/controllers/admin_public_body_categories_controller.rb @@ -22,7 +22,8 @@ class AdminPublicBodyCategoriesController < AdminController I18n.with_locale(I18n.default_locale) do if params[:public_body_category][:category_tag] && PublicBody.find_by_tag(@category.category_tag).count > 0 && @category.category_tag != params[:public_body_category][:category_tag] - flash[:notice] = 'There are authorities associated with this category, so the tag can\'t be renamed' + flash[:error] = "There are authorities associated with this category, so the tag can't be renamed" + render :action => 'edit' else if params[:headings] heading_ids = params[:headings].values @@ -48,10 +49,11 @@ class AdminPublicBodyCategoriesController < AdminController if @category.update_attributes(params[:public_body_category]) flash[:notice] = 'Category was successfully updated.' + redirect_to edit_admin_category_path(@category) + else + render :action => 'edit' end end - - render :action => 'edit' end end diff --git a/app/controllers/admin_public_body_headings_controller.rb b/app/controllers/admin_public_body_headings_controller.rb index c7c80e802..e893e760d 100644 --- a/app/controllers/admin_public_body_headings_controller.rb +++ b/app/controllers/admin_public_body_headings_controller.rb @@ -10,8 +10,10 @@ class AdminPublicBodyHeadingsController < AdminController @heading = PublicBodyHeading.find(params[:id]) if @heading.update_attributes(params[:public_body_heading]) flash[:notice] = 'Category heading was successfully updated.' + redirect_to edit_admin_heading_path(@heading) + else + render :action => 'edit' end - render :action => 'edit' end end @@ -54,13 +56,6 @@ class AdminPublicBodyHeadingsController < AdminController @locale = self.locale_from_params() I18n.with_locale(@locale) do heading = PublicBodyHeading.find(params[:id]) - - if heading.public_body_categories.count > 0 - flash[:notice] = "There are categories associated with this heading, so can't destroy it" - redirect_to edit_admin_heading_url(heading) - return - end - heading.destroy flash[:notice] = "Category heading was successfully destroyed." redirect_to admin_categories_url |