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
0228bef5
Commit
0228bef5
authored
May 02, 2016
by
delanoe
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/romain-refactoring' into refactoring-merge
parents
6c2b5ea4
82663596
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
78 additions
and
74 deletions
+78
-74
Europress.py
gargantext/util/parsers/Europress.py
+7
-7
requirements.txt
install/python/requirements.txt
+1
-1
tables.css
static/css/gargantext/tables.css
+4
-0
Docs_dyna_chart_and_table.js
static/js/gargantext/Docs_dyna_chart_and_table.js
+49
-19
jquery.dynatable.js
static/js/jquery/jquery.dynatable.js
+4
-46
titles.html
templates/pages/corpora/titles.html
+13
-1
No files found.
gargantext/util/parsers/Europress.py
View file @
0228bef5
...
...
@@ -228,22 +228,22 @@ class EuropressParser(Parser):
# 2) we parse the retrieved datestring into a formal date
try
:
hyperdata
[
'publication_date'
]
=
dateparser
.
parse
(
the_date
=
dateparser
.
parse
(
date_str
.
strip
(),
languages
=
[
doc_language
],
date_formats
=
[
'
%
d
%
B
%
Y'
,
'
%
B
%
d,
%
Y'
]
)
# print("RES POSTPROC:",hyperdata['publication_date'])
except
:
hyperdata
[
'publication_date'
]
=
timezone
.
now
()
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
the_date
=
timezone
.
now
()
hyperdata
[
'publication_date'
]
=
the_date
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
# print("RES POSTPROC:",hyperdata['publication_date'])
# infos dérivées
hyperdata
[
'publication_year'
]
=
hyperdata
[
'publication_date'
]
.
strftime
(
'
%
Y'
)
hyperdata
[
'publication_month'
]
=
hyperdata
[
'publication_date'
]
.
strftime
(
'
%
m'
)
hyperdata
[
'publication_day'
]
=
hyperdata
[
'publication_date'
]
.
strftime
(
'
%
d'
)
hyperdata
[
'publication_year'
]
=
the_date
.
strftime
(
'
%
Y'
)
hyperdata
[
'publication_month'
]
=
the_date
.
strftime
(
'
%
m'
)
hyperdata
[
'publication_day'
]
=
the_date
.
strftime
(
'
%
d'
)
# RUBRIQUE
...
...
install/python/requirements.txt
View file @
0228bef5
...
...
@@ -4,7 +4,7 @@ anyjson==0.3.3
billiard==3.3.0.22 # multiprocessing fork
celery==3.1.20
chardet==2.3.0
dateparser==0.3.
2
dateparser==0.3.
5
Django==1.9.2
django-celery==3.1.17
django-pgfields==1.4.4
...
...
static/css/gargantext/tables.css
View file @
0228bef5
...
...
@@ -26,6 +26,10 @@ th a {
min-width
:
20em
;
}
#doubleSearch
{
min-width
:
25em
;
}
.dynatable-search
{
margin-left
:
2em
;
font-size
:
16px
;
...
...
static/js/gargantext/Docs_dyna_chart_and_table.js
View file @
0228bef5
...
...
@@ -435,11 +435,14 @@ function Main_test( Data , SearchFilter ) {
},
features
:
{
pushState
:
false
,
// prevent default title search which can't do title vs abstract
search
:
false
,
// sort: false //i need to fix the sorting function... the current one just sucks
},
// inputs: {
// queries: $('#searchAB')
// },
inputs
:
{
// our own search which differentiates title vs abstract queries
queries
:
$
(
'#doubleSearch'
)
},
writers
:
{
_rowWriter
:
ulWriter
// _cellWriter: customCellWriter
...
...
@@ -454,26 +457,53 @@ function Main_test( Data , SearchFilter ) {
$
(
".dynatable-record-count"
).
insertAfter
(
".imadiv"
)
$
(
".dynatable-pagination-links"
).
insertAfter
(
".imadiv"
)
// make filter checkboxes appear in the right place (ie after search box)
$
(
"#filter_search"
).
html
(
$
(
"#filter_search"
).
html
().
replace
(
'selected="selected"'
)
);
$
(
"#"
+
SearchFilter
).
attr
(
"selected"
,
"selected"
)
var
the_content
=
$
(
"#filter_search"
).
html
();
$
(
""
+
the_content
).
insertAfter
(
"#dynatable-query-search-my-ajax-table"
)
// $('#searchAB').click( function() {
// if($(this).is(':checked')) {
// console.log( "Do stuff")
// $("#dynatable-query-search-my-ajax-table").keyup(function (e) {
// if (e.keyCode == 13) {
// console.log("Do stuff: Just pressed ENTER")
// }
// })
// }
// });
// MyTable.data('dynatable').settings.inputs.queries = { $('#searchAB') }
// .insertAfter("#dynatable-query-search-my-ajax-table")
$
(
""
+
the_content
).
insertAfter
(
"#doubleSearch"
)
// binds a custom filter to our 'doubleSearch' via dynatable.queries.functions
MyTable
.
data
(
'dynatable'
).
queries
.
functions
[
'doubleSearch'
]
=
function
(
record
,
searchString
)
{
// NB searchString == $("#doubleSearch").val()
// by default we always decide to search in the title
matchInTexts
=
[
record
.
title
]
// if box is checked we'll also search in the abstracts
if
(
$
(
"#searchAB"
).
is
(
':checked'
))
{
matchInTexts
.
push
(
record
.
hyperdata
.
abstract
)
}
// inspired from the default cf. dynatable.queries.functions['search']
var
contains
=
false
;
for
(
i
in
matchInTexts
)
{
matchInText
=
matchInTexts
[
i
]
contains
=
(
matchInText
.
toLowerCase
().
indexOf
(
searchString
.
toLowerCase
()
)
!==
-
1
)
if
(
contains
)
{
break
;
}
else
{
continue
;
}
}
return
contains
;
}
MyTable
.
data
(
'dynatable'
).
process
// re-apply search function on click
$
(
'#searchAB'
).
click
(
function
()
{
MyTable
.
data
(
'dynatable'
).
process
();
});
// re-apply search function on ENTER
$
(
"#doubleSearch"
).
keyup
(
function
(
e
)
{
if
(
e
.
keyCode
==
13
)
{
MyTable
.
data
(
'dynatable'
).
process
();
}
})
return
"OK"
}
...
...
static/js/jquery/jquery.dynatable.js
View file @
0228bef5
...
...
@@ -1177,51 +1177,9 @@
}
}
// collect all records that return true for query
if
(
$
(
'input[name=searchAB]:checked'
).
length
==
0
)
{
settings
.
dataset
.
records
=
$
.
map
(
settings
.
dataset
.
records
,
function
(
record
)
{
return
_this
.
functions
[
query
](
record
,
value
)
?
record
:
null
;
});
}
else
{
var
pageurl
=
window
.
location
.
href
.
split
(
"/"
)
var
cid
;
for
(
var
i
in
pageurl
)
{
if
(
pageurl
[
i
]
==
"corpus"
)
{
cid
=
parseInt
(
i
);
break
;
}
}
var
corpus_id
=
pageurl
[
cid
+
1
];
var
search_api
=
window
.
location
.
origin
+
"/v1.0/nodes/"
+
corpus_id
+
"/children/ids?limit="
+
(
settings
.
dataset
.
records
.
length
)
+
"&contain="
+
encodeURI
(
value
.
toLowerCase
())
var
coincidences_
=
[]
$
.
ajax
({
type
:
"GET"
,
url
:
search_api
,
dataType
:
"json"
,
async
:
false
,
success
:
function
(
data
,
textStatus
,
jqXHR
)
{
var
results_
=
{}
if
(
data
.
pagination
.
total
>
0
)
{
for
(
var
i
in
data
.
data
)
{
results_
[
data
.
data
[
i
].
id
]
=
true
}
for
(
var
i
in
settings
.
dataset
.
records
)
{
if
(
results_
[
settings
.
dataset
.
records
[
i
].
id
]
)
{
coincidences_
.
push
(
settings
.
dataset
.
records
[
i
]
)
}
}
}
},
error
:
function
(
exception
)
{
console
.
log
(
"error in abstracts-API:"
);
console
.
log
(
exception
)
console
.
log
(
" - - - -- - - -"
)
}
})
console
.
log
(
"abstracts-API: "
+
coincidences_
.
length
)
settings
.
dataset
.
records
=
coincidences_
}
}
}
settings
.
dataset
.
queryRecordCount
=
obj
.
records
.
count
();
...
...
templates/pages/corpora/titles.html
View file @
0228bef5
...
...
@@ -61,6 +61,14 @@
<p
id=
"corpusdisplayer"
onclick=
'Final_UpdateTable("click")'
class=
"btn btn-primary btn-lg"
style=
"width:200px; margin:0 auto; display:block;"
>
Titles
</h2></p>
</a>
</h4>
<!-- search box with custom function in Docs_dyna_chart_and_tables.js -->
<div
class=
"pull-left"
style=
"margin-top:1.85em; font-size: 16px;"
>
Search:
<input
type=
"search"
id=
"doubleSearch"
/>
</div>
</div>
<div
id=
"collapseOne"
class=
"panel-collapse collapse no-transition"
role=
"tabpanel"
>
<div
class=
"panel-body"
>
...
...
@@ -78,6 +86,7 @@
<div
id=
"filter_search"
style=
"visibility:hidden"
>
<span
style=
"font-size:70%;"
>
<!-- Used by the #doubleSearch associated function -->
<input
title=
"Search in Titles"
id=
"searchTI"
name=
"searchTI"
type=
"checkbox"
checked
onclick=
"return false"
>
TI
<input
title=
"Search in Abstracts"
id=
"searchAB"
name=
"searchAB"
type=
"checkbox"
>
AB
</span>
...
...
@@ -90,7 +99,10 @@
<!-- </optgroup> -->
<!-- <optgroup label="Duplicates"> -->
<!-- <option value="filter_doi">By DOI</option> -->
<option
id=
"filter_dupl-titles"
value=
"filter_dupl-titles"
>
Duplicates by Title
</option>
<!-- TODO
<option id="filter_dupl-titles" value="filter_dupl-titles">Duplicates by Title</option> -->
<!-- </optgroup> -->
</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