mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-28 19:24:10 +08:00
Refactor some sample groups code
This commit is contained in:
parent
f5e286b1f6
commit
8ff5285179
3 changed files with 3 additions and 29 deletions
|
@ -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
|
||||
|
|
|
@ -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 <strong>%{sample_group}</strong> to team <strong>%{organization}</strong>."
|
||||
update:
|
||||
success_flash: "Successfully updated sample group <strong>%{sample_group}</strong> to team <strong>%{organization}</strong>."
|
||||
destroy:
|
||||
success_flash: "Sample group <strong>%{sample_group}</strong> successfully deleted."
|
||||
|
||||
activities:
|
||||
index:
|
||||
|
|
|
@ -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'
|
||||
|
|
Loading…
Reference in a new issue