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
a1565646
Commit
a1565646
authored
Jul 04, 2016
by
delanoe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] Permissions fix (thanks to Romain Loth).
parent
4ec52443
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
15 deletions
+13
-15
garganrest.js
static/lib/gargantext/garganrest.js
+13
-15
No files found.
static/lib/gargantext/garganrest.js
View file @
a1565646
...
@@ -22,13 +22,6 @@ var getCookie = function(name) {
...
@@ -22,13 +22,6 @@ var getCookie = function(name) {
}
}
return
cookieValue
;
return
cookieValue
;
}
}
var
csrftoken
=
getCookie
(
'csrftoken'
);
$
.
ajaxSetup
({
beforeSend
:
function
(
xhr
,
settings
)
{
xhr
.
setRequestHeader
(
"X-CSRFToken"
,
csrftoken
);
}
});
// Resource class
// Resource class
var
Resource
=
function
(
url_path
)
{
var
Resource
=
function
(
url_path
)
{
...
@@ -65,6 +58,9 @@ var Resource = function(url_path) {
...
@@ -65,6 +58,9 @@ var Resource = function(url_path) {
$
.
ajax
({
$
.
ajax
({
url
:
url
,
url
:
url
,
type
:
'GET'
,
type
:
'GET'
,
beforeSend
:
function
(
xhr
)
{
xhr
.
setRequestHeader
(
"X-CSRFToken"
,
getCookie
(
"csrftoken"
));
},
success
:
callback
success
:
callback
});
});
};
};
...
@@ -73,30 +69,32 @@ var Resource = function(url_path) {
...
@@ -73,30 +69,32 @@ var Resource = function(url_path) {
$
.
ajax
({
$
.
ajax
({
url
:
url_path
+
'/'
+
id
,
url
:
url_path
+
'/'
+
id
,
type
:
'PATCH'
,
type
:
'PATCH'
,
beforeSend
:
function
(
xhr
)
{
xhr
.
setRequestHeader
(
"X-CSRFToken"
,
getCookie
(
"csrftoken"
));
},
success
:
callback
success
:
callback
});
});
};
};
// remove an item
// remove an item
this
.
delete
=
this
.
remove
=
function
(
id
,
callback
)
{
this
.
delete
=
this
.
remove
=
function
(
id
,
callback
)
{
if
(
id
.
id
!=
undefined
)
{
id
=
id
.
id
;
}
$
.
ajax
({
$
.
ajax
({
url
:
url_path
+
'/'
+
id
,
url
:
url_path
+
'/'
+
id
,
type
:
'DELETE'
,
type
:
'DELETE'
,
beforeSend
:
function
(
xhr
)
{
xhr
.
setRequestHeader
(
"X-CSRFToken"
,
getCookie
(
"csrftoken"
));
},
success
:
callback
success
:
callback
});
});
};
};
// add an item
// add an item
this
.
add
=
this
.
append
=
function
(
value
,
callback
)
{
this
.
add
=
this
.
append
=
function
(
id
,
callback
)
{
$
.
ajax
({
$
.
ajax
({
// todo define id
// todo define id
url
:
url_path
+
'/'
+
id
,
url
:
url_path
+
'/'
+
id
,
type
:
'POST'
,
type
:
'POST'
,
beforeSend
:
function
(
xhr
)
{
xhr
.
setRequestHeader
(
"X-CSRFToken"
,
getCookie
(
"csrftoken"
));
},
success
:
callback
success
:
callback
});
});
};
};
...
...
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