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):
cache = {}
with store.bulk_operations(course.id):
for model in collection:
model.update({
update = {
u"text": sanitize_html(model["text"]),
u"quote": sanitize_html(model["quote"]),
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"]
if usage_id in cache:
model.update(cache[usage_id])
......
......@@ -233,6 +233,13 @@ $divider-visual-tertiary: ($baseline/20) solid $gray-l4;
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.
a.reference-meta.reference-tags:after {
content: ",";
......
......@@ -38,7 +38,7 @@
<% if (tags.length > 0) { %>
<p class="reference-title"><%- gettext("Tags:") %></p>
<% 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>
......
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