-
Notifications
You must be signed in to change notification settings - Fork 4
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
Showing
18 changed files
with
116 additions
and
2 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
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 |
---|---|---|
@@ -1,2 +1,10 @@ | ||
module ApplicationHelper | ||
def research_field_label(options = {}) | ||
research_field_service = ResearchFieldService.new | ||
options[:value].map { |field_code| html_escape(research_field_service.label(field_code)) }.to_sentence | ||
end | ||
|
||
def research_field_facet(field_code) | ||
ResearchFieldService.new.label(field_code) | ||
end | ||
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
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
class EtdPresenter < Hyrax::WorkShowPresenter | ||
delegate :degree, :department, :school, :partnering_agency, :submitting_type, to: :solr_document | ||
delegate :degree, :department, :school, :partnering_agency, :submitting_type, :research_field, to: :solr_document | ||
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,11 @@ | ||
class ResearchFieldAttributeRenderer < Hyrax::Renderers::AttributeRenderer | ||
def attribute_value_to_html(value) | ||
research_field_label = ResearchFieldService.new.label(value) | ||
# Adapted from Hyrax's AttributeRenderer | ||
if microdata_value_attributes(field).present? | ||
"<span#{html_attributes(microdata_value_attributes(field))}>#{li_value(research_field_label)}</span>" | ||
else | ||
li_value(research_field_label) | ||
end | ||
end | ||
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,6 @@ | ||
# services/research_field_service.rb | ||
class ResearchFieldService < Hyrax::QaSelectService | ||
def initialize | ||
super('research_fields') | ||
end | ||
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
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,6 @@ | ||
<% research_field_service = ResearchFieldService.new %> | ||
<%= f.input :research_field, as: :multi_value_select, | ||
collection: research_field_service.select_all_options, | ||
input_html: { class: 'form-control' }, | ||
include_blank: true | ||
%> |
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,21 @@ | ||
terms: | ||
- id: '5670' | ||
term: 'Dentistry' | ||
- id: '566' | ||
term: 'Health Sciences' | ||
- id: '992' | ||
term: 'Oncology' | ||
- id: '383' | ||
term: 'Toxicology' | ||
- id: '213' | ||
term: 'Psychology' | ||
- id: '576' | ||
term: 'Surgery' | ||
- id: '496' | ||
term: 'Alternative Medicine' | ||
- id: '382' | ||
term: 'Physical Therapy' | ||
- id: '442' | ||
term: 'Adolescent Development' | ||
- id: '986' | ||
term: "Women's Health" |
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
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
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
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 @@ | ||
require 'spec_helper' | ||
|
||
describe ResearchFieldService do | ||
let(:research_field_service) { described_class.new } | ||
|
||
describe "select_all_options" do | ||
subject(:research_field_options) { research_field_service.select_all_options } | ||
|
||
it "has a select list" do | ||
expect(research_field_options.first).to eq ['Dentistry', '5670'] | ||
expect(research_field_options.size).to eq 10 | ||
end | ||
end | ||
|
||
describe "label" do | ||
subject { research_field_service.label('383') } | ||
|
||
it { is_expected.to eq 'Toxicology' } | ||
end | ||
end |