diff --git a/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI.js.erb b/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI.js.erb index f7909d69..f25e4d9f 100644 --- a/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI.js.erb +++ b/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI.js.erb @@ -127,7 +127,6 @@ var galleryAPI = function(){ var $img = $("
"); else var $img = $(""); - var tag_string = ""; for(tag in album.tag_names){ tag_string+= ' '; @@ -294,12 +293,9 @@ var galleryAPI = function(){ } }) g.albumArea.find("#tag_panel .bt-save").click(function(){ - g.saveTags(imageArray[imagecount]._id,"pic") - var tagids = new Array(); - g.tagList.find("li input:checked").each(function(){ - tagids.push($(this).parent().attr("data-content")); + g.saveTags(imageArray[imagecount]._id,"pic",function(tagids){ + imageArray[imagecount].tag_ids = tagids; }) - imageArray[imagecount].tag_ids = tagids; }) $(".slidectrl a.togglelist").click(function(){ var rslide_h = $rslide.outerHeight(); @@ -493,6 +489,7 @@ var galleryAPI = function(){ }) var current_element_for_tags = null; + var current_element_no = null; $('.bt-tag').click(function(){ var has_class = false; if($(this).hasClass("active")) @@ -527,11 +524,11 @@ var galleryAPI = function(){ current_element_for_tags = $(this).attr("href"); if(count == 1){ - var no = $(this).parent().attr("no"); - if(imageTagArray[no].id == current_element_for_tags){ + current_element_no = $(this).parent().attr("no"); + if(imageTagArray[current_element_no].id == current_element_for_tags){ g.tagList.find("input").attr("checked",false); - for(tag in imageTagArray[no].tags){ - g.tagList.find("li[data-content="+imageTagArray[no].tags[tag]+"] input").attr("checked",true); + for(tag in imageTagArray[current_element_no].tags){ + g.tagList.find("li[data-content="+imageTagArray[current_element_no].tags[tag]+"] input").attr("checked",true); } } } @@ -555,7 +552,9 @@ var galleryAPI = function(){ } }) g.albumArea.find("#tag_panel .bt-save").click(function(){ - g.saveTags(current_element_for_tags,"pic"); + g.saveTags(current_element_for_tags,"pic",function(tagids){ + imageTagArray[current_element_no].tags = tagids; + }) }) var tempval; $(".txtchange").focus(function(){ @@ -603,12 +602,15 @@ var galleryAPI = function(){ }) bindHandlers(); } - this.saveTags = function(id,tagsfor){ + this.saveTags = function(id,tagsfor,callbackFn){ var tagids = new Array(); g.tagList.find("li input:checked").each(function(){ tagids.push($(this).parent().attr("data-content")); }) - $.post("../save_tags",{"id":id,"tag":tagsfor,"tids":tagids}) + $.post("../save_tags",{"id":id,"tag":tagsfor,"tids":tagids},function(){ + if(typeof callbackFn == "function") + callbackFn.call(this,tagids); + }) } } galleryAPI.prototype.locale = "en"; diff --git a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb index 41c5c186..e3441fad 100644 --- a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb +++ b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb @@ -168,6 +168,21 @@ include AdminHelper end render :json=>tags.to_json end + + def update + debugger + @album = GalleryAlbum.find(params[:id]) + #album.update_attributes(params[:gallery_album]) + if is_manager? || is_admin? || is_sub_manager? + @authenticated = true #turn this value to false for view only + else + @authenticated = false + end + + @tags = GalleryTag.all + render :action => :show + end + end diff --git a/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/albums/edit.html.erb b/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/albums/edit.html.erb index a3007000..0a396785 100644 --- a/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/albums/edit.html.erb +++ b/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/albums/edit.html.erb @@ -23,21 +23,25 @@ <% end %>