Commit da790f94 authored by Romain Loth's avatar Romain Loth

Ngrams table groups: remove modify buttons if already active modifications

parent bde5ec27
...@@ -148,6 +148,7 @@ class GroupChange(APIView): ...@@ -148,6 +148,7 @@ class GroupChange(APIView):
=> removes couples where newly reconnected ngrams where involved => removes couples where newly reconnected ngrams where involved
=> adds new couples from GroupsBuffer of terms view => adds new couples from GroupsBuffer of terms view
TODO recalculate scores after new groups
TODO see use of util.lists.Translations TODO see use of util.lists.Translations
TODO benchmark selective delete compared to entire list rewrite TODO benchmark selective delete compared to entire list rewrite
""" """
...@@ -155,10 +156,6 @@ class GroupChange(APIView): ...@@ -155,10 +156,6 @@ class GroupChange(APIView):
all_nodes_involved = [] all_nodes_involved = []
links = [] links = []
print([i for i in request.POST.lists()])
pass
for (mainform_key, subforms_ids) in request.POST.lists(): for (mainform_key, subforms_ids) in request.POST.lists():
mainform_id = mainform_key[:-2] # remove brackets '543[]' -> '543' mainform_id = mainform_key[:-2] # remove brackets '543[]' -> '543'
all_nodes_involved.append(mainform_id) all_nodes_involved.append(mainform_id)
......
...@@ -60,8 +60,8 @@ p.note > label { ...@@ -60,8 +60,8 @@ p.note > label {
float: left; float: left;
} }
.note.greyed { .greyed {
opacity: 0.2; opacity: 0.3;
} }
tr:hover { tr:hover {
......
...@@ -441,7 +441,7 @@ function toggleSeeGroup(plusicon, ngramId) { ...@@ -441,7 +441,7 @@ function toggleSeeGroup(plusicon, ngramId) {
plusicon.classList.add('glyphicon-triangle-right') ; plusicon.classList.add('glyphicon-triangle-right') ;
} }
else { else {
var subNgramHtml = seeGroup(ngramId) ; var subNgramHtml = seeGroup(ngramId, true) ;
// we target the html in the mainform term's box // we target the html in the mainform term's box
$( "#box-"+ngramId).append(subNgramHtml) ; $( "#box-"+ngramId).append(subNgramHtml) ;
...@@ -459,7 +459,7 @@ function toggleSeeGroup(plusicon, ngramId) { ...@@ -459,7 +459,7 @@ function toggleSeeGroup(plusicon, ngramId) {
* *
* @param ngramId (of the mainform) * @param ngramId (of the mainform)
*/ */
function seeGroup ( ngramId ) { function seeGroup ( ngramId , allowChangeFlag) {
// 1/7 create new element container // 1/7 create new element container
var subNgramHtml = $('<p class="note">') ; var subNgramHtml = $('<p class="note">') ;
subNgramHtml.attr("id", "subforms-"+ngramId) ; subNgramHtml.attr("id", "subforms-"+ngramId) ;
...@@ -494,12 +494,14 @@ function seeGroup ( ngramId ) { ...@@ -494,12 +494,14 @@ function seeGroup ( ngramId ) {
subNgramHtml.append(htmlMiniTree) subNgramHtml.append(htmlMiniTree)
// 6/7 add a "modify group" button // 6/7 add a "modify group" button
var changeGroupsButton = '<button style="float:right"' ; if (allowChangeFlag) {
changeGroupsButton += ' title="add/remove contents of groups"' ; var changeGroupsButton = '<button style="float:right"' ;
changeGroupsButton += ' onclick="modifyGroup('+ngramId+')">' ; changeGroupsButton += ' title="add/remove contents of groups"' ;
changeGroupsButton += 'modify group' ; changeGroupsButton += ' onclick="modifyGroup('+ngramId+')">' ;
changeGroupsButton += '</button>' ; changeGroupsButton += 'modify group' ;
subNgramHtml.append(changeGroupsButton) ; changeGroupsButton += '</button>' ;
subNgramHtml.append(changeGroupsButton) ;
}
// 7/7 return html snippet (ready for rendering) // 7/7 return html snippet (ready for rendering)
return(subNgramHtml) return(subNgramHtml)
...@@ -919,7 +921,11 @@ function transformContent(ngramId) { ...@@ -919,7 +921,11 @@ function transformContent(ngramId) {
result["name"] += '</span>\n' result["name"] += '</span>\n'
// if curently open we also add #subforms p with the sublist // if curently open we also add #subforms p with the sublist
if (ngram_info["id"] in vizopenGroup) { if (ngram_info["id"] in vizopenGroup) {
result["name"] += seeGroup(ngram_info["id"])[0].outerHTML ; allowChange = (GState != 1)
result["name"] += seeGroup(
ngram_info["id"],
allowChange
)[0].outerHTML ;
} }
} }
result["name"] += '</div>\n' result["name"] += '</div>\n'
......
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