Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
NPDD
baobaxia
Commits
8dd56f2f
Commit
8dd56f2f
authored
9 years ago
by
Fernão Lopes
Browse files
Options
Download
Email Patches
Plain Diff
interface: media View image now get configurable parameter and gets size from API -
#195
parent
709378e4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/django-bbx/bbx/static/js/config.js.example
+4
-0
app/django-bbx/bbx/static/js/config.js.example
app/django-bbx/bbx/static/js/modules/media/functions.js
+18
-7
app/django-bbx/bbx/static/js/modules/media/functions.js
app/django-bbx/bbx/static/js/views/media/MediaView.js
+6
-4
app/django-bbx/bbx/static/js/views/media/MediaView.js
with
28 additions
and
11 deletions
+28
-11
app/django-bbx/bbx/static/js/config.js.example
View file @
8dd56f2f
...
...
@@ -26,6 +26,10 @@ BBX.config = {
"fullSize": {
"width": "0",
"height": window.innerHeight
},
"mediaView": {
"width": "0",
"height": "400"
}
}
}
...
...
This diff is collapsed.
Click to expand it.
app/django-bbx/bbx/static/js/modules/media/functions.js
View file @
8dd56f2f
...
...
@@ -347,8 +347,13 @@ define([
var
getUrlInterval
=
setInterval
(
function
()
{
if
(
typeof
BBX
.
tmp
.
imageThumb
[
media
.
uuid
]
!==
'
undefined
'
)
{
if
(
typeof
BBX
.
tmp
.
imageThumb
[
media
.
uuid
][
params
.
width
+
'
x
'
+
params
.
height
]
!==
'
undefined
'
)
{
var
url
=
BBX
.
tmp
.
imageThumb
[
media
.
uuid
][
params
.
width
+
'
x
'
+
params
.
height
];
var
url
=
BBX
.
tmp
.
imageThumb
[
media
.
uuid
][
params
.
width
+
'
x
'
+
params
.
height
].
url
,
width
=
BBX
.
tmp
.
imageThumb
[
media
.
uuid
][
params
.
width
+
'
x
'
+
params
.
height
].
width
,
height
=
BBX
.
tmp
.
imageThumb
[
media
.
uuid
][
params
.
width
+
'
x
'
+
params
.
height
].
height
;
$
(
el
).
attr
(
'
href
'
,
url
);
$
(
el
).
attr
(
'
width
'
,
width
);
$
(
el
).
attr
(
'
height
'
,
height
);
clearInterval
(
getUrlInterval
);
}
}
...
...
@@ -856,7 +861,10 @@ define([
var
thumbInterval
=
setInterval
(
function
()
{
if
(
typeof
BBX
.
tmp
.
imageThumb
[
media
.
uuid
]
!==
'
undefined
'
)
{
if
(
typeof
BBX
.
tmp
.
imageThumb
[
media
.
uuid
][
params
.
width
+
'
x
'
+
params
.
height
]
!==
'
undefined
'
)
{
media
.
url
=
BBX
.
tmp
.
imageThumb
[
media
.
uuid
][
params
.
width
+
'
x
'
+
params
.
height
];
media
.
url
=
BBX
.
tmp
.
imageThumb
[
media
.
uuid
][
params
.
width
+
'
x
'
+
params
.
height
].
url
;
media
.
width
=
BBX
.
tmp
.
imageThumb
[
media
.
uuid
][
params
.
width
+
'
x
'
+
params
.
height
].
width
;
media
.
height
=
BBX
.
tmp
.
imageThumb
[
media
.
uuid
][
params
.
width
+
'
x
'
+
params
.
height
].
height
;
var
tmpImage
=
new
Image
();
tmpImage
.
src
=
media
.
url
;
tmpImage
.
onload
=
function
()
{
...
...
@@ -867,10 +875,9 @@ define([
}
else
{
$
(
'
.media-image-container
'
).
prepend
(
'
<img id="media-
'
+
media
.
uuid
+
'
" src="
'
+
media
.
url
+
'
" />
'
);
}
var
width
=
(
params
.
width
!==
'
00
'
&&
params
.
width
<
tmpImage
.
naturalWidth
)
?
params
.
width
:
tmpImage
.
naturalWidth
;
var
height
=
(
params
.
height
!==
'
00
'
&&
params
.
height
<
tmpImage
.
naturalHeight
)
?
params
.
height
:
tmpImage
.
naturalHeight
;
$
(
'
#media-
'
+
media
.
uuid
).
prop
(
'
width
'
,
width
);
$
(
'
#media-
'
+
media
.
uuid
).
prop
(
'
height
'
,
height
);
$
(
'
#media-
'
+
media
.
uuid
).
prop
(
'
width
'
,
media
.
width
);
$
(
'
#media-
'
+
media
.
uuid
).
prop
(
'
height
'
,
media
.
height
);
}
clearInterval
(
thumbInterval
);
}
...
...
@@ -900,7 +907,11 @@ define([
if
(
typeof
BBX
.
tmp
.
imageThumb
[
media
.
uuid
]
===
'
undefined
'
)
{
BBX
.
tmp
.
imageThumb
[
media
.
uuid
]
=
[];
}
BBX
.
tmp
.
imageThumb
[
media
.
uuid
][
params
.
width
+
'
x
'
+
params
.
height
]
=
mediaLoad
.
attributes
.
url
;
BBX
.
tmp
.
imageThumb
[
media
.
uuid
][
params
.
width
+
'
x
'
+
params
.
height
]
=
{
'
url
'
:
mediaLoad
.
attributes
.
url
,
'
width
'
:
mediaLoad
.
attributes
.
width
,
'
height
'
:
mediaLoad
.
attributes
.
height
}
}
});
}
...
...
This diff is collapsed.
Click to expand it.
app/django-bbx/bbx/static/js/views/media/MediaView.js
View file @
8dd56f2f
...
...
@@ -20,8 +20,10 @@ define([
media
=
''
,
url
=
config
.
apiUrl
+
'
/
'
+
config
.
repository
+
'
/
'
+
config
.
mucua
+
'
/media/
'
+
uuid
,
urlWhereis
=
config
.
apiUrl
+
'
/
'
+
config
.
repository
+
'
/
'
+
config
.
mucua
+
'
/media/
'
+
uuid
+
'
/whereis
'
,
userData
=
localStorage
.
userData
;
userData
=
localStorage
.
userData
,
mediaWidth
=
(
typeof
(
BBX
.
config
.
images
.
mediaView
)
!==
'
undefined
'
)
?
BBX
.
config
.
images
.
mediaView
.
width
:
'
0
'
,
// default value if size unset at config.js
mediaHeight
=
(
typeof
(
BBX
.
config
.
images
.
mediaView
)
!==
'
undefined
'
)
?
BBX
.
config
.
images
.
mediaView
.
height
:
'
300
'
;
// default value if size unset at config.js
// pergunta se vai excluir cópia local do arquivo
var
askDrop
=
function
()
{
var
config
=
BBX
.
config
,
...
...
@@ -61,7 +63,7 @@ define([
clearInterval
(
focus
);
}
},
500
);
media
=
MediaFunctions
.
getMedia
(
url
,
function
(
data
)
{
data
.
formatDate
=
BBXFunctions
.
formatDate
;
data
.
media
=
data
.
medias
[
0
];
...
...
@@ -80,7 +82,7 @@ define([
$
(
'
.request-copy
'
).
addClass
(
'
requested-copy
'
).
removeClass
(
'
request-copy
'
);
});
},
{
'
width
'
:
'
00
'
,
'
height
'
:
'
300
'
});
},
{
'
width
'
:
mediaWidth
,
'
height
'
:
mediaHeight
});
// who has the file
var
dataWhereis
=
new
MediaModel
([],
{
url
:
urlWhereis
});
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help