mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-31 03:59:51 +08:00
Refactor hardcoded protocol_source in SearchService
This commit is contained in:
parent
9be4fc2470
commit
bc4b07cc0f
3 changed files with 4 additions and 2 deletions
|
@ -7,7 +7,8 @@ class ExternalProtocolsController < ApplicationController
|
||||||
# GET list_external_protocols
|
# GET list_external_protocols
|
||||||
def index
|
def index
|
||||||
service_call = ProtocolImporters::SearchProtocolsService
|
service_call = ProtocolImporters::SearchProtocolsService
|
||||||
.call(protocol_source: 'protocolsio/v3', query_params: index_params)
|
.call(protocol_source: index_params[:protocol_source],
|
||||||
|
query_params: index_params)
|
||||||
|
|
||||||
if service_call.succeed?
|
if service_call.succeed?
|
||||||
render json: {
|
render json: {
|
||||||
|
|
|
@ -11,7 +11,7 @@ module ProtocolImporters
|
||||||
|
|
||||||
def initialize(protocol_source:, query_params: {})
|
def initialize(protocol_source:, query_params: {})
|
||||||
@protocol_source = protocol_source
|
@protocol_source = protocol_source
|
||||||
@query_params = query_params
|
@query_params = query_params.except(:protocol_source)
|
||||||
@errors = Hash.new { |h, k| h[k] = {} }
|
@errors = Hash.new { |h, k| h[k] = {} }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<%= image_tag 'external_protocols/protocolsio_logo.png',
|
<%= image_tag 'external_protocols/protocolsio_logo.png',
|
||||||
class: 'protocolsio-logo' %>
|
class: 'protocolsio-logo' %>
|
||||||
<span class='protocolsio-title'><%= t('protocols.index.external_protocols.protocolsio_title') %></span>
|
<span class='protocolsio-title'><%= t('protocols.index.external_protocols.protocolsio_title') %></span>
|
||||||
|
<%= hidden_field_tag 'protocol_source', 'protocolsio/v3' %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class='input-group'>
|
<div class='input-group'>
|
||||||
|
|
Loading…
Reference in a new issue