[IMP] website: media editor: insert add button for video loader
bzr revid: chm@openerp.com-20140407081159-434frpfqhe1zqrc0
This commit is contained in:
parent
ee4b879536
commit
2f7950f19f
|
@ -1817,8 +1817,8 @@
|
|||
website.editor.VideoDialog = website.editor.Media.extend({
|
||||
template: 'website.editor.dialog.video',
|
||||
events : _.extend({}, website.editor.Dialog.prototype.events, {
|
||||
'blur input#urlvideo': 'get_video',
|
||||
'blur input#embedvideo': 'get_embed_video',
|
||||
'click input#urlvideo ~ button': 'get_video',
|
||||
'click input#embedvideo ~ button': 'get_embed_video',
|
||||
}),
|
||||
start: function () {
|
||||
this.$iframe = this.$("iframe");
|
||||
|
@ -1845,12 +1845,17 @@
|
|||
return video_id;
|
||||
}
|
||||
},
|
||||
get_embed_video: function () {
|
||||
get_embed_video: function (event) {
|
||||
event.preventDefault();
|
||||
var embedvideo = this.$("input#embedvideo").val().match(/src=["']?([^"']+)["' ]?/);
|
||||
this.$("input#urlvideo").val(embedvideo ? embedvideo[1] : "");
|
||||
this.get_video();
|
||||
if (embedvideo) {
|
||||
this.$("input#urlvideo").val(embedvideo[1]);
|
||||
this.get_video(event);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
get_video: function () {
|
||||
get_video: function (event) {
|
||||
event.preventDefault();
|
||||
var needle = this.$("input#urlvideo").val();
|
||||
var video_id;
|
||||
var video_type;
|
||||
|
@ -1876,6 +1881,7 @@
|
|||
this.$("#video_type").val(video_type);
|
||||
|
||||
this.$iframe.attr("src", this.get_url());
|
||||
return false;
|
||||
},
|
||||
save: function () {
|
||||
var video_id = this.$("#video_id").val();
|
||||
|
|
|
@ -299,27 +299,27 @@
|
|||
<t t-name="website.editor.dialog.video">
|
||||
<form action="#" class="form-inline">
|
||||
<div class="well">
|
||||
<div class="form-group">
|
||||
<label for="urlvideo" style="width: 200px;">Video URL</label>
|
||||
<div class="form-group btn-group">
|
||||
<span class="text-muted pull-right" style="margin-left:10px; line-height: 2em;">(Youtube, Vimeo, Dailymotion)</span>
|
||||
<label for="urlvideo" style="width: 180px; line-height: 2em;" class="pull-left">Video URL</label>
|
||||
<input type="text"
|
||||
name="url"
|
||||
class="form-control url"
|
||||
class="form-control url pull-left"
|
||||
style="width: 400px;"
|
||||
id="urlvideo"
|
||||
placeholder="http://openerp.com"
|
||||
value="//www.youtube.com/embed/yws1tbgNV7k"/>
|
||||
<span class="text-muted">
|
||||
(Youtube, Vimeo, Dailymotion)
|
||||
</span>
|
||||
<button class="btn btn-primary">Add</button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="urlvideo" style="width: 200px;">Html Embed Video</label>
|
||||
<div class="form-group btn-group">
|
||||
<label for="urlvideo" style="width: 180px; line-height: 2em;" class="pull-left">Html Embed Video</label>
|
||||
<input type="text"
|
||||
name="embed"
|
||||
class="form-control url"
|
||||
class="form-control url pull-left"
|
||||
style="width: 400px;"
|
||||
id="embedvideo"
|
||||
placeholder='<iframe src="//www.youtube.com/embed/yws1tbgNV7k"></iframe>'/>
|
||||
<button class="btn btn-primary">Add</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue