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
96f1b1e0
authored
Feb 04, 2013
by
Dányi Bence
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
store: ajax new folder
parent
e453dc74
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
16 deletions
+59
-16
cloud/urls.py
+1
-0
one/static/box.less
+14
-4
one/static/cloud.js
+22
-12
one/templates/box-filelist.html
+10
-0
store/views.py
+12
-0
No files found.
cloud/urls.py
View file @
96f1b1e0
...
...
@@ -32,4 +32,5 @@ urlpatterns = patterns('',
url
(
r'^ajax/store/download$'
,
'store.views.ajax_download'
,
name
=
'store_ajax_download'
),
url
(
r'^ajax/store/upload$'
,
'store.views.ajax_upload'
,
name
=
'store_ajax_upload'
),
url
(
r'^ajax/store/delete$'
,
'store.views.ajax_delete'
,
name
=
'store_ajax_delete'
),
url
(
r'^ajax/store/newFolder$'
,
'store.views.ajax_new_folder'
,
name
=
'store_ajax_new_folder'
),
)
one/static/box.less
View file @
96f1b1e0
...
...
@@ -138,6 +138,16 @@
}
}
}
#new-folder-form {
float: right;
margin-left: 5px;
display: none;
z-index: 2;
position: relative;
}
}
&.opened #new-folder-form {
display: block;
}
.details{
border-top: 1px solid #888;
...
...
@@ -206,9 +216,6 @@
}
}
}
&.opened .details{
display: block;
}
&.new .name{
background-image: url(icons/computer--plus.png);
}
...
...
@@ -239,7 +246,7 @@
background-image: url(icons/folder-zipper.png);
}
.filetype-folder {
background-image: url(icons/folder
-horizontal
.png);
background-image: url(icons/folder.png);
}
.filetype-more {
background-image: url(icons/arrow-circle-double.png);
...
...
@@ -247,6 +254,9 @@
.filetype-up {
background-image: url(icons/upload-cloud.png);
}
.filetype-new-folder {
background-image: url(icons/folder--plus.png);
}
.filetype-jump-out {
background-image: url(icons/arrow-curve-090.png);
}
...
...
one/static/cloud.js
View file @
96f1b1e0
...
...
@@ -28,15 +28,15 @@ $(function() {
}
});
toggleDetails
=
function
()
{
if
(
$
(
this
).
next
(
'.details'
).
is
(
':hidden'
))
{
$
(
this
).
next
(
'.details'
).
slideDown
(
700
);
$
(
this
).
parent
(
'.wm'
).
addClass
(
'opened'
);
if
(
$
(
this
).
parent
(
'.wm'
).
hasClass
(
'opened'
))
{
$
(
this
).
parent
(
'.wm'
).
removeClass
(
'opened'
);
$
(
this
).
next
(
'.details'
).
slideUp
(
700
);
}
else
{
var
that
=
this
;
$
(
this
).
next
(
'.details'
).
slideUp
(
700
,
function
()
{
$
(
that
).
parent
(
'.wm'
).
removeClass
(
'opened'
);
});
console
.
log
(
'addClass'
);
$
(
this
).
parent
(
'.wm'
).
addClass
(
'opened'
);
$
(
this
).
next
(
'.details'
).
slideDown
(
700
);
}
}
$
(
'.wm .summary'
).
unbind
(
'click'
).
click
(
toggleDetails
);
$
(
'#load-more-files'
).
click
(
function
()
{
...
...
@@ -76,9 +76,8 @@ $(function() {
self
.
allFiles
=
[];
self
.
notInRoot
=
ko
.
observable
(
false
);
self
.
fileLimit
=
5
;
var
disabled
=
false
;
function
throttle
(
f
)
{
var
disabled
=
false
;
return
function
()
{
if
(
disabled
)
{
console
.
log
(
'disabled'
);
...
...
@@ -195,18 +194,29 @@ $(function() {
}
self
.
uploadURL
=
ko
.
observable
(
'/'
);
self
.
getUploadURL
=
function
(){
console
.
log
(
'sad'
)
$
.
ajax
({
type
:
'POST'
,
data
:
'ul='
+
self
.
currentPath
(),
data
:
'ul='
+
self
.
currentPath
()
+
'&next='
+
encodeURI
(
window
.
location
.
href
)
,
url
:
'/ajax/store/upload'
,
dataType
:
'json'
,
success
:
function
(
data
){
console
.
log
(
'asdasd'
,
data
);
self
.
uploadURL
(
data
.
url
);
}
}).
error
(
function
(){
console
.
log
(
'asd'
,
arguments
)})
}
self
.
newFolderName
=
ko
.
observable
();
self
.
newFolder
=
throttle
(
function
(
i
,
e
){
$
(
e
.
target
).
parent
().
parent
().
parent
().
removeClass
(
'opened'
);
$
.
ajax
({
type
:
'POST'
,
data
:
'new='
+
self
.
newFolderName
()
+
'&path='
+
self
.
currentPath
(),
url
:
'/ajax/store/newFolder'
,
dataType
:
'json'
,
success
:
function
(
data
){
loadFolder
(
self
.
currentPath
());
}
})
});
loadFolder
(
self
.
currentPath
());
}
var
model
=
new
Model
();
...
...
one/templates/box-filelist.html
View file @
96f1b1e0
...
...
@@ -61,6 +61,16 @@
<div
class=
"clear"
></div>
</div>
</li>
<li
class=
"wm"
>
<div
class=
"summary"
>
<div
class=
"name filetype-new-folder"
>
Új mappa
</div>
<div
id=
"new-folder-form"
>
<input
type=
"text"
placeholder=
"Új mappa neve"
data-bind=
"value: newFolderName, click: function(m,e){console.log(arguments); e.preventDefault(); e.stopPropagation(); return false;}"
/>
<input
type=
"submit"
data-bind=
"click: newFolder, clickBubble: false"
value=
"Létrehozás"
/>
</div>
<div
class=
"clear"
></div>
</div>
</li>
<li
class=
"file-upload wm"
>
<div
class=
"summary"
data-bind=
"click: getUploadURL"
>
<div
class=
"name filetype-up"
>
Fájlfeltöltés
</div>
...
...
store/views.py
View file @
96f1b1e0
...
...
@@ -127,6 +127,18 @@ def ajax_delete(request):
return
HttpResponse
(
'File not found!'
,
status_code
=
404
)
@login_required
def
ajax_new_folder
(
request
):
user
=
request
.
user
.
username
try
:
path
=
request
.
POST
[
'path'
]
new
=
request
.
POST
[
'new'
]
success
=
StoreApi
.
requestnewfolder
(
user
,
path
+
'/'
+
new
)
return
HttpResponse
(
json
.
dumps
({
'success'
:
success
}))
except
:
pass
return
HttpResponse
(
'Error!'
,
status_code
=
404
)
@login_required
def
toplist
(
request
):
user
=
request
.
user
.
username
path
=
backpath
=
'/'
...
...
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