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
896b8be5
Commit
896b8be5
authored
Aug 17, 2017
by
sim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT] Add corpus form: automatically select CSV type for CSV files
parent
297bb868
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletion
+19
-1
project.html
templates/pages/projects/project.html
+19
-1
No files found.
templates/pages/projects/project.html
View file @
896b8be5
...
...
@@ -440,11 +440,12 @@
// in the form "Add a corpus"
var
type
=
$
(
"#id_type"
).
val
()
var
file
=
$
(
"#id_file"
).
val
()
// 5 booleans
var
nameField
=
$
(
"#id_name"
).
val
()
!=
""
var
typeField
=
(
type
!=
""
)
&&
(
type
!=
"0"
)
var
fileField
=
$
(
"#id_file"
).
val
()
!=
""
var
fileField
=
file
!=
""
var
wantfileField
=
$
(
"#file_yes"
).
prop
(
"checked"
)
var
crawling
=
((
type
==
3
)
||
(
type
==
8
)
||
(
type
==
9
))
&&
!
wantfileField
...
...
@@ -457,6 +458,23 @@
if
(
!
crawling
)
{
$
(
"#submit_thing"
).
prop
(
'disabled'
,
!
(
nameField
&&
typeField
&&
fileField
))
}
// Automatically select CSV when type is undefined
// and we have a .csv file
if
(
!
typeField
&&
file
&&
file
.
match
(
/.csv$/i
))
{
// Get CSV type id
var
csv
=
$
(
'#id_type > option'
)
.
filter
(
function
()
{
return
$
(
this
).
text
()
===
'CSV'
})
.
attr
(
'value'
)
// Select CSV type
$
(
'#id_type'
).
val
(
csv
)
// Focus on name field
setTimeout
(
function
()
{
$
(
"#id_name"
).
focus
()
})
}
}
function
bringDaNoise
()
{
...
...
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