From 16b1e97685d10e2163710052cd93e6f2087b2679 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Tue, 21 Aug 2012 20:15:17 +0800 Subject: [PATCH] =?UTF-8?q?code=20merged=20=E2=80=A6=20ui=20updated?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/assets/javascripts/galleryAPI.js.erb | 16 +++-- .../back_end/orbit_galleries_controller.rb | 18 ++++- .../orbit_galleries/edit_album.html.erb | 69 ++++++++++--------- 3 files changed, 63 insertions(+), 40 deletions(-) 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 b0365c96..9c01786d 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 @@ -35,7 +35,10 @@ var galleryAPI = function(){ g.loadArea = "albums"; passid = g.urlVars['tag']; g.loadAlbums(g.urlVars['tag']); - }else if(g.urlVars.length == 0){ + }else if(g.urlVars["locale"]){ + g.loadArea = "albums"; + g.loadAlbums("all"); + }else if(g.urlVars.length == 0) { g.loadArea = "albums"; g.loadAlbums("all"); } @@ -493,15 +496,18 @@ var galleryAPI = function(){ }) g.albumArea.find(".rghead .rgfn .bt-save").click(function(){ // var dataArray = Array(); - // $(".description_loader .txtchange").each(function(){ - // dataArray.push({"id":$(this).attr("for"),"text": $(this).val()}); + // $(".description_loader .en .txtchange").each(function(){ + // var thisid = $(this).attr("for"); + // dataArray.push({"id":thisid,"text":{"en":$(this).val(),"zh_tw":$(".description_loader .zh_tw .txtchange[for="+thisid+"]").val()}}); // }) // var albumnm = Array(); // $(".albumname_edit .txtchange").each(function(){ // albumnm.push($(this).val()) // }) - var dataArray = $("form#edit_album").serialize(); - $.post("update_album",{"aid":id,"data":dataArray},function(){ + // var dataArray = $("form#edit_album").serialize(); + // $.post("update_album",{"data":dataArray},function(){ + + // }) }) }) diff --git a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/orbit_galleries_controller.rb b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/orbit_galleries_controller.rb index cb78c5f6..2bd9a94a 100644 --- a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/orbit_galleries_controller.rb +++ b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/orbit_galleries_controller.rb @@ -191,8 +191,24 @@ include AdminHelper # end # album = GalleryAlbum.find(aid) # album.update_attributes(:name => album_name) - data = params['data'] + album_names = params[:albumnm] + data = params[:data] + aid =params[:aid] debugger + data.each do |d| + image = GalleryImage.find(d[1][:id]) + @site_valid_locales.each do |locale| + image.description_translations[locale] = d[1][:text][locale] + end + image.save! + end + + album = GalleryAlbum.find(aid) + + @site_valid_locales.each_with_index do |locale,i| + album.name_translations[locale] = album_names[i] + end + album.save! render :json =>{"success"=>true}.to_json end diff --git a/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/orbit_galleries/edit_album.html.erb b/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/orbit_galleries/edit_album.html.erb index 4c405eff..253f039d 100644 --- a/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/orbit_galleries/edit_album.html.erb +++ b/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/orbit_galleries/edit_album.html.erb @@ -9,42 +9,44 @@
  • ><%= I18nVariable.from_locale(locale) %>
  • <% end %> -
    -
    - <% i = 0 %> - <% @site_valid_locales.each do |locale| %> - <% if i == 0 %> -
    - <% else %> -
    - <% end %> - <% i = 1 %> -
    - -
    -
    -
    - <% @images.each do |image| %> -
    - -
    - -
    -
    - <% if image.id.to_s == @cover %> - - <% else %> - - <% end %> - - -
    -
    + +
    + <% @site_valid_locales.each_with_index do |locale, i| %> + <% if i == 0 %> +
    + <% else %> +
    <% end %> + +
    + +
    +
    + +
    + <% @images.each_with_index do |image,x| %> +
    + +
    + +
    +
    + <% if image.id.to_s == @cover %> + + <% else %> + + <% end %> + + +
    +
    + <% end %> +
    -
    - <% end %> + + + -
    \ No newline at end of file