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
ba6d3c63
Commit
ba6d3c63
authored
Jul 25, 2016
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reconnect the side panel input text 'add ngram' in annotations view
parent
0fc68a7b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
95 additions
and
86 deletions
+95
-86
app.css
annotations/static/annotations/app.css
+44
-8
ngramlist.js
annotations/static/annotations/ngramlist.js
+43
-71
main.html
annotations/templates/annotations/main.html
+8
-7
No files found.
annotations/static/annotations/app.css
View file @
ba6d3c63
...
...
@@ -5,13 +5,6 @@
* To display another list name, add a new class under this
*/
.MapList
{
color
:
black
;
/* green */
background-color
:
rgba
(
60
,
118
,
61
,
.7
);
cursor
:
pointer
;
}
.MAPLIST
{
color
:
black
;
/* green */
...
...
@@ -22,8 +15,9 @@
.MAINLIST
{
color
:
black
;
/*
background-color: rgba(60, 118, 61, 0.5);
*/
/*
orange
*/
background-color
:
orange
;
/* background-color: rgba(60, 118, 61, 0.5); */
cursor
:
pointer
;
}
...
...
@@ -42,6 +36,47 @@
cursor
:
pointer
;
}
.inlay
{
border-radius
:
.8em
;
padding
:
0
.5em
;
margin
:
0
.2em
;
}
.words-panel
>
.tab-content
{
font-size
:
80%
;
border-left
:
1px
solid
#aaa
;
border-right
:
1px
solid
#aaa
;
border-bottom
:
1px
solid
#aaa
;
padding
:
1em
;
margin-right
:
1px
;
min-height
:
22em
;
/* needs to be bigger than .words-list */
}
#addfreengram
{
padding
:
3em
.5em
.2em
.5em
;
}
.nav-pills.activelists
>
li
>
a
{
padding
:
10px
1px
;
border-top-left-radius
:
4px
;
border-top-right-radius
:
4px
;
border-bottom-left-radius
:
0
;
border-bottom-right-radius
:
0
;
border-top
:
1px
solid
#ddd
;
border-left
:
1px
solid
#ddd
;
border-right
:
1px
solid
#ddd
;
border-bottom
:
1px
solid
#aaa
;
}
.nav-pills.activelists
>
li
.active
>
a
,
.nav-pills.activelists
>
li
.active
>
a
:focus
,
.nav-pills.activelists
>
li
.active
>
a
:hover
{
background-color
:
#337ab7
;
border-top
:
1px
solid
#aaa
;
border-left
:
1px
solid
#aaa
;
border-right
:
1px
solid
#aaa
;
border-bottom
:
none
;
}
.delete-keyword
,
.occurrences
{
vertical-align
:
super
;
...
...
@@ -89,6 +124,7 @@
.words-list
{
margin-bottom
:
5px
;
min-height
:
17em
;
}
.keyword-text
{
...
...
annotations/static/annotations/ngramlist.js
View file @
ba6d3c63
...
...
@@ -103,8 +103,8 @@
/*
* Add a new NGram from the user input in the extra-text list
*/
$scope
.
onListSubmit
=
function
(
$event
,
l
istId
)
{
var
inputEltId
=
"#"
+
l
istId
+
"-input"
;
$scope
.
onListSubmit
=
function
(
$event
,
tgtL
istId
)
{
var
inputEltId
=
"#"
+
tgtL
istId
+
"-input"
;
if
(
$event
.
keyCode
!==
undefined
&&
$event
.
keyCode
!=
13
)
return
;
var
value
=
angular
.
element
(
inputEltId
).
val
().
trim
();
...
...
@@ -118,11 +118,11 @@
// TODO £NEW : lookup obj[list_id][term_text] = {terminfo}
// // $rootScope.lookup =
console
.
log
(
'looking for "'
+
value
+
'" in list:'
+
l
istId
)
console
.
log
(
'looking for "'
+
value
+
'" in list:'
+
tgtL
istId
)
var
already_in_list
=
false
;
angular
.
forEach
(
$rootScope
.
annotations
,
function
(
annot
,
i
)
{
// console.log(i + ' => ' + annot.text + ',' + annot.list_id) ;
if
(
value
==
annot
.
text
&&
l
istId
==
annot
.
list_id
)
{
if
(
value
==
annot
.
text
&&
tgtL
istId
==
annot
.
list_id
)
{
console
.
log
(
'the term "'
+
value
+
'" was already present in list'
)
// no creation
already_in_list
=
true
;
...
...
@@ -132,74 +132,46 @@
if
(
already_in_list
)
{
return
;
}
// ---------------------------------------------------------------
var
tgtListName
=
$rootScope
.
lists
[
tgtListId
]
// alert("ADDING TO listId: " + tgtListId +"\n listName: "+ tgtListName)
var
crudCallsToMake
=
[]
switch
(
tgtListName
)
{
case
"STOPLIST"
:
crudCallsToMake
=
[
{
'service'
:
MainApiAddNgramHttpService
,
'action'
:
'put'
,
'params'
:
{
'ngramStr'
:
value
,
corpusId
:
$rootScope
.
corpusId
},
'dataPropertiesToCache'
:
[
'id'
]
},
{
'service'
:
MainApiChangeNgramHttpService
,
'action'
:
'put'
,
'params'
:
{
'listId'
:
tgtListId
,
'ngramIdList'
:
{
'fromCache'
:
'id'
}
}
}
];
break
;
case
"MAINLIST"
:
crudCallsToMake
=
[
{
'service'
:
MainApiAddNgramHttpService
,
'action'
:
'put'
,
'params'
:
{
'ngramStr'
:
value
,
corpusId
:
$rootScope
.
corpusId
},
'dataPropertiesToCache'
:
[
'id'
]
},
{
'service'
:
MainApiChangeNgramHttpService
,
'action'
:
'put'
,
'params'
:
{
'listId'
:
tgtListId
,
'ngramIdList'
:
{
'fromCache'
:
'id'
}
}
}
];
break
;
case
"MAPLIST"
:
crudCallsToMake
=
[
{
'service'
:
MainApiAddNgramHttpService
,
'action'
:
'put'
,
'params'
:
{
'ngramStr'
:
value
,
corpusId
:
$rootScope
.
corpusId
},
'dataPropertiesToCache'
:
[
'id'
]
},
{
'service'
:
MainApiChangeNgramHttpService
,
'action'
:
'put'
,
'params'
:
{
'listId'
:
$rootScope
.
listIds
.
MAINLIST
,
'ngramIdList'
:
{
'fromCache'
:
'id'
}
}
},
{
'service'
:
MainApiChangeNgramHttpService
,
'action'
:
'put'
,
'params'
:
{
'listId'
:
tgtListId
,
'ngramIdList'
:
{
'fromCache'
:
'id'
}
}
}
];
break
;
}
// run the ajax calls in a recursive loop by calling the step n° 0
$rootScope
.
makeChainedCalls
(
0
,
crudCallsToMake
,
$rootScope
.
refresh
)
var
listName
=
$rootScope
.
lists
[
listId
]
alert
(
"listId: "
+
listId
+
"
\n
listName: "
+
listName
)
console
.
log
(
"dir $rootScope :"
)
console
.
dir
(
$rootScope
)
// run the loop by calling the initial recursion step
// $rootScope.makeChainedCalls(0, crudCalls, lastCallback)
// AddNgram
// --------
// creation will return an ngramId
// (checks if there's a preexisting ngramId for this value
// otherwise creates a new one and indexes the ngram in corpus)
// MainApiAddNgramHttpService.put(
// {
// // text <=> str to create the new ngram
// 'text': value,
// 'corpusId': $rootScope.corpusId
// },
// // on AddNgram success
// function(data) {
// var newNgramId = data.id
// console.log("OK created new ngram for '"+value+"' with id: "+newNgramId)
//
// // ChangeNgram
// // -----------
// // add to listId after creation
// // TODO: if maplist => also add to miam
// MainApiChangeNgramHttpService["put"](
// {
// 'listId': listId,
// 'ngramIdList': newNgramId
// },
// // on ChangeNgram success
// function(data) {
// // Refresh the annotations (was broken: TODO FIX)
// console.warn("refresh attempt");
// angular.element(inputEltId).val(""); // what for ???
// NgramListHttpService.get(
// {
// 'corpusId': $rootScope.corpusId,
// 'docId': $rootScope.docId
// },
// // on refresh success
// function(data) {
// $rootScope.annotations = data[$rootScope.corpusId.toString()][$rootScope.docId.toString()];
// $rootScope.refreshDisplay();
// },
// // on refresh error
// function(data) {
// console.error("unable to get the list of ngrams");
// }
// );
// },
// // on ChangeNgram error
// function(data) {
// console.error("unable to edit the Ngram"+ngramId+") on list "+listId+")");
// }
// );
// },
// // on AddNgram error
// function(data) {
// angular.element(inputEltId).parent().addClass("has-error");
// console.error("error adding Ngram "+ value);
// }
// );
};
// onListSubmit
}]);
...
...
annotations/templates/annotations/main.html
View file @
ba6d3c63
...
...
@@ -36,9 +36,11 @@
</select>
</h5>
<div
class=
"row spacer"
></div>
<ul
class=
"nav nav-pills nav-justified"
>
<ul
class=
"nav nav-pills nav-justified
activelists
"
>
<li
ng-repeat=
"(listId, listName) in activeLists"
ng-class=
"{active: $first == true}"
>
<a
href=
"#tab-{[{listId}]}"
data-toggle=
"tab"
>
{[{listName}]}
</a>
<a
href=
"#tab-{[{listId}]}"
data-toggle=
"tab"
>
<span
class=
"{[{listName}]} inlay"
>
{[{listName}]}
</span>
</a>
</li>
</ul>
</div>
...
...
@@ -60,12 +62,11 @@
<li
ng-class=
"{'disabled': currentListPage >= totalListPages(listId) - 1}"
><a
ng-click=
"nextListPage()"
class=
"glyphicon glyphicon-forward"
></a></li>
</ul>
</nav>
<
!--
<div class="form-group" ng-controller="NgramInputController"
>
<input autosave="search" maxlength="240" placeholder="A
dd a
ny text" type="text" class="form-control" id="{[{listId}]}-input" ng-keypress="onListSubmit($event, listId)">
<button type="submit" class="form-control btn btn-default
btn-primary" ng-click="onListSubmit($event, listId)">Add to {[{listName}]}
</button>
<
div
id=
"addfreengram"
class=
"form-group"
ng-controller=
"NgramInputController"
>
<label
for=
"{[{listId}]}-input"
>
Add a free term to
<span
class=
"{[{listName}]} inlay"
>
{[{listName}]}
</span>
:
</label
>
<input
autosave=
"search"
maxlength=
"240"
placeholder=
"Any text"
type=
"text"
class=
"form-control"
id=
"{[{listId}]}-input"
ng-keypress=
"onListSubmit($event, listId)"
>
<button
type=
"submit"
class=
"form-control btn btn-default
"
ng-click=
"onListSubmit($event, listId)"
>
Create
&
add
</button>
</div>
-->
</div>
</div>
</div>
...
...
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