New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ti 135 doc highlighting #25
Changes from all commits
eae884b
cc55ec3
ea94acd
8818438
a4df949
49b0fb8
0b0dde5
e11ee28
29b0683
75b85dd
ec7b9b6
451ce6b
3ef7df7
d2aa3fe
bc52c3e
93514cc
b067cf7
deea063
71d370c
7a3b26e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,32 @@ | ||
<div class="detail jira-issue vertical grid-content"> | ||
<h3 class="subheader"> | ||
|
||
<a ng-href="{{::vm.doc.id}}" ng-click="vm.postSignal(vm.doc.__signals_doc_id__)" rel="noopener" target="_blank"> | ||
<field value="::vm.doc.name_s" highlight="::vm.highlight" maxlength="200" hkey="name_s"></field> | ||
<field value="::vm.doc.name_s" highlight="vm.highlight[doc.id]" maxlength="200" hkey="name_s"></field> | ||
</a> | ||
</h3> | ||
|
||
<div class="large-8 xlarge-7 xx-large-6"> | ||
<p ng-if="::vm.doc.description_s"> | ||
<field value="::vm.doc.description_s" highlight="::vm.highlight" maxlength="200" | ||
hkey="description_s"></field> | ||
<p ng-if="::vm.doc.content_txt"> | ||
<field value="::vm.doc.content_txt" highlight="::vm.highlight[doc.id]" maxlength="200" | ||
hkey="content_txt"></field> | ||
</p> | ||
<div class="detail-row"> | ||
<div class="type" ng-if="::vm.doc.jira_content_type_s"> | ||
<field value="::vm.doc.jira_content_type_s" highlight="vm.highlight" maxlength="200" | ||
<field value="::vm.doc.jira_content_type_s" highlight="::vm.highlight[doc.id]" maxlength="200" | ||
hkey="jira_content_type_s"></field> | ||
</div> | ||
<div class="key" ng-if="::vm.doc.parent_s"> | ||
<a ng-href="{{::vm.doc.id}}" ng-click="vm.postSignal(vm.doc.__signals_doc_id__)" rel="noopener" target="_blank"> | ||
<field value="::vm.doc.key_s" highlight="::vm.highlight" maxlength="200" hkey="key_s"></field> | ||
<field value="::vm.doc.key_s" highlight="::vm.highlight[doc.id]" maxlength="200" hkey="key_s"></field> | ||
</a> | ||
</div> | ||
<div class="last-modified" ng-if="::vm.doc.lastModified_dt"><span class="doc-label">Last Modified:</span> <field value="::vm.doc.lastModified_dtFormatted"></field></div> | ||
<div class="lead" ng-if="::vm.doc.lead_s"><span class="doc-label">Lead:</span> <field value="::vm.doc.lead_s" maxlength="200"></field></div> | ||
<div class="last-modified" ng-if="::vm.doc.lastModified_dt"> | ||
<span class="doc-label">Last Modified:</span> <field value="::vm.doc.lastModified_dtFormatted"></field> | ||
</div> | ||
<div class="lead" ng-if="::vm.doc.lead_s"> | ||
<span class="doc-label">Lead:</span> <field value="::vm.doc.lead_s" maxlength="200"></field> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#documentList{ | ||
em{ background-color:$highlight-color;} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ | |
} | ||
|
||
|
||
function Controller($sce, $anchorScroll, Orwell, SignalsService) { | ||
function Controller($sce, $anchorScroll, Orwell, SignalsService, $log) { | ||
'ngInject'; | ||
var vm = this; | ||
vm.docs = []; | ||
|
@@ -36,7 +36,6 @@ | |
|
||
function activate() { | ||
var resultsObservable = Orwell.getObservable('queryResults'); | ||
|
||
resultsObservable.addObserver(function (data) { | ||
vm.docs = parseDocuments(data); | ||
vm.highlighting = parseHighlighting(data); | ||
|
@@ -78,6 +77,7 @@ | |
if (data.hasOwnProperty('response')) { | ||
docs = data.response.docs; | ||
} | ||
$log.debug(docs); | ||
return docs; | ||
} | ||
|
||
|
@@ -87,22 +87,25 @@ | |
* @return {object} The highlighting results. | ||
*/ | ||
function parseHighlighting(data) { | ||
var highlighting = {}; | ||
if (data.hasOwnProperty('highlighting')){ | ||
_.each(data.highlighting, function(value, key){ | ||
var vals = {}; | ||
if (value) { | ||
_.each(Object.keys(value), function (key) { | ||
$log.debug('highlight', value); | ||
var val = value[key]; | ||
_.each(val, function(high){ | ||
vals[key] = $sce.trustAsHtml(high); | ||
}); | ||
}); | ||
highlighting[key] = vals; | ||
vm.highlighting[key] = vals; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why are we using vm.highlighting here as opposed to a non attached variable? we are already going to assign the value in the activate function. I think this will have a slight performance cost which will grow with a large number of highlights. Won't this trigger a watch event for each iteration of the loop. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this is worth fixing at the current moment. |
||
} | ||
}); | ||
} | ||
return highlighting; | ||
else{ | ||
vm.highlighting = {}; | ||
} | ||
return vm.highlighting; | ||
} | ||
} | ||
})(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we using one time binding on some highlights and not others?