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 = $("
"+album.name+""+album.category_name+"
"); else var $img = $("
"+album.name+""+album.category_name+"
"); - var tag_string = ""; for(tag in album.tag_names){ tag_string+= '' + album.tag_names[tag] + ''; @@ -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 %>
- -
+ <%= f.fields_for :name_translations do |name| %> + <%= f.label t("gallery.album_name") %> +
+ <%= name.text_field locale, :value => (@album_name[locale]), :class => "txtchange" %> +
+ <% end %>
<% @images.each_with_index do |image,x| %>
- <%= link_to panel_gallery_back_end_album_image_path(image) do %> <% end %>
<%= f.fields_for :gallery_images do |j| %> + <%= j.hidden_field :id, :value => (image.id) %> <%= j.fields_for :description_translations do |desc| %> - <%= desc.text_area locale, :value => (image.description_translations[locale] rescue nil ), :class => "txtchange" %> + <%= desc.text_area locale, :value => (image.description_translations[locale] rescue nil), :class => "txtchange" %> <% end %> <% end %>
@@ -57,19 +61,15 @@ <% end %> -
- -<% end %> - + "><%= I18n.t("gallery.back_to_photos") %> + + <%= f.submit t('gallery.save'), :class=>'bt-save icon-ok btn btn-primary pull-right', :style=>"display:none;" %> +
+<% end %> + +
diff --git a/vendor/built_in_modules/gallery/config/routes.rb b/vendor/built_in_modules/gallery/config/routes.rb index ca368b3a..5c058e05 100644 --- a/vendor/built_in_modules/gallery/config/routes.rb +++ b/vendor/built_in_modules/gallery/config/routes.rb @@ -5,6 +5,7 @@ Rails.application.routes.draw do match "get_albums" => "albums#get_albums" match "upload_image" => "albums#upload_image" match "save_tags" => "tags#save_tags" + match "albums/save_tags" => "tags#save_tags" resources :albums do match "set_cover" => "albums#set_cover" @@ -16,6 +17,7 @@ Rails.application.routes.draw do resources :album_images resources :gallery_categories resources :tags + end namespace :front_end do match "orbit_galleries" => "orbit_galleries#index"