mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-11-08 07:21:03 +08:00
Merge pull request #8719 from okriuchykhin/ok_SCI_12174
Fix listing of protocol templates [SCI-12174]
This commit is contained in:
commit
45f7cdade2
2 changed files with 8 additions and 9 deletions
|
|
@ -11,13 +11,11 @@ module Api
|
||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
protocol_templates =
|
protocol_templates = timestamps_filter(Protocol.latest_available_versions(@team))
|
||||||
timestamps_filter(
|
# Team owners see all protocol templates in the team
|
||||||
Protocol.latest_available_versions(@team)
|
protocol_templates = protocol_templates.readable_by_user(current_user, @team) unless can_manage_team?(@team)
|
||||||
)
|
protocol_templates = protocol_templates.page(params.dig(:page, :number))
|
||||||
.readable_by_user(current_user, @team)
|
.per(params.dig(:page, :size))
|
||||||
.page(params.dig(:page, :number))
|
|
||||||
.per(params.dig(:page, :size))
|
|
||||||
|
|
||||||
render jsonapi: protocol_templates,
|
render jsonapi: protocol_templates,
|
||||||
each_serializer: ProtocolTemplateSerializer, rte_rendering: render_rte?, team: @team
|
each_serializer: ProtocolTemplateSerializer, rte_rendering: render_rte?, team: @team
|
||||||
|
|
|
||||||
|
|
@ -85,10 +85,11 @@ class ProtocolsController < ApplicationController
|
||||||
else
|
else
|
||||||
current_team.repository_protocols.readable_by_user(current_user, current_team)
|
current_team.repository_protocols.readable_by_user(current_user, current_team)
|
||||||
end
|
end
|
||||||
render json: Lists::ProtocolsService.new(protocols, params).call,
|
protocols_list = Lists::ProtocolsService.new(protocols, params).call
|
||||||
|
render json: protocols_list,
|
||||||
each_serializer: Lists::ProtocolSerializer,
|
each_serializer: Lists::ProtocolSerializer,
|
||||||
user: current_user,
|
user: current_user,
|
||||||
meta: pagination_dict(protocols)
|
meta: pagination_dict(protocols_list)
|
||||||
end
|
end
|
||||||
format.html do
|
format.html do
|
||||||
render 'index'
|
render 'index'
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue