From 029273328c8ddddbbe67c13981a4afd72c9a31bc Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Wed, 31 Jul 2013 21:10:00 +0600 Subject: [PATCH] small refactoring build lists controller --- .../projects/build_lists_controller.rb | 28 ++++++------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/app/controllers/projects/build_lists_controller.rb b/app/controllers/projects/build_lists_controller.rb index cfc019472..99d71dfde 100644 --- a/app/controllers/projects/build_lists_controller.rb +++ b/app/controllers/projects/build_lists_controller.rb @@ -122,36 +122,24 @@ class Projects::BuildListsController < Projects::BaseController end @build_list.publisher = current_user - if @build_list.publish - redirect_to :back, :notice => t('layout.build_lists.publish_success') - else - redirect_to :back, :notice => t('layout.build_lists.publish_fail') - end + message = @build_list.publish ? 'success' : 'fail' + redirect_to :back, :notice => t("layout.build_lists.publish_#{message}") end def reject_publish @build_list.publisher = current_user - if @build_list.reject_publish - redirect_to :back, :notice => t('layout.build_lists.reject_publish_success') - else - redirect_to :back, :notice => t('layout.build_lists.reject_publish_fail') - end + message = @build_list.reject_publish ? 'success' : 'fail' + redirect_to :back, :notice => t("layout.build_lists.reject_publish_#{message}") end def create_container - if @build_list.publish_container - redirect_to :back, :notice => t('layout.build_lists.create_container_success') - else - redirect_to :back, :notice => t('layout.build_lists.create_container_fail') - end + message = @build_list.publish_container ? 'success' : 'fail' + redirect_to :back, :notice => t("layout.build_lists.create_container_#{message}") end def cancel - if @build_list.cancel - redirect_to :back, :notice => t('layout.build_lists.will_be_canceled') - else - redirect_to :back, :notice => t('layout.build_lists.cancel_fail') - end + message = @build_list.cancel ? 'will_be_canceled' : 'cancel_fail' + redirect_to :back, :notice => t("layout.build_lists.#{message}") end def log