Skip to content

Commit

Permalink
full turnaround of source entities
Browse files Browse the repository at this point in the history
  • Loading branch information
chrishokamp committed Jun 3, 2014
1 parent 5ca4556 commit e42b2d3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/scripts/sourceArea/sourceArea.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ angular.module('directives')
// this comes from the Document service via segment via contentArea
sourceSentence: '=',
annotatedSentence: '=',
findSurfaceForms: '&'
},
restrict: 'E',
//templateUrl: 'scripts/sourceArea/sourceArea.html',
Expand Down Expand Up @@ -39,9 +38,8 @@ angular.module('directives')
angular.forEach(data.entityData, function(resObj) {
var surfaceForm = resObj['@surfaceForm'];
// test
scope.$emit('find-surface-forms', { 'sf': surfaceForm });
var re = new RegExp('(' + surfaceForm + ')', "g");
text = text.replace(re, '<span style="background-color: blue" ng-click="">$1</span>');
text = text.replace(re, '<span style="text-decoration: underline" ng-click="setSurfaceForms($event)">$1</span>');
});
$log.log('replaced text: ' + text);
var compiledHTML = $compile(text)(scope);
Expand All @@ -56,6 +54,11 @@ angular.module('directives')
$scope.getLinkedData = function() {
return '<ul><li>test</li><li>test</li><li>test</li></ul>';
}
$scope.setSurfaceForms = function(e) {
var surfaceForm = $(e.target).text();
$log.log('target text is: ' + surfaceForm);
$scope.$emit('find-surface-forms', { 'sf': surfaceForm });
}

}
};
Expand Down

0 comments on commit e42b2d3

Please sign in to comment.