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
9a0e4e1c
Commit
9a0e4e1c
authored
Jan 07, 2015
by
Administrator
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'mat-master'
Intégration last changes of Mathieu
parents
8af90db3
75530220
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
426 additions
and
31 deletions
+426
-31
api.py
gargantext_web/api.py
+1
-0
settings.py
gargantext_web/settings.py
+7
-19
urls.py
gargantext_web/urls.py
+2
-0
views.py
gargantext_web/views.py
+11
-0
gargantext.angular.js
static/js/gargantext.angular.js
+40
-7
mvc-listdocuments.html
templates/tests/mvc-listdocuments.html
+360
-0
mvc.html
templates/tests/mvc.html
+5
-5
No files found.
gargantext_web/api.py
View file @
9a0e4e1c
...
@@ -509,6 +509,7 @@ class NodesList(APIView):
...
@@ -509,6 +509,7 @@ class NodesList(APIView):
def
get
(
self
,
request
):
def
get
(
self
,
request
):
query
=
(
Node
query
=
(
Node
.
query
(
Node
.
id
,
Node
.
name
,
NodeType
.
name
.
label
(
'type'
))
.
query
(
Node
.
id
,
Node
.
name
,
NodeType
.
name
.
label
(
'type'
))
.
filter
(
Node
.
user_id
==
request
.
session
.
_session_cache
[
'_auth_user_id'
])
.
join
(
NodeType
)
.
join
(
NodeType
)
)
)
if
'type'
in
request
.
GET
:
if
'type'
in
request
.
GET
:
...
...
gargantext_web/settings.py
View file @
9a0e4e1c
...
@@ -10,7 +10,7 @@ https://docs.djangoproject.com/en/1.6/ref/settings/
...
@@ -10,7 +10,7 @@ https://docs.djangoproject.com/en/1.6/ref/settings/
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import
os
import
os
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
__file__
))
BASE_DIR
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
__file__
)
))
PROJECT_PATH
=
os
.
path
.
join
(
BASE_DIR
,
os
.
pardir
)
PROJECT_PATH
=
os
.
path
.
join
(
BASE_DIR
,
os
.
pardir
)
PROJECT_PATH
=
os
.
path
.
abspath
(
PROJECT_PATH
)
PROJECT_PATH
=
os
.
path
.
abspath
(
PROJECT_PATH
)
...
@@ -33,16 +33,7 @@ TEMPLATE_DEBUG = True
...
@@ -33,16 +33,7 @@ TEMPLATE_DEBUG = True
TEMPLATE_DIRS
=
(
TEMPLATE_DIRS
=
(
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
os
.
path
.
join
(
BASE_DIR
,
'templates'
),
# Always use forward slashes
# Don't forget to use absolute paths, not relative paths.
'/srv/gargantext/templates'
,
#import os.path
#
#TEMPLATE_DIRS = (
# os.path.join(os.path.dirname(__file__), 'templates').replace('\\','/'),
#)
)
)
...
@@ -121,11 +112,11 @@ USE_TZ = True
...
@@ -121,11 +112,11 @@ USE_TZ = True
ROOT_URLCONF
=
'gargantext_web.urls'
ROOT_URLCONF
=
'gargantext_web.urls'
STATIC_ROOT
=
'/var/www/gargantext/static/'
STATIC_ROOT
=
os
.
path
.
join
(
PROJECT_PATH
,
'static'
)
STATIC_URL
=
'/static/'
STATIC_URL
=
'/static/'
MEDIA_ROOT
=
'/var/www/gargantext/media'
#
MEDIA_ROOT = '/var/www/gargantext/media'
#
MEDIA_ROOT = os.path.join(PROJECT_PATH, 'media')
MEDIA_ROOT
=
os
.
path
.
join
(
PROJECT_PATH
,
'media'
)
MEDIA_URL
=
'/media/'
MEDIA_URL
=
'/media/'
...
@@ -136,11 +127,8 @@ STATICFILES_FINDERS = (
...
@@ -136,11 +127,8 @@ STATICFILES_FINDERS = (
STATICFILES_DIRS
=
(
STATICFILES_DIRS
=
(
#os.path.join(BASE_DIR, "static"),
os
.
path
.
join
(
BASE_DIR
,
"static"
),
'/srv/gargantext/static'
,
)
#'/var/www/www/alexandre/media',
#'/var/www/alexandre.delanoe.org/',
)
TEMPLATE_CONTEXT_PROCESSORS
=
(
TEMPLATE_CONTEXT_PROCESSORS
=
(
"django.contrib.auth.context_processors.auth"
,
"django.contrib.auth.context_processors.auth"
,
...
...
gargantext_web/urls.py
View file @
9a0e4e1c
...
@@ -29,6 +29,7 @@ urlpatterns = patterns('',
...
@@ -29,6 +29,7 @@ urlpatterns = patterns('',
url
(
r'^project/(\d+)/corpus/(\d+)/$'
,
views
.
corpus
),
url
(
r'^project/(\d+)/corpus/(\d+)/$'
,
views
.
corpus
),
url
(
r'^project/(\d+)/corpus/(\d+)/delete/$'
,
views
.
delete_corpus
),
url
(
r'^project/(\d+)/corpus/(\d+)/delete/$'
,
views
.
delete_corpus
),
url
(
r'^project/(\d+)/corpus/(\d+)/corpus.csv$'
,
views
.
corpus_csv
),
url
(
r'^project/(\d+)/corpus/(\d+)/corpus.csv$'
,
views
.
corpus_csv
),
url
(
r'^project/(\d+)/corpus/(tests_mvc_listdocuments+)/corpus.tests_mvc_listdocuments$'
,
views
.
corpus_csv
),
url
(
r'^project/(\d+)/corpus/(\d+)/timerange/(\d+)/(\d+)$'
,
views
.
subcorpus
),
url
(
r'^project/(\d+)/corpus/(\d+)/timerange/(\d+)/(\d+)$'
,
views
.
subcorpus
),
...
@@ -57,6 +58,7 @@ urlpatterns = patterns('',
...
@@ -57,6 +58,7 @@ urlpatterns = patterns('',
url
(
r'^ngrams$'
,
views
.
ngrams
),
url
(
r'^ngrams$'
,
views
.
ngrams
),
url
(
r'^nodeinfo/(\d+)$'
,
views
.
nodeinfo
),
url
(
r'^nodeinfo/(\d+)$'
,
views
.
nodeinfo
),
url
(
r'^tests/mvc$'
,
views
.
tests_mvc
),
url
(
r'^tests/mvc$'
,
views
.
tests_mvc
),
url
(
r'^tests/mvc-listdocuments$'
,
views
.
tests_mvc_listdocuments
),
)
)
...
...
gargantext_web/views.py
View file @
9a0e4e1c
...
@@ -701,6 +701,17 @@ def tests_mvc(request):
...
@@ -701,6 +701,17 @@ def tests_mvc(request):
}))
}))
return
HttpResponse
(
html
)
return
HttpResponse
(
html
)
def
tests_mvc_listdocuments
(
request
):
'''Just a test page for Javascript MVC.'''
t
=
get_template
(
'tests/mvc-listdocuments.html'
)
user
=
request
.
user
date
=
datetime
.
datetime
.
now
()
html
=
t
.
render
(
Context
({
'user'
:
user
,
'date'
:
date
,
}))
return
HttpResponse
(
html
)
def
ngrams
(
request
):
def
ngrams
(
request
):
'''The ngrams list.'''
'''The ngrams list.'''
t
=
get_template
(
'ngrams.html'
)
t
=
get_template
(
'ngrams.html'
)
...
...
static/js/gargantext.angular.js
View file @
9a0e4e1c
...
@@ -87,7 +87,7 @@ var groupings = {
...
@@ -87,7 +87,7 @@ var groupings = {
// Define the application
// Define the application
var
gargantext
=
angular
.
module
(
'Gargantext'
,
[
'n3-charts.linechart'
,
'ngCookies'
])
var
gargantext
=
angular
.
module
(
'Gargantext'
,
[
'n3-charts.linechart'
,
'ngCookies'
])
;
// Customize the application's scope
// Customize the application's scope
...
@@ -168,7 +168,7 @@ gargantext.controller("QueryController", function($scope, $http) {
...
@@ -168,7 +168,7 @@ gargantext.controller("QueryController", function($scope, $http) {
// change view to loading mode
// change view to loading mode
$scope
.
loading
=
true
;
$scope
.
loading
=
true
;
// query parameters: columns
// query parameters: columns
var
retrieve
=
{
type
:
'fields'
,
list
:
[
'id'
,
'name'
]};
var
retrieve
=
{
type
:
'fields'
,
list
:
[
'id'
,
'name'
,
'metadata.publication_date'
]};
// query parameters: pagination
// query parameters: pagination
var
pagination
=
$scope
.
pagination
;
var
pagination
=
$scope
.
pagination
;
// query parameters: sort
// query parameters: sort
...
@@ -200,13 +200,27 @@ gargantext.controller("QueryController", function($scope, $http) {
...
@@ -200,13 +200,27 @@ gargantext.controller("QueryController", function($scope, $http) {
// send query to the server
// send query to the server
$http
.
post
(
url
,
query
).
success
(
function
(
response
){
$http
.
post
(
url
,
query
).
success
(
function
(
response
){
$scope
.
resultsCount
=
response
.
pagination
.
total
;
$scope
.
resultsCount
=
response
.
pagination
.
total
;
$scope
.
results
=
response
.
data
;
$scope
.
results
=
response
.
results
;
$scope
.
columns
=
response
.
retrieve
;
$scope
.
loading
=
false
;
$scope
.
loading
=
false
;
}).
error
(
function
(
response
){
}).
error
(
function
(
response
){
console
.
error
(
response
);
console
.
error
(
response
);
});
});
}
}
}
}
// change current page
$scope
.
decrement
=
function
()
{
if
(
$scope
.
pagination
.
offset
>
0
)
{
$scope
.
pagination
.
offset
--
;
}
$scope
.
postQuery
();
};
$scope
.
increment
=
function
()
{
if
(
$scope
.
pagination
.
offset
<
$scope
.
resultsCount
)
{
$scope
.
pagination
.
offset
+=
$scope
.
pagination
.
limit
;
}
$scope
.
postQuery
();
};
});
});
// Controller for datasets
// Controller for datasets
...
@@ -220,10 +234,17 @@ gargantext.controller("DatasetController", function($scope, $http) {
...
@@ -220,10 +234,17 @@ gargantext.controller("DatasetController", function($scope, $http) {
$scope
.
results
=
[];
$scope
.
results
=
[];
$scope
.
resultsCount
=
undefined
;
$scope
.
resultsCount
=
undefined
;
// corpus retrieval
// corpus retrieval
$scope
.
projects
=
[];
$scope
.
corpora
=
[];
$scope
.
corpora
=
[];
$http
.
get
(
'/api/nodes?type=
Corpus
'
,
{
cache
:
true
}).
success
(
function
(
response
){
$http
.
get
(
'/api/nodes?type=
Project
'
,
{
cache
:
true
}).
success
(
function
(
response
){
$scope
.
corpora
=
response
.
data
;
$scope
.
projects
=
response
.
data
;
});
});
// update corpora according to the select parent project
$scope
.
updateCorpora
=
function
()
{
$http
.
get
(
'/api/nodes?type=Corpus&parent='
+
$scope
.
projectId
,
{
cache
:
true
}).
success
(
function
(
response
){
$scope
.
corpora
=
response
.
data
;
});
};
// update entities depending on the selected corpus
// update entities depending on the selected corpus
$scope
.
updateEntities
=
function
()
{
$scope
.
updateEntities
=
function
()
{
var
url
=
'/api/nodes/'
+
$scope
.
corpusId
+
'/children/metadata'
;
var
url
=
'/api/nodes/'
+
$scope
.
corpusId
+
'/children/metadata'
;
...
@@ -302,7 +323,7 @@ gargantext.controller("GraphController", function($scope, $http, $element) {
...
@@ -302,7 +323,7 @@ gargantext.controller("GraphController", function($scope, $http, $element) {
options
:
{
options
:
{
axes
:
{
axes
:
{
x
:
{
key
:
'x'
,
type
:
'date'
},
x
:
{
key
:
'x'
,
type
:
'date'
},
y
:
{
type
:
'l
og
'
},
y
:
{
type
:
'l
inear'
,
type
:
'numeric
'
},
},
},
tension
:
1.0
,
tension
:
1.0
,
lineMode
:
'bundle'
,
lineMode
:
'bundle'
,
...
@@ -363,15 +384,27 @@ gargantext.controller("GraphController", function($scope, $http, $element) {
...
@@ -363,15 +384,27 @@ gargantext.controller("GraphController", function($scope, $http, $element) {
});
});
});
});
// Convert this object back to a sorted array
// Convert this object back to a sorted array
var
yMin
,
yMax
;
var
linearData
=
[];
var
linearData
=
[];
for
(
var
x
in
dataObject
)
{
for
(
var
x
in
dataObject
)
{
var
row
=
{
x
:
convert
(
x
)};
var
row
=
{
x
:
convert
(
x
)};
var
yList
=
dataObject
[
x
];
var
yList
=
dataObject
[
x
];
for
(
var
i
=
0
;
i
<
yList
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
yList
.
length
;
i
++
)
{
row
[
'y'
+
i
]
=
yList
[
i
];
y
=
yList
[
i
];
row
[
'y'
+
i
]
=
y
;
if
(
yMax
==
undefined
||
y
>
yMax
)
{
yMax
=
y
;
}
if
(
yMin
==
undefined
||
y
<
yMin
)
{
yMin
=
y
;
}
}
}
linearData
.
push
(
row
);
linearData
.
push
(
row
);
}
}
// Update the axis
$scope
.
graph
.
options
.
axes
.
y
.
min
=
yMin
;
$scope
.
graph
.
options
.
axes
.
y
.
max
=
yMax
;
$scope
.
graph
.
options
.
axes
.
y
.
ticks
=
100
;
// Finally, update the graph
// Finally, update the graph
var
series
=
[];
var
series
=
[];
for
(
var
i
=
0
,
n
=
$scope
.
datasets
.
length
;
i
<
n
;
i
++
)
{
for
(
var
i
=
0
,
n
=
$scope
.
datasets
.
length
;
i
<
n
;
i
++
)
{
...
...
templates/tests/mvc-listdocuments.html
0 → 100644
View file @
9a0e4e1c
This diff is collapsed.
Click to expand it.
templates/tests/mvc.html
View file @
9a0e4e1c
...
@@ -227,10 +227,10 @@
...
@@ -227,10 +227,10 @@
<div
class=
"corpus"
>
<div
class=
"corpus"
>
<button
ng-click=
"removeDataset($index)"
title=
"remove this dataset"
>
X
</button>
<button
ng-click=
"removeDataset($index)"
title=
"remove this dataset"
>
X
</button>
<select
ng-model=
"mesured"
style=
"background-color:{{ getColor($index, datasets.length) }}"
ng-options=
"value as key for (key, value) in {'Documents count': 'nodes.count', 'Ngrams count': 'ngrams.count'}"
ng-change=
"updateQuery()"
></select>
<select
ng-model=
"mesured"
style=
"background-color:{{ getColor($index, datasets.length) }}"
ng-options=
"value as key for (key, value) in {'Documents count': 'nodes.count', 'Ngrams count': 'ngrams.count'}"
ng-change=
"updateQuery()"
></select>
in the
corpus
in the
project
<select
ng-model=
"
corpusId"
ng-change=
"updateEntities()"
>
<select
ng-model=
"
projectId"
ng-change=
"updateCorpora()"
ng-options=
"project.id as project.name for project in projects"
></select>
,
<option
ng-repeat=
"corpus in corpora"
value=
"{{corpus.id}}"
>
{{corpus.name}}
</option>
corpus
</select>
<
select
ng-model=
"corpusId"
ng-change=
"updateEntities()"
ng-options=
"corpus.id as corpus.name for corpus in corpora"
><
/select>
</div>
</div>
<div
class=
"filters"
ng-if=
"entities"
>
<div
class=
"filters"
ng-if=
"entities"
>
<ul>
<ul>
...
@@ -273,7 +273,7 @@
...
@@ -273,7 +273,7 @@
<br/>
<br/>
Y-axis: use a
Y-axis: use a
<select
ng-model=
"graph.options.axes.y.type"
ng-options=
"type for type in ['l
og', 'linear
']"
></select>
<select
ng-model=
"graph.options.axes.y.type"
ng-options=
"type for type in ['l
inear', 'log
']"
></select>
scale
scale
<br/>
<br/>
...
...
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