Commit 20af58c3 authored by Romain Loth's avatar Romain Loth

FIX: annotation view actions affect mainform if subform is highlighted

parent bdc8d2a1
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
// attach the annotation scope dynamically // attach the annotation scope dynamically
if (keyword) { if (keyword) {
// console.log('TextSelectionController found highlighted keyword annotation: ' + keyword.text) // console.log('TextSelectionController found highlighted keyword annotation: ' + keyword.text)
keyword.romdebuginfo = "source = TextSelectionController" ; // keyword.romdebuginfo = "source = TextSelectionController" ;
$scope.keyword = keyword; $scope.keyword = keyword;
} }
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
$rootScope.$emit("positionAnnotationMenu", e.pageX, e.pageY); $rootScope.$emit("positionAnnotationMenu", e.pageX, e.pageY);
$rootScope.$emit("toggleAnnotationMenu", $scope.keyword); $rootScope.$emit("toggleAnnotationMenu", $scope.keyword);
// $rootScope.$emit("toggleAnnotationMenu", {'uuid':42,'list_id':1,'text':'gotcha'}); // $rootScope.$emit("toggleAnnotationMenu", {'uuid':42,'list_id':1,'text':'gotcha'});
console.log("EMIT toggleAnnotationMenu with \$scope.keyword: '" + $scope.keyword.text +"'") // console.log("EMIT toggleAnnotationMenu with \$scope.keyword: '" + $scope.keyword.text +"'")
e.stopPropagation(); e.stopPropagation();
}; };
}]); }]);
...@@ -122,6 +122,7 @@ ...@@ -122,6 +122,7 @@
// otherwise the menu for mainlist items can hide the menu for map items // otherwise the menu for mainlist items can hide the menu for map items
if ($rootScope.lists[annotation.list_id] == "MAPLIST") { if ($rootScope.lists[annotation.list_id] == "MAPLIST") {
console.log($scope)
$scope.menuItems.push({ $scope.menuItems.push({
// "tgtListName" is just used to render the GUI explanation // "tgtListName" is just used to render the GUI explanation
'tgtListName': 'STOPLIST', 'tgtListName': 'STOPLIST',
...@@ -257,13 +258,14 @@ ...@@ -257,13 +258,14 @@
* post/delete * post/delete
*/ */
$scope.onMenuClick = function($event, crudActions) { $scope.onMenuClick = function($event, crudActions) {
console.warn('in onMenuClick') // console.warn('in onMenuClick')
console.warn('item.crudActions') // console.warn('item.crudActions')
console.warn(crudActions) // console.warn(crudActions)
if (angular.isObject($scope.selection_text)) { if (angular.isObject($scope.selection_text)) {
var ngramId = $scope.selection_text.uuid var ngramId = $scope.selection_text.uuid
var mainformId = $scope.selection_text.group
var ngramText = $scope.selection_text.text var ngramText = $scope.selection_text.text
var lastCallback = function() { var lastCallback = function() {
...@@ -291,7 +293,7 @@ ...@@ -291,7 +293,7 @@
MainApiChangeNgramHttpService[action]( MainApiChangeNgramHttpService[action](
{'listId': listId, {'listId': listId,
'ngramIdList': ngramId}, 'ngramIdList': mainformId ? mainformId : ngramId},
// on success // on success
function(data) { function(data) {
...@@ -548,7 +550,7 @@ ...@@ -548,7 +550,7 @@
var cssClass = $rootScope.lists[annotation.list_id]; var cssClass = $rootScope.lists[annotation.list_id];
// except if FOCUS // except if FOCUS
if (annotation.uuid == focusNgram) { if (focusNgram && (annotation.uuid == focusNgram || annotation.group == focusNgram)) {
cssClass = "FOCUS" cssClass = "FOCUS"
} }
......
...@@ -40,6 +40,8 @@ class NgramList(APIView): ...@@ -40,6 +40,8 @@ class NgramList(APIView):
""" """
Get all ngrams for a doc id, sorted by list Get all ngrams for a doc id, sorted by list
usual route: /annotations/documents/<docid>
NB1 : we are within a doc only NB1 : we are within a doc only
NB2 : MAINLIST items are actually MAINLIST without MAP items NB2 : MAINLIST items are actually MAINLIST without MAP items
NB3 : mostly the mainforms are in lists, but doc can have subform NB3 : mostly the mainforms are in lists, but doc can have subform
...@@ -122,8 +124,12 @@ class NgramList(APIView): ...@@ -122,8 +124,12 @@ class NgramList(APIView):
# skip object # skip object
continue continue
if mainform_id == ngram_id:
group = None
else:
group = mainform_id
# normal case # normal case
doc_ngram_list_add((ngram_id, obj.terms, w, list_id)) doc_ngram_list_add((ngram_id, obj.terms, group, w, list_id))
# debug # debug
# print("annotations.views.NgramList.doc_ngram_list: ", doc_ngram_list) # print("annotations.views.NgramList.doc_ngram_list: ", doc_ngram_list)
...@@ -131,10 +137,11 @@ class NgramList(APIView): ...@@ -131,10 +137,11 @@ class NgramList(APIView):
'%s' % doc_id : '%s' % doc_id :
[ [
{'uuid': ngram_id, {'uuid': ngram_id,
'group': group, # the mainform if there is a group
'text': ngram_text, 'text': ngram_text,
'occs': ngram_occurrences, 'occs': ngram_occs,
'list_id': list_id,} 'list_id': list_id,}
for (ngram_id,ngram_text,ngram_occurrences,list_id) in doc_ngram_list for (ngram_id,ngram_text,group,ngram_occs,list_id) in doc_ngram_list
], ],
'lists': lists 'lists': lists
}} }}
......
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