fixes routes.rb indentation

This commit is contained in:
zmagod 2017-01-03 09:49:18 +01:00
parent e554fdf805
commit 01c086b667

View file

@ -1,41 +1,78 @@
Rails.application.routes.draw do
require 'subdomain'
constraints (UserSubdomain) do
devise_for :users, controllers: { registrations: "users/registrations",
sessions: "users/sessions", invitations: "users/invitations",
confirmations: "users/confirmations" }
constraints UserSubdomain 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"
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"
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"
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"
get "users/settings/organizations/:organization_id/search", to: "users/settings#search_organization_users", as: "search_organization_users"
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"
post "users/settings/user_organizations/new", to: "users/settings#create_user_organization", as: "create_user_organization"
post "users/settings/users_organizations/new_user", to: "users/settings#create_user_and_user_organization", as: "create_user_and_user_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"
get 'users/settings/preferences',
to: 'users/settings#preferences',
as: 'preferences'
put 'users/settings/preferences',
to: 'users/settings#update_preferences',
as: 'update_preferences'
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'
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'
get 'users/settings/organizations/:organization_id/search',
to: 'users/settings#search_organization_users',
as: 'search_organization_users'
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'
post 'users/settings/user_organizations/new',
to: 'users/settings#create_user_organization',
as: 'create_user_organization'
post 'users/settings/users_organizations/new_user',
to: 'users/settings#create_user_and_user_organization',
as: 'create_user_and_user_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'
resources :organizations, only: [] do
resources :samples, only: [:new, :create]
@ -47,21 +84,27 @@ Rails.application.routes.draw do
post 'import_samples'
post 'export_samples'
end
match '*path', :to => 'organizations#routing_error', via: [:get, :post, :put, :patch]
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
resources :user_projects, path: "/users", only: [:new, :create, :index, :edit, :update, :destroy]
resources :user_projects,
path: '/users',
only: [:new, :create, :index, :edit, :update, :destroy]
resources :project_comments,
path: '/comments',
only: [:new, :create, :index, :edit, :update, :destroy]
# 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 :project_activities, path: '/activities', only: :index
resources :tags, only: [:create, :update, :destroy]
resources :reports, path: "/reports", only: [:index, :new, :create, :edit, :update] do
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
@ -107,14 +150,21 @@ Rails.application.routes.draw do
only: [:new, :create, :edit, :update],
defaults: { format: 'json' }
member do
get 'notifications' # Notifications popup for individual project in projects index
# Notifications popup for individual project in projects index
get 'notifications'
get 'samples' # Samples for single project
post 'samples_index' # Renders sample datatable for single project (ajax action)
# Renders sample datatable for single project (ajax action)
post 'samples_index'
get 'experiment_archive' # Experiment archive for single project
post :delete_samples, constraints: CommitParamRouting.new(MyModulesController::DELETE_SAMPLES), action: :delete_samples
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.
# 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
@ -126,7 +176,8 @@ Rails.application.routes.draw do
get 'canvas/full_zoom', to: 'canvas#full_zoom' # AJAX-loaded canvas zoom
# AJAX-loaded canvas zoom
get 'canvas/medium_zoom', to: 'canvas#medium_zoom'
get 'canvas/small_zoom', to: 'canvas#small_zoom' # AJAX-loaded canvas zoom
get 'canvas/small_zoom',
to: 'canvas#small_zoom' # AJAX-loaded canvas zoom
post 'canvas', to: 'canvas#update' # Save updated canvas action
get 'module_archive' # Module archive for single experiment
get 'archive' # archive experiment
@ -149,13 +200,19 @@ Rails.application.routes.draw do
# Show action is a popup (JSON) for individual module in full-zoom canvas,
# as well as "module info" page for single module (HTML)
resources :my_modules, path: "/modules", only: [:show, :edit, :update, :destroy] do
resources :my_module_tags, path: "/tags", only: [:index, :create, :update, :destroy]
resources :user_my_modules, path: "/users", only: [:index, :new, :create, :destroy]
resources :my_modules,
path: '/modules',
only: [:show, :edit, :update, :destroy] do
resources :my_module_tags,
path: '/tags',
only: [:index, :create, :update, :destroy]
resources :user_my_modules,
path: '/users',
only: [:index, :new, :create, :destroy]
resources :my_module_comments,
path: '/comments',
only: [:index, :new, :create, :edit, :update, :destroy]
resources :sample_my_modules, path: "/samples_index", only: [:index]
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]
@ -170,13 +227,27 @@ Rails.application.routes.draw do
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
# Renders sample datatable for single module (ajax action)
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
end
# Those routes are defined outside of member block to preserve original id parameters in URL.
# 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
@ -215,41 +286,44 @@ Rails.application.routes.draw do
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"
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"
get 'linked_children', to: 'protocols#linked_children'
post 'linked_children_datatable',
to: 'protocols#linked_children_datatable'
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"
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'
end
end
@ -258,25 +332,23 @@ Rails.application.routes.draw do
# 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"
get "files/:id/view", to: "assets#view", as: "view_asset"
get "files/:id/edit", to: "assets#edit", as: "edit_asset"
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'
get 'files/:id/view', to: 'assets#view', as: 'view_asset'
get 'files/:id/edit', to: 'assets#edit', as: 'edit_asset'
post 'asset_signature' => 'assets#signature'
devise_scope :user do
get 'avatar/:id/:style' => 'users/registrations#avatar', as: 'avatar'
post 'avatar_signature' => 'users/registrations#signature'
end
end
constraints (WopiSubdomain) do
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