2016-02-12 23:52:43 +08:00
|
|
|
Rails.application.routes.draw do
|
|
|
|
devise_for :users, controllers: { registrations: "users/registrations",
|
|
|
|
sessions: "users/sessions", invitations: "users/invitations",
|
|
|
|
confirmations: "users/confirmations" }
|
|
|
|
|
|
|
|
root 'projects#index'
|
|
|
|
|
|
|
|
resources :activities, only: [:index]
|
|
|
|
|
|
|
|
get "forbidden", :to => "application#forbidden", as: "forbidden"
|
|
|
|
get "not_found", :to => "application#not_found", as: "not_found"
|
|
|
|
|
|
|
|
# Settings
|
|
|
|
get "users/settings/preferences", to: "users/settings#preferences", as: "preferences"
|
|
|
|
put "users/settings/preferences", to: "users/settings#update_preferences", as: "update_preferences"
|
2016-07-21 19:11:15 +08:00
|
|
|
get "users/settings/preferences/tutorial", to: "users/settings#tutorial", as: "tutorial"
|
|
|
|
post "users/settings/preferences/reset_tutorial/", to: "users/settings#reset_tutorial", as: "reset_tutorial"
|
2016-10-04 21:52:48 +08:00
|
|
|
post 'users/settings/preferences/notifications_settings',
|
|
|
|
to: 'users/settings#notifications_settings',
|
|
|
|
as: 'notifications_settings',
|
|
|
|
defaults: { format: 'json' }
|
2016-10-11 17:40:14 +08:00
|
|
|
post 'users/settings/user_current_organization',
|
|
|
|
to: 'users/settings#user_current_organization',
|
|
|
|
as: 'user_current_organization'
|
2016-02-12 23:52:43 +08:00
|
|
|
get "users/settings/organizations", to: "users/settings#organizations", as: "organizations"
|
|
|
|
get "users/settings/organizations/new", to: "users/settings#new_organization", as: "new_organization"
|
|
|
|
post "users/settings/organizations/new", to: "users/settings#create_organization", as: "create_organization"
|
|
|
|
get "users/settings/organizations/:organization_id", to: "users/settings#organization", as: "organization"
|
|
|
|
put "users/settings/organizations/:organization_id", to: "users/settings#update_organization", as: "update_organization"
|
|
|
|
get "users/settings/organizations/:organization_id/name", to: "users/settings#organization_name", as: "organization_name"
|
|
|
|
get "users/settings/organizations/:organization_id/description", to: "users/settings#organization_description", as: "organization_description"
|
|
|
|
post "users/settings/organizations/:organization_id/users_datatable", to: "users/settings#organization_users_datatable", as: "organization_users_datatable"
|
|
|
|
delete "users/settings/organizations/:organization_id", to: "users/settings#destroy_organization", as: "destroy_organization"
|
|
|
|
put "users/settings/user_organizations/:user_organization_id", to: "users/settings#update_user_organization", as: "update_user_organization"
|
|
|
|
get "users/settings/user_organizations/:user_organization_id/leave_html", to: "users/settings#leave_user_organization_html", as: "leave_user_organization_html"
|
|
|
|
get "users/settings/user_organizations/:user_organization_id/destroy_html", to: "users/settings#destroy_user_organization_html", as: "destroy_user_organization_html"
|
|
|
|
delete "users/settings/user_organizations/:user_organization_id", to: "users/settings#destroy_user_organization", as: "destroy_user_organization"
|
|
|
|
|
2016-11-03 18:27:17 +08:00
|
|
|
# Invite users
|
2016-11-06 18:29:00 +08:00
|
|
|
devise_scope :user do
|
|
|
|
post '/invite',
|
|
|
|
to: 'users/invitations#invite_users',
|
|
|
|
as: 'invite_users'
|
|
|
|
end
|
2016-11-03 18:27:17 +08:00
|
|
|
|
2016-09-29 20:49:58 +08:00
|
|
|
# Notifications
|
|
|
|
get 'users/:id/recent_notifications',
|
|
|
|
to: 'user_notifications#recent_notifications',
|
|
|
|
as: 'recent_notifications',
|
|
|
|
defaults: { format: 'json' }
|
|
|
|
|
|
|
|
get 'users/:id/unseen_notification',
|
|
|
|
to: 'user_notifications#unseen_notification',
|
|
|
|
as: 'unseen_notification',
|
|
|
|
defaults: { format: 'json' }
|
|
|
|
|
2016-10-03 20:40:15 +08:00
|
|
|
get 'users/notifications',
|
|
|
|
to: 'user_notifications#index',
|
|
|
|
as: 'notifications'
|
|
|
|
|
2016-02-12 23:52:43 +08:00
|
|
|
resources :organizations, only: [] do
|
|
|
|
resources :samples, only: [:new, :create]
|
2016-11-22 21:59:57 +08:00
|
|
|
resources :sample_types, only: [:create]
|
2016-11-22 21:57:01 +08:00
|
|
|
resources :sample_groups, only: [:create]
|
2016-02-12 23:52:43 +08:00
|
|
|
resources :custom_fields, only: [:create]
|
|
|
|
member do
|
|
|
|
post 'parse_sheet'
|
|
|
|
post 'import_samples'
|
|
|
|
post 'export_samples'
|
|
|
|
end
|
|
|
|
match '*path', :to => 'organizations#routing_error', via: [:get, :post, :put, :patch]
|
|
|
|
end
|
|
|
|
|
|
|
|
get 'projects/archive', to: 'projects#archive', as: 'projects_archive'
|
|
|
|
|
|
|
|
resources :projects, except: [:new, :destroy] do
|
2016-11-22 00:33:08 +08:00
|
|
|
resources :user_projects, path: '/users',
|
|
|
|
only: [:create, :index, :update, :destroy]
|
2016-08-24 17:27:29 +08:00
|
|
|
resources :project_comments,
|
|
|
|
path: '/comments',
|
2016-11-19 23:54:55 +08:00
|
|
|
only: [:create, :index, :edit, :update, :destroy]
|
2016-02-12 23:52:43 +08:00
|
|
|
# Activities popup (JSON) for individual project in projects index,
|
|
|
|
# as well as all activities page for single project (HTML)
|
|
|
|
resources :project_activities, path: "/activities", only: [:index]
|
|
|
|
resources :tags, only: [:create, :update, :destroy]
|
|
|
|
resources :reports, path: "/reports", only: [:index, :new, :create, :edit, :update] do
|
|
|
|
collection do
|
|
|
|
# The posts following here should in theory be gets,
|
|
|
|
# but are posts because of parameters payload
|
|
|
|
post 'generate', to: 'reports#generate'
|
2016-07-21 19:11:15 +08:00
|
|
|
get 'new/', to: 'reports#new'
|
|
|
|
get 'new/project_contents_modal',
|
2016-08-05 14:29:49 +08:00
|
|
|
to: 'reports#project_contents_modal',
|
|
|
|
as: :project_contents_modal
|
2016-07-21 19:11:15 +08:00
|
|
|
post 'new/project_contents',
|
2016-08-05 14:29:49 +08:00
|
|
|
to: 'reports#project_contents',
|
|
|
|
as: :project_contents
|
2016-07-29 22:53:50 +08:00
|
|
|
get 'new/experiment_contents_modal',
|
2016-08-05 14:29:49 +08:00
|
|
|
to: 'reports#experiment_contents_modal',
|
|
|
|
as: :experiment_contents_modal
|
2016-07-29 22:53:50 +08:00
|
|
|
post 'new/experiment_contents',
|
2016-08-05 14:29:49 +08:00
|
|
|
to: 'reports#experiment_contents',
|
|
|
|
as: :experiment_contents
|
2016-07-21 19:11:15 +08:00
|
|
|
get 'new/module_contents_modal',
|
2016-08-05 14:29:49 +08:00
|
|
|
to: 'reports#module_contents_modal',
|
|
|
|
as: :module_contents_modal
|
2016-07-21 19:11:15 +08:00
|
|
|
post 'new/module_contents',
|
2016-08-05 14:29:49 +08:00
|
|
|
to: 'reports#module_contents',
|
|
|
|
as: :module_contents
|
2016-07-21 19:11:15 +08:00
|
|
|
get 'new/step_contents_modal',
|
2016-08-05 14:29:49 +08:00
|
|
|
to: 'reports#step_contents_modal',
|
|
|
|
as: :step_contents_modal
|
2016-07-21 19:11:15 +08:00
|
|
|
post 'new/step_contents',
|
2016-08-05 14:29:49 +08:00
|
|
|
to: 'reports#step_contents',
|
|
|
|
as: :step_contents
|
2016-07-21 19:11:15 +08:00
|
|
|
get 'new/result_contents_modal',
|
2016-08-05 14:29:49 +08:00
|
|
|
to: 'reports#result_contents_modal',
|
|
|
|
as: :result_contents_modal
|
2016-07-21 19:11:15 +08:00
|
|
|
post 'new/result_contents',
|
2016-08-05 14:29:49 +08:00
|
|
|
to: 'reports#result_contents',
|
|
|
|
as: :result_contents
|
|
|
|
post '_save',
|
|
|
|
to: 'reports#save_modal',
|
|
|
|
as: :save_modal
|
|
|
|
post 'destroy', as: :destroy # Destroy multiple entries at once
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|
|
|
|
end
|
2016-08-03 15:44:05 +08:00
|
|
|
resources :experiments,
|
|
|
|
only: [:new, :create, :edit, :update],
|
|
|
|
defaults: { format: 'json' }
|
2016-02-12 23:52:43 +08:00
|
|
|
member do
|
|
|
|
get 'notifications' # Notifications popup for individual project in projects index
|
|
|
|
get 'samples' # Samples for single project
|
|
|
|
post 'samples_index' # Renders sample datatable for single project (ajax action)
|
2016-07-28 17:30:34 +08:00
|
|
|
get 'experiment_archive' # Experiment archive for single project
|
2016-02-12 23:52:43 +08:00
|
|
|
post :delete_samples, constraints: CommitParamRouting.new(MyModulesController::DELETE_SAMPLES), action: :delete_samples
|
|
|
|
end
|
|
|
|
|
|
|
|
# This route is defined outside of member block to preserve original :project_id parameter in URL.
|
|
|
|
get 'users/edit', to: 'user_projects#index_edit'
|
|
|
|
end
|
|
|
|
|
2016-08-08 22:35:45 +08:00
|
|
|
resources :experiments do
|
2016-07-28 17:30:34 +08:00
|
|
|
member do
|
2016-07-28 22:41:10 +08:00
|
|
|
get 'canvas' # Overview/structure for single experiment
|
2016-08-02 15:13:30 +08:00
|
|
|
# AJAX-loaded canvas edit mode (from canvas)
|
|
|
|
get 'canvas/edit', to: 'canvas#edit'
|
2016-07-28 17:30:34 +08:00
|
|
|
get 'canvas/full_zoom', to: 'canvas#full_zoom' # AJAX-loaded canvas zoom
|
2016-08-02 15:13:30 +08:00
|
|
|
# AJAX-loaded canvas zoom
|
|
|
|
get 'canvas/medium_zoom', to: 'canvas#medium_zoom'
|
2016-07-28 17:30:34 +08:00
|
|
|
get 'canvas/small_zoom', to: 'canvas#small_zoom' # AJAX-loaded canvas zoom
|
|
|
|
post 'canvas', to: 'canvas#update' # Save updated canvas action
|
2016-07-28 22:41:10 +08:00
|
|
|
get 'module_archive' # Module archive for single experiment
|
2016-08-03 15:34:10 +08:00
|
|
|
get 'archive' # archive experiment
|
2016-08-11 15:46:15 +08:00
|
|
|
get 'clone_modal' # return modal with clone options
|
|
|
|
post 'clone' # clone experiment
|
2016-08-12 17:26:18 +08:00
|
|
|
get 'move_modal' # return modal with move options
|
|
|
|
post 'move' # move experiment
|
2016-08-02 14:44:07 +08:00
|
|
|
get 'samples' # Samples for single project
|
2016-08-19 21:36:12 +08:00
|
|
|
get 'updated_img' # Checks if the workflow image is updated
|
2016-08-22 17:29:19 +08:00
|
|
|
get 'fetch_workflow_img' # Get udated workflow img
|
2016-08-02 15:13:30 +08:00
|
|
|
# Renders sample datatable for single project (ajax action)
|
|
|
|
post 'samples_index'
|
|
|
|
post :delete_samples,
|
|
|
|
constraints: CommitParamRouting.new(
|
|
|
|
MyModulesController::DELETE_SAMPLES
|
|
|
|
),
|
|
|
|
action: :delete_samples
|
2016-07-28 17:30:34 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-02-12 23:52:43 +08:00
|
|
|
# Show action is a popup (JSON) for individual module in full-zoom canvas,
|
|
|
|
# as well as "module info" page for single module (HTML)
|
2016-11-22 21:52:43 +08:00
|
|
|
resources :my_modules, path: '/modules', only: [:show, :update] do
|
2016-11-22 22:19:12 +08:00
|
|
|
resources :my_module_tags, path: '/tags', only: [:create, :destroy]
|
2016-11-22 00:33:08 +08:00
|
|
|
resources :user_my_modules, path: '/users',
|
2016-11-22 22:16:26 +08:00
|
|
|
only: [:index, :create, :destroy]
|
2016-08-24 17:27:29 +08:00
|
|
|
resources :my_module_comments,
|
|
|
|
path: '/comments',
|
2016-11-19 23:54:55 +08:00
|
|
|
only: [:index, :create, :edit, :update, :destroy]
|
2016-02-12 23:52:43 +08:00
|
|
|
resources :sample_my_modules, path: "/samples_index", only: [:index]
|
|
|
|
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'
|
|
|
|
get 'activities_tab' # Activities in tab view for single module
|
|
|
|
get 'due_date'
|
2016-07-21 19:11:15 +08:00
|
|
|
get 'protocols' # Protocols view for single module
|
2016-02-12 23:52:43 +08:00
|
|
|
get 'results' # Results view for single module
|
|
|
|
get 'samples' # Samples view for single module
|
|
|
|
get 'archive' # Archive view for single module
|
|
|
|
post 'samples_index' # Renders sample datatable for single module (ajax action)
|
|
|
|
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
|
|
|
|
end
|
|
|
|
|
|
|
|
# Those routes are defined outside of member block to preserve original id parameters in URL.
|
|
|
|
get 'tags/edit', to: 'my_module_tags#index_edit'
|
|
|
|
get 'users/edit', to: 'user_my_modules#index_edit'
|
|
|
|
end
|
|
|
|
|
|
|
|
resources :steps, only: [:edit, :update, :destroy, :show] do
|
2016-08-24 17:27:29 +08:00
|
|
|
resources :step_comments,
|
|
|
|
path: '/comments',
|
2016-11-22 22:01:48 +08:00
|
|
|
only: [:create, :index, :edit, :update, :destroy]
|
2016-02-12 23:52:43 +08:00
|
|
|
member do
|
|
|
|
post 'checklistitem_state'
|
|
|
|
post 'toggle_step_state'
|
|
|
|
get 'move_down'
|
|
|
|
get 'move_up'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-09-06 22:16:39 +08:00
|
|
|
resources :results, only: [:update, :destroy] do
|
2016-08-24 17:27:29 +08:00
|
|
|
resources :result_comments,
|
|
|
|
path: '/comments',
|
2016-11-19 23:54:55 +08:00
|
|
|
only: [:create, :index, :edit, :update, :destroy]
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
resources :samples, only: [:edit, :update, :destroy]
|
2016-09-23 23:45:02 +08:00
|
|
|
get 'samples/:id', to: 'samples#show'
|
|
|
|
|
2016-02-12 23:52:43 +08:00
|
|
|
resources :result_texts, only: [:edit, :update, :destroy]
|
|
|
|
get 'result_texts/:id/download' => 'result_texts#download',
|
|
|
|
as: :result_text_download
|
|
|
|
resources :result_assets, only: [:edit, :update, :destroy]
|
|
|
|
get 'result_assets/:id/download' => 'result_assets#download',
|
|
|
|
as: :result_asset_download
|
|
|
|
resources :result_tables, only: [:edit, :update, :destroy]
|
|
|
|
get 'result_tables/:id/download' => 'result_tables#download',
|
|
|
|
as: :result_table_download
|
|
|
|
|
2016-07-21 19:11:15 +08:00
|
|
|
resources :protocols, only: [:index, :edit, :create] do
|
|
|
|
resources :steps, only: [:new, :create]
|
2016-02-12 23:52:43 +08:00
|
|
|
member do
|
2016-07-21 19:11:15 +08:00
|
|
|
get "linked_children", to: "protocols#linked_children"
|
|
|
|
post "linked_children_datatable", to: "protocols#linked_children_datatable"
|
2016-12-13 17:39:18 +08:00
|
|
|
get "preview", to: "protocols#preview"
|
2016-07-21 19:11:15 +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"
|
|
|
|
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"
|
|
|
|
get "export", to: "protocols#export"
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-07-21 19:11:15 +08:00
|
|
|
get 'search' => 'search#index'
|
|
|
|
get 'search/new' => 'search#new', as: :new_search
|
|
|
|
|
|
|
|
# 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"
|
|
|
|
get "files/:id/download", to: "assets#download", as: "download_asset"
|
|
|
|
get "files/:id/preview", to: "assets#preview", as: "preview_asset"
|
2016-02-12 23:52:43 +08:00
|
|
|
post 'asset_signature' => 'assets#signature'
|
|
|
|
|
|
|
|
devise_scope :user do
|
2016-07-21 19:11:15 +08:00
|
|
|
get 'avatar/:id/:style' => 'users/registrations#avatar', as: 'avatar'
|
2016-02-12 23:52:43 +08:00
|
|
|
post 'avatar_signature' => 'users/registrations#signature'
|
2016-12-01 21:51:37 +08:00
|
|
|
get 'users/auth_token_sign_in' => 'users/sessions#auth_token_create'
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|
|
|
|
end
|