Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
3f14aca8
authored
Jul 09, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: load new store dirs via js
parent
cb63bc25
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
14 deletions
+43
-14
circle/dashboard/static/dashboard/dashboard.js
+8
-0
circle/dashboard/static/dashboard/store.js
+16
-8
circle/dashboard/templates/dashboard/store/_list-box.html
+3
-2
circle/dashboard/templates/dashboard/store/list.html
+1
-1
circle/dashboard/views.py
+15
-3
No files found.
circle/dashboard/static/dashboard/dashboard.js
View file @
3f14aca8
...
...
@@ -114,6 +114,7 @@ $(function () {
/* no js compatibility */
noJS
();
$
(
'.no-js-hidden'
).
show
();
$
(
'.js-hidden'
).
hide
();
...
...
@@ -555,3 +556,10 @@ function getCookie(name) {
}
return
cookieValue
;
}
/* no js compatibility */
function
noJS
()
{
$
(
'.no-js-hidden'
).
show
();
$
(
'.js-hidden'
).
hide
();
}
circle/dashboard/static/dashboard/store.js
View file @
3f14aca8
$
(
function
()
{
$
(
".store-list-item"
).
click
(
function
()
{
if
(
$
(
this
).
data
(
"item-type"
)
==
"D"
)
return
true
;
$
(
this
).
next
(
".store-list-file-infos"
).
stop
().
slideToggle
();
$
(
"#store-list-container"
).
on
(
"click"
,
".store-list-item"
,
function
()
{
if
(
$
(
this
).
data
(
"item-type"
)
==
"D"
)
{
var
url
=
$
(
this
).
prop
(
"href"
);
$
.
get
(
url
,
function
(
result
)
{
$
(
"#store-list-container"
).
html
(
result
);
noJS
();
$
(
"[title]"
).
tooltip
();
history
.
pushState
({},
""
,
url
);
});
}
else
{
$
(
this
).
next
(
".store-list-file-infos"
).
stop
().
slideToggle
();
}
return
false
;
});
/* less js way, but at least works, tho redirection is bad */
$
(
'#store-upload-form input[type="submit"]'
).
click
(
function
()
{
$
(
"#store-list-container"
).
on
(
"click"
,
'#store-upload-form input[type="submit"]'
,
function
()
{
var
current_dir
=
$
(
"#store-upload-form"
).
find
(
'[name="current_dir"]'
).
val
();
$
.
get
(
$
(
"#store-upload-form"
).
data
(
"action"
)
+
"?current_dir="
+
current_dir
,
function
(
result
)
{
$
(
"#store-upload-form"
).
get
(
0
).
setAttribute
(
"action"
,
result
[
'url'
]);
console
.
log
(
$
(
"#store-upload-form"
).
prop
(
"action"
));
$
(
"#store-upload-form"
).
submit
();
});
...
...
@@ -18,18 +26,18 @@ $(function() {
});
/* click on the "fake" browse button will */
$
(
'#store-upload-browse'
).
click
(
function
()
{
$
(
"#store-list-container"
).
on
(
"click"
,
"#store-upload-browse"
,
function
()
{
$
(
'#store-upload-form input[type="file"]'
).
click
();
});
$
(
"#store-
upload-file"
).
change
(
function
()
{
$
(
"#store-
list-container"
).
on
(
"change"
,
"#store-upload-file"
,
function
()
{
var
input
=
$
(
this
);
var
numFiles
=
input
.
get
(
0
).
files
?
input
.
get
(
0
).
files
.
length
:
1
;
var
label
=
input
.
val
().
replace
(
/
\\
/g
,
'/'
).
replace
(
/.*
\/
/
,
''
);
input
.
trigger
(
'fileselect'
,
[
numFiles
,
label
]);
});
$
(
"#store-
upload-file"
).
on
(
"fileselect
"
,
function
(
event
,
numFiles
,
label
)
{
$
(
"#store-
list-container"
).
on
(
"fileselect"
,
"#store-upload-file
"
,
function
(
event
,
numFiles
,
label
)
{
var
input
=
$
(
"#store-upload-filename"
);
var
log
=
numFiles
>
1
?
numFiles
+
' files selected'
:
label
;
if
(
input
.
length
)
{
...
...
circle/dashboard/templates/dashboard/store/_list-box.html
View file @
3f14aca8
{% load i18n %}
<div
class=
"list-group"
id=
"store-list-list"
>
<a
href=
"?directory={{ up_url }}"
class=
"list-group-item store-list-item"
data-item-type=
"D"
>
<a
href=
"{% url "
dashboard
.
views
.
store-list
"
%}?
directory=
{{
up_url
}}"
class=
"list-group-item store-list-item"
data-item-type=
"D"
>
<i
class=
"icon-reply store-list-item-icon"
></i>
..
<div
class=
"pull-right"
>
...
...
@@ -11,7 +12,7 @@
{% for f in root %}
<a
class=
"list-group-item store-list-item"
data-item-type=
"{{ f.TYPE }}"
href=
"{% if f.TYPE == "
D
"
%}?
directory=
{{
f
.
path
}}{%
else
%}
href=
"{% if f.TYPE == "
D
"
%}
{%
url
"
dashboard
.
views
.
store-list
"
%}
?
directory=
{{
f
.
path
}}{%
else
%}
{%
url
"
dashboard
.
views
.
store-download
"
%}?
path=
{{
f
.
path
}}{%
endif
%}"
>
<div
class=
"store-list-item-icon"
>
...
...
circle/dashboard/templates/dashboard/store/list.html
View file @
3f14aca8
...
...
@@ -6,7 +6,7 @@
{% block content %}
<div
class=
"row"
>
<div
class=
"col-md-12"
>
<div>
<div
id=
"store-list-container"
>
{% include "dashboard/store/_list-box.html" %}
</div>
</div>
...
...
circle/dashboard/views.py
View file @
3f14aca8
...
...
@@ -39,7 +39,9 @@ from django.core import signing
from
django.core.urlresolvers
import
reverse
,
reverse_lazy
from
django.db.models
import
Count
from
django.http
import
HttpResponse
,
HttpResponseRedirect
,
Http404
from
django.shortcuts
import
redirect
,
render
,
get_object_or_404
from
django.shortcuts
import
(
redirect
,
render
,
get_object_or_404
,
render_to_response
,
)
from
django.views.decorators.http
import
require_GET
,
require_POST
from
django.views.generic.detail
import
SingleObjectMixin
from
django.views.generic
import
(
TemplateView
,
DetailView
,
View
,
DeleteView
,
...
...
@@ -2941,8 +2943,8 @@ class UserKeyCreate(LoginRequiredMixin, SuccessMessageMixin, CreateView):
class
StoreList
(
LoginRequiredMixin
,
TemplateView
):
template_name
=
"dashboard/store/list.html"
def
get_context_data
(
self
,
*
args
,
*
*
kwargs
):
context
=
super
(
StoreList
,
self
)
.
get_context_data
(
*
args
,
*
*
kwargs
)
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
StoreList
,
self
)
.
get_context_data
(
**
kwargs
)
directory
=
self
.
request
.
GET
.
get
(
"directory"
,
"/"
)
directory
=
"/"
if
not
len
(
directory
)
else
directory
...
...
@@ -2954,6 +2956,16 @@ class StoreList(LoginRequiredMixin, TemplateView):
directory
)
return
context
def
get
(
self
,
*
args
,
**
kwargs
):
if
self
.
request
.
is_ajax
():
context
=
self
.
get_context_data
(
**
kwargs
)
return
render_to_response
(
"dashboard/store/_list-box.html"
,
RequestContext
(
self
.
request
,
context
),
)
else
:
return
super
(
StoreList
,
self
)
.
get
(
*
args
,
**
kwargs
)
def
create_up_directory
(
self
,
directory
):
cut
=
-
2
if
directory
.
endswith
(
"/"
)
else
-
1
return
"/"
.
join
(
directory
.
split
(
"/"
)[:
cut
])
+
"/"
...
...
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