mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-30 19:52:20 +01:00
use slug in traning show url
This commit is contained in:
parent
c27c4372b0
commit
e48bb88f1f
@ -12,13 +12,13 @@ Application.Controllers.controller "TrainingsController", ['$scope', '$state', '
|
|||||||
# Callback for the 'reserve' button
|
# Callback for the 'reserve' button
|
||||||
##
|
##
|
||||||
$scope.reserveTraining = (training, event) ->
|
$scope.reserveTraining = (training, event) ->
|
||||||
$state.go('app.logged.trainings_reserve', {id: training.id})
|
$state.go('app.logged.trainings_reserve', {id: training.slug})
|
||||||
|
|
||||||
##
|
##
|
||||||
# Callback for the 'show' button
|
# Callback for the 'show' button
|
||||||
##
|
##
|
||||||
$scope.showTraining = (training) ->
|
$scope.showTraining = (training) ->
|
||||||
$state.go('app.public.training_show', {id: training.id})
|
$state.go('app.public.training_show', {id: training.slug})
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ class API::TrainingsController < API::ApiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@training = Training.find(params[:id])
|
@training = Training.friendly.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
@ -2,7 +2,7 @@ role = (current_user and current_user.is_admin?) ? 'admin' : 'user'
|
|||||||
|
|
||||||
json.cache! [@trainings, role] do
|
json.cache! [@trainings, role] do
|
||||||
json.array!(@trainings) do |training|
|
json.array!(@trainings) do |training|
|
||||||
json.extract! training, :id, :name, :description, :machine_ids, :nb_total_places
|
json.extract! training, :id, :name, :description, :machine_ids, :nb_total_places, :slug
|
||||||
json.training_image training.training_image.attachment.large.url if training.training_image
|
json.training_image training.training_image.attachment.large.url if training.training_image
|
||||||
json.plan_ids training.plan_ids if role === 'admin'
|
json.plan_ids training.plan_ids if role === 'admin'
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user