Commit da857199 authored by Romain Loth's avatar Romain Loth

FIX: annotation view actions affect mainform if subform is highlighted

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