Commit 29f65267 authored by c24b's avatar c24b

Activated help

parent 5908b135
......@@ -81,4 +81,3 @@ class AuthenticationForm(forms.Form):
def get_user(self):
return self.user_cache
......@@ -5,6 +5,18 @@ from gargantext.models import Node
from gargantext.constants import get_resource
from datetime import datetime
def get_node_user(user):
#load user parameters
node_user = session.query(Node).filter(Node.user_id == user.id, Node.typename== "USER").first()
if node_user is None:
node_user = Node(typename== "USER", user_id = user.id, name= user.name)
#default language for now is 'fr'
node_user["hyperdata"]["language"] = "fr"
session.add(node_user)
session.commit()
return node_user
@requires_auth
def ngramtable(request, project_id, corpus_id):
'''
......@@ -32,7 +44,7 @@ def ngramtable(request, project_id, corpus_id):
corpora_infos = corpora_infos_q.all()
source_type = corpus.resources()[0]['type']
user_node = get_node_user(request.user)
# rendered page : terms.html
return render(
template_name = 'pages/corpora/terms.html',
......@@ -48,6 +60,7 @@ def ngramtable(request, project_id, corpus_id):
# for the CSV import modal
'importroute': "/api/ngramlists/import?onto_corpus=%i"% corpus.id,
'corporainfos' : corpora_infos
'corporainfos' : corpora_infos,
'user_parameters': user_node.hyperdata,
},
)
......@@ -145,31 +145,22 @@ help = {"#project":{
"placement": "right",
"position":"after",
}
}
//define lang
lang = $("a#lang").data("lang")
//change lang
$('li#new_lang').on('click', function (e) {
alert("click");
}
};
$( ".help" ).each(function(i, el) {
console.log("This", el)
console.log("This", el);
id = el.id
div_id = "#"+id
help_steps = Object.keys(help)
//console.log(help_steps)
//console.log("div help:", div_id)
if (help_steps.includes(div_id) == false){
console.log("Step",id,"not described in help")
console.log("Step #",id,"class='help' not described in help")
return
}
btn = id+"-help"
info = help[div_id]
lang = $("a#lang").data("lang");
console.log(lang)
console.log(info[lang]["content"])
help_btn = '<span class="glyphicon glyphicon-question-sign" tab-index=0 data-toggle="popover" data-placement="'+info[lang]["placement"]+'" title="'+info[lang]["title"]+'" data-content="'+info[lang]["content"]+'"></span>'
......@@ -197,7 +188,7 @@ $( ".help" ).each(function(i, el) {
//$(help_btn).insertBefore(el);
}
})
});
$(document).on('click', function (e) {
$('[data-toggle="popover"],[data-original-title]').each(function () {
......
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