diff options
| author | Jules Laplace <jules@okfoc.us> | 2016-03-28 19:10:26 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2016-03-28 19:11:20 -0400 |
| commit | d8e9b4d5334db049feec81b0083c3adcedaf7e12 (patch) | |
| tree | 844a9fa3fe6cfd08ad4a4085c50dd9e139648b85 /themes/okadmin/public/js/app.js | |
| parent | 49fe25c8e884c14ab3258d22240a62f0b57da490 (diff) | |
allow generic urls in media fieldv0.1.21
Diffstat (limited to 'themes/okadmin/public/js/app.js')
| -rw-r--r-- | themes/okadmin/public/js/app.js | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/themes/okadmin/public/js/app.js b/themes/okadmin/public/js/app.js index da398eb..61fc8c8 100644 --- a/themes/okadmin/public/js/app.js +++ b/themes/okadmin/public/js/app.js @@ -47,17 +47,33 @@ var OKAdmin = function(){ $("ol", parent).prepend($el) } uploader.addVideo = function(media){ - console.log(media) - var videoTemplate = $(".video-template", parent).html() - var $el = $(videoTemplate) - $el.addClass("loaded") - $el.find(".video-type").val( media.type ) - $el.find(".video-token").val( media.token ) - $el.find(".video-title").val( media.title ) - $el.find(".video-thumb").val( media.thumbnail ) - $el.find("img").attr("src", media.thumbnail ) - $("ol", parent).prepend($el) - } + switch (media.type) { + case 'youtube': + case 'vimeo': + case 'video': + var videoTemplate = $(".video-template", parent).html() + var $el = $(videoTemplate) + $el.addClass("loaded") + $el.find(".video-type").val( media.type ) + $el.find(".video-token").val( media.token ) + $el.find(".video-title").val( media.title ) + $el.find(".video-thumb").val( media.thumbnail ) + $el.find(".video-width").val( media.width ) + $el.find(".video-height").val( media.height ) + $el.find("img").attr("src", media.thumbnail ) + $("ol", parent).prepend($el) + break + case 'link': + var linkTemplate = $(".link-template", parent).html() + var $el = $(linkTemplate) + $el.addClass("loaded") + $el.find(".uri").val( media.url ) + $("ol", parent).prepend($el) + break + default: + alert("Unsupported link type!") + } + } }) // delete image from gallery $(document).on("mousedown", ".media-list .remove", function(){ |
