diff --git a/app/controllers/explore_controller.rb b/app/controllers/explore_controller.rb index c21454d1..023a6866 100644 --- a/app/controllers/explore_controller.rb +++ b/app/controllers/explore_controller.rb @@ -9,7 +9,7 @@ class ExploreController < ApplicationController #autocomplete :map, :name, full: true, extra_data: [:user_id] # GET /explore/active - def activemaps + def active page = params[:page].present? ? params[:page] : 1 @maps = policy_scope(Map).order('updated_at DESC') .page(page).per(20) @@ -25,7 +25,7 @@ class ExploreController < ApplicationController end # GET /explore/featured - def featuredmaps + def featured page = params[:page].present? ? params[:page] : 1 @maps = policy_scope( Map.where('maps.featured = ? AND maps.permission != ?', @@ -39,7 +39,7 @@ class ExploreController < ApplicationController end # GET /explore/mine - def mymaps + def mine unless authenticated? skip_policy_scope return redirect_to explore_active_path @@ -57,7 +57,7 @@ class ExploreController < ApplicationController end # GET /explore/shared - def sharedmaps + def shared unless authenticated? skip_policy_scope return redirect_to explore_active_path @@ -75,7 +75,7 @@ class ExploreController < ApplicationController end # GET /explore/starred - def starredmaps + def starred unless authenticated? skip_policy_scope return redirect_to explore_active_path @@ -94,7 +94,7 @@ class ExploreController < ApplicationController end # GET /explore/mapper/:id - def usermaps + def mapper page = params[:page].present? ? params[:page] : 1 @user = User.find(params[:id]) @maps = policy_scope(Map.where(user: @user)) diff --git a/config/routes.rb b/config/routes.rb index fe48b6ba..f9a1be8f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -57,12 +57,14 @@ Metamaps::Application.routes.draw do post 'maps/:id/star', to: 'maps#star', defaults: { format: :json } post 'maps/:id/unstar', to: 'maps#unstar', defaults: { format: :json } - get 'explore/active', to: 'maps#activemaps' - get 'explore/featured', to: 'maps#featuredmaps' - get 'explore/mine', to: 'maps#mymaps' - get 'explore/shared', to: 'maps#sharedmaps' - get 'explore/starred', to: 'maps#starredmaps' - get 'explore/mapper/:id', to: 'maps#usermaps' + namespace :explore do + get 'active' + get 'featured' + get 'mine' + get 'shared' + get 'starred' + get 'mapper/:id', action: 'mapper' + end devise_for :users, skip: :sessions, controllers: { registrations: 'users/registrations',