Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
c0d64726
Commit
c0d64726
authored
Oct 26, 2016
by
c24b
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX]
parent
baeed314
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
55 additions
and
26 deletions
+55
-26
corpora.py
gargantext/views/pages/corpora.py
+12
-10
projects.py
gargantext/views/pages/projects.py
+4
-4
help.js
static/lib/gargantext/help.js
+9
-1
authors.html
templates/pages/corpora/authors.html
+1
-1
myGraphs.html
templates/pages/corpora/myGraphs.html
+1
-1
sources.html
templates/pages/corpora/sources.html
+1
-1
terms.html
templates/pages/corpora/terms.html
+1
-1
menu.html
templates/pages/menu.html
+26
-7
No files found.
gargantext/views/pages/corpora.py
View file @
c0d64726
...
...
@@ -8,11 +8,12 @@ from gargantext.settings import *
from
datetime
import
datetime
def
get_node_user
(
user
):
node_user
=
session
.
query
(
Node
)
.
filter
(
Node
.
user_id
==
user
.
id
&
Node
.
typename
==
"USER"
)
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"
node_user
[
"hyperdata"
]
[
"language"
]
=
"fr"
session
.
add
(
node_user
)
session
.
commit
()
return
node_user
...
...
@@ -38,7 +39,7 @@ def docs_by_titles(request, project_id, corpus_id):
authorized
,
user
,
project
,
corpus
=
_get_user_project_corpus
(
request
,
project_id
,
corpus_id
)
if
not
authorized
:
return
HttpResponseForbidden
()
node_user
=
session
.
query
(
Node
)
.
filter
(
Node
.
user_id
==
user
.
id
&
Node
.
typename
==
"USER"
)
node_user
=
get_node_user
(
user
)
source_type
=
corpus
.
resources
()[
0
][
'type'
]
# response!
return
render
(
...
...
@@ -52,7 +53,7 @@ def docs_by_titles(request, project_id, corpus_id):
'resourcename'
:
get_resource
(
source_type
)[
'name'
],
'view'
:
'titles'
,
'user'
:
request
.
user
,
'user_parameters'
:
get_node_user
(
user
)[
"hyperdata"
]
'user_parameters'
:
node_user
.
hyperdata
,
},
)
...
...
@@ -70,8 +71,9 @@ def docs_by_sources(request, project_id, corpus_id):
project
=
cache
.
Node
[
project_id
]
user
=
cache
.
User
[
request
.
user
.
id
]
source_type
=
corpus
.
resources
()[
0
][
'type'
]
node_user
=
get_node_user
(
user
)
# rendered page : sources.html
print
(
node_user
)
return
render
(
template_name
=
'pages/corpora/sources.html'
,
request
=
request
,
...
...
@@ -82,7 +84,7 @@ def docs_by_sources(request, project_id, corpus_id):
'corpus'
:
corpus
,
'resourcename'
:
get_resource
(
source_type
)[
'name'
],
'user'
:
request
.
user
,
'user_parameters'
:
get_node_user
(
user
)[
"hyperdata"
]
,
'user_parameters'
:
node_user
,
'view'
:
'sources'
},
)
...
...
@@ -101,8 +103,8 @@ def docs_by_authors(request, project_id, corpus_id):
project
=
cache
.
Node
[
project_id
]
user
=
cache
.
User
[
request
.
user
.
id
]
source_type
=
corpus
.
resources
()[
0
][
'type'
]
# rendered page : sources.html
node_user
=
get_node_user
(
user
)
return
render
(
template_name
=
'pages/corpora/authors.html'
,
request
=
request
,
...
...
@@ -114,7 +116,7 @@ def docs_by_authors(request, project_id, corpus_id):
'resourcename'
:
get_resource
(
source_type
)[
'name'
],
'view'
:
'authors'
,
'user'
:
request
.
user
,
'user_parameters'
:
get_node_user
(
user
)
[
"hyperdata"
]
'user_parameters'
:
node_user
[
"hyperdata"
]
},
)
...
...
@@ -126,7 +128,7 @@ def analytics(request, project_id, corpus_id):
return
HttpResponseForbidden
()
source_type
=
corpus
.
resources
()[
0
][
'type'
]
node_user
=
get_node_user
(
user
)
# response!
return
render
(
template_name
=
'pages/analytics/histories.html'
,
...
...
@@ -139,6 +141,6 @@ def analytics(request, project_id, corpus_id):
'resourcename'
:
get_resource
(
source_type
)[
'name'
],
'view'
:
'analytics'
,
'user'
:
request
.
user
,
'user_parameters'
:
get_node_user
(
user
)
[
"hyperdata"
]
'user_parameters'
:
node_user
[
"hyperdata"
]
},
)
gargantext/views/pages/projects.py
View file @
c0d64726
...
...
@@ -18,7 +18,7 @@ def get_node_user(user):
if
node_user
is
None
:
node_user
=
Node
(
user_id
=
user
.
id
,
typename
=
'USER'
,
#
username = user.name,
username
=
user
.
name
,
)
#default language for now is 'fr'
node_user
.
hyperdata
[
"language"
]
=
"fr"
...
...
@@ -66,7 +66,7 @@ def overview(request):
# projects owned by the user
'number'
:
user_projects
.
count
(),
'projects'
:
user_projects
,
"user_parameters"
:
node_user
.
hyperdata
,
"user_parameters"
:
node_user
[
"hyperdata"
]
,
# projects owned by the user's contacts
'common_users'
:
(
contact
for
contact
,
projects
in
contacts_projects
),
'common_projects'
:
sum
((
projects
for
contact
,
projects
in
contacts_projects
),
[]),
...
...
@@ -188,7 +188,7 @@ def project(request, project_id):
'form'
:
NewCorpusForm
,
'user'
:
request
.
user
,
"user_parameters"
:
node_user
.
hyperdata
,
"user_parameters"
:
node_user
[
"hyperdata"
]
,
'date'
:
datetime
.
now
(),
'project'
:
project
,
'donut'
:
donut
,
...
...
@@ -208,7 +208,7 @@ def project(request, project_id):
template_name
=
'pages/projects/project.html'
,
request
=
request
,
context
=
{
"user_parameters"
:
node_user
.
hyperdata
,
"user_parameters"
:
node_user
[
"hyperdata"
]
,
'form'
:
NewCorpusForm
,
'user'
:
request
.
user
,
'date'
:
datetime
.
now
(),
...
...
static/lib/gargantext/help.js
View file @
c0d64726
...
...
@@ -146,6 +146,14 @@ help = {"#project":{
"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
)
...
...
@@ -161,7 +169,7 @@ $( ".help" ).each(function(i, el) {
}
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>'
...
...
templates/pages/corpora/authors.html
View file @
c0d64726
{% extends "pages/menu.html"
with user_parameters%
}
{% extends "pages/menu.html"}
{% block css %}
{% load staticfiles %}
...
...
templates/pages/corpora/myGraphs.html
View file @
c0d64726
{% extends "pages/menu.html"
with user_parameters=user_parameters%
}
{% extends "pages/menu.html"}
{% block css %}
...
...
templates/pages/corpora/sources.html
View file @
c0d64726
{% extends "pages/menu.html"
with user_parameters=user_parameters%
}
{% extends "pages/menu.html"}
{% block css %}
{% load staticfiles %}
...
...
templates/pages/corpora/terms.html
View file @
c0d64726
{% extends "pages/menu.html"
with user_parameters=user_parameters
%}
{% extends "pages/menu.html" %}
{% load staticfiles %}
{% block css %}
...
...
templates/pages/menu.html
View file @
c0d64726
...
...
@@ -5,7 +5,7 @@
<script
type=
"text/javascript"
src=
"{% static "
lib
/
jquery
/
1
.
11
.
1
/
jquery
.
min
.
js
"
%}"
></script>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{% static "
lib
/
bootstrap
/
3
.
0
.
2
/
bootstrap
.
css
"
%}"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{% static "
lib
/
gargantext
/
menu
.
css
"%}"
/>
<!-- <script type="text/javascript" src="{% static "lib/gargantext/help.js" %}"></script> -->
{% block css %}
{% endblock %}
...
...
@@ -104,17 +104,36 @@
{% endif %}
</ul>
</li>
<li
class=
"
lang
"
>
<a
href=
"#"
id=
"lang"
data-lang=
"{{user_parameters.language}}"
role=
"button"
class=
"dropdown-toggle navbar-text
"
>
<li
class=
"
dropdown
"
>
<a
id=
"lang"
href=
"#"
role=
"button"
data-lang=
"{{user_parameters.language}}"
role=
"button"
class=
"dropdown-toggle navbar-text"
data-toggle=
"dropdown"
title=
"This is your chosen language
"
>
{% if user_parameters.language == "fr" %}
<img
value=
"{{user_parameters.language}}"
src=
"{% static "
img
/
fr
.
png
"%}"
width=
"45%"
/>
<img
value=
"{{user_parameters.language}}"
src=
"{% static "
img
/
fr
.
png
"%}"
width=
"25%"
/>
{%else %}
<img
value=
"{{user_parameters.language}}"
src=
"{% static "
img
/
en
.
png
"%}"
width=
"
4
5%"
/>
<img
value=
"{{user_parameters.language}}"
src=
"{% static "
img
/
en
.
png
"%}"
width=
"
2
5%"
/>
{%endif%}
{{user_parameters.language}}
<i
class=
"caret"
></i>
</a>
<ul
class=
"dropdown-menu"
>
<li
class=
"dropdown"
>
<!-- <a href="/{{user.username}}/parameters/" > -->
{% if user_parameters.language == "fr" %}
<button
id=
"new_lang"
data-lang=
"en"
>
<img
value=
"en"
src=
"{% static "
img
/
en
.
png
"%}"
width=
"25%"
/>
en
{%else%}
<img
value=
"fr"
src=
"{% static "
img
/
fr
.
png
"%}"
width=
"25%"
/>
fr
<!-- </a> -->
{%endif%}
</button>
</li>
<li></li>
</ul>
</li>
</ul>
...
...
@@ -359,7 +378,7 @@
-->
<script
type=
"text/javascript"
src=
"{% static "
lib
/
bootstrap
/
3
.
2
.
0
/
bootstrap
.
min
.
js
"
%}"
></script>
<script
type=
"text/javascript"
src=
"{% static "
lib
/
gargantext
/
help
.
js
"
%}"
></script>
<script
type=
"text/javascript"
>
// initializes the popover elements with jquery
$
(
function
()
{
$
(
"[data-toggle='popover']"
).
popover
({
...
...
@@ -417,7 +436,7 @@
<script
type=
"text/javascript"
src=
"{% static "
lib
/
gargantext
/
graph_renamer
.
js
"
%}"
></script>
<!-- <script type="text/javascript" src="{% static "lib/gargantext/help.js" %}"></script> -->
{% endif %}
<script
type=
"text/javascript"
src=
"{% static "
lib
/
gargantext
/
help
.
js
"
%}"
></script>
{% if debug == False %}
<!-- Piwik -->
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment