Class: ObservationMatrixRowsController

Inherits:
ApplicationController show all
Includes:
DataControllerConfiguration::ProjectDataControllerConfiguration
Defined in:
app/controllers/observation_matrix_rows_controller.rb

Constant Summary

Constants included from ProjectsHelper

ProjectsHelper::CLASSIFIER, ProjectsHelper::CLASSIFIER_ANNOTATION

Instance Method Summary collapse

Methods included from DataControllerConfiguration::ProjectDataControllerConfiguration

#annotator_params

Methods included from RedirectHelper

#destroy_redirect

Methods included from RequestType

#json_request?

Methods included from LogRecent

#log_user_recent_route

Methods included from Cookies

#digest_cookie, #digested_cookie_exists?

Methods included from Whitelist

#whitelist_constantize

Methods included from ProjectsHelper

#cumulative_gb_per_year, #document_cumulative_gb_per_year, #document_gb_per_year, #gb_per_year, #image_cumulative_gb_per_year, #image_gb_per_year, #invalid_object, #project_classification, #project_link, #project_matches, #project_tag, #projects_list, #projects_search_form, #taxonworks_classification, #week_in_review_graphs

Methods included from Api::Intercept

#intercept_api

Methods included from TokenAuthentication

#intercept_project, #intercept_user, #intercept_user_or_project, #project_token_authenticate, #token_authenticate

Instance Method Details

#autocompleteObject



38
39
40
41
42
43
44
# File 'app/controllers/observation_matrix_rows_controller.rb', line 38

def autocomplete
  @observation_matrix_rows = Queries::ObservationMatrixRow::Autocomplete.new(
    params.require(:term),
    project_id: sessions_current_project_id,
    observation_matrix_id: params[:observation_matrix_id]
  ).autocomplete
end

#filter_paramsObject (private)



52
53
54
55
56
57
58
59
# File 'app/controllers/observation_matrix_rows_controller.rb', line 52

def filter_params
  params.permit(
    :observation_matrix_id,
    :observation_object_type,
    :observation_object_id,
    :observation_object_id_vector
  ).to_h.symbolize_keys.merge(project_id: sessions_current_project_id)
end

#indexObject

GET /observation_matrix_rows.json



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/observation_matrix_rows_controller.rb', line 8

def index
  respond_to do |format|
    format.html do
      @recent_objects = ObservationMatrixRow.recent_from_project_id(sessions_current_project_id).order(updated_at: :desc).limit(10)
      render '/shared/data/all/index'
    end
    format.json {
      @observation_matrix_rows = Queries::ObservationMatrixRow::Filter.new(filter_params)
        .all
        .order('observation_matrix_rows.position')
        .page(params[:page]).per(params[:per])
    }
  end
end

#listObject



28
29
30
# File 'app/controllers/observation_matrix_rows_controller.rb', line 28

def list
  @observation_matrix_rows = ObservationMatrixRow.where(project_id: sessions_current_project_id).page(params[:page])
end

#set_matrix_rowObject (private)



48
49
50
# File 'app/controllers/observation_matrix_rows_controller.rb', line 48

def set_matrix_row
  @observation_matrix_row = ObservationMatrixRow.where(project_id: sessions_current_project_id).find(params[:id])
end

#showObject

GET /observation_matrix_rows/1 GET /observation_matrix_rows/1.json



25
26
# File 'app/controllers/observation_matrix_rows_controller.rb', line 25

def show
end

#sortObject



33
34
35
36
# File 'app/controllers/observation_matrix_rows_controller.rb', line 33

def sort
  ObservationMatrixRow.sort(params.require(:ids))
  head :no_content 
end