Commit 9dc2b7f81ed54e54063fa7c24321cc3812c8e510

Authored by Rafael Manzo
Committed by Diego Camarinha
1 parent a9c34b03

[Colab] Routes scoped as expected by colab with '/mezuro'

Signed off by: Gustavo Jaruga <darksshades@hotmail.com>
Showing 2 changed files with 40 additions and 41 deletions   Show diff stats
config/environments/colab.rb
... ... @@ -47,4 +47,5 @@ Rails.application.configure do
47 47  
48 48 # Responds on a subdirectory
49 49 config.relative_url_root = '/mezuro'
  50 + config.assets.prefix = '/mezuro'
50 51 end
... ...
config/routes.rb
1 1 Rails.application.routes.draw do
2   - scope "(:locale)", locale: /en|pt/ do
3   - # We need to manually define OmniAuth routes since the automatic generation does not support the dynamic scope
4   - devise_for :users, skip: :omniauth_callbacks
5   - get 'users/:user_id/projects' => 'users#projects', as: :user_projects
6   -
7   - resources :projects do
8   - resources :repositories, only: [:new, :create]
9   - end
  2 + scope "mezuro" do
  3 + scope "(:locale)", locale: /en|pt/ do
  4 + # We need to manually define OmniAuth routes since the automatic generation does not support the dynamic scope
  5 + devise_for :users, skip: :omniauth_callbacks
  6 + get 'users/:user_id/projects' => 'users#projects', as: :user_projects
  7 +
  8 + resources :projects do
  9 + resources :repositories, only: [:new, :create]
  10 + end
10 11  
11   - resources :repositories, except: [:update]
12   - get '/repositories/:id/modules/:module_result_id' => 'repositories#show', as: :repository_module
13   - get '/repositories/:id/state' => 'repositories#state', as: :repository_state
14   - get '/repositories/:id/state_with_date' => 'repositories#state_with_date', as: :repository_state_with_date
15   - put '/repositories/:id' => 'repositories#update', as: :repository_update
  12 + resources :repositories, except: [:update]
  13 + get '/repositories/:id/modules/:module_result_id' => 'repositories#show', as: :repository_module
  14 + get '/repositories/:id/state' => 'repositories#state', as: :repository_state
  15 + get '/repositories/:id/state_with_date' => 'repositories#state_with_date', as: :repository_state_with_date
  16 + put '/repositories/:id' => 'repositories#update', as: :repository_update
16 17 # This route should be a POST to be semantically correct. But, RepositoriesController#create relies on a redirect to it which is not possible with a POST
17   - get '/repositories/:id/process' => 'repositories#process_repository', as: :repository_process
  18 + get '/repositories/:id/process' => 'repositories#process_repository', as: :repository_process
18 19 get '/repository_branches' => 'repositories#branches', as: :repository_branches
19 20  
20   - scope :format => false, :constraints => { :format => 'json' } do
21   - post '/repositories/:id/notify_push' => 'repositories#notify_push', as: :repository_notify_push, format: :json
22   - end
23   -
24   - resources :kalibro_configurations do
25   - get '/metric_configurations/choose_metric' => 'metric_configurations#choose_metric', as: :choose_metric
26   - resources :metric_configurations, except: [:update, :new] do
27   - get '/kalibro_ranges/new' => 'kalibro_ranges#new', as: :new_kalibro_range
28   - resources :kalibro_ranges, except: [:update, :new]
29   - put '/kalibro_ranges/:id' => 'kalibro_ranges#update', as: :kalibro_range_update
  21 + resources :kalibro_configurations do
  22 + get '/metric_configurations/choose_metric' => 'metric_configurations#choose_metric', as: :choose_metric
  23 + resources :metric_configurations, except: [:update, :new] do
  24 + get '/kalibro_ranges/new' => 'kalibro_ranges#new', as: :new_kalibro_range
  25 + resources :kalibro_ranges, except: [:update, :new]
  26 + put '/kalibro_ranges/:id' => 'kalibro_ranges#update', as: :kalibro_range_update
  27 + end
  28 + post '/metric_configurations/new' => 'metric_configurations#new', as: :new_metric_configuration
  29 + put '/metric_configurations/:id' => 'metric_configurations#update', as: :metric_configuration_update
  30 +
  31 + resources :compound_metric_configurations, except: [:destroy, :update]
  32 + put '/compound_metric_configurations/:id' => 'compound_metric_configurations#update', as: :compound_metric_configuration_update
30 33 end
31   - post '/metric_configurations/new' => 'metric_configurations#new', as: :new_metric_configuration
32   - put '/metric_configurations/:id' => 'metric_configurations#update', as: :metric_configuration_update
33   -
34   - resources :compound_metric_configurations, except: [:destroy, :update]
35   - put '/compound_metric_configurations/:id' => 'compound_metric_configurations#update', as: :compound_metric_configuration_update
36   - end
37 34  
38   - resources :reading_groups do
39   - resources :readings, except: [:index, :update, :show]
40   - put '/readings/:id' => 'readings#update', as: :reading_update
41   - end
  35 + resources :reading_groups do
  36 + resources :readings, except: [:index, :update, :show]
  37 + put '/readings/:id' => 'readings#update', as: :reading_update
  38 + end
42 39  
43   - # Modules
44   - post '/modules/:id/metric_history' => 'modules#metric_history', as: 'module_metric_history'
45   - post '/modules/:id/tree' => 'modules#load_module_tree', as: 'module_tree'
  40 + # Modules
  41 + post '/modules/:id/metric_history' => 'modules#metric_history', as: 'module_metric_history'
  42 + post '/modules/:id/tree' => 'modules#load_module_tree', as: 'module_tree'
46 43  
47   - # Tutorials
48   - get '/tutorials/:name' => 'tutorials#view', as: 'tutorials'
  44 + # Tutorials
  45 + get '/tutorials/:name' => 'tutorials#view', as: 'tutorials'
49 46  
50   - root "home#index"
  47 + root "home#index"
  48 + end
51 49 end
52 50  
53   -
54 51 # See comment above for devise_for
55 52 devise_for :users, only: :omniauth_callbacks, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
  53 +
56 54 # The priority is based upon order of creation: first created -> highest priority.
57 55 # See how all your routes lay out with "rake routes".
58 56  
... ...