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
87a27ff0
Commit
87a27ff0
authored
Mar 24, 2016
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
annotation app: basic functionality resored
parent
cd21d78a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
33 deletions
+36
-33
activelists.js
annotations/static/annotations/activelists.js
+3
-2
app.css
annotations/static/annotations/app.css
+2
-2
highlight.js
annotations/static/annotations/highlight.js
+4
-4
http.js
annotations/static/annotations/http.js
+19
-19
main.html
annotations/templates/annotations/main.html
+1
-1
views.py
annotations/views.py
+7
-5
No files found.
annotations/static/annotations/activelists.js
View file @
87a27ff0
...
...
@@ -28,13 +28,14 @@
if
(
newValue
===
undefined
)
return
;
// reformat lists to allListsSelect
var
allListsSelect
=
[];
console
.
log
(
$rootScope
.
lists
)
angular
.
forEach
(
$rootScope
.
lists
,
function
(
value
,
key
)
{
this
.
push
({
'id'
:
key
,
'label'
:
value
});
// initialize activeLists with the MiamList by default
if
(
value
==
'M
iamList
'
)
{
if
(
value
==
'M
AINLIST
'
)
{
$rootScope
.
activeLists
=
{};
$rootScope
.
activeLists
[
key
]
=
value
;
}
...
...
@@ -44,7 +45,7 @@
$timeout
(
function
()
{
$
(
'.selectpicker'
).
selectpicker
();
$
(
'.selectpicker'
).
selectpicker
(
'val'
,
[
'M
iamList
'
]);
$
(
'.selectpicker'
).
selectpicker
(
'val'
,
[
'M
AINLIST
'
]);
});
});
...
...
annotations/static/annotations/app.css
View file @
87a27ff0
...
...
@@ -6,13 +6,13 @@
*/
.M
iamList
{
.M
AINLIST
{
color
:
black
;
background-color
:
rgba
(
60
,
118
,
61
,
0.5
);
cursor
:
pointer
;
}
.S
topList
{
.S
TOPLIST
{
color
:
black
;
background-color
:
rgba
(
169
,
68
,
66
,
0.2
);
cursor
:
pointer
;
...
...
annotations/static/annotations/highlight.js
View file @
87a27ff0
...
...
@@ -71,8 +71,8 @@
function
toggleMenu
(
context
,
annotation
)
{
$timeout
(
function
()
{
$scope
.
$apply
(
function
()
{
var
miamlist_id
=
_
.
invert
(
$rootScope
.
lists
).
M
iamList
;
var
stoplist_id
=
_
.
invert
(
$rootScope
.
lists
).
S
topList
;
var
miamlist_id
=
_
.
invert
(
$rootScope
.
lists
).
M
AINLIST
;
var
stoplist_id
=
_
.
invert
(
$rootScope
.
lists
).
S
TOPLIST
;
// variable used in onClick
$scope
.
selection_text
=
angular
.
copy
(
annotation
);
...
...
@@ -87,7 +87,7 @@
'listName'
:
$rootScope
.
lists
[
annotation
.
list_id
]
}
];
if
(
$rootScope
.
lists
[
annotation
.
list_id
]
==
"M
iamList
"
)
{
if
(
$rootScope
.
lists
[
annotation
.
list_id
]
==
"M
APLIST
"
)
{
// Add to the alternative list
$scope
.
menuItems
.
push
({
'action'
:
'post'
,
...
...
@@ -95,7 +95,7 @@
'verb'
:
'Move to'
,
'listName'
:
$rootScope
.
lists
[
stoplist_id
]
});
}
else
if
(
$rootScope
.
lists
[
annotation
.
list_id
]
==
"S
topList
"
)
{
}
else
if
(
$rootScope
.
lists
[
annotation
.
list_id
]
==
"S
TOPLIST
"
)
{
// Add to the alternative list
$scope
.
menuItems
.
push
({
'action'
:
'post'
,
...
...
annotations/static/annotations/http.js
View file @
87a27ff0
...
...
@@ -47,23 +47,23 @@
/*
* Create, modify or delete 1 Ngram
*/
//
http.factory('NgramHttpService', function ($resource) {
//
return $resource(
//
window.ANNOTATION_API_URL + 'lists/:listId/ngrams/:ngramId',
//
{
//
listId: '@listId',
//
ngramId: '@id'
//
},
//
{
//
post: {
//
method: 'POST',
//
params: {'listId': '@listId', 'ngramId': '@ngramId'}
//
},
//
delete: {
//
method: 'DELETE',
//
params: {'listId': '@listId', 'ngramId': '@ngramId'}
//
}
//
}
//
);
//
});
http
.
factory
(
'NgramHttpService'
,
function
(
$resource
)
{
return
$resource
(
window
.
ANNOTATION_API_URL
+
'lists/:listId/ngrams/:ngramId'
,
{
listId
:
'@listId'
,
ngramId
:
'@id'
},
{
post
:
{
method
:
'POST'
,
params
:
{
'listId'
:
'@listId'
,
'ngramId'
:
'@ngramId'
}
},
delete
:
{
method
:
'DELETE'
,
params
:
{
'listId'
:
'@listId'
,
'ngramId'
:
'@ngramId'
}
}
}
);
});
})(
window
);
annotations/templates/annotations/main.html
View file @
87a27ff0
...
...
@@ -58,7 +58,7 @@
<div>
<h5>
Select lists
</h5>
<select
class=
"selectpicker"
multiple
ng-change=
"activeListsChange()"
ng-model=
"lists"
ng-controller=
"ActiveListsController"
>
<option
ng-repeat=
"item in allListsSelect"
id=
"list---{[{item.id}]}"
ng-disabled=
"{[{ item.label == 'M
iamList
' }]}"
>
{[{item.label}]}
</option>
<option
ng-repeat=
"item in allListsSelect"
id=
"list---{[{item.id}]}"
ng-disabled=
"{[{ item.label == 'M
AINLIST
' }]}"
>
{[{item.label}]}
</option>
</select>
</div>
</div>
...
...
annotations/views.py
View file @
87a27ff0
...
...
@@ -42,12 +42,14 @@ class NgramList(APIView):
corpus_id
=
int
(
corpus_id
)
doc_id
=
int
(
doc_id
)
lists
=
{}
for
list_type
in
[
'MiamList'
,
'StopList'
]:
list_id
=
listIds
(
user_id
=
request
.
user
.
id
,
corpus_id
=
int
(
corpus_id
),
typeList
=
list_type
)
lists
[
"
%
s"
%
list_id
[
0
][
0
]]
=
list_type
for
list_type
in
[
'MAINLIST'
]:
corpus_nod
=
cache
.
Node
[
corpus_id
]
list_nod
=
corpus_nod
.
children
(
typename
=
list_type
)
.
first
()
list_id
=
list_nod
.
id
lists
[
"
%
s"
%
list_id
]
=
list_type
# ngrams for the corpus_id (ignoring doc_id for the moment):
doc_ngram_list
=
listNgramIds
(
corpus_id
=
corpus_id
,
doc_id
=
doc_id
,
user_id
=
request
.
user
.
id
)
doc_ngram_list
=
[(
obj
.
id
,
obj
.
terms
,
w
)
for
(
w
,
obj
)
in
list_nod
.
ngrams
.
all
()]
data
=
{
'
%
s'
%
corpus_id
:
{
'
%
s'
%
doc_id
:
[
{
...
...
@@ -56,7 +58,7 @@ class NgramList(APIView):
'occurrences'
:
ngram_occurrences
,
'list_id'
:
list_id
,
}
for
ngram_id
,
ngram_text
,
ngram_occurrences
,
list_id
in
doc_ngram_list
],
for
ngram_id
,
ngram_text
,
ngram_occurrences
in
doc_ngram_list
],
'lists'
:
lists
}}
return
Response
(
data
)
...
...
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