-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e670879
commit 8e86d9b
Showing
5 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
class MockSpikeFinderDocument < Document | ||
FORMAT_SPECIFIC_FIELDS = %i[ | ||
mock_spike_finder_document_facet_one | ||
mock_spike_finder_document_facet_two | ||
].freeze | ||
|
||
attr_accessor(*FORMAT_SPECIFIC_FIELDS) | ||
|
||
def initialize(params = {}) | ||
super(params, FORMAT_SPECIFIC_FIELDS) | ||
end | ||
|
||
def self.title | ||
"Mock Spike Finder Document" | ||
end | ||
|
||
def primary_publishing_organisation | ||
"af07d5a5-df63-4ddc-9383-6a666845ebe9" | ||
end | ||
end |
28 changes: 28 additions & 0 deletions
28
app/views/metadata_fields/_mock_spike_finder_documents.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<%= render layout: "shared/form_group", locals: { f: f, field: :mock_spike_finder_document_facet_one, label: "Facet 1" } do %> | ||
<%= f.select :mock_spike_finder_document_facet_one, | ||
facet_options(f, :mock_spike_finder_document_facet_one), | ||
{}, | ||
{ | ||
class: 'select2 form-control', | ||
multiple: true, | ||
data: | ||
{ | ||
placeholder: 'Select Facet One' | ||
} | ||
} | ||
%> | ||
<% end %> | ||
|
||
<%= render layout: "shared/form_group", locals: { f: f, field: :mock_spike_finder_document_facet_two, label: "Facet 2" } do %> | ||
<%= f.select :mock_spike_finder_document_facet_two, | ||
facet_options(f, :mock_spike_finder_document_facet_two), | ||
{}, | ||
{ | ||
class: 'select2 form-control', | ||
data: | ||
{ | ||
placeholder: 'Select Facet Two' | ||
} | ||
} | ||
%> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"pre-production": true, | ||
"content_id": "66e7df00-5d57-43b5-8fc4-b233db73d787", | ||
"base_path": "/mock-spike-finder", | ||
"format_name": "Mock spike finder", | ||
"name": "Mock spike finder", | ||
"description": "Mock spike finder description", | ||
"summary": "Mock spike finder summary", | ||
"filter": { | ||
"format": "mock_spike_finder_document" | ||
}, | ||
"show_summaries": true, | ||
"organisations": ["af07d5a5-df63-4ddc-9383-6a666845ebe9"], | ||
"related": [ | ||
"af07d5a5-df63-4ddc-9383-6a666845ebe9" | ||
], | ||
"document_noun": "mock document", | ||
"facets": [ | ||
{ | ||
"key": "mock_spike_finder_document_facet_one", | ||
"name": "Mock spike finder document facet one", | ||
"short_name": "F1", | ||
"type": "text", | ||
"preposition": "helps with", | ||
"display_as_result_metadata": true, | ||
"filterable": true, | ||
"allowed_values": [ | ||
{"label": "Facet one value one", "value": "facet_one_value_one"}, | ||
{"label": "Facet one value two", "value": "facet_one_value_two"} | ||
] | ||
}, | ||
{ | ||
"key": "mock_spike_finder_document_facet_two", | ||
"name": "Mock spike finder document facet two", | ||
"short_name": "F2", | ||
"type": "text", | ||
"preposition": "helps with", | ||
"display_as_result_metadata": true, | ||
"filterable": true, | ||
"allowed_values": [ | ||
{"label": "Facet two value one", "value": "facet_two_value_one"}, | ||
{"label": "Facet two value two", "value": "facet_two_value_two"} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require "spec_helper" | ||
require "models/valid_against_schema" | ||
|
||
RSpec.describe MockSpikeFinderDocument do | ||
let(:payload) { FactoryBot.create(:mock_spike_finder_document) } | ||
include_examples "it saves payloads that are valid against the 'specialist_document' schema" | ||
|
||
it "is not exportable" do | ||
expect(described_class).not_to be_exportable | ||
end | ||
end |