Skip to content

Commit bba7bc8

Browse files
authored
Merge pull request #241 from MITLibraries/use-65-tacos-interventions
Use 65 tacos interventions
2 parents 22eb852 + 0ba8da8 commit bba7bc8

33 files changed

+315
-803
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ See `Optional Environment Variables` for more information.
9393
- `BOOLEAN_OPTIONS`: comma separated list of values to present to testers on instances where `BOOLEAN_PICKER` feature is enabled.
9494
- `BOOLEAN_PICKER`: feature to allow users to select their preferred boolean type. If set, feature is enabled. This feature is only intended for internal team
9595
testing and should never be enabled in production (mostly because the UI is a mess more than it would cause harm).
96-
- `FACT_PANELS_ENABLED`: Comma separated list of enabled fact panels. See `/views/results.html.erb` for implemented panels/valid options. Leave unset to disable all.
9796
- `FILTER_ACCESS_TO_FILES`: The name to use instead of "Access to files" for that filter / aggregation.
9897
- `FILTER_CONTENT_TYPE`: The name to use instead of "Content type" for that filter / aggregation.
9998
- `FILTER_CONTRIBUTOR`: The name to use instead of "Contributor" for that filter / aggregation.

app/assets/stylesheets/application.css.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@
1919
@import "partials/_shared";
2020
@import "partials/_results";
2121
@import "partials/_typography";
22+
@import "partials/_suggestion-panel";

app/assets/stylesheets/partials/_panels.scss

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,6 @@
6262
}
6363
}
6464

65-
.fact {
66-
.panel {
67-
margin-top: 0;
68-
69-
.panel-heading {
70-
margin-top: 0;
71-
padding-top: 16.8px;
72-
}
73-
}
74-
}
75-
7665
.ask-us {
7766
margin-top: 3rem;
7867
a {
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
/* Color Variables */
2+
3+
// Core
4+
$blue-500: #0000FF;
5+
6+
$purple-700: #990099;
7+
8+
$white: #fff;
9+
$gray-100: #F2F2F2;
10+
$black: #111;
11+
12+
@mixin focus-outline {
13+
&:focus {
14+
outline: 3px solid $blue-500;
15+
}
16+
}
17+
18+
@mixin hover-transition {
19+
transition: all .25s ease-in-out 0s;
20+
}
21+
22+
// Semantic
23+
$color-suggestion-border: $purple-700;
24+
$color-suggestion-accent-text: $purple-700;
25+
26+
/* Suggestion Panel */
27+
.mitlib-suggestion-panel {
28+
border: 4px solid $color-suggestion-border;
29+
30+
display: flex;
31+
column-gap: 24px;
32+
33+
padding: 20px 24px;
34+
position: relative;
35+
36+
.panel-type {
37+
color: $color-suggestion-accent-text;
38+
font-size: 14px;
39+
font-weight: 600;
40+
margin-bottom: 8px;
41+
}
42+
43+
h3 {
44+
font-size: 20px;
45+
font-weight: 600;
46+
line-height: 1.25;
47+
margin-bottom: 8px;
48+
}
49+
50+
p {
51+
font-size: 16px;
52+
}
53+
54+
ul.metadata {
55+
font-size: 14px;
56+
list-style: none inside;
57+
padding-left: 0;
58+
margin-bottom: 20px;
59+
}
60+
61+
// This would need to be extracted into an Icon Button in the future.
62+
button.dismiss {
63+
//Temporarily hiding until we can move to a prop
64+
display: none;
65+
66+
width: 48px;
67+
height: 48px;
68+
position: absolute;
69+
top: 0;
70+
right: 0;
71+
72+
background-color: $white;
73+
border: none;
74+
color: $black;
75+
cursor: pointer;
76+
font-weight: 600;
77+
78+
@include hover-transition;
79+
80+
@include focus-outline;
81+
82+
&:hover {
83+
background-color: $gray-100;
84+
}
85+
}
86+
}
87+
88+
/* Button styles to be extracted into button component */
89+
.button.secondary {
90+
border: 1px solid $black;
91+
border-radius: 0;
92+
display: inline-block;
93+
padding: 6px 12px;
94+
text-decoration: none;
95+
font-size: 16px;
96+
font-weight: 600;
97+
98+
@include hover-transition;
99+
100+
@include focus-outline;
101+
102+
&:hover {
103+
color: $white;
104+
background-color: $black;
105+
}
106+
}

app/controllers/fact_controller.rb

Lines changed: 0 additions & 27 deletions
This file was deleted.

app/controllers/tacos_controller.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ class TacosController < ApplicationController
44
def analyze
55
return unless ApplicationHelper.tacos_enabled?
66

7-
Tacos.analyze(params[:q])
7+
tacos_response = Tacos.analyze(params[:q])
8+
9+
# Suggestions return as an array but we don't want to display more than one.
10+
# We may want to have a "priority" system in the future to determine which suggestion to show.
11+
@suggestions = tacos_response['data']['logSearchEvent']['detectors']['suggestedResources'].first
812
end
913
end

app/helpers/record_helper.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
module RecordHelper
2-
def doi(metadata)
3-
dois = metadata['identifiers']&.select { |id| id['kind'].downcase == 'doi' }
4-
return unless dois.present?
5-
6-
dois.first['value']
7-
end
8-
92
def date_parse(date)
103
return unless date.present?
114

app/helpers/results_helper.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
module ResultsHelper
2-
def fact_enabled?(fact_type)
3-
ENV.fetch('FACT_PANELS_ENABLED', false).split(',').include?(fact_type)
4-
end
5-
62
def results_summary(hits)
73
hits.to_i >= 10_000 ? '10,000+ results' : "#{number_with_delimiter(hits)} results"
84
end

app/models/fact_doi.rb

Lines changed: 0 additions & 44 deletions
This file was deleted.

app/models/fact_isbn.rb

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)