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
170268c2
Commit
170268c2
authored
Mar 02, 2021
by
Kevin Gutierrez
Browse files
Fix tabs
parent
d672ac13
Changes
4
Hide whitespace changes
Inline
Side-by-side
wagtailvideos/static/wagtailvideos/js/video-chooser-modal.js
View file @
170268c2
var
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
()
{
var
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
)
{
var
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">
'
+
'
<strong>
'
+
jsonData
[
'
error_label
'
]
+
'
: </strong>
'
+
message
+
'
</div>
'
'
<div class="help-block help-critical">
'
+
'
<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/templates/wagtailvideos/chooser/results.html
View file @
170268c2
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
<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"
alt=
"{% trans 'Video thumbnail' %}"
/>
<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"
alt=
""
/>
<img
width=
"165"
height=
"165"
class=
"show-transparency"
alt=
""
/>
{% endif %}
{% endif %}
...
...
wagtailvideos/templates/wagtailvideos/videos/results.html
View file @
170268c2
...
@@ -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"
alt=
"{% trans 'Video thumbnail' %}"
/>
<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 @
170268c2
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
{% 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"
alt=
"{% trans 'Video thumbnail' %}"
/>
<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"
alt=
""
/>
<img
width=
"165"
height=
"165"
class=
"show-transparency"
alt=
""
/>
{% endif %}
{% endif %}
...
...
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