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
fad733f6
Commit
fad733f6
authored
Jan 20, 2015
by
Mathieu Rodic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEATURE] Added autocompletion for ngrams filters in advanced charts, part II
https://forge.iscpif.fr/issues/1363
parent
9ffdc327
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
18 deletions
+22
-18
gargantext.angular.js
static/js/gargantext.angular.js
+21
-17
mvc.html
templates/tests/mvc.html
+1
-1
No files found.
static/js/gargantext.angular.js
View file @
fad733f6
...
...
@@ -288,6 +288,20 @@ gargantext.controller("DatasetController", function($scope, $http) {
});
$scope
.
updateQuery
();
};
// query ngrams
$scope
.
getNgrams
=
function
(
query
)
{
var
url
=
'/api/nodes/'
+
$scope
.
corpusId
+
'/children/ngrams?limit=10&contain='
+
encodeURI
(
query
);
var
appendTransform
=
function
(
defaults
,
transform
)
{
defaults
=
angular
.
isArray
(
defaults
)
?
defaults
:
[
defaults
];
return
defaults
.
concat
(
transform
);
}
return
$http
.
get
(
url
,
{
transformResponse
:
appendTransform
(
$http
.
defaults
.
transformResponse
,
function
(
value
)
{
console
.
log
(
value
.
data
)
return
value
.
data
;
})
});
};
// filtering informations retrieval
$scope
.
operators
=
operators
;
// add a filter
...
...
@@ -319,11 +333,13 @@ gargantext.controller("DatasetController", function($scope, $http) {
angular
.
forEach
(
filter
.
value
,
function
(
ngram
)
{
termsList
.
push
(
ngram
.
terms
);
});
filters
.
push
({
field
:
'ngrams.terms'
,
operator
:
'in'
,
value
:
termsList
});
if
(
termsList
.
length
)
{
filters
.
push
({
field
:
'ngrams.terms'
,
operator
:
'in'
,
value
:
termsList
});
}
}
else
{
filters
.
push
({
field
:
filter
.
entity
.
key
+
'.'
+
filter
.
column
.
key
,
...
...
@@ -375,18 +391,6 @@ gargantext.controller("GraphController", function($scope, $http, $element) {
columnsHGap
:
5
}
};
// query ngrams
$scope
.
getNgrams
=
function
(
query
)
{
var
appendTransform
=
function
(
defaults
,
transform
)
{
defaults
=
angular
.
isArray
(
defaults
)
?
defaults
:
[
defaults
];
return
defaults
.
concat
(
transform
);
}
return
$http
.
get
(
'/api/nodes/26128/children/ngrams?limit=10&contain='
+
encodeURI
(
query
),
{
transformResponse
:
appendTransform
(
$http
.
defaults
.
transformResponse
,
function
(
value
)
{
return
value
.
data
;
})
});
};
// add a dataset
$scope
.
addDataset
=
function
()
{
$scope
.
datasets
.
push
({});
...
...
templates/tests/mvc.html
View file @
fad733f6
...
...
@@ -226,7 +226,7 @@
<ul
class=
"datasets"
>
<button
class=
"add"
ng-click=
"addDataset()"
>
Add a dataset...
</button>
<li
class=
"dataset"
ng-controller=
"DatasetController"
ng-repeat=
"dataset in datasets"
>
<hr/>
<hr/>
<div
class=
"corpus"
>
<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>
...
...
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