Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
69148c99
authored
Jul 23, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: store js clean up
parent
61450d0d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
22 deletions
+8
-22
circle/dashboard/static/dashboard/store.js
+8
-22
No files found.
circle/dashboard/static/dashboard/store.js
View file @
69148c99
...
@@ -14,11 +14,16 @@ $(function() {
...
@@ -14,11 +14,16 @@ $(function() {
return
false
;
return
false
;
});
});
/* less js way, but at least works, tho redirection is bad */
/* how upload works
* - user clicks on a "fake" browse button, this triggers a click event on the file upload
* - if the file input changes it adds the name of the file to form (or number of files if multiple is enabled)
* - and finally when we click on the upload button (this event handler) it firsts ask the store api where to upload
* then changes the form's action attr before sending the form itself
*/
$
(
"#store-list-container"
).
on
(
"click"
,
'#store-upload-form button[type="submit"]'
,
function
()
{
$
(
"#store-list-container"
).
on
(
"click"
,
'#store-upload-form button[type="submit"]'
,
function
()
{
var
current_dir
=
$
(
"#store-upload-form"
).
find
(
'[name="current_dir"]'
).
val
();
var
current_dir
=
$
(
"#store-upload-form"
).
find
(
'[name="current_dir"]'
).
val
();
$
.
get
(
$
(
"#store-upload-form"
).
data
(
"action"
)
+
"?current_dir="
+
current_dir
,
function
(
result
)
{
$
.
get
(
$
(
"#store-upload-form"
).
data
(
"action"
)
+
"?current_dir="
+
current_dir
,
function
(
result
)
{
$
(
'#store-upload-form button[type="submit"] i'
).
addClass
(
"
icon-spinner icon
-spin"
);
$
(
'#store-upload-form button[type="submit"] i'
).
addClass
(
"
fa-spinner fa
-spin"
);
$
(
"#store-upload-form"
).
get
(
0
).
setAttribute
(
"action"
,
result
[
'url'
]);
$
(
"#store-upload-form"
).
get
(
0
).
setAttribute
(
"action"
,
result
[
'url'
]);
$
(
"#store-upload-form"
).
submit
();
$
(
"#store-upload-form"
).
submit
();
});
});
...
@@ -26,7 +31,7 @@ $(function() {
...
@@ -26,7 +31,7 @@ $(function() {
return
false
;
return
false
;
});
});
/*
click on the "fake" browse button will
*/
/*
"fake" browse button
*/
$
(
"#store-list-container"
).
on
(
"click"
,
"#store-upload-browse"
,
function
()
{
$
(
"#store-list-container"
).
on
(
"click"
,
"#store-upload-browse"
,
function
()
{
$
(
'#store-upload-form input[type="file"]'
).
click
();
$
(
'#store-upload-form input[type="file"]'
).
click
();
});
});
...
@@ -46,28 +51,9 @@ $(function() {
...
@@ -46,28 +51,9 @@ $(function() {
}
}
if
(
log
)
{
if
(
log
)
{
$
(
'#store-upload-form button[type="submit"]'
).
prop
(
"disabled"
,
false
);
$
(
'#store-upload-form button[type="submit"]'
).
prop
(
"disabled"
,
false
);
}
else
{
}
else
{
$
(
'#store-upload-form button[type="submit"]'
).
prop
(
"disabled"
,
true
);
$
(
'#store-upload-form button[type="submit"]'
).
prop
(
"disabled"
,
true
);
}
}
});
/* this does not work
$('form input[type="submit"]').click(function() {
var current_dir = $("form").find('[name="current_dir"]').val();
$.get($("form").data("action") + "?current_dir=" + current_dir, function(result) {
$.ajax({
method: "POST",
url: result['url'],
data: $("form").serialize(),
success: function(re) {
console.log(re);
}
});
});
});
return false;
}); */
});
});
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