Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Websites UFRPE
Wagtail Videos
Commits
794ed405
Unverified
Commit
794ed405
authored
Mar 05, 2021
by
seb-b
Committed by
GitHub
Mar 05, 2021
Browse files
Merge pull request #75 from jkevingutierrez/feature/format
Format some files
parents
c281c46a
170268c2
Changes
16
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
794ed405
...
@@ -20,7 +20,6 @@ head:
...
@@ -20,7 +20,6 @@ head:
lts_27
:
lts_27
:
extends
:
.python_test
extends
:
.python_test
image
:
python:3.7
image
:
python:3.7
extends
:
.python_test
before_script
:
before_script
:
-
pip install .['testing'] wagtail~=2.7 django~=2.2
-
pip install .['testing'] wagtail~=2.7 django~=2.2
...
...
wagtailvideos/models.py
View file @
794ed405
...
@@ -131,7 +131,6 @@ class AbstractVideo(CollectionMember, index.Indexed, models.Model):
...
@@ -131,7 +131,6 @@ class AbstractVideo(CollectionMember, index.Indexed, models.Model):
if
too_long
>
len
(
head
)
+
1
:
if
too_long
>
len
(
head
)
+
1
:
raise
SuspiciousFileOperation
(
'File name can not be shortened to a safe length'
)
raise
SuspiciousFileOperation
(
'File name can not be shortened to a safe length'
)
filename
=
head
[:
-
too_long
]
+
ext
filename
=
head
[:
-
too_long
]
+
ext
file_path
=
os
.
path
.
join
(
folder_name
,
filename
)
return
os
.
path
.
join
(
folder_name
,
filename
)
return
os
.
path
.
join
(
folder_name
,
filename
)
def
get_usage
(
self
):
def
get_usage
(
self
):
...
@@ -143,7 +142,7 @@ class AbstractVideo(CollectionMember, index.Indexed, models.Model):
...
@@ -143,7 +142,7 @@ class AbstractVideo(CollectionMember, index.Indexed, models.Model):
@
property
@
property
def
formatted_duration
(
self
):
def
formatted_duration
(
self
):
if
(
self
.
duration
)
:
if
self
.
duration
:
hours
,
remainder
=
divmod
(
self
.
duration
.
seconds
,
3600
)
hours
,
remainder
=
divmod
(
self
.
duration
.
seconds
,
3600
)
minutes
,
seconds
=
divmod
(
remainder
,
60
)
minutes
,
seconds
=
divmod
(
remainder
,
60
)
return
"%d:%02d:%02d"
%
(
hours
,
minutes
,
seconds
)
return
"%d:%02d:%02d"
%
(
hours
,
minutes
,
seconds
)
...
@@ -327,9 +326,7 @@ class VideoTranscode(AbstractVideoTranscode):
...
@@ -327,9 +326,7 @@ class VideoTranscode(AbstractVideoTranscode):
video
=
models
.
ForeignKey
(
Video
,
related_name
=
'transcodes'
,
on_delete
=
models
.
CASCADE
)
video
=
models
.
ForeignKey
(
Video
,
related_name
=
'transcodes'
,
on_delete
=
models
.
CASCADE
)
class
Meta
:
class
Meta
:
unique_together
=
(
unique_together
=
(
'video'
,
'media_format'
)
(
'video'
,
'media_format'
)
)
class
AbstractTrackListing
(
ClusterableModel
):
class
AbstractTrackListing
(
ClusterableModel
):
...
...
wagtailvideos/static/wagtailvideos/css/edit-video.css
View file @
794ed405
.transcode-error
{
.transcode-error
{
color
:
red
;
color
:
red
;
}
}
.processing
{
.processing
{
opacity
:
0.8
;
opacity
:
0.8
;
font-weight
:
bold
;
font-weight
:
bold
;
}
}
wagtailvideos/static/wagtailvideos/css/summary-override.css
View file @
794ed405
...
@@ -14,5 +14,5 @@ section.summary > .stats > li {
...
@@ -14,5 +14,5 @@ section.summary > .stats > li {
@media
only
screen
and
(
max-width
:
50em
)
{
@media
only
screen
and
(
max-width
:
50em
)
{
section
.summary
>
.stats
{
section
.summary
>
.stats
{
grid-template-columns
:
repeat
(
2
,
1
fr
);
grid-template-columns
:
repeat
(
2
,
1
fr
);
}
}
}
}
\ No newline at end of file
wagtailvideos/static/wagtailvideos/js/add-multiple.js
View file @
794ed405
...
@@ -23,8 +23,8 @@ $(function() {
...
@@ -23,8 +23,8 @@ $(function() {
add
:
function
(
e
,
data
)
{
add
:
function
(
e
,
data
)
{
$
(
'
.messages
'
).
empty
();
$
(
'
.messages
'
).
empty
();
var
$this
=
$
(
this
);
var
$this
=
$
(
this
);
var
that
=
$this
.
data
(
'
blueimp-fileupload
'
)
||
$this
.
data
(
'
fileupload
'
)
var
that
=
$this
.
data
(
'
blueimp-fileupload
'
)
||
$this
.
data
(
'
fileupload
'
)
;
var
li
=
$
(
$
(
'
#upload-list-item
'
).
html
()).
addClass
(
'
upload-uploading
'
)
var
li
=
$
(
$
(
'
#upload-list-item
'
).
html
()).
addClass
(
'
upload-uploading
'
)
;
var
options
=
that
.
options
;
var
options
=
that
.
options
;
$
(
'
#upload-list
'
).
append
(
li
);
$
(
'
#upload-list
'
).
append
(
li
);
...
@@ -39,10 +39,12 @@ $(function() {
...
@@ -39,10 +39,12 @@ $(function() {
});
});
}).
done
(
function
()
{
}).
done
(
function
()
{
data
.
context
.
find
(
'
.start
'
).
prop
(
'
disabled
'
,
false
);
data
.
context
.
find
(
'
.start
'
).
prop
(
'
disabled
'
,
false
);
if
((
that
.
_trigger
(
'
added
'
,
e
,
data
)
!==
false
)
&&
if
(
(
options
.
autoUpload
||
data
.
autoUpload
)
&&
that
.
_trigger
(
'
added
'
,
e
,
data
)
!==
false
&&
data
.
autoUpload
!==
false
)
{
(
options
.
autoUpload
||
data
.
autoUpload
)
&&
data
.
submit
()
data
.
autoUpload
!==
false
)
{
data
.
submit
();
}
}
}).
fail
(
function
()
{
}).
fail
(
function
()
{
if
(
data
.
files
.
error
)
{
if
(
data
.
files
.
error
)
{
...
@@ -68,19 +70,24 @@ $(function() {
...
@@ -68,19 +70,24 @@ $(function() {
var
progress
=
Math
.
floor
(
data
.
loaded
/
data
.
total
*
100
);
var
progress
=
Math
.
floor
(
data
.
loaded
/
data
.
total
*
100
);
data
.
context
.
each
(
function
()
{
data
.
context
.
each
(
function
()
{
$
(
this
).
find
(
'
.progress
'
).
addClass
(
'
active
'
).
attr
(
'
aria-valuenow
'
,
progress
).
find
(
'
.bar
'
).
css
(
$
(
this
)
'
width
'
,
.
find
(
'
.progress
'
)
progress
+
'
%
'
.
addClass
(
'
active
'
)
).
html
(
progress
+
'
%
'
);
.
attr
(
'
aria-valuenow
'
,
progress
)
.
find
(
'
.bar
'
)
.
css
(
'
width
'
,
progress
+
'
%
'
)
.
html
(
progress
+
'
%
'
);
});
});
},
},
progressall
:
function
(
e
,
data
)
{
progressall
:
function
(
e
,
data
)
{
var
progress
=
parseInt
(
data
.
loaded
/
data
.
total
*
100
,
10
);
var
progress
=
parseInt
(
data
.
loaded
/
data
.
total
*
100
,
10
);
$
(
'
#overall-progress
'
).
addClass
(
'
active
'
).
attr
(
'
aria-valuenow
'
,
progress
).
find
(
'
.bar
'
).
css
(
$
(
'
#overall-progress
'
)
'
width
'
,
.
addClass
(
'
active
'
)
progress
+
'
%
'
.
attr
(
'
aria-valuenow
'
,
progress
)
).
html
(
progress
+
'
%
'
);
.
find
(
'
.bar
'
)
.
css
(
'
width
'
,
progress
+
'
%
'
)
.
html
(
progress
+
'
%
'
);
if
(
progress
>=
100
)
{
if
(
progress
>=
100
)
{
$
(
'
#overall-progress
'
).
removeClass
(
'
active
'
).
find
(
'
.bar
'
).
css
(
'
width
'
,
'
0%
'
);
$
(
'
#overall-progress
'
).
removeClass
(
'
active
'
).
find
(
'
.bar
'
).
css
(
'
width
'
,
'
0%
'
);
...
@@ -92,14 +99,13 @@ $(function() {
...
@@ -92,14 +99,13 @@ $(function() {
var
response
=
$
.
parseJSON
(
data
.
result
);
var
response
=
$
.
parseJSON
(
data
.
result
);
if
(
response
.
success
)
{
if
(
response
.
success
)
{
itemElement
.
addClass
(
'
upload-success
'
)
itemElement
.
addClass
(
'
upload-success
'
)
;
$
(
'
.preview
'
,
itemElement
).
attr
(
'
data-thumb-target
'
,
response
.
video_id
);
$
(
'
.preview
'
,
itemElement
).
attr
(
'
data-thumb-target
'
,
response
.
video_id
);
$
(
'
.right
'
,
itemElement
).
append
(
response
.
form
);
$
(
'
.right
'
,
itemElement
).
append
(
response
.
form
);
}
else
{
}
else
{
itemElement
.
addClass
(
'
upload-failure
'
);
itemElement
.
addClass
(
'
upload-failure
'
);
$
(
'
.right .error_messages
'
,
itemElement
).
append
(
response
.
error_message
);
$
(
'
.right .error_messages
'
,
itemElement
).
append
(
response
.
error_message
);
}
}
},
},
fail
:
function
(
e
,
data
)
{
fail
:
function
(
e
,
data
)
{
...
@@ -124,7 +130,9 @@ $(function() {
...
@@ -124,7 +130,9 @@ $(function() {
if
(
data
.
success
)
{
if
(
data
.
success
)
{
var
statusText
=
$
(
'
.status-msg.update-success
'
).
text
();
var
statusText
=
$
(
'
.status-msg.update-success
'
).
text
();
addMessage
(
'
success
'
,
statusText
);
addMessage
(
'
success
'
,
statusText
);
itemElement
.
slideUp
(
function
()
{
$
(
this
).
remove
()});
itemElement
.
slideUp
(
function
()
{
$
(
this
).
remove
();
});
}
else
{
}
else
{
form
.
replaceWith
(
data
.
form
);
form
.
replaceWith
(
data
.
form
);
...
@@ -142,11 +150,12 @@ $(function() {
...
@@ -142,11 +150,12 @@ $(function() {
var
CSRFToken
=
$
(
'
input[name="csrfmiddlewaretoken"]
'
,
form
).
val
();
var
CSRFToken
=
$
(
'
input[name="csrfmiddlewaretoken"]
'
,
form
).
val
();
$
.
post
(
this
.
href
,
{
csrfmiddlewaretoken
:
CSRFToken
},
function
(
data
)
{
$
.
post
(
this
.
href
,
{
csrfmiddlewaretoken
:
CSRFToken
},
function
(
data
)
{
if
(
data
.
success
)
{
if
(
data
.
success
)
{
itemElement
.
slideUp
(
function
()
{
$
(
this
).
remove
()});
itemElement
.
slideUp
(
function
()
{
$
(
this
).
remove
();
});
}
}
});
});
});
});
});
});
wagtailvideos/static/wagtailvideos/js/video-chooser-modal.js
View file @
794ed405
VIDEO_CHOOSER_MODAL_ONLOAD_HANDLERS
=
{
var
VIDEO_CHOOSER_MODAL_ONLOAD_HANDLERS
=
{
'
chooser
'
:
function
(
modal
,
jsonData
)
{
chooser
:
function
(
modal
,
jsonData
)
{
var
searchUrl
=
$
(
'
form.video-search
'
,
modal
.
body
).
attr
(
'
action
'
);
var
searchUrl
=
$
(
'
form.video-search
'
,
modal
.
body
).
attr
(
'
action
'
);
/* currentTag stores the tag currently being filtered on, so that we can
/* currentTag stores the tag currently being filtered on, so that we can
preserve this when paginating */
preserve this when paginating */
var
currentTag
;
var
currentTag
;
function
ajaxifyLinks
(
context
)
{
function
ajaxifyLinks
(
context
)
{
$
(
'
.listing a
'
,
context
).
click
(
function
()
{
$
(
'
.listing a
'
,
context
).
click
(
function
()
{
modal
.
loadUrl
(
this
.
href
);
modal
.
loadUrl
(
this
.
href
);
return
false
;
return
false
;
});
});
$
(
'
.pagination a
'
,
context
).
click
(
function
()
{
$
(
'
.pagination a
'
,
context
).
click
(
function
()
{
var
page
=
this
.
getAttribute
(
"
data-page
"
);
var
page
=
this
.
getAttribute
(
'
data-page
'
);
setPage
(
page
);
setPage
(
page
);
return
false
;
return
false
;
});
});
}
}
function
fetchResults
(
requestData
)
{
$
.
ajax
({
url
:
searchUrl
,
data
:
requestData
,
success
:
function
(
data
,
status
)
{
$
(
'
#image-results
'
).
html
(
data
);
ajaxifyLinks
(
$
(
'
#image-results
'
));
}
});
}
function
search
(
)
{
function
fetchResults
(
requestData
)
{
/* Searching causes currentTag to be cleared - otherwise there's
$
.
ajax
({
no way to de-select a tag */
url
:
searchUrl
,
currentTag
=
null
;
data
:
requestData
,
fetchResults
(
{
success
:
function
(
data
,
status
)
{
q
:
$
(
'
#id_q
'
).
val
(),
$
(
'
#image-results
'
).
html
(
data
);
collection_id
:
$
(
'
#collection_chooser_collection_id
'
).
val
()
ajaxifyLinks
(
$
(
'
#image-results
'
));
}
);
}
return
false
;
})
;
}
}
function
setPage
(
page
)
{
function
search
()
{
params
=
{
p
:
page
};
/* Searching causes currentTag to be cleared - otherwise there's
if
(
$
(
'
#id_q
'
).
val
().
length
){
no way to de-select a tag */
params
[
'
q
'
]
=
$
(
'
#id_q
'
).
val
();
currentTag
=
null
;
fetchResults
({
q
:
$
(
'
#id_q
'
).
val
(),
collection_id
:
$
(
'
#collection_chooser_collection_id
'
).
val
()
});
return
false
;
}
}
if
(
currentTag
)
{
params
[
'
tag
'
]
=
currentTag
;
function
setPage
(
page
)
{
var
params
=
{
p
:
page
};
if
(
$
(
'
#id_q
'
).
val
().
length
)
{
params
[
'
q
'
]
=
$
(
'
#id_q
'
).
val
();
}
if
(
currentTag
)
{
params
[
'
tag
'
]
=
currentTag
;
}
params
[
'
collection_id
'
]
=
$
(
'
#collection_chooser_collection_id
'
).
val
();
fetchResults
(
params
);
return
false
;
}
}
params
[
'
collection_id
'
]
=
$
(
'
#collection_chooser_collection_id
'
).
val
();
fetchResults
(
params
);
return
false
;
}
ajaxifyLinks
(
modal
.
body
);
ajaxifyLinks
(
modal
.
body
);
$
(
'
form.video-upload
'
,
modal
.
body
).
submit
(
function
()
{
$
(
'
form.video-upload
'
,
modal
.
body
).
submit
(
function
()
{
var
formdata
=
new
FormData
(
this
);
var
formdata
=
new
FormData
(
this
);
$
.
ajax
({
$
.
ajax
({
url
:
this
.
action
,
url
:
this
.
action
,
data
:
formdata
,
data
:
formdata
,
processData
:
false
,
processData
:
false
,
contentType
:
false
,
contentType
:
false
,
type
:
'
POST
'
,
type
:
'
POST
'
,
dataType
:
'
text
'
,
dataType
:
'
text
'
,
success
:
function
(
response
){
success
:
function
(
response
)
{
modal
.
loadResponseText
(
response
);
modal
.
loadResponseText
(
response
);
},
},
error
:
function
(
response
,
textStatus
,
errorThrown
)
{
error
:
function
(
response
,
textStatus
,
errorThrown
)
{
message
=
jsonData
[
'
error_message
'
]
+
'
<br />
'
+
errorThrown
+
'
-
'
+
response
.
status
;
var
message
=
jsonData
[
'
error_message
'
]
+
'
<br />
'
+
errorThrown
+
'
-
'
+
response
.
status
;
$
(
'
#upload
'
).
append
(
$
(
'
#upload
'
).
append
(
'
<div class="help-block help-critical">
'
+
'
<div class="help-block help-critical">
'
+
'
<strong>
'
+
jsonData
[
'
error_label
'
]
+
'
: </strong>
'
+
message
+
'
</div>
'
'
<strong>
'
+
jsonData
[
'
error_label
'
]
+
'
: </strong>
'
+
message
+
'
</div>
'
);
);
}
}
});
});
return
false
;
return
false
;
});
});
$
(
'
form.video-search
'
,
modal
.
body
).
submit
(
search
);
$
(
'
form.video-search
'
,
modal
.
body
).
submit
(
search
);
$
(
'
#id_q
'
).
on
(
'
input
'
,
function
()
{
$
(
'
#id_q
'
).
on
(
'
input
'
,
function
()
{
clearTimeout
(
$
.
data
(
this
,
'
timer
'
));
clearTimeout
(
$
.
data
(
this
,
'
timer
'
));
var
wait
=
setTimeout
(
search
,
200
);
var
wait
=
setTimeout
(
search
,
200
);
$
(
this
).
data
(
'
timer
'
,
wait
);
$
(
this
).
data
(
'
timer
'
,
wait
);
});
$
(
'
#collection_chooser_collection_id
'
).
change
(
search
);
$
(
'
a.suggested-tag
'
).
click
(
function
()
{
currentTag
=
$
(
this
).
text
();
$
(
'
#id_q
'
).
val
(
''
);
fetchResults
({
'
tag
'
:
currentTag
,
collection_id
:
$
(
'
#collection_chooser_collection_id
'
).
val
()
});
});
return
false
;
$
(
'
#collection_chooser_collection_id
'
).
change
(
search
);
});
$
(
'
a.suggested-tag
'
).
click
(
function
()
{
/* Add tag entry interface (with autocompletion) to the tag field of the image upload form */
currentTag
=
$
(
this
).
text
();
// $('#id_tags', modal.body).tagit({
$
(
'
#id_q
'
).
val
(
''
);
// autocomplete: {source: "{{ autocomplete_url|addslashes }}"}
fetchResults
({
// });
tag
:
currentTag
,
},
collection_id
:
$
(
'
#collection_chooser_collection_id
'
).
val
()
'
video_chosen
'
:
function
(
modal
,
jsonData
)
{
});
modal
.
respond
(
'
videoChosen
'
,
jsonData
[
'
result
'
]);
return
false
;
modal
.
close
();
});
},
/* Add tag entry interface (with autocompletion) to the tag field of the image upload form */
}
// $('#id_tags', modal.body).tagit({
// autocomplete: {source: "{{ autocomplete_url|addslashes }}"}
// });
},
video_chosen
:
function
(
modal
,
jsonData
)
{
modal
.
respond
(
'
videoChosen
'
,
jsonData
[
'
result
'
]);
modal
.
close
();
}
};
wagtailvideos/static/wagtailvideos/js/video-chooser.js
View file @
794ed405
...
@@ -4,12 +4,12 @@ function createVideoChooser(id) {
...
@@ -4,12 +4,12 @@ function createVideoChooser(id) {
var
input
=
$
(
'
#
'
+
id
);
var
input
=
$
(
'
#
'
+
id
);
var
editLink
=
chooserElement
.
find
(
'
.edit-link
'
);
var
editLink
=
chooserElement
.
find
(
'
.edit-link
'
);
$
(
'
.action-choose
'
,
chooserElement
).
click
(
function
()
{
$
(
'
.action-choose
'
,
chooserElement
).
click
(
function
()
{
ModalWorkflow
({
ModalWorkflow
({
url
:
window
.
chooserUrls
.
videoChooser
,
url
:
window
.
chooserUrls
.
videoChooser
,
onload
:
VIDEO_CHOOSER_MODAL_ONLOAD_HANDLERS
,
onload
:
VIDEO_CHOOSER_MODAL_ONLOAD_HANDLERS
,
responses
:
{
responses
:
{
videoChosen
:
function
(
videoData
)
{
videoChosen
:
function
(
videoData
)
{
input
.
val
(
videoData
.
id
);
input
.
val
(
videoData
.
id
);
previewVideo
.
attr
({
previewVideo
.
attr
({
src
:
videoData
.
preview
.
url
,
src
:
videoData
.
preview
.
url
,
...
@@ -22,7 +22,7 @@ function createVideoChooser(id) {
...
@@ -22,7 +22,7 @@ function createVideoChooser(id) {
});
});
});
});
$
(
'
.action-clear
'
,
chooserElement
).
click
(
function
()
{
$
(
'
.action-clear
'
,
chooserElement
).
click
(
function
()
{
input
.
val
(
''
);
input
.
val
(
''
);
chooserElement
.
addClass
(
'
blank
'
);
chooserElement
.
addClass
(
'
blank
'
);
});
});
...
...
wagtailvideos/templates/wagtailvideos/chooser/results.html
View file @
794ed405
...
@@ -19,9 +19,9 @@
...
@@ -19,9 +19,9 @@
<a
class=
"image-choice"
href=
"{% if will_select_format %}{% url 'wagtailvideos:chooser_select_format' video.id %}{% else %}{% url 'wagtailvideos:video_chosen' video.id %}{% endif %}"
>
<a
class=
"image-choice"
href=
"{% if will_select_format %}{% url 'wagtailvideos:chooser_select_format' video.id %}{% else %}{% url 'wagtailvideos:video_chosen' video.id %}{% endif %}"
>
<div
class=
"image"
>
<div
class=
"image"
>
{% if video.thumbnail %}
{% if video.thumbnail %}
<img
src=
'
{{video.thumbnail.url}}
'
width=
"165"
height=
"165"
class=
"show-transparency"
>
<img
src=
"
{{
video.thumbnail.url
}}
"
width=
"165"
height=
"165"
class=
"show-transparency"
alt=
"{% trans 'Video thumbnail' %}"
/
>
{% else %}
{% else %}
<img
width=
"165"
height=
"165"
class=
"show-transparency"
>
<img
width=
"165"
height=
"165"
class=
"show-transparency"
alt=
""
/
>
{% endif %}
{% endif %}
</div>
</div>
<h3>
{{ video.title|ellipsistrim:60 }}
</h3>
<h3>
{{ video.title|ellipsistrim:60 }}
</h3>
...
...
wagtailvideos/templates/wagtailvideos/homepage/videos_summary.html
View file @
794ed405
...
@@ -8,4 +8,4 @@
...
@@ -8,4 +8,4 @@
<span>
{{ total }}
</span>
Videos
<span
class=
"visuallyhidden"
>
created in {{ site_name }}
</span>
<span>
{{ total }}
</span>
Videos
<span
class=
"visuallyhidden"
>
created in {{ site_name }}
</span>
{% endblocktrans %}
{% endblocktrans %}
</a>
</a>
</li>
</li>
\ No newline at end of file
wagtailvideos/templates/wagtailvideos/multiple/add.html
View file @
794ed405
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
{% block titletag %}{% trans "Add multiple videos" %}{% endblock %}
{% block titletag %}{% trans "Add multiple videos" %}{% endblock %}
{% block extra_css %}
{% block extra_css %}
{{ block.super }}
{{ block.super }}
<!-- it's cheating but we're just going to use wagtailimages css since they should look identical anyways -->
<!-- it's cheating but we're just going to use wagtailimages css since they should look identical anyways -->
<link
rel=
"stylesheet"
href=
"{% static 'wagtailimages/css/add-multiple.css' %}"
type=
"text/css"
/>
<link
rel=
"stylesheet"
href=
"{% static 'wagtailimages/css/add-multiple.css' %}"
type=
"text/css"
/>
{% endblock %}
{% endblock %}
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
<div
class=
"nice-padding"
>
<div
class=
"nice-padding"
>
<div
class=
"drop-zone"
>
<div
class=
"drop-zone"
>
<p>
{% trans "Drag and drop videos into this area to upload immediately." %}
</p>
<p>
{% trans "Drag and drop videos into this area to upload immediately." %}
</p>
<p>
{{ help_text }}
<p>
{{ help_text }}
</p>
<form
action=
"{% url 'wagtailvideos:add_multiple' %}"
method=
"POST"
enctype=
"multipart/form-data"
>
<form
action=
"{% url 'wagtailvideos:add_multiple' %}"
method=
"POST"
enctype=
"multipart/form-data"
>
<div
class=
"replace-file-input"
>
<div
class=
"replace-file-input"
>
...
@@ -84,7 +84,7 @@
...
@@ -84,7 +84,7 @@
max_file_size
:
"
{{ error_max_file_size }}
"
,
max_file_size
:
"
{{ error_max_file_size }}
"
,
accepted_file_types
:
"
{{ error_accepted_file_types }}
"
accepted_file_types
:
"
{{ error_accepted_file_types }}
"
}
}
}
}
;
window
.
tagit_opts
=
{
window
.
tagit_opts
=
{
autocomplete
:
{
source
:
"
{{ autocomplete_url|addslashes }}
"
}
autocomplete
:
{
source
:
"
{{ autocomplete_url|addslashes }}
"
}
};
};
...
...
wagtailvideos/templates/wagtailvideos/multiple/edit_form.html
View file @
794ed405
...
@@ -10,18 +10,17 @@
...
@@ -10,18 +10,17 @@
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
<li>
<li>
<input
class=
'
button
'
type=
"submit"
value=
"{% trans 'Update' %}"
/>
<input
class=
"
button
"
type=
"submit"
value=
"{% trans 'Update' %}"
/>
<a
href=
"{% url 'wagtailvideos:delete_multiple' video.id %}"
class=
"delete button button-secondary no"
>
{% trans "Delete" %}
</a>
<a
href=
"{% url 'wagtailvideos:delete_multiple' video.id %}"
class=
"delete button button-secondary no"
>
{% trans "Delete" %}
</a>
</li>
</li>
</ul>
</ul>
</form>
</form>
<div
data-video-thumb=
"{{ video.id }}"
class=
'
thumb icon icon-media hasthumb
'
>
<div
data-video-thumb=
"{{ video.id }}"
class=
"
thumb icon icon-media hasthumb
"
>
{% if video.thumbnail %}
{% if video.thumbnail %}
<img
src=
"{{ video.thumbnail.url }}"
/>
<img
src=
"{{ video.thumbnail.url }}"
alt=
"{% trans 'Video thumbnail' %}"
/>
{% endif %}
{% endif %}
</div>
</div>
<script>
<script>
var
thumb
=
$
(
"
[data-video-thumb=
\"
"
+
{{
video
.
id
}}
+
"
\"
]
"
);
var
thumb
=
$
(
"
[data-video-thumb=
\"
"
+
{{
video
.
id
}}
+
"
\"
]
"
);
$
(
"
[data-thumb-target=
\"
"
+
{{
video
.
id
}}
+
"
\"
]
"
).
append
(
thumb
);
$
(
"
[data-thumb-target=
\"
"
+
{{
video
.
id
}}
+
"
\"
]
"
).
append
(
thumb
);
</script>
</script>
wagtailvideos/templates/wagtailvideos/videos/add.html
View file @
794ed405
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
{% include "wagtailadmin/shared/field_as_li.html" with field=field %}
{% include "wagtailadmin/shared/field_as_li.html" with field=field %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
<li><input
class=
'
button
'
type=
"submit"
value=
"{% trans 'Save' %}"
/></li>
<li><input
class=
"
button
"
type=
"submit"
value=
"{% trans 'Save' %}"
/></li>
</ul>
</ul>
</form>
</form>
</div>
</div>
...
...
wagtailvideos/templates/wagtailvideos/videos/confirm_delete.html
View file @
794ed405
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
<p>
{% trans "Are you sure you want to delete this video?" %}
</p>
<p>
{% trans "Are you sure you want to delete this video?" %}
</p>
<form
action=
"{% url 'wagtailvideos:delete' video.id %}"
method=
"POST"
>
<form
action=
"{% url 'wagtailvideos:delete' video.id %}"
method=
"POST"
>
{% csrf_token %}
{% csrf_token %}
<input
type=
"submit"
class=
'
button serious
'
value=
"{% trans 'Yes, delete' %}"
/>
<input
type=
"submit"
class=
"
button serious
"
value=
"{% trans 'Yes, delete' %}"
/>
</form>
</form>
</div>
</div>
</div>
</div>
...
...
wagtailvideos/templates/wagtailvideos/videos/results.html
View file @
794ed405
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
<a
class=
"image-choice"
href=
"{% url 'wagtailvideos:edit' video.id %}"
>
<a
class=
"image-choice"
href=
"{% url 'wagtailvideos:edit' video.id %}"
>
<div
class=
"image"
>
<div
class=
"image"
>
{% if video.thumbnail %}
{% if video.thumbnail %}
<img
src=
'
{{video.thumbnail.url}}
'
height=
165
width=
165
class=
"show-transparency"
/></img
>
<img
src=
"
{{
video.thumbnail.url
}}
"
height=
"
165
"
width=
"
165
"
class=
"show-transparency"
alt=
"{% trans 'Video thumbnail' %}"
/
>
{% endif %}
{% endif %}
</div>
</div>
<h3>
{{ video.title|ellipsistrim:60 }}
</h3>
<h3>
{{ video.title|ellipsistrim:60 }}
</h3>
...
...
wagtailvideos/templates/wagtailvideos/widgets/video_chooser.html
View file @
794ed405
{% extends "wagtailadmin/widgets/chooser.html" %}
{% extends "wagtailadmin/widgets/chooser.html" %}
{% load i18n %}
{% block chooser_class %}image-chooser{% endblock %}
{% block chooser_class %}image-chooser{% endblock %}
{% block chosen_state_view %}
{% block chosen_state_view %}
<div
class=
"preview-image"
>
<div
class=
"preview-image"
>
{% if video and video.thumbnail %}
{% if video and video.thumbnail %}
<img
src=
"{{video.thumbnail.url}}"
width=
"165"
height=
"165"
class=
"show-transparency"
>
<img
src=
"{{
video.thumbnail.url
}}"
width=
"165"
height=
"165"
class=
"show-transparency"
alt=
"{% trans 'Video thumbnail' %}"
/
>
{% else %}
{% else %}
<img
width=
"165"
height=
"165"
class=
"show-transparency"
>
<img
width=
"165"
height=
"165"
class=
"show-transparency"
alt=
""
/
>
{% endif %}
{% endif %}
</div>
</div>
{% endblock %}
{% endblock %}
...
...
wagtailvideos/templatetags/wagtailvideos_tags.py
View file @
794ed405
...
@@ -12,7 +12,7 @@ def video(parser, token):
...
@@ -12,7 +12,7 @@ def video(parser, token):
extra_attrs
=
{}
extra_attrs
=
{}
# Everyting after video expression
# Everyting after video expression
if
(
len
(
template_params
)
>
1
)
:
if
len
(
template_params
)
>
1
:
for
param
in
template_params
[
1
:]:
for
param
in
template_params
[
1
:]:
try
:
try
:
name
,
value
=
param
.
split
(
'='
)
name
,
value
=
param
.
split
(
'='
)
...
...
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