Skip to content

Commit db5fc44

Browse files
committed
#1250 no clickable ontology terms in list views
1 parent 77109ab commit db5fc44

8 files changed

Lines changed: 11 additions & 31 deletions

File tree

app/assets/stylesheets/masonry.scss

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@
105105
border-radius: 8px;
106106
padding: $item-padding-base;
107107
display: block;
108-
position: relative;
109108
transition: $transition-time;
110109

111110
&:hover, &:focus {
@@ -164,20 +163,6 @@
164163
}
165164
}
166165

167-
.link-overlay-main-link {
168-
position: absolute;
169-
top: 0;
170-
left: 0;
171-
bottom: 0;
172-
right: 0;
173-
z-index: 0;
174-
}
175-
176-
.link-overlay-link {
177-
position: relative;
178-
z-index: 1;
179-
}
180-
181166
li.media-item {
182167
list-style-type: none;
183168
}

app/helpers/materials_helper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,13 @@ def keywords_and_topics(resource, limit: nil)
119119

120120
if resource.respond_to?(:scientific_topics)
121121
tags += resource.scientific_topics.map do |term|
122-
link_to(term.preferred_label, term.uri, class: 'label label-info tag-topic link-overlay-link', target: '_blank')
122+
content_tag(:span, term.preferred_label, class: 'label label-info tag-topic')
123123
end
124124
end
125125

126126
if resource.respond_to?(:operations)
127127
tags += resource.operations.map do |term|
128-
link_to(term.preferred_label, term.uri, class: 'label label-info tag-operation link-overlay-link', target: '_blank')
128+
content_tag(:span, term.preferred_label, class: 'label label-info tag-operation')
129129
end
130130
end
131131

app/views/events/_event.html.erb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<% learning_path_topic_item ||= nil %>
22
<% collection_item ||= learning_path_topic_item %>
33
<li class="masonry-brick media-item long">
4-
<div class="link-overlay with-left-icon">
5-
<%= link_to '', event, class: 'link-overlay-main-link' %>
4+
<%= link_to event, class: 'link-overlay with-left-icon' do %>
65
<%= item_order_badge(collection_item) if collection_item %>
76
<div class="with-left-icon">
87
<div class="icon-container hidden-xs">
@@ -56,5 +55,5 @@
5655
</div>
5756

5857
<%= item_comment(collection_item) if collection_item %>
59-
</div>
58+
<% end %>
6059
</li>

app/views/learning_paths/_learning_path.html.erb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<li class="masonry-brick media-item large block-item learning-path-bg-<%= (learning_path.id % 4) + 1 -%>">
2-
<div class="link-overlay">
3-
<%= link_to '', learning_path, class: 'link-overlay-main-link' %>
2+
<%= link_to learning_path, class: 'link-overlay' do %>
43
<%= item_order_badge(collection_item) if defined? collection_item %>
54

65
<div class="masonry-brick-heading">
@@ -35,5 +34,5 @@
3534
</div>
3635

3736
<%= item_comment(collection_item) if defined? collection_item %>
38-
</div>
37+
<% end %>
3938
</li>

app/views/materials/_material.html.erb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
end
88
%>
99
<li class="masonry-brick media-item long">
10-
<div class="link-overlay">
11-
<%= link_to '', material_path(material, **link_params), class: 'link-overlay-main-link' %>
10+
<%= link_to material_path(material, **link_params), class: 'link-overlay' do %>
1211
<%= item_order_badge(collection_item) if show_order && collection_item %>
1312

1413
<div class="masonry-brick-heading">
@@ -41,5 +40,5 @@
4140
</div>
4241

4342
<%= item_comment(collection_item) if collection_item %>
44-
</div>
43+
<% end %>
4544
</li>

test/controllers/learning_paths_controller_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ class LearningPathsControllerTest < ActionController::TestCase
525525
topic_link = @learning_path.topic_links.first
526526
topic_item = topic_link.topic.items.first
527527

528-
assert_select '.link-overlay a[href=?]',
528+
assert_select '.link-overlay[href=?]',
529529
material_path(topic_item.resource, lp: [topic_link, topic_item].map(&:id).join(':'))
530530
end
531531

test/controllers/stars_controller_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,6 @@ class StarsControllerTest < ActionController::TestCase
7171

7272
assert_response :success
7373
assert_select '#materials div.search-results-count', text: '1 Material', count: 1
74-
assert_select '#materials li.masonry-brick .link-overlay a[href=?]', material_path(material), count: 1
74+
assert_select '#materials li.masonry-brick a.link-overlay[href=?]', material_path(material), count: 1
7575
end
7676
end

test/helpers/materials_helper_test.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class MaterialsHelperTest < ActionView::TestCase
88
assert_includes topics, 'Metabolomics'
99
end
1010

11-
test 'keywords_and_topics generates clickable links for scientific topics and operations' do
11+
test 'keywords_and_topics generates spans with css classes for scientific topics and operations' do
1212
topic_term = OpenStruct.new(preferred_label: 'Genomics', uri: 'http://edamontology.org/topic_0622')
1313
operation_term = OpenStruct.new(preferred_label: 'Sequence alignment', uri: 'http://edamontology.org/operation_0292')
1414
resource = OpenStruct.new(
@@ -18,10 +18,8 @@ class MaterialsHelperTest < ActionView::TestCase
1818
)
1919
result = keywords_and_topics(resource)
2020

21-
assert_includes result, 'href="http://edamontology.org/topic_0622"'
2221
assert_includes result, 'Genomics'
2322
assert_includes result, 'tag-topic'
24-
assert_includes result, 'href="http://edamontology.org/operation_0292"'
2523
assert_includes result, 'Sequence alignment'
2624
assert_includes result, 'tag-operation'
2725
assert_includes result, 'keyword1'

0 commit comments

Comments
 (0)