From 8ff52851799a263c66ca00991da23a2dbeb3fcdc Mon Sep 17 00:00:00 2001 From: Luka Murn Date: Tue, 22 Nov 2016 14:57:01 +0100 Subject: [PATCH] Refactor some sample groups code --- app/controllers/sample_groups_controller.rb | 22 ++------------------- config/locales/en.yml | 8 -------- config/routes.rb | 2 +- 3 files changed, 3 insertions(+), 29 deletions(-) diff --git a/app/controllers/sample_groups_controller.rb b/app/controllers/sample_groups_controller.rb index 821de9bc4..bfacc6982 100644 --- a/app/controllers/sample_groups_controller.rb +++ b/app/controllers/sample_groups_controller.rb @@ -1,11 +1,6 @@ class SampleGroupsController < ApplicationController - before_action :load_vars_nested, only: [:new, :create] - before_action :check_create_permissions, only: [:new, :create] - - def new - @sample_group = SampleGroup.new - session[:return_to] ||= request.referer - end + before_action :load_vars_nested, only: [:create] + before_action :check_create_permissions, only: [:create] def create @sample_group = SampleGroup.new(sample_group_params) @@ -35,19 +30,6 @@ class SampleGroupsController < ApplicationController end end - def update - @sample_group.last_modified_by = current_user - if @sample_group.update_attributes(sample_group_params) - flash[:success] = t( - "sample_groups.update.success_flash", - sample_group: @sample_group.name, - organization: @organization.name) - redirect_to (session.delete(:return_to) || root_path) - else - render :edit - end - end - private def load_vars_nested diff --git a/config/locales/en.yml b/config/locales/en.yml index bbf4981ef..1d3d1d66b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -941,16 +941,8 @@ en: sample_groups: color_label: "Sample group color" - edit: - head_title: "%{organization} | Edit sample group" - title: "Edit sample group %{sample_group} from team %{organization}" - create: "Edit sample group" create: success_flash: "Successfully added sample group %{sample_group} to team %{organization}." - update: - success_flash: "Successfully updated sample group %{sample_group} to team %{organization}." - destroy: - success_flash: "Sample group %{sample_group} successfully deleted." activities: index: diff --git a/config/routes.rb b/config/routes.rb index 129526ec3..72d0d5bd0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -61,7 +61,7 @@ Rails.application.routes.draw do resources :organizations, only: [] do resources :samples, only: [:new, :create] resources :sample_types, only: [:new, :create] - resources :sample_groups, only: [:new, :create] + resources :sample_groups, only: [:create] resources :custom_fields, only: [:create] member do post 'parse_sheet'