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
Commit
bc3656cb
authored
Jan 31, 2013
by
Dányi Bence
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
store: limit number of shown files
parent
16c72327
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
15 deletions
+38
-15
one/static/cloud.js
+28
-8
one/templates/home.html
+10
-7
No files found.
one/static/cloud.js
View file @
bc3656cb
...
@@ -71,14 +71,16 @@ $(function(){
...
@@ -71,14 +71,16 @@ $(function(){
var
Model
=
function
(){
var
Model
=
function
(){
var
self
=
this
;
var
self
=
this
;
self
.
files
=
ko
.
observableArray
();
self
.
files
=
ko
.
observableArray
();
self
.
allFiles
=
[];
self
.
notInRoot
=
ko
.
observable
(
false
);
self
.
notInRoot
=
ko
.
observable
(
false
);
self
.
fileLimit
=
5
;
self
.
jumpUp
=
function
(){
self
.
jumpUp
=
function
(){
var
s
=
self
.
currentPath
();
var
s
=
self
.
currentPath
();
self
.
currentPath
(
s
.
substr
(
0
,
s
.
substr
(
0
,
s
.
length
-
1
).
lastIndexOf
(
'/'
)
+
1
));
self
.
currentPath
(
s
.
substr
(
0
,
s
.
substr
(
0
,
s
.
length
-
1
).
lastIndexOf
(
'/'
)
+
1
));
loadFolder
(
self
.
currentPath
());
loadFolder
(
self
.
currentPath
());
}
}
var
loadFolder
=
function
(
path
){
var
loadFolder
=
function
(
path
){
console
.
log
(
'loadFolder'
)
;
self
.
fileLimit
=
5
;
$
.
ajax
({
$
.
ajax
({
type
:
'POST'
,
type
:
'POST'
,
data
:
'path='
+
path
,
data
:
'path='
+
path
,
...
@@ -94,11 +96,20 @@ $(function(){
...
@@ -94,11 +96,20 @@ $(function(){
}
}
var
loadFolderDone
=
function
(
data
){
var
loadFolderDone
=
function
(
data
){
self
.
notInRoot
(
self
.
currentPath
().
lastIndexOf
(
'/'
)
!==
0
);
self
.
notInRoot
(
self
.
currentPath
().
lastIndexOf
(
'/'
)
!==
0
);
self
.
files
([]);
self
.
allFiles
=
data
;
var
viewData
=
[];
var
viewData
=
[];
var
added
=
0
;
for
(
var
i
in
data
){
for
(
var
i
in
data
){
var
d
=
data
[
i
];
added
++
;
if
(
data
[
i
].
TYPE
===
'D'
){
if
(
added
<
6
)
viewData
[
i
]
=
{
addFile
(
data
[
i
]);
}
}
var
addFile
=
function
(
d
){
var
viewData
;
if
(
d
.
TYPE
===
'D'
){
viewData
=
{
originalName
:
d
.
NAME
,
originalName
:
d
.
NAME
,
name
:
d
.
NAME
.
length
>
30
?(
d
.
NAME
.
substr
(
0
,
27
)
+
'...'
):
d
.
NAME
,
name
:
d
.
NAME
.
length
>
30
?(
d
.
NAME
.
substr
(
0
,
27
)
+
'...'
):
d
.
NAME
,
size
:
'katalógus'
,
size
:
'katalógus'
,
...
@@ -111,10 +122,10 @@ $(function(){
...
@@ -111,10 +122,10 @@ $(function(){
}
}
};
};
}
else
{
}
else
{
viewData
[
i
]
=
{
viewData
=
{
originalName
:
d
.
NAME
,
originalName
:
d
.
NAME
,
name
:
d
.
NAME
.
length
>
30
?(
d
.
NAME
.
substr
(
0
,
27
)
+
'...'
):
d
.
NAME
,
name
:
d
.
NAME
.
length
>
30
?(
d
.
NAME
.
substr
(
0
,
27
)
+
'...'
):
d
.
NAME
,
size
:
data
[
i
]
.
SIZE
+
'K'
,
size
:
d
.
SIZE
+
'K'
,
type
:
'fájl'
,
type
:
'fájl'
,
mTime
:
d
.
MTIME
,
mTime
:
d
.
MTIME
,
getTypeClass
:
'name filetype-text'
,
getTypeClass
:
'name filetype-text'
,
...
@@ -122,11 +133,20 @@ $(function(){
...
@@ -122,11 +133,20 @@ $(function(){
}
}
};
};
}
}
self
.
files
.
push
(
viewData
);
}
}
self
.
files
(
viewData
);
self
.
fadeIn
=
function
(
e
){
console
.
log
(
e
,
arguments
);
$
(
e
).
hide
().
slideDown
(
500
);
}
}
self
.
currentPath
=
ko
.
observable
(
'/'
);
self
.
currentPath
=
ko
.
observable
(
'/'
);
self
.
showMore
=
function
(){
for
(
var
i
=
self
.
fileLimit
;
i
<
self
.
fileLimit
+
5
;
i
++
){
if
(
self
.
allFiles
[
i
]
===
undefined
)
break
;
addFile
(
self
.
allFiles
[
i
]);
}
self
.
fileLimit
+=
5
;
}
self
.
download
=
function
(
item
){
self
.
download
=
function
(
item
){
$
.
ajax
({
$
.
ajax
({
type
:
'POST'
,
type
:
'POST'
,
...
...
one/templates/home.html
View file @
bc3656cb
...
@@ -203,7 +203,13 @@
...
@@ -203,7 +203,13 @@
<div
class=
"clear"
></div>
<div
class=
"clear"
></div>
</div>
</div>
</li>
</li>
<!-- ko foreach: files -->
<li
class=
"wm small real"
data-bind=
"visible: files().length == 0"
>
<div
class=
"summary"
>
<div
class=
"name"
>
Nincs megjeleníthető fájl.
</div>
<div
class=
"clear"
></div>
</div>
</li>
<!-- ko foreach: {data:files,afterAdd:fadeIn} -->
<li
class=
"wm real"
>
<li
class=
"wm real"
>
<div
class=
"summary"
data-bind=
"click: clickHandler"
>
<div
class=
"summary"
data-bind=
"click: clickHandler"
>
<div
class=
"name"
data-bind=
"text: name, attr: {class: getTypeClass}"
></div>
<div
class=
"name"
data-bind=
"text: name, attr: {class: getTypeClass}"
></div>
...
@@ -231,13 +237,10 @@
...
@@ -231,13 +237,10 @@
</div>
</div>
</li>
</li>
<!-- /ko -->
<!-- /ko -->
<li
class=
"file-details wm"
id=
"load-more-files"
>
<li
class=
"file-details wm"
id=
"load-more-files"
data-bind=
"visible: (files().length>0 && files().length != allFiles.length)"
>
<div
class=
"summary"
>
<div
class=
"summary"
data-bind=
"click: showMore"
>
<div
class=
"name filetype-more"
>
<div
class=
"name filetype-more"
>
Mutasd a régebbi fájlokat!
Mutass több fájlt!
</div>
<div
class=
"actions"
style=
"text-align: right; display: none"
>
<img
src=
"/static/load-4.gif"
alt=
"loading"
/>
</div>
</div>
<div
class=
"clear"
></div>
<div
class=
"clear"
></div>
</div>
</div>
...
...
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