set up explore controller routes and rename methods
This commit is contained in:
parent
686d80e274
commit
5e180ac10e
2 changed files with 14 additions and 12 deletions
|
@ -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))
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Reference in a new issue