1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-13 23:48:55 +01:00

Merge branch 'dev' for release 6.3.36

This commit is contained in:
Du Peng 2024-12-12 14:20:18 +01:00
commit bf0c30ba55
6 changed files with 13 additions and 3 deletions

View File

@ -2,6 +2,11 @@
## Next release ## Next release
## v6.3.36 2024 December 12
- Improvement: default order for the spaces/trainings list is set to descending by created_at
- Improvement: members cannot see training deactivated in the list
## v6.3.35 2024 November 13 ## v6.3.35 2024 November 13
- Fix a bug: unable to run rails db:migrate if the database is empty - Fix a bug: unable to run rails db:migrate if the database is empty

View File

@ -7,7 +7,7 @@ class API::SpacesController < API::APIController
respond_to :json respond_to :json
def index def index
@spaces = Space.includes(:space_image, :machines).where(deleted_at: nil) @spaces = Space.includes(:space_image, :machines).where(deleted_at: nil).order(:created_at)
@spaces_indexed_with_parent = @spaces.index_with { |space| @spaces.find { |s| s.id == space.parent_id } } @spaces_indexed_with_parent = @spaces.index_with { |space| @spaces.find { |s| s.id == space.parent_id } }
@spaces_grouped_by_parent_id = @spaces.group_by(&:parent_id) @spaces_grouped_by_parent_id = @spaces.group_by(&:parent_id)
end end

View File

@ -14,6 +14,7 @@ class API::TrainingsController < API::APIController
def show def show
@training = Training.friendly.find(params[:id]) @training = Training.friendly.find(params[:id])
authorize @training
end end
def create def create

View File

@ -8,6 +8,10 @@ class TrainingPolicy < ApplicationPolicy
end end
end end
def show?
!record.disabled? || user.admin? || user.manager?
end
def create? def create?
user.admin? user.admin?
end end

View File

@ -5,7 +5,7 @@ class TrainingService
class << self class << self
# @param filters [ActionController::Parameters] # @param filters [ActionController::Parameters]
def list(filters) def list(filters)
trainings = Training.includes(:training_image, :plans, :machines) trainings = Training.includes(:training_image, :plans, :machines).order(:created_at)
trainings = filter_by_disabled(trainings, filters) trainings = filter_by_disabled(trainings, filters)
trainings = filter_by_public_page(trainings, filters) trainings = filter_by_public_page(trainings, filters)

View File

@ -1,6 +1,6 @@
{ {
"name": "fab-manager", "name": "fab-manager",
"version": "6.3.35", "version": "6.3.36",
"description": "Fab-manager is the FabLab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks and your marker's projects.", "description": "Fab-manager is the FabLab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks and your marker's projects.",
"keywords": [ "keywords": [
"fablab", "fablab",