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
b7dc0d0a
authored
Feb 05, 2013
by
Dányi Bence
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
store: ajax rename
parent
8196afc6
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
1 deletions
+37
-1
cloud/urls.py
+1
-0
one/static/cloud.js
+9
-0
one/templates/box-filelist.html
+5
-1
store/api.py
+10
-0
store/views.py
+12
-0
No files found.
cloud/urls.py
View file @
b7dc0d0a
...
@@ -34,4 +34,5 @@ urlpatterns = patterns('',
...
@@ -34,4 +34,5 @@ urlpatterns = patterns('',
url
(
r'^ajax/store/delete$'
,
'store.views.ajax_delete'
,
name
=
'store_ajax_delete'
),
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'
),
url
(
r'^ajax/store/newFolder$'
,
'store.views.ajax_new_folder'
,
name
=
'store_ajax_new_folder'
),
url
(
r'^ajax/store/quota$'
,
'store.views.ajax_quota'
,
name
=
'store_ajax_quota'
),
url
(
r'^ajax/store/quota$'
,
'store.views.ajax_quota'
,
name
=
'store_ajax_quota'
),
url
(
r'^ajax/store/rename$'
,
'store.views.ajax_rename'
,
name
=
'store_ajax_rename'
),
)
)
one/static/cloud.js
View file @
b7dc0d0a
...
@@ -203,7 +203,16 @@ $(function() {
...
@@ -203,7 +203,16 @@ $(function() {
<input type="submit" value="Átnevezés" />'
);
<input type="submit" value="Átnevezés" />'
);
$
(
e
.
target
).
parent
().
parent
().
parent
().
find
(
'.name input[type=submit]'
).
click
(
function
()
{
$
(
e
.
target
).
parent
().
parent
().
parent
().
find
(
'.name input[type=submit]'
).
click
(
function
()
{
var
newName
=
$
(
e
.
target
).
parent
().
parent
().
parent
().
find
(
'.name input[type=text]'
).
val
();
var
newName
=
$
(
e
.
target
).
parent
().
parent
().
parent
().
find
(
'.name input[type=text]'
).
val
();
$
.
ajax
({
type
:
'POST'
,
data
:
'path='
+
self
.
currentPath
()
+
item
.
originalName
+
'&new='
+
newName
,
url
:
'/ajax/store/rename'
,
dataType
:
'json'
,
success
:
function
(
data
){
console
.
log
(
data
);
loadFolder
(
self
.
currentPath
());
loadFolder
(
self
.
currentPath
());
}
})
})
})
}
}
self
.
uploadURL
=
ko
.
observable
(
'/'
);
self
.
uploadURL
=
ko
.
observable
(
'/'
);
...
...
one/templates/box-filelist.html
View file @
b7dc0d0a
...
@@ -101,7 +101,11 @@
...
@@ -101,7 +101,11 @@
<div
class=
"used"
style=
"background-color: rgba(0,255,0,0.2)"
data-bind=
"style: {width: quota.usedBar}"
></div>
<div
class=
"used"
style=
"background-color: rgba(0,255,0,0.2)"
data-bind=
"style: {width: quota.usedBar}"
></div>
<div
class=
"softLimit"
data-bind=
"style: {left: quota.softPos}"
></div>
<div
class=
"softLimit"
data-bind=
"style: {left: quota.softPos}"
></div>
</div>
</div>
<div
class=
"name"
>
Kvóta:
<span
data-bind=
"text: quota.used"
></span>
/
<span
data-bind=
"text: quota.hard"
></span></div>
<div
class=
"name"
>
Kvóta:
<span
data-bind=
"text: quota.used"
></span>
/
<abbr
data-bind=
"text: quota.soft"
title=
"Soft limit"
></abbr>
(
<abbr
title=
"Hard limit"
data-bind=
"text: quota.hard"
></abbr>
)
</div>
<div
class=
"clear"
></div>
<div
class=
"clear"
></div>
</div>
</div>
</li>
</li>
...
...
store/api.py
View file @
b7dc0d0a
...
@@ -128,6 +128,16 @@ class StoreApi:
...
@@ -128,6 +128,16 @@ class StoreApi:
else
:
else
:
return
False
return
False
@staticmethod
@staticmethod
def
requestrename
(
neptun
,
old_path
,
new_name
):
url
=
settings
[
'store_url'
]
+
'/'
+
neptun
payload
=
json
.
dumps
({
'CMD'
:
'RENAME'
,
'NEW_NAME'
:
new_name
,
'PATH'
:
old_path
})
headers
=
{
'content-type'
:
'application/json'
}
r
=
StoreApi
.
post_request
(
url
,
payload
)
if
r
.
status_code
==
requests
.
codes
.
ok
:
return
True
else
:
return
False
@staticmethod
def
requestquota
(
neptun
):
def
requestquota
(
neptun
):
url
=
settings
[
'store_url'
]
+
'/'
+
neptun
url
=
settings
[
'store_url'
]
+
'/'
+
neptun
r
=
StoreApi
.
get_request
(
url
)
r
=
StoreApi
.
get_request
(
url
)
...
...
store/views.py
View file @
b7dc0d0a
...
@@ -149,6 +149,18 @@ def ajax_new_folder(request):
...
@@ -149,6 +149,18 @@ def ajax_new_folder(request):
return
HttpResponse
(
'Error!'
,
status_code
=
404
)
return
HttpResponse
(
'Error!'
,
status_code
=
404
)
@login_required
@login_required
def
ajax_rename
(
request
):
user
=
request
.
user
.
username
try
:
path
=
request
.
POST
[
'path'
]
new
=
request
.
POST
[
'new'
]
success
=
StoreApi
.
requestrename
(
user
,
path
,
new
)
return
HttpResponse
(
json
.
dumps
({
'success'
:
success
}))
except
:
pass
return
HttpResponse
(
'Error!'
,
status_code
=
404
)
@login_required
def
toplist
(
request
):
def
toplist
(
request
):
user
=
request
.
user
.
username
user
=
request
.
user
.
username
path
=
backpath
=
'/'
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