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
ecd23e32
Commit
ecd23e32
authored
Sep 14, 2016
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] terms table: put mono/multi options in a separate filter (todo someday checkboxes)
parent
c066d2a9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
16 deletions
+31
-16
NGrams_dyna_chart_and_table.js
static/lib/gargantext/NGrams_dyna_chart_and_table.js
+25
-12
terms.html
templates/pages/corpora/terms.html
+6
-4
No files found.
static/lib/gargantext/NGrams_dyna_chart_and_table.js
View file @
ecd23e32
...
...
@@ -194,6 +194,7 @@ function saveParamsToCache() {
var
search_filter_status
=
MyTable
.
data
(
'dynatable'
).
settings
.
dataset
.
queries
[
'search'
]
var
state_filter_status
=
MyTable
.
data
(
'dynatable'
).
settings
.
dataset
.
queries
[
'my_state_filter'
]
var
type_filter_status
=
MyTable
.
data
(
'dynatable'
).
settings
.
dataset
.
queries
[
'my_termtype_filter'
]
// var page_status = document.getElementsByClassName("dynatable-page-link dynatable-active-page")[0].getAttribute("data-dynatable-page")
var
per_page_status
=
MyTable
.
data
(
'dynatable'
).
settings
.
dataset
.
perPage
...
...
@@ -211,6 +212,12 @@ function saveParamsToCache() {
else
{
localStorage
.
removeItem
(
corpusId
+
'/terms/state'
)
}
if
(
type_filter_status
)
{
localStorage
[
corpusId
+
'/terms/type'
]
=
type_filter_status
}
else
{
localStorage
.
removeItem
(
corpusId
+
'/terms/type'
)
}
// if (page_status) {
// localStorage[corpusId+'/terms/page'] = page_status
...
...
@@ -233,12 +240,16 @@ function saveParamsToCache() {
function
restoreSettingsFromCache
()
{
var
corpusId
=
getIDFromURL
(
"corpora"
)
// var had_page = localStorage[corpusId+'/terms/page']
var
had_type
=
localStorage
[
corpusId
+
'/terms/type'
]
var
had_state
=
localStorage
[
corpusId
+
'/terms/state'
]
var
had_search
=
localStorage
[
corpusId
+
'/terms/search'
]
var
had_perPage
=
localStorage
[
corpusId
+
'/terms/perPage'
]
// if (had_page) {
// MyTable.data('dynatable').paginationPage.set(had_page);
// }
if
(
had_type
)
{
MyTable
.
data
(
'dynatable'
).
settings
.
dataset
.
queries
[
'my_termtype_filter'
]
=
had_type
}
if
(
had_state
)
{
MyTable
.
data
(
'dynatable'
).
settings
.
dataset
.
queries
[
'my_state_filter'
]
=
had_state
}
...
...
@@ -2215,8 +2226,7 @@ function MainTableAndCharts( ngdata , initial , search_filter) {
// _cellWriter: customCellWriter
},
inputs
:
{
queries
:
$
(
'select#testquery'
),
queries
:
$
(
'select#picklistmenu'
),
queries
:
$
(
'select#picklistmenu, select#picktermtype'
),
}
})
...
...
@@ -2278,28 +2288,31 @@ function MainTableAndCharts( ngdata , initial , search_filter) {
return
true
}
// for states, possible value are in {0,1,2}
else
if
(
selectedValue
<=
2
)
{
else
{
// return true or false
return
(
AjaxRecords
[
record
.
id
].
state
==
selectedValue
)
}
// for values > max_state we can also select mono/multi
else
if
(
selectedValue
==
3
)
{
}
// second filter named 'my_termtype_filter'
MyTable
.
data
(
'dynatable'
).
queries
.
functions
[
'my_termtype_filter'
]
=
function
(
record
,
selectedValue
)
{
if
(
selectedValue
==
'reset'
)
{
return
true
}
else
if
(
selectedValue
==
'mono'
)
{
// one-word terms aka monograms aka monolexical terms
return
(
AjaxRecords
[
record
.
id
][
'name'
].
indexOf
(
" "
)
==
-
1
)
}
else
if
(
selectedValue
==
4
)
{
else
if
(
selectedValue
==
'multi'
)
{
// MWE aka multigrams aka polylexical terms
return
(
AjaxRecords
[
record
.
id
][
'name'
].
indexOf
(
" "
)
!=
-
1
)
}
else
{
console
.
error
(
"unknown value in #picklistmenu :"
,
selectedValue
)
return
true
}
}
// and set this filter's initial status to 'maplist' (aka state == 1)
// MyTable.data('dynatable').settings.dataset.queries['my_state_filter'] = 1 ;
// and set these filters' initial status
MyTable
.
data
(
'dynatable'
).
settings
.
dataset
.
queries
[
'my_state_filter'
]
=
search_filter
;
MyTable
.
data
(
'dynatable'
).
settings
.
dataset
.
queries
[
'my_termtype_filter'
]
=
'reset'
;
MyTable
.
data
(
'dynatable'
).
process
();
// £todo factorize with previous with a param search_filters
...
...
templates/pages/corpora/terms.html
View file @
ecd23e32
...
...
@@ -137,15 +137,17 @@ em {
</div>
<!-- see in javascript function queries.functions['my_state_filter'] -->
<div
class=
"pull-right"
style=
"margin-top:2.1em;padding-left:1em;"
>
Filter:
<select
id=
"picklistmenu"
name=
"my_state_filter"
>
<option
value=
'reset'
>
All
term
s
</option>
<option
value=
'reset'
>
All
list
s
</option>
<option
value=
'0'
>
Candidates only
</option>
<!-- <option value='1' selected="selected">Map terms only</option> -->
<option
value=
'1'
>
Map terms only
</option>
<option
value=
'2'
>
Stopwords only
</option>
<option
value=
'3'
>
One word terms only
</option>
<option
value=
'4'
>
Multiword terms only
</option>
</select>
<select
id=
"picktermtype"
name=
"my_termtype_filter"
style=
"margin-left:1em;"
>
<option
value=
'reset'
>
All types
</option>
<option
value=
'mono'
>
One word terms only
</option>
<option
value=
'multi'
>
Multiword terms only
</option>
</select>
</div>
</h4>
...
...
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