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
dfc1d59b
Commit
dfc1d59b
authored
Jan 04, 2015
by
Mathieu Rodic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUGFIX - Solved the CSRF problem
parent
60517996
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
10 deletions
+27
-10
angular-cookies.min.js
static/js/angular-cookies.min.js
+8
-0
gargantext.angular.js
static/js/gargantext.angular.js
+18
-10
mvc.html
templates/tests/mvc.html
+1
-0
No files found.
static/js/angular-cookies.min.js
0 → 100644
View file @
dfc1d59b
/*
AngularJS v1.2.28
(c) 2010-2014 Google, Inc. http://angularjs.org
License: MIT
*/
(
function
(
p
,
f
,
n
){
'use strict'
;
f
.
module
(
"ngCookies"
,[
"ng"
]).
factory
(
"$cookies"
,[
"$rootScope"
,
"$browser"
,
function
(
e
,
b
){
var
c
=
{},
g
=
{},
h
,
k
=!
1
,
l
=
f
.
copy
,
m
=
f
.
isUndefined
;
b
.
addPollFn
(
function
(){
var
a
=
b
.
cookies
();
h
!=
a
&&
(
h
=
a
,
l
(
a
,
g
),
l
(
a
,
c
),
k
&&
e
.
$apply
())})();
k
=!
0
;
e
.
$watch
(
function
(){
var
a
,
d
,
e
;
for
(
a
in
g
)
m
(
c
[
a
])
&&
b
.
cookies
(
a
,
n
);
for
(
a
in
c
)
d
=
c
[
a
],
f
.
isString
(
d
)
||
(
d
=
""
+
d
,
c
[
a
]
=
d
),
d
!==
g
[
a
]
&&
(
b
.
cookies
(
a
,
d
),
e
=!
0
);
if
(
e
)
for
(
a
in
d
=
b
.
cookies
(),
c
)
c
[
a
]
!==
d
[
a
]
&&
(
m
(
d
[
a
])?
delete
c
[
a
]:
c
[
a
]
=
d
[
a
])});
return
c
}]).
factory
(
"$cookieStore"
,
[
"$cookies"
,
function
(
e
){
return
{
get
:
function
(
b
){
return
(
b
=
e
[
b
])?
f
.
fromJson
(
b
):
b
},
put
:
function
(
b
,
c
){
e
[
b
]
=
f
.
toJson
(
c
)},
remove
:
function
(
b
){
delete
e
[
b
]}}}])})(
window
,
window
.
angular
);
//# sourceMappingURL=angular-cookies.min.js.map
static/js/gargantext.angular.js
View file @
dfc1d59b
...
...
@@ -86,12 +86,15 @@ var groupings = {
};
//
application defini
tion
var
gargantext
=
angular
.
module
(
'Gargantext'
,
[
'n3-charts.linechart'
]);
//
Define the applica
tion
var
gargantext
=
angular
.
module
(
'Gargantext'
,
[
'n3-charts.linechart'
,
'ngCookies'
])
// tuning the application's scope
angular
.
module
(
'Gargantext'
).
run
([
'$rootScope'
,
function
(
$rootScope
){
// Customize the application's scope
angular
.
module
(
'Gargantext'
).
run
(
function
(
$rootScope
,
$http
,
$cookies
){
// Access Math library from anywhere in the scope of the application
$rootScope
.
Math
=
Math
;
// Access to an HSB to RGB converter
$rootScope
.
getColor
=
function
(
i
,
n
){
var
h
=
.
3
+
(
i
/
n
)
%
1
;
var
s
=
.
7
;
...
...
@@ -116,6 +119,7 @@ angular.module('Gargantext').run(['$rootScope', function($rootScope){
var
color
=
'rgb('
+
r
+
','
+
g
+
','
+
b
+
')'
;
return
color
;
};
// Access to a range function, very similar to the one available in Python
$rootScope
.
range
=
function
(
min
,
max
,
step
){
if
(
max
==
undefined
){
max
=
min
;
...
...
@@ -128,9 +132,12 @@ angular.module('Gargantext').run(['$rootScope', function($rootScope){
}
return
output
;
};
}]);
// For CSRF token compatibility with Django
$http
.
defaults
.
headers
.
post
[
'X-CSRFToken'
]
=
$cookies
[
'csrftoken'
];
});
// Controller for queries
gargantext
.
controller
(
"QueryController"
,
function
(
$scope
,
$http
)
{
// query-specific information
$scope
.
filters
=
[];
...
...
@@ -202,7 +209,7 @@ gargantext.controller("QueryController", function($scope, $http) {
}
});
// Controller for datasets
gargantext
.
controller
(
"DatasetController"
,
function
(
$scope
,
$http
)
{
// query-specific information
$scope
.
mesured
=
'nodes.count'
;
...
...
@@ -276,7 +283,7 @@ gargantext.controller("DatasetController", function($scope, $http) {
}
});
// Controller for graphs
gargantext
.
controller
(
"GraphController"
,
function
(
$scope
,
$http
,
$element
)
{
// initialization
$scope
.
datasets
=
[{}];
...
...
@@ -450,8 +457,8 @@ gargantext.controller("GraphController", function($scope, $http, $element) {
});
/
/ For debugging only!
// Only for debugging!
/
*
setTimeout(function(){
// first dataset
$('div.corpus select').change();
...
...
@@ -478,4 +485,5 @@ setTimeout(function(){
// // refresh
// // $('button.refresh').first().click();
}, 500);
},
250
);
\ No newline at end of file
}, 250);
*/
\ No newline at end of file
templates/tests/mvc.html
View file @
dfc1d59b
...
...
@@ -331,6 +331,7 @@
-->
{% endverbatim %}
<script
type=
"text/javascript"
src=
"{% static "
js
/
angular
.
min
.
js
"
%}"
></script>
<script
type=
"text/javascript"
src=
"{% static "
js
/
angular-cookies
.
min
.
js
"
%}"
></script>
<script
type=
"text/javascript"
src=
"{% static "
js
/
d3
/
d3
.
v2
.
min
.
js
"
%}"
></script>
<script
type=
"text/javascript"
src=
"{% static "
js
/
d3
/
n3
.
line-chart
.
min
.
js
"
%}"
></script>
<!-- <script type="text/javascript" src="{% static "js/d3/angular-charts.js" %}"></script> -->
...
...
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