Commit f4250271 by Ben McMorran

Merge pull request #8048 from edx/benmcmorran/search-tags

Enable HTML in note tags and support highlighting
parents 0fc3c14d 6d2464a3
...@@ -139,11 +139,14 @@ def preprocess_collection(user, course, collection): ...@@ -139,11 +139,14 @@ def preprocess_collection(user, course, collection):
cache = {} cache = {}
with store.bulk_operations(course.id): with store.bulk_operations(course.id):
for model in collection: for model in collection:
model.update({ update = {
u"text": sanitize_html(model["text"]), u"text": sanitize_html(model["text"]),
u"quote": sanitize_html(model["quote"]), u"quote": sanitize_html(model["quote"]),
u"updated": dateutil_parse(model["updated"]), u"updated": dateutil_parse(model["updated"]),
}) }
if "tags" in model:
update[u"tags"] = [sanitize_html(tag) for tag in model["tags"]]
model.update(update)
usage_id = model["usage_id"] usage_id = model["usage_id"]
if usage_id in cache: if usage_id in cache:
model.update(cache[usage_id]) model.update(cache[usage_id])
......
...@@ -233,6 +233,13 @@ $divider-visual-tertiary: ($baseline/20) solid $gray-l4; ...@@ -233,6 +233,13 @@ $divider-visual-tertiary: ($baseline/20) solid $gray-l4;
color: $m-gray-d2; color: $m-gray-d2;
} }
// CASE: tag matches a search query
.reference-meta.reference-tags .note-highlight {
// needed because .note-highlight is a span, which overrides the color
@extend %shame-link-text;
background-color: $result-highlight-color-base;
}
// Put commas between tags. // Put commas between tags.
a.reference-meta.reference-tags:after { a.reference-meta.reference-tags:after {
content: ","; content: ",";
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<% if (tags.length > 0) { %> <% if (tags.length > 0) { %>
<p class="reference-title"><%- gettext("Tags:") %></p> <p class="reference-title"><%- gettext("Tags:") %></p>
<% for (var i = 0; i < tags.length; i++) { %> <% for (var i = 0; i < tags.length; i++) { %>
<a class="reference-meta reference-tags" href="#"><%- tags[i] %></a> <a class="reference-meta reference-tags" href="#"><%= tags[i] %></a>
<% } %> <% } %>
<% } %> <% } %>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment