diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-01-20 19:26:09 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-01-20 19:26:09 +0100 |
commit | 9dcdf517f5ac9230564cce7c46b14ed8bf4f7523 (patch) | |
tree | 0760d3805aa1d139202e4fa4fb57a7126572f0c0 | |
parent | 735fcf8bd2739f109d7519aac99d864691c4ba6f (diff) | |
download | nextcloud-server-9dcdf517f5ac9230564cce7c46b14ed8bf4f7523.tar.gz nextcloud-server-9dcdf517f5ac9230564cce7c46b14ed8bf4f7523.zip |
fix deleting/renaming albums with a ' in the name
-rw-r--r-- | apps/gallery/css/styles.css | 17 | ||||
-rw-r--r-- | apps/gallery/js/album_cover.js | 6 | ||||
-rw-r--r-- | apps/gallery/js/albums.js | 30 |
3 files changed, 30 insertions, 23 deletions
diff --git a/apps/gallery/css/styles.css b/apps/gallery/css/styles.css index 4ada23b0b06..a0822ddec1e 100644 --- a/apps/gallery/css/styles.css +++ b/apps/gallery/css/styles.css @@ -1,11 +1,12 @@ div#gallery_list { margin: 90pt 20pt; } -div#gallery_list.leftcontent { padding-top: 15pt; margin: 0; position: absolute; bottom:0px; text-align: center; overflow: scroll; } -div#gallery_album_box { width: 200px; text-align: center; border: 0; display: inline-block; margin: 5pt; vertical-align: top; padding: 10px; position: relative; overflow: hidden; color: #999; } -div#gallery_album_box:hover { color: black; } -.leftcontent div#gallery_album_box { margin: 5px; } -div#gallery_album_box h1 { font-size: 9pt; font-family: Verdana; } -div#gallery_album_cover { width: 199px; height: 199px; border: solid 1pt #999; padding: 0; } -div#gallery_control_overlay { border: 0; position:absolute; right: 10pt; background-color: #333; opacity: 0.5; visibility:hidden; padding: 0 5pt; } -div#gallery_control_overlay a { color:white; } +div.gallery_list.leftcontent { padding-top: 15pt; margin: 0; position: absolute; bottom:0px; text-align: center; overflow: scroll; } +div.gallery_album_box { width: 200px; text-align: center; border: 0; display: inline-block; margin: 5pt; vertical-align: top; padding: 10px; position: relative; overflow: hidden; color: #999; } +div.gallery_album_box:hover { color: black; } +.leftcontent div.gallery_album_box { margin: 5px; } +div.gallery_album_box h1 { font-size: 9pt; font-family: Verdana; } +div.gallery_album_cover { width: 199px; height: 199px; border: solid 1pt #999; padding: 0; } +div.gallery_control_overlay { border: 0; position:absolute; right: 10pt; background-color: #333; opacity: 0; padding: 0 5pt; } +div.gallery_album_box:hover div.gallery_control_overlay { opacity:0.5 } +div.gallery_control_overlay a { color:white; } #gallery_images.rightcontent { padding:10px 5px; position:absolute; bottom: 0px; overflow: scroll; } diff --git a/apps/gallery/js/album_cover.js b/apps/gallery/js/album_cover.js index 38b5815775c..0e791689a1a 100644 --- a/apps/gallery/js/album_cover.js +++ b/apps/gallery/js/album_cover.js @@ -77,8 +77,8 @@ function galleryRemove(albumName) { if (confirm(t('gallery',"Do you wan't to remove album")+' ' + albumName + "?")) { $.getJSON("ajax/galleryOp.php", {operation: "remove", name: albumName}, function(r) { if (r.status == "success") { - $("#gallery_album_box[title='"+albumName+"']").remove(); - Albums.remove(albumName); + $(".gallery_album_box").filterAttr('data-album',albumName).remove(); + Albums.remove(albumName); } else { alert("Error: " + r.cause); } @@ -95,7 +95,7 @@ function galleryRename(name) { } $.getJSON("ajax/galleryOp.php", {operation: "rename", oldname: name, newname: result}, function(r) { if (r.status == "success") { - Albums.rename($("#gallery_album_box[title='"+name+"']"), result); + Albums.rename($(".gallery_album_box").filterAttr('data-album',albumName), result); } else { alert("Error: " + r.cause); } diff --git a/apps/gallery/js/albums.js b/apps/gallery/js/albums.js index 546aadba49f..f18d1deca4c 100644 --- a/apps/gallery/js/albums.js +++ b/apps/gallery/js/albums.js @@ -41,20 +41,26 @@ Albums={ // displays gallery in linear representation // on given element, and apply default styles for gallery display: function(element) { - var displayTemplate = '<div id="gallery_album_box" title="*NAME*"><div id="gallery_control_overlay"><a href="#" onclick="galleryRename(\'*NAME*\');return false;">rename</a> | <a href="#" onclick="galleryRemove(\'*NAME*\');">remove</a></div><a href="?view=*NAME*"><div id="gallery_album_cover" title="*NAME*"></div></a><h1>*NAME*</h1></div></div>'; + var displayTemplate = '<div class="gallery_album_box"><div class="gallery_control_overlay"><a href="#" class="rename">rename</a> | <a href="#" class="remove">remove</a></div><a class="view"><div class="gallery_album_cover"></div></a><h1></h1></div></div>'; for (var i in Albums.albums) { var a = Albums.albums[i]; - var local = $(displayTemplate.replace(/\*NAME\*/g, a.name)); - $("#gallery_album_cover", local).css('background-repeat', 'no-repeat'); - $("#gallery_album_cover", local).css('background-position', '0'); - $("#gallery_album_cover", local).css('background-image','url("ajax/galleryOp.php?operation=get_covers&albumname='+a.name+'")'); - local.mouseover(function(e) { - $("#gallery_control_overlay", this).css('visibility','visible'); - }); - local.mouseout(function(e) { - $("#gallery_control_overlay", this).css('visibility','hidden'); - }); - $("#gallery_album_cover", local).mousemove(function(e) { + var local=$(displayTemplate); + local.attr('data-album',a.name); + $(".gallery_control_overlay a.rename", local).click(function(name,event){ + event.preventDefault(); + galleryRename(name); + }.bind(null,a.name)); + $(".gallery_control_overlay a.remove", local).click(function(name,event){ + event.preventDefault(); + galleryRemove(name); + }.bind(null,a.name)); + $("a.view", local).attr('href','?view='+a.name); + $('h1',local).text(a.name); + $(".gallery_album_cover", local).attr('title',a.name); + $(".gallery_album_cover", local).css('background-repeat', 'no-repeat'); + $(".gallery_album_cover", local).css('background-position', '0'); + $(".gallery_album_cover", local).css('background-image','url("ajax/galleryOp.php?operation=get_covers&albumname='+a.name+'")'); + $(".gallery_album_cover", local).mousemove(function(e) { var albumMetadata = Albums.find(this.title); if (albumMetadata == undefined) { |