2016-02-12 23:52:43 +08:00
|
|
|
Rails.application.routes.draw do
|
2018-08-17 17:59:47 +08:00
|
|
|
use_doorkeeper do
|
|
|
|
skip_controllers :applications, :authorized_applications, :token_info
|
|
|
|
end
|
2017-01-03 16:49:18 +08:00
|
|
|
require 'subdomain'
|
2017-10-04 15:16:17 +08:00
|
|
|
|
|
|
|
def draw(routes_name)
|
|
|
|
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
|
|
|
|
end
|
|
|
|
|
2017-01-03 16:49:18 +08:00
|
|
|
constraints UserSubdomain do
|
2017-08-30 00:49:07 +08:00
|
|
|
devise_for :users,
|
|
|
|
controllers: { registrations: 'users/registrations',
|
|
|
|
sessions: 'users/sessions',
|
|
|
|
invitations: 'users/invitations',
|
|
|
|
confirmations: 'users/confirmations',
|
|
|
|
omniauth_callbacks: 'users/omniauth_callbacks' }
|
2016-11-30 23:43:33 +08:00
|
|
|
|
2018-10-29 06:19:06 +08:00
|
|
|
devise_scope :user do
|
|
|
|
authenticated :user do
|
|
|
|
root 'projects#index'
|
|
|
|
end
|
|
|
|
|
|
|
|
unauthenticated do
|
|
|
|
root 'users/sessions#new'
|
|
|
|
end
|
|
|
|
end
|
2016-02-12 23:52:43 +08:00
|
|
|
|
2018-01-29 22:42:22 +08:00
|
|
|
# # Client APP endpoints
|
|
|
|
# get '/settings', to: 'client_api/settings#index'
|
|
|
|
# get '/settings/*all', to: 'client_api/settings#index'
|
|
|
|
#
|
|
|
|
# namespace :client_api, defaults: { format: 'json' } do
|
|
|
|
# post '/premissions', to: 'permissions#status'
|
|
|
|
# %i(activities teams notifications users configurations).each do |path|
|
|
|
|
# draw path
|
|
|
|
# end
|
|
|
|
# end
|
2017-07-27 19:53:29 +08:00
|
|
|
|
2017-01-03 23:35:25 +08:00
|
|
|
# Save sample table state
|
2018-04-24 14:26:55 +08:00
|
|
|
# post '/state_save/:team_id/:user_id',
|
|
|
|
# to: 'user_samples#save_samples_table_status',
|
|
|
|
# as: 'save_samples_table_status',
|
|
|
|
# defaults: { format: 'json' }
|
|
|
|
#
|
|
|
|
# post '/state_load/:team_id/:user_id',
|
|
|
|
# to: 'user_samples#load_samples_table_status',
|
|
|
|
# as: 'load_samples_table_status',
|
|
|
|
# defaults: { format: 'json' }
|
2016-12-05 18:34:36 +08:00
|
|
|
|
2017-03-10 23:21:43 +08:00
|
|
|
resources :activities, only: [:index]
|
2016-02-12 23:52:43 +08:00
|
|
|
|
2017-03-10 23:21:43 +08:00
|
|
|
get 'forbidden', to: 'application#forbidden', as: 'forbidden'
|
|
|
|
get 'not_found', to: 'application#not_found', as: 'not_found'
|
2016-02-12 23:52:43 +08:00
|
|
|
|
2019-01-08 15:07:24 +08:00
|
|
|
# JS backend helpers
|
|
|
|
get 'helpers/to_user_date_format',
|
|
|
|
to: 'application#to_user_date_format',
|
|
|
|
as: 'to_user_date_format',
|
|
|
|
defaults: { format: 'json' }
|
|
|
|
|
2017-01-03 16:49:18 +08:00
|
|
|
# Settings
|
2017-07-28 21:37:28 +08:00
|
|
|
resources :users, only: :index # needed for testing signup
|
2017-11-08 23:23:52 +08:00
|
|
|
# needed for testing edit passowrd
|
|
|
|
get '/users/password', to: 'devise_password#edit'
|
2017-07-28 21:37:28 +08:00
|
|
|
|
2017-03-10 23:21:43 +08:00
|
|
|
get 'users/settings/account/preferences',
|
|
|
|
to: 'users/settings/account/preferences#index',
|
2017-01-03 16:49:18 +08:00
|
|
|
as: 'preferences'
|
2017-10-17 19:17:49 +08:00
|
|
|
get 'users/settings/account/addons',
|
|
|
|
to: 'users/settings/account/addons#index',
|
|
|
|
as: 'addons'
|
2017-03-10 23:21:43 +08:00
|
|
|
put 'users/settings/account/preferences',
|
|
|
|
to: 'users/settings/account/preferences#update',
|
2017-01-03 16:49:18 +08:00
|
|
|
as: 'update_preferences'
|
2018-09-05 22:36:32 +08:00
|
|
|
post 'users/settings/account/preferences/togglable_settings',
|
|
|
|
to: 'users/settings/account/preferences#update_togglable_settings',
|
|
|
|
as: 'update_togglable_settings',
|
2017-01-03 23:35:25 +08:00
|
|
|
defaults: { format: 'json' }
|
2017-02-09 18:07:16 +08:00
|
|
|
|
2017-03-10 23:21:43 +08:00
|
|
|
# Change user's current team
|
|
|
|
post 'users/settings/user_current_team',
|
|
|
|
to: 'users/settings#user_current_team',
|
|
|
|
as: 'user_current_team'
|
2017-02-09 21:33:12 +08:00
|
|
|
|
2017-03-10 23:21:43 +08:00
|
|
|
get 'users/settings/teams',
|
|
|
|
to: 'users/settings/teams#index',
|
|
|
|
as: 'teams'
|
|
|
|
post 'users/settings/teams/datatable',
|
|
|
|
to: 'users/settings/teams#datatable',
|
|
|
|
as: 'teams_datatable'
|
|
|
|
get 'users/settings/teams/new',
|
|
|
|
to: 'users/settings/teams#new',
|
|
|
|
as: 'new_team'
|
|
|
|
post 'users/settings/teams',
|
|
|
|
to: 'users/settings/teams#create',
|
|
|
|
as: 'create_team'
|
|
|
|
get 'users/settings/teams/:id',
|
|
|
|
to: 'users/settings/teams#show',
|
|
|
|
as: 'team'
|
|
|
|
post 'users/settings/teams/:id/users_datatable',
|
|
|
|
to: 'users/settings/teams#users_datatable',
|
|
|
|
as: 'team_users_datatable'
|
|
|
|
get 'users/settings/teams/:id/name_html',
|
|
|
|
to: 'users/settings/teams#name_html',
|
|
|
|
as: 'team_name'
|
|
|
|
get 'users/settings/teams/:id/description_html',
|
|
|
|
to: 'users/settings/teams#description_html',
|
|
|
|
as: 'team_description'
|
|
|
|
put 'users/settings/teams/:id',
|
|
|
|
to: 'users/settings/teams#update',
|
|
|
|
as: 'update_team'
|
|
|
|
delete 'users/settings/teams/:id',
|
|
|
|
to: 'users/settings/teams#destroy',
|
|
|
|
as: 'destroy_team'
|
2017-02-09 21:33:12 +08:00
|
|
|
|
2017-03-10 23:21:43 +08:00
|
|
|
put 'users/settings/user_teams/:id',
|
|
|
|
to: 'users/settings/user_teams#update',
|
|
|
|
as: 'update_user_team'
|
|
|
|
get 'users/settings/user_teams/:id/leave_html',
|
|
|
|
to: 'users/settings/user_teams#leave_html',
|
|
|
|
as: 'leave_user_team_html'
|
|
|
|
get 'users/settings/user_teams/:id/destroy_html',
|
|
|
|
to: 'users/settings/user_teams#destroy_html',
|
|
|
|
as: 'destroy_user_team_html'
|
|
|
|
delete 'users/settings/user_teams/:id',
|
|
|
|
to: 'users/settings/user_teams#destroy',
|
|
|
|
as: 'destroy_user_team'
|
2016-02-12 23:52:43 +08:00
|
|
|
|
2017-01-03 23:35:25 +08:00
|
|
|
# Invite users
|
|
|
|
devise_scope :user do
|
|
|
|
post '/invite',
|
|
|
|
to: 'users/invitations#invite_users',
|
|
|
|
as: 'invite_users'
|
|
|
|
end
|
2016-09-29 20:49:58 +08:00
|
|
|
|
2017-01-03 23:35:25 +08:00
|
|
|
# Notifications
|
|
|
|
get 'users/:id/recent_notifications',
|
|
|
|
to: 'user_notifications#recent_notifications',
|
|
|
|
as: 'recent_notifications',
|
|
|
|
defaults: { format: 'json' }
|
2016-09-29 20:49:58 +08:00
|
|
|
|
2017-01-03 23:35:25 +08:00
|
|
|
get 'users/:id/unseen_notification',
|
|
|
|
to: 'user_notifications#unseen_notification',
|
|
|
|
as: 'unseen_notification',
|
|
|
|
defaults: { format: 'json' }
|
2016-09-29 20:49:58 +08:00
|
|
|
|
2017-01-03 23:35:25 +08:00
|
|
|
get 'users/notifications',
|
|
|
|
to: 'user_notifications#index',
|
|
|
|
as: 'notifications'
|
2016-10-03 20:40:15 +08:00
|
|
|
|
2017-03-21 23:15:11 +08:00
|
|
|
# Get Zip Export
|
|
|
|
get 'zip_exports/download/:id',
|
|
|
|
to: 'zip_exports#download',
|
|
|
|
as: 'zip_exports_download'
|
2017-03-24 19:42:50 +08:00
|
|
|
|
2018-09-17 02:28:26 +08:00
|
|
|
# Get Team Zip Export
|
|
|
|
get 'zip_exports/download_export_all_zip/:id',
|
|
|
|
to: 'zip_exports#download_export_all_zip',
|
|
|
|
as: 'zip_exports_download_export_all'
|
|
|
|
|
2017-03-27 16:38:28 +08:00
|
|
|
get 'zip_exports/file_expired',
|
|
|
|
to: 'zip_exports#file_expired',
|
|
|
|
as: 'file_expired'
|
|
|
|
|
2017-03-10 23:21:43 +08:00
|
|
|
resources :teams do
|
2017-05-24 15:29:44 +08:00
|
|
|
resources :repositories, only: %i(index create destroy update) do
|
|
|
|
collection do
|
2017-06-06 21:50:43 +08:00
|
|
|
get 'create_modal', to: 'repositories#create_modal',
|
2017-05-24 15:29:44 +08:00
|
|
|
defaults: { format: 'json' }
|
|
|
|
end
|
2017-06-01 01:24:38 +08:00
|
|
|
get 'destroy_modal', to: 'repositories#destroy_modal',
|
|
|
|
defaults: { format: 'json' }
|
|
|
|
get 'rename_modal', to: 'repositories#rename_modal',
|
|
|
|
defaults: { format: 'json' }
|
2017-06-08 00:43:48 +08:00
|
|
|
get 'copy_modal', to: 'repositories#copy_modal',
|
|
|
|
defaults: { format: 'json' }
|
2017-06-08 01:11:25 +08:00
|
|
|
post 'copy', to: 'repositories#copy',
|
|
|
|
defaults: { format: 'json' }
|
2017-05-30 21:11:28 +08:00
|
|
|
end
|
2018-04-24 14:26:55 +08:00
|
|
|
# resources :samples, only: [:new, :create]
|
|
|
|
# resources :sample_types, except: [:show, :new] do
|
|
|
|
# get 'sample_type_element', to: 'sample_types#sample_type_element'
|
|
|
|
# get 'destroy_confirmation', to: 'sample_types#destroy_confirmation'
|
|
|
|
# end
|
|
|
|
# resources :sample_groups, except: [:show, :new] do
|
|
|
|
# get 'sample_group_element', to: 'sample_groups#sample_group_element'
|
|
|
|
# get 'destroy_confirmation', to: 'sample_groups#destroy_confirmation'
|
|
|
|
# end
|
|
|
|
# resources :custom_fields, only: [:create, :edit, :update, :destroy] do
|
|
|
|
# get 'destroy_html'
|
|
|
|
# end
|
2017-01-03 16:49:18 +08:00
|
|
|
member do
|
2018-04-10 19:19:53 +08:00
|
|
|
post 'parse_sheet', defaults: { format: 'json' }
|
2018-04-24 14:26:55 +08:00
|
|
|
# post 'import_samples'
|
|
|
|
# post 'export_samples'
|
2017-06-06 22:12:34 +08:00
|
|
|
post 'export_repository', to: 'repositories#export_repository'
|
2018-10-12 04:55:35 +08:00
|
|
|
post 'export_projects'
|
2018-11-16 20:37:32 +08:00
|
|
|
get 'export_projects_modal'
|
2017-03-10 23:21:43 +08:00
|
|
|
# Used for atwho (smart annotations)
|
|
|
|
get 'atwho_users', to: 'at_who#users'
|
2018-04-03 02:38:56 +08:00
|
|
|
get 'atwho_repositories', to: 'at_who#repositories'
|
|
|
|
get 'atwho_rep_items', to: 'at_who#rep_items'
|
2017-03-10 23:21:43 +08:00
|
|
|
get 'atwho_projects', to: 'at_who#projects'
|
|
|
|
get 'atwho_experiments', to: 'at_who#experiments'
|
|
|
|
get 'atwho_my_modules', to: 'at_who#my_modules'
|
|
|
|
get 'atwho_menu_items', to: 'at_who#menu_items'
|
2017-01-03 16:49:18 +08:00
|
|
|
end
|
|
|
|
match '*path',
|
2017-03-10 23:21:43 +08:00
|
|
|
to: 'teams#routing_error',
|
2017-01-03 16:49:18 +08:00
|
|
|
via: [:get, :post, :put, :patch]
|
|
|
|
end
|
2016-02-12 23:52:43 +08:00
|
|
|
|
2017-01-03 16:49:18 +08:00
|
|
|
get 'projects/archive', to: 'projects#archive', as: 'projects_archive'
|
2018-10-01 21:39:42 +08:00
|
|
|
post 'projects/index_dt', to: 'projects#index_dt', as: 'projects_index_dt'
|
2018-11-29 21:20:20 +08:00
|
|
|
get 'projects/sidebar', to: 'projects#sidebar', as: 'projects_sidebar'
|
2018-10-10 22:11:52 +08:00
|
|
|
get 'projects/dt_state_load', to: 'projects#dt_state_load',
|
|
|
|
as: 'projects_dt_state_load'
|
2016-02-12 23:52:43 +08:00
|
|
|
|
2018-04-18 22:47:52 +08:00
|
|
|
resources :reports, only: :index
|
|
|
|
get 'reports/datatable', to: 'reports#datatable'
|
|
|
|
post 'reports/visible_projects', to: 'reports#visible_projects',
|
|
|
|
defaults: { format: 'json' }
|
2018-05-16 15:31:19 +08:00
|
|
|
post 'reports/available_repositories', to: 'reports#available_repositories',
|
|
|
|
defaults: { format: 'json' }
|
|
|
|
post 'reports/save_pdf_to_inventory_item',
|
|
|
|
to: 'reports#save_pdf_to_inventory_item',
|
|
|
|
defaults: { format: 'json' }
|
2018-05-17 17:21:34 +08:00
|
|
|
post 'available_asset_type_columns',
|
|
|
|
to: 'repository_columns#available_asset_type_columns',
|
|
|
|
defaults: { format: 'json' }
|
2018-04-18 22:47:52 +08:00
|
|
|
post 'reports/destroy', to: 'reports#destroy'
|
|
|
|
|
2017-01-03 16:49:18 +08:00
|
|
|
resources :projects, except: [:new, :destroy] do
|
2017-03-10 23:21:43 +08:00
|
|
|
resources :user_projects, path: '/users',
|
|
|
|
only: [:create, :index, :update, :destroy]
|
2017-01-03 16:49:18 +08:00
|
|
|
resources :project_comments,
|
|
|
|
path: '/comments',
|
2017-03-10 23:21:43 +08:00
|
|
|
only: [:create, :index, :edit, :update, :destroy]
|
2017-01-03 16:49:18 +08:00
|
|
|
# Activities popup (JSON) for individual project in projects index,
|
|
|
|
# as well as all activities page for single project (HTML)
|
2017-03-10 23:21:43 +08:00
|
|
|
resources :project_activities, path: '/activities', only: [:index]
|
2017-01-03 16:49:18 +08:00
|
|
|
resources :tags, only: [:create, :update, :destroy]
|
|
|
|
resources :reports,
|
|
|
|
path: '/reports',
|
2018-04-18 22:47:52 +08:00
|
|
|
only: %i(edit update create) do
|
2017-01-03 16:49:18 +08:00
|
|
|
collection do
|
|
|
|
# The posts following here should in theory be gets,
|
|
|
|
# but are posts because of parameters payload
|
|
|
|
post 'generate', to: 'reports#generate'
|
|
|
|
get 'new/', to: 'reports#new'
|
|
|
|
get 'new/project_contents_modal',
|
|
|
|
to: 'reports#project_contents_modal',
|
|
|
|
as: :project_contents_modal
|
|
|
|
post 'new/project_contents',
|
|
|
|
to: 'reports#project_contents',
|
|
|
|
as: :project_contents
|
|
|
|
get 'new/experiment_contents_modal',
|
|
|
|
to: 'reports#experiment_contents_modal',
|
|
|
|
as: :experiment_contents_modal
|
|
|
|
post 'new/experiment_contents',
|
|
|
|
to: 'reports#experiment_contents',
|
|
|
|
as: :experiment_contents
|
|
|
|
get 'new/module_contents_modal',
|
|
|
|
to: 'reports#module_contents_modal',
|
|
|
|
as: :module_contents_modal
|
|
|
|
post 'new/module_contents',
|
|
|
|
to: 'reports#module_contents',
|
|
|
|
as: :module_contents
|
|
|
|
get 'new/step_contents_modal',
|
|
|
|
to: 'reports#step_contents_modal',
|
|
|
|
as: :step_contents_modal
|
|
|
|
post 'new/step_contents',
|
|
|
|
to: 'reports#step_contents',
|
|
|
|
as: :step_contents
|
|
|
|
get 'new/result_contents_modal',
|
|
|
|
to: 'reports#result_contents_modal',
|
|
|
|
as: :result_contents_modal
|
|
|
|
post 'new/result_contents',
|
|
|
|
to: 'reports#result_contents',
|
|
|
|
as: :result_contents
|
|
|
|
post '_save',
|
|
|
|
to: 'reports#save_modal',
|
|
|
|
as: :save_modal
|
|
|
|
end
|
|
|
|
end
|
|
|
|
resources :experiments,
|
|
|
|
only: [:new, :create, :edit, :update],
|
|
|
|
defaults: { format: 'json' }
|
|
|
|
member do
|
|
|
|
# Notifications popup for individual project in projects index
|
|
|
|
get 'notifications'
|
2018-04-24 14:26:55 +08:00
|
|
|
# get 'samples' # Samples for single project
|
2017-01-03 16:49:18 +08:00
|
|
|
# Renders sample datatable for single project (ajax action)
|
2018-04-24 14:26:55 +08:00
|
|
|
# post 'samples_index'
|
2017-01-03 16:49:18 +08:00
|
|
|
get 'experiment_archive' # Experiment archive for single project
|
2018-04-24 14:26:55 +08:00
|
|
|
# post :delete_samples,
|
|
|
|
# constraints: CommitParamRouting.new(
|
|
|
|
# ProjectsController::DELETE_SAMPLES
|
|
|
|
# ),
|
|
|
|
# action: :delete_samples
|
2017-01-03 16:49:18 +08:00
|
|
|
end
|
2017-03-10 23:21:43 +08:00
|
|
|
|
|
|
|
# This route is defined outside of member block
|
|
|
|
# to preserve original :project_id parameter in URL.
|
2017-01-03 16:49:18 +08:00
|
|
|
get 'users/edit', to: 'user_projects#index_edit'
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|
|
|
|
|
2017-01-03 16:49:18 +08:00
|
|
|
resources :experiments do
|
|
|
|
member do
|
|
|
|
get 'canvas' # Overview/structure for single experiment
|
|
|
|
# AJAX-loaded canvas edit mode (from canvas)
|
|
|
|
get 'canvas/edit', to: 'canvas#edit'
|
|
|
|
get 'canvas/full_zoom', to: 'canvas#full_zoom' # AJAX-loaded canvas zoom
|
|
|
|
# AJAX-loaded canvas zoom
|
|
|
|
get 'canvas/medium_zoom', to: 'canvas#medium_zoom'
|
2017-03-10 23:21:43 +08:00
|
|
|
get 'canvas/small_zoom', to: 'canvas#small_zoom' # AJAX-loaded canvas zoom
|
2017-01-03 16:49:18 +08:00
|
|
|
post 'canvas', to: 'canvas#update' # Save updated canvas action
|
|
|
|
get 'module_archive' # Module archive for single experiment
|
2019-01-12 00:20:04 +08:00
|
|
|
get 'my_module_tags', to: 'my_module_tags#canvas_index'
|
2017-01-03 16:49:18 +08:00
|
|
|
get 'archive' # archive experiment
|
|
|
|
get 'clone_modal' # return modal with clone options
|
|
|
|
post 'clone' # clone experiment
|
|
|
|
get 'move_modal' # return modal with move options
|
|
|
|
post 'move' # move experiment
|
2018-04-24 14:26:55 +08:00
|
|
|
# get 'samples' # Samples for single project
|
2017-01-03 16:49:18 +08:00
|
|
|
get 'updated_img' # Checks if the workflow image is updated
|
|
|
|
get 'fetch_workflow_img' # Get udated workflow img
|
|
|
|
# Renders sample datatable for single project (ajax action)
|
2018-04-24 14:26:55 +08:00
|
|
|
# post 'samples_index'
|
|
|
|
# post :delete_samples,
|
|
|
|
# constraints: CommitParamRouting.new(
|
|
|
|
# ExperimentsController::DELETE_SAMPLES
|
|
|
|
# ),
|
|
|
|
# action: :delete_samples
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-01-03 16:49:18 +08:00
|
|
|
# Show action is a popup (JSON) for individual module in full-zoom canvas,
|
2017-03-10 23:21:43 +08:00
|
|
|
# as well as 'module info' page for single module (HTML)
|
|
|
|
resources :my_modules, path: '/modules', only: [:show, :update] do
|
2019-03-06 16:18:45 +08:00
|
|
|
resources :my_module_tags, path: '/tags', only: [:index, :create, :destroy] do
|
2019-05-13 22:53:58 +08:00
|
|
|
collection do
|
2019-03-06 16:18:45 +08:00
|
|
|
get :search_tags
|
|
|
|
end
|
2019-05-13 22:53:58 +08:00
|
|
|
member do
|
2019-03-06 16:18:45 +08:00
|
|
|
post :destroy_by_tag_id
|
|
|
|
end
|
|
|
|
end
|
2017-03-10 23:21:43 +08:00
|
|
|
resources :user_my_modules, path: '/users',
|
|
|
|
only: [:index, :create, :destroy]
|
2017-01-03 16:49:18 +08:00
|
|
|
resources :my_module_comments,
|
|
|
|
path: '/comments',
|
2017-03-10 23:21:43 +08:00
|
|
|
only: [:index, :create, :edit, :update, :destroy]
|
2018-04-24 14:26:55 +08:00
|
|
|
# resources :sample_my_modules, path: '/samples_index', only: [:index]
|
2017-01-03 16:49:18 +08:00
|
|
|
resources :result_texts, only: [:new, :create]
|
|
|
|
resources :result_assets, only: [:new, :create]
|
|
|
|
resources :result_tables, only: [:new, :create]
|
|
|
|
member do
|
|
|
|
# AJAX popup accessed from full-zoom canvas for single module,
|
|
|
|
# as well as full activities view (HTML) for single module
|
|
|
|
get 'description'
|
|
|
|
get 'activities'
|
2019-03-28 17:55:48 +08:00
|
|
|
post 'activities'
|
2017-01-03 16:49:18 +08:00
|
|
|
get 'activities_tab' # Activities in tab view for single module
|
|
|
|
get 'due_date'
|
2019-03-20 18:41:36 +08:00
|
|
|
patch 'description',
|
|
|
|
to: 'my_modules#update_description',
|
|
|
|
as: 'update_description'
|
2019-03-14 23:08:52 +08:00
|
|
|
patch 'protocol_description',
|
|
|
|
to: 'my_modules#update_protocol_description',
|
|
|
|
as: 'update_protocol_description'
|
2017-01-03 16:49:18 +08:00
|
|
|
get 'protocols' # Protocols view for single module
|
|
|
|
get 'results' # Results view for single module
|
2018-04-24 14:26:55 +08:00
|
|
|
# get 'samples' # Samples view for single module
|
2017-05-18 20:21:00 +08:00
|
|
|
# Repository view for single module
|
|
|
|
get 'repository/:repository_id',
|
|
|
|
to: 'my_modules#repository',
|
|
|
|
as: :repository
|
2017-06-06 23:35:29 +08:00
|
|
|
post 'repository_index/:repository_id',
|
|
|
|
to: 'my_modules#repository_index',
|
|
|
|
as: :repository_index
|
2018-04-23 17:33:16 +08:00
|
|
|
post 'assign_repository_records_modal/:repository_id',
|
|
|
|
to: 'my_modules#assign_repository_records_modal',
|
|
|
|
as: :assign_repository_records_modal
|
2017-06-06 23:35:29 +08:00
|
|
|
post 'assign_repository_records/:repository_id',
|
|
|
|
to: 'my_modules#assign_repository_records',
|
|
|
|
as: :assign_repository_records
|
2018-04-23 17:33:16 +08:00
|
|
|
post 'unassign_repository_records_modal/:repository_id',
|
|
|
|
to: 'my_modules#unassign_repository_records_modal',
|
|
|
|
as: :unassign_repository_records_modal
|
2017-06-06 23:35:29 +08:00
|
|
|
post 'unassign_repository_records/:repository_id',
|
|
|
|
to: 'my_modules#unassign_repository_records',
|
|
|
|
as: :unassign_repository_records
|
2017-01-03 16:49:18 +08:00
|
|
|
get 'archive' # Archive view for single module
|
2017-05-04 18:41:22 +08:00
|
|
|
get 'complete_my_module'
|
2017-03-10 23:21:43 +08:00
|
|
|
post 'toggle_task_state'
|
2019-01-03 21:11:00 +08:00
|
|
|
get 'repositories_dropdown',
|
|
|
|
to: 'my_modules#repositories_dropdown',
|
|
|
|
as: :repositories_dropdown
|
|
|
|
get 'repositories_dropdown/:repository_id',
|
|
|
|
to: 'my_modules#repositories_dropdown',
|
|
|
|
as: :repositories_dropdown_repository_tab
|
2017-01-03 16:49:18 +08:00
|
|
|
# Renders sample datatable for single module (ajax action)
|
2018-04-24 14:26:55 +08:00
|
|
|
# post 'samples_index'
|
|
|
|
# post :assign_samples,
|
|
|
|
# constraints: CommitParamRouting.new(
|
|
|
|
# MyModulesController::ASSIGN_SAMPLES
|
|
|
|
# ),
|
|
|
|
# action: :assign_samples
|
|
|
|
# post :assign_samples,
|
|
|
|
# constraints: CommitParamRouting.new(
|
|
|
|
# MyModulesController::UNASSIGN_SAMPLES
|
|
|
|
# ),
|
|
|
|
# action: :unassign_samples
|
|
|
|
# post :assign_samples,
|
|
|
|
# constraints: CommitParamRouting.new(
|
|
|
|
# MyModulesController::DELETE_SAMPLES
|
|
|
|
# ),
|
|
|
|
# action: :delete_samples
|
2017-01-03 16:49:18 +08:00
|
|
|
end
|
2016-02-12 23:52:43 +08:00
|
|
|
|
2017-03-10 23:21:43 +08:00
|
|
|
# Those routes are defined outside of member block
|
|
|
|
# to preserve original id parameters in URL.
|
2017-01-03 16:49:18 +08:00
|
|
|
get 'tags/edit', to: 'my_module_tags#index_edit'
|
|
|
|
get 'users/edit', to: 'user_my_modules#index_edit'
|
2016-07-28 17:30:34 +08:00
|
|
|
end
|
|
|
|
|
2017-01-03 16:49:18 +08:00
|
|
|
resources :steps, only: [:edit, :update, :destroy, :show] do
|
|
|
|
resources :step_comments,
|
|
|
|
path: '/comments',
|
2017-03-10 23:21:43 +08:00
|
|
|
only: [:create, :index, :edit, :update, :destroy]
|
2017-01-03 16:49:18 +08:00
|
|
|
member do
|
|
|
|
post 'checklistitem_state'
|
|
|
|
post 'toggle_step_state'
|
|
|
|
get 'move_down'
|
|
|
|
get 'move_up'
|
|
|
|
end
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|
|
|
|
|
2019-02-13 20:06:14 +08:00
|
|
|
# System notifications routes
|
2019-02-19 21:46:15 +08:00
|
|
|
resources :system_notifications, only: %i(index show) do
|
2019-02-13 20:06:14 +08:00
|
|
|
collection do
|
|
|
|
post 'mark_as_seen'
|
2019-02-19 18:08:59 +08:00
|
|
|
get 'unseen_counter'
|
2019-02-13 20:06:14 +08:00
|
|
|
end
|
2019-02-15 20:07:29 +08:00
|
|
|
member do
|
|
|
|
post 'mark_as_read'
|
|
|
|
end
|
2019-02-13 20:06:14 +08:00
|
|
|
end
|
|
|
|
|
2017-04-19 15:11:52 +08:00
|
|
|
# tinyMCE image uploader endpoint
|
|
|
|
post '/tinymce_assets', to: 'tiny_mce_assets#create', as: :tiny_mce_assets
|
|
|
|
|
2017-01-03 16:49:18 +08:00
|
|
|
resources :results, only: [:update, :destroy] do
|
|
|
|
resources :result_comments,
|
|
|
|
path: '/comments',
|
2017-03-10 23:21:43 +08:00
|
|
|
only: [:create, :index, :edit, :update, :destroy]
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|
|
|
|
|
2018-04-24 14:26:55 +08:00
|
|
|
# resources :samples, only: [:edit, :update, :destroy]
|
|
|
|
# get 'samples/:id', to: 'samples#show'
|
2016-09-23 23:45:02 +08:00
|
|
|
|
2017-01-03 16:49:18 +08:00
|
|
|
resources :result_texts, only: [:edit, :update, :destroy]
|
|
|
|
get 'result_texts/:id/download' => 'result_texts#download',
|
2017-03-10 23:21:43 +08:00
|
|
|
as: :result_text_download
|
2017-01-03 16:49:18 +08:00
|
|
|
resources :result_assets, only: [:edit, :update, :destroy]
|
|
|
|
get 'result_assets/:id/download' => 'result_assets#download',
|
2017-03-10 23:21:43 +08:00
|
|
|
as: :result_asset_download
|
2017-01-03 16:49:18 +08:00
|
|
|
resources :result_tables, only: [:edit, :update, :destroy]
|
|
|
|
get 'result_tables/:id/download' => 'result_tables#download',
|
2017-03-10 23:21:43 +08:00
|
|
|
as: :result_table_download
|
2016-02-12 23:52:43 +08:00
|
|
|
|
2017-01-03 16:49:18 +08:00
|
|
|
resources :protocols, only: [:index, :edit, :create] do
|
|
|
|
resources :steps, only: [:new, :create]
|
|
|
|
member do
|
|
|
|
get 'linked_children', to: 'protocols#linked_children'
|
|
|
|
post 'linked_children_datatable',
|
|
|
|
to: 'protocols#linked_children_datatable'
|
2017-03-10 23:21:43 +08:00
|
|
|
get 'preview', to: 'protocols#preview'
|
2019-04-24 19:34:56 +08:00
|
|
|
patch 'description', to: 'protocols#update_description'
|
2017-01-03 16:49:18 +08:00
|
|
|
patch 'metadata', to: 'protocols#update_metadata'
|
|
|
|
patch 'keywords', to: 'protocols#update_keywords'
|
|
|
|
post 'clone', to: 'protocols#clone'
|
|
|
|
get 'unlink_modal', to: 'protocols#unlink_modal'
|
|
|
|
post 'unlink', to: 'protocols#unlink'
|
|
|
|
get 'revert_modal', to: 'protocols#revert_modal'
|
|
|
|
post 'revert', to: 'protocols#revert'
|
|
|
|
get 'update_parent_modal', to: 'protocols#update_parent_modal'
|
|
|
|
post 'update_parent', to: 'protocols#update_parent'
|
|
|
|
get 'update_from_parent_modal', to: 'protocols#update_from_parent_modal'
|
|
|
|
post 'update_from_parent', to: 'protocols#update_from_parent'
|
|
|
|
post 'load_from_repository_datatable',
|
|
|
|
to: 'protocols#load_from_repository_datatable'
|
|
|
|
get 'load_from_repository_modal',
|
|
|
|
to: 'protocols#load_from_repository_modal'
|
|
|
|
post 'load_from_repository', to: 'protocols#load_from_repository'
|
|
|
|
post 'load_from_file', to: 'protocols#load_from_file'
|
2017-09-15 21:52:55 +08:00
|
|
|
|
2017-01-03 16:49:18 +08:00
|
|
|
get 'copy_to_repository_modal', to: 'protocols#copy_to_repository_modal'
|
|
|
|
post 'copy_to_repository', to: 'protocols#copy_to_repository'
|
|
|
|
get 'protocol_status_bar', to: 'protocols#protocol_status_bar'
|
|
|
|
get 'updated_at_label', to: 'protocols#updated_at_label'
|
|
|
|
get 'edit_name_modal', to: 'protocols#edit_name_modal'
|
|
|
|
get 'edit_keywords_modal', to: 'protocols#edit_keywords_modal'
|
|
|
|
get 'edit_authors_modal', to: 'protocols#edit_authors_modal'
|
|
|
|
get 'edit_description_modal', to: 'protocols#edit_description_modal'
|
|
|
|
end
|
|
|
|
collection do
|
|
|
|
get 'create_new_modal', to: 'protocols#create_new_modal'
|
|
|
|
post 'datatable', to: 'protocols#datatable'
|
|
|
|
post 'make_private', to: 'protocols#make_private'
|
|
|
|
post 'publish', to: 'protocols#publish'
|
|
|
|
post 'archive', to: 'protocols#archive'
|
|
|
|
post 'restore', to: 'protocols#restore'
|
|
|
|
post 'import', to: 'protocols#import'
|
2018-03-16 17:53:05 +08:00
|
|
|
post 'protocolsio_import_create',
|
|
|
|
to: 'protocols#protocolsio_import_create'
|
2017-09-15 21:52:55 +08:00
|
|
|
post 'protocolsio_import_save', to: 'protocols#protocolsio_import_save'
|
2017-01-03 16:49:18 +08:00
|
|
|
get 'export', to: 'protocols#export'
|
|
|
|
end
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|
|
|
|
|
2017-06-06 23:35:29 +08:00
|
|
|
resources :repositories do
|
|
|
|
post 'repository_index',
|
2018-03-16 17:53:05 +08:00
|
|
|
to: 'repository_rows#index',
|
2017-06-06 23:35:29 +08:00
|
|
|
as: 'table_index',
|
|
|
|
defaults: { format: 'json' }
|
|
|
|
# Save repository table state
|
|
|
|
post 'state_save',
|
|
|
|
to: 'user_repositories#save_table_state',
|
|
|
|
as: 'save_table_state',
|
|
|
|
defaults: { format: 'json' }
|
|
|
|
# Load repository table state
|
|
|
|
post 'state_load',
|
|
|
|
to: 'user_repositories#load_table_state',
|
|
|
|
as: 'load_table_state',
|
|
|
|
defaults: { format: 'json' }
|
|
|
|
# Delete records from repository
|
|
|
|
post 'delete_records',
|
|
|
|
to: 'repository_rows#delete_records',
|
|
|
|
as: 'delete_records',
|
|
|
|
defaults: { format: 'json' }
|
2018-04-11 23:17:19 +08:00
|
|
|
post 'copy_records',
|
|
|
|
to: 'repository_rows#copy_records',
|
|
|
|
defaults: { format: 'json' }
|
2018-03-22 16:35:36 +08:00
|
|
|
get 'repository_columns/:id/destroy_html',
|
2018-03-23 23:00:33 +08:00
|
|
|
to: 'repository_columns#destroy_html',
|
|
|
|
as: 'columns_destroy_html'
|
|
|
|
get 'create_html',
|
|
|
|
to: 'repository_columns#create_html',
|
|
|
|
as: 'columns_create_html',
|
|
|
|
defaults: { format: 'json' }
|
2018-06-12 21:28:03 +08:00
|
|
|
get 'available_columns',
|
|
|
|
to: 'repository_columns#available_columns',
|
|
|
|
as: 'available_columns',
|
|
|
|
defaults: { format: 'json' }
|
2017-06-06 23:35:29 +08:00
|
|
|
|
2018-03-22 16:35:36 +08:00
|
|
|
resources :repository_columns, only: %i(index create edit update destroy)
|
2017-06-06 23:35:29 +08:00
|
|
|
resources :repository_rows, only: %i(create edit update)
|
2017-06-13 14:10:10 +08:00
|
|
|
member do
|
2018-04-10 19:19:53 +08:00
|
|
|
post 'parse_sheet', defaults: { format: 'json' }
|
2017-06-13 14:10:10 +08:00
|
|
|
post 'import_records'
|
|
|
|
end
|
2017-06-06 23:35:29 +08:00
|
|
|
end
|
|
|
|
|
2018-05-16 15:31:19 +08:00
|
|
|
post 'available_rows', to: 'repository_rows#available_rows',
|
|
|
|
defaults: { format: 'json' }
|
|
|
|
|
2018-03-15 22:43:16 +08:00
|
|
|
post 'repository_list_items', to: 'repository_list_items#search',
|
|
|
|
defaults: { format: 'json' }
|
|
|
|
|
2018-02-27 23:21:46 +08:00
|
|
|
get 'repository_rows/:id', to: 'repository_rows#show',
|
|
|
|
as: :repository_row,
|
|
|
|
defaults: { format: 'json' }
|
|
|
|
|
2017-01-03 16:49:18 +08:00
|
|
|
get 'search' => 'search#index'
|
|
|
|
get 'search/new' => 'search#new', as: :new_search
|
2016-07-21 19:11:15 +08:00
|
|
|
|
2017-01-03 16:49:18 +08:00
|
|
|
# We cannot use 'resources :assets' because assets is a reserved route
|
|
|
|
# in Rails (assets pipeline) and causes funky behavior
|
|
|
|
get 'files/:id/present', to: 'assets#file_present', as: 'file_present_asset'
|
2019-05-13 22:53:58 +08:00
|
|
|
get 'files/:id/present_in_step', to: 'assets#step_file_present', as: 'step_file_present_asset'
|
2018-03-30 17:50:28 +08:00
|
|
|
get 'files/:id/preview',
|
|
|
|
to: 'assets#file_preview',
|
|
|
|
as: 'asset_file_preview'
|
2017-01-03 16:49:18 +08:00
|
|
|
get 'files/:id/download', to: 'assets#download', as: 'download_asset'
|
|
|
|
get 'files/:id/preview', to: 'assets#preview', as: 'preview_asset'
|
|
|
|
get 'files/:id/view', to: 'assets#view', as: 'view_asset'
|
|
|
|
get 'files/:id/edit', to: 'assets#edit', as: 'edit_asset'
|
2018-10-19 16:00:58 +08:00
|
|
|
post 'files/:id/update_image', to: 'assets#update_image',
|
|
|
|
as: 'update_asset_image'
|
2019-03-16 03:59:15 +08:00
|
|
|
post 'files/create_wopi_file',
|
|
|
|
to: 'assets#create_wopi_file',
|
|
|
|
as: 'create_wopi_file'
|
2016-02-12 23:52:43 +08:00
|
|
|
|
2017-01-03 16:49:18 +08:00
|
|
|
devise_scope :user do
|
|
|
|
get 'avatar/:id/:style' => 'users/registrations#avatar', as: 'avatar'
|
|
|
|
post 'avatar_signature' => 'users/registrations#signature'
|
2017-01-03 23:35:25 +08:00
|
|
|
get 'users/auth_token_sign_in' => 'users/sessions#auth_token_create'
|
2018-02-26 18:05:05 +08:00
|
|
|
get 'users/sign_up_provider' => 'users/registrations#new_with_provider'
|
2018-03-02 00:52:24 +08:00
|
|
|
post 'users/complete_sign_up_provider' =>
|
|
|
|
'users/registrations#create_with_provider'
|
2017-01-03 16:49:18 +08:00
|
|
|
end
|
2017-08-30 00:49:07 +08:00
|
|
|
|
|
|
|
namespace :api, defaults: { format: 'json' } do
|
2018-01-22 23:52:48 +08:00
|
|
|
get 'health', to: 'api#health'
|
2017-08-30 00:49:07 +08:00
|
|
|
get 'status', to: 'api#status'
|
2019-01-04 17:44:38 +08:00
|
|
|
if Api.configuration.core_api_v1_enabled
|
2018-08-24 18:11:28 +08:00
|
|
|
namespace :v1 do
|
|
|
|
resources :teams, only: %i(index show) do
|
2018-08-24 22:41:26 +08:00
|
|
|
resources :inventories,
|
|
|
|
only: %i(index create show update destroy) do
|
|
|
|
resources :inventory_columns,
|
|
|
|
only: %i(index create show update destroy),
|
|
|
|
path: 'columns',
|
2018-10-03 19:22:11 +08:00
|
|
|
as: :columns do
|
|
|
|
resources :inventory_list_items,
|
|
|
|
only: %i(index create show update destroy),
|
|
|
|
path: 'list_items',
|
|
|
|
as: :list_items
|
|
|
|
end
|
2018-08-24 17:26:49 +08:00
|
|
|
resources :inventory_items,
|
|
|
|
only: %i(index create show update destroy),
|
|
|
|
path: 'items',
|
2018-10-05 06:18:42 +08:00
|
|
|
as: :items do
|
|
|
|
resources :inventory_cells,
|
|
|
|
only: %i(index create show update destroy),
|
|
|
|
path: 'cells',
|
|
|
|
as: :cells
|
|
|
|
end
|
2018-08-22 17:38:39 +08:00
|
|
|
end
|
2018-09-05 15:55:04 +08:00
|
|
|
resources :projects, only: %i(index show) do
|
2018-09-11 15:13:17 +08:00
|
|
|
resources :user_projects, only: %i(index show),
|
2018-10-10 23:35:09 +08:00
|
|
|
path: 'users', as: :users
|
2018-09-11 15:13:17 +08:00
|
|
|
resources :project_comments, only: %i(index show),
|
2018-10-10 23:35:09 +08:00
|
|
|
path: 'comments', as: :comments
|
|
|
|
get 'activities', to: 'projects#activities'
|
2018-09-11 15:13:17 +08:00
|
|
|
resources :reports, only: %i(index show),
|
|
|
|
path: 'reports', as: :reports
|
2018-09-06 21:38:48 +08:00
|
|
|
resources :experiments, only: %i(index show) do
|
2018-10-07 15:45:24 +08:00
|
|
|
resources :task_groups, only: %i(index show)
|
|
|
|
resources :connections, only: %i(index show)
|
|
|
|
resources :tasks, only: %i(index show) do
|
2018-10-07 16:07:37 +08:00
|
|
|
resources :task_inventory_items, only: %i(index show),
|
|
|
|
path: 'items',
|
|
|
|
as: :items
|
2018-11-28 21:14:45 +08:00
|
|
|
resources :task_users, only: %i(index show),
|
2018-10-07 16:20:01 +08:00
|
|
|
path: 'users',
|
|
|
|
as: :users
|
2018-10-07 17:10:41 +08:00
|
|
|
resources :task_tags, only: %i(index show),
|
|
|
|
path: 'tags',
|
|
|
|
as: :tags
|
2018-11-28 21:14:45 +08:00
|
|
|
resources :protocols, only: %i(index)
|
2018-10-07 18:36:58 +08:00
|
|
|
resources :results, only: %i(index create show)
|
2018-10-07 17:49:11 +08:00
|
|
|
get 'activities', to: 'tasks#activities'
|
2018-09-07 19:36:55 +08:00
|
|
|
end
|
2018-09-06 21:38:48 +08:00
|
|
|
end
|
2018-09-05 15:55:04 +08:00
|
|
|
end
|
2018-09-07 18:54:09 +08:00
|
|
|
end
|
|
|
|
resources :users, only: %i(show) do
|
|
|
|
resources :user_identities,
|
2018-10-07 19:07:27 +08:00
|
|
|
only: %i(index create show update destroy),
|
|
|
|
path: 'identities',
|
|
|
|
as: :identities
|
2018-08-24 18:11:28 +08:00
|
|
|
end
|
2018-07-31 19:40:27 +08:00
|
|
|
end
|
|
|
|
end
|
2017-08-30 00:49:07 +08:00
|
|
|
end
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|
2016-08-03 21:31:25 +08:00
|
|
|
|
2019-03-06 17:34:04 +08:00
|
|
|
resources :global_activities, only: [:index] do
|
2019-04-09 15:08:27 +08:00
|
|
|
collection do
|
|
|
|
get :search_subjects
|
|
|
|
get :team_filter
|
|
|
|
get :user_filter
|
|
|
|
end
|
2019-02-26 18:01:15 +08:00
|
|
|
end
|
2019-02-14 20:20:32 +08:00
|
|
|
|
2019-03-08 17:29:51 +08:00
|
|
|
post 'global_activities', to: 'global_activities#index'
|
|
|
|
|
2017-01-03 16:49:18 +08:00
|
|
|
constraints WopiSubdomain do
|
|
|
|
# Office integration
|
|
|
|
get 'wopi/files/:id/contents', to: 'wopi#file_contents_get_endpoint'
|
|
|
|
post 'wopi/files/:id/contents', to: 'wopi#file_contents_post_endpoint'
|
|
|
|
get 'wopi/files/:id', to: 'wopi#file_get_endpoint', as: 'wopi_rest_endpoint'
|
|
|
|
post 'wopi/files/:id', to: 'wopi#post_file_endpoint'
|
|
|
|
end
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|