summaryrefslogtreecommitdiff
path: root/themes
diff options
context:
space:
mode:
Diffstat (limited to 'themes')
-rw-r--r--themes/okadmin/public/js/app.js10
-rw-r--r--themes/okadmin/public/js/upload.js4
2 files changed, 8 insertions, 6 deletions
diff --git a/themes/okadmin/public/js/app.js b/themes/okadmin/public/js/app.js
index 874b7e1..e981223 100644
--- a/themes/okadmin/public/js/app.js
+++ b/themes/okadmin/public/js/app.js
@@ -1,7 +1,7 @@
var OKAdmin = function(){
// initialize our multi-image uploader with an element and a template
- $(".image-list").each(function(){
+ $(".group.image-list").each(function(){
var uploader = new OKUpload ()
uploader.bind( this )
uploader.add = function(url){
@@ -14,18 +14,20 @@ var OKAdmin = function(){
})
// delete image from gallery
$(document).on("mousedown", ".image-list .remove-image", function(){
- if (confirm("Delete this image?")) {
+ if (confirm("Remove this image?")) {
$(this).parent().remove()
}
})
// initialize our single image uploader with existing DOM
- $(".image").each(function(){
+ $(".group.image").each(function(){
var $el = $(this)
var uploader = new OKUpload ()
uploader.bind( this )
uploader.add = function(url){
+ console.log(url)
+ console.log($el)
$el.find(".uri").val(url)
$el.find(".caption").val("")
$el.find("img").attr("src", url)
@@ -34,7 +36,7 @@ var OKAdmin = function(){
})
// delete image from single image entry
$(document).on("mousedown", ".image .remove-image", function(){
- if (confirm("Delete this image?")) {
+ if (confirm("Remove this image?")) {
var $el = $(this).closest(".image")
$el.removeClass('loaded')
$el.find(".uri").val("")
diff --git a/themes/okadmin/public/js/upload.js b/themes/okadmin/public/js/upload.js
index 040654b..b4a0dfc 100644
--- a/themes/okadmin/public/js/upload.js
+++ b/themes/okadmin/public/js/upload.js
@@ -5,9 +5,10 @@ var OKUpload = function(){
OKUpload.prototype.bind = function(rapper){
var uploader = this
$(".add-image-button input", rapper).change( uploader.handleFileSelect.bind(uploader) )
- $(".add-image-url", rapper).keydown(pressEnter(function(e){
+ $(".add-image-url", rapper).on("keydown blur", pressEnter( function(e){
var url = $(this).val()
$(this).val("")
+ if (! url) return
uploader.add(url)
}))
}
@@ -54,7 +55,6 @@ OKUpload.prototype.error = function(error){
}
-
function pressEnter(fn){
return function(e){
if (e.keyCode && e.keyCode !== 13) return