Class: Unico::SimilarityControlsController

Inherits:
CrudController
  • Object
show all
Defined in:
app/controllers/unico/similarity_controls_controller.rb

Direct Known Subclasses

SimilarityControlsController

Instance Method Summary collapse

Instance Method Details

#createObject



14
15
16
17
18
19
# File 'app/controllers/unico/similarity_controls_controller.rb', line 14

def create
  create! do |success, failure|
    success.html { redirect_to edit_resource_path(resource) }
    failure.html { render :new }
  end
end

#destroyObject



42
43
44
45
46
47
# File 'app/controllers/unico/similarity_controls_controller.rb', line 42

def destroy
  destroy! do |success, failure|
    success.html { redirect_to new_resource_path }
    failure.html { render :edit }
  end
end

#editObject



21
22
23
24
25
26
27
# File 'app/controllers/unico/similarity_controls_controller.rb', line 21

def edit
  if resource.processing?
    render :processing
  elsif resource.processed?
    render :edit
  end
end

#inactivate_recordsObject



49
50
51
52
53
# File 'app/controllers/unico/similarity_controls_controller.rb', line 49

def inactivate_records
  SimilarityControlAdjuster.inactivate!(resource)
  flash[:notice] = I18n.t('successfully_done')
  redirect_to edit_resource_path(resource)
end

#load_columnsObject



6
7
8
# File 'app/controllers/unico/similarity_controls_controller.rb', line 6

def load_columns
  @columns = SimilarityTable.columns(params[:table])
end

#showObject



10
11
12
# File 'app/controllers/unico/similarity_controls_controller.rb', line 10

def show
  render layout: 'report'
end

#updateObject



29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/controllers/unico/similarity_controls_controller.rb', line 29

def update
  update! do |success, failure|
    success.html do
      if params[:agglutinate] == 'true'
        redirect_to inactivate_records_similarity_control_path(resource)
      else
        redirect_to edit_resource_path(resource)
      end
    end
    failure.html { render :edit }
  end
end