diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb index f98984a3..938d632c 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -67,15 +67,15 @@ <% end -%> <% end -%> -<%= content_tag :li, :class => active_for_controllers('orbit_galleries','/panel/gallery/back_end/tags') || active_for_app_auth("orbit_gallery") do -%> - <%= link_to content_tag(:i, nil, :class => 'icons-picture') + t('admin.orbit_gallery'), panel_gallery_back_end_orbit_gallery_path %> +<%= content_tag :li, :class => active_for_controllers('albums','album_images','gallery_categories','/panel/gallery/back_end/tags') || active_for_app_auth("gallery") do -%> + <%= link_to content_tag(:i, nil, :class => 'icons-picture') + t('admin.orbit_gallery'), panel_gallery_back_end_albums_path %> <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('orbit_galleries') ) do -%> <%#= content_tag :li, link_to(t('admin.ad.all_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %> <%#= content_tag :li, link_to(t('admin.ad.new_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %> <%#= content_tag :li, link_to(t('admin.ad.new_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_images', 'new') %> - <%= content_tag :li, link_to(t('gallery.categories'), panel_gallery_back_end_categorylist_path), :class => active_for_action('/panel/gallery/back_end/categorylist','categorylist') %> + <%= content_tag :li, link_to(t('gallery.categories'), panel_gallery_back_end_gallery_categories_path), :class => active_for_action('/panel/gallery/back_end/categorylist','categorylist') %> <%= content_tag :li, link_to(t('gallery.tags'), panel_gallery_back_end_tags_path), :class => active_for_action('/panel/gallery/back_end/tags', 'index') %> - <%= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {title: "orbit_gallery"}))), :class => active_for_app_auth('orbit_gallery') if (is_admin? rescue nil) %> + <%= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {title: "Gallery"}))), :class => active_for_app_auth('gallery') if (is_admin? rescue nil) %> <% end -%> <% end %> <%#= content_tag :li, :class => active_for_controllers('assets', '/admin/asset_tags', 'asset_categories') do -%> 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 1c6e0950..bc1221db 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 @@ -14,43 +14,43 @@ var galleryAPI = function(){ $(document).ready(function(){ bindHandlers(); var passid = null; - if(typeof g.urlVars['cat']!= "undefined"){ - g.loadArea = "albums"; - passid = g.urlVars['cat']; - g.loadAlbums(g.urlVars['cat']); - }else if(typeof g.urlVars['album']!= "undefined"){ - g.loadArea = "images"; - passid = g.urlVars['album']; - g.loadImages(g.urlVars['album']); - }else if(typeof g.urlVars['theater']!= "undefined"){ - g.loadArea = "theater"; - passid = g.urlVars['theater']; - g.loadTheater(g.urlVars['theater']); - }else if(typeof g.urlVars['edit']!= "undefined"){ - g.loadArea = "edit"; - passid = g.urlVars['edit']; - g.editAlbum(g.urlVars['edit']); - }else if(typeof g.urlVars['tag']!= "undefined"){ - g.loadArea = "albums"; - passid = g.urlVars['tag']; - g.loadAlbums(g.urlVars['tag']); - }else if(g.urlVars["locale"]){ - g.loadArea = "albums"; - g.loadAlbums("all"); - }else if(g.urlVars.length == 0) { - g.loadArea = "albums"; - g.loadAlbums("all"); - } - if(typeof callbackFn == "function"){ - callbackFn.call(this,g.loadArea,passid); - } + // if(typeof g.urlVars['cat']!= "undefined"){ + // g.loadArea = "albums"; + // passid = g.urlVars['cat']; + // g.loadAlbums(g.urlVars['cat']); + // }else if(typeof g.urlVars['album']!= "undefined"){ + // g.loadArea = "images"; + // passid = g.urlVars['album']; + // g.loadImages(g.urlVars['album']); + // }else if(typeof g.urlVars['theater']!= "undefined"){ + // g.loadArea = "theater"; + // passid = g.urlVars['theater']; + // g.loadTheater(g.urlVars['theater']); + // }else if(typeof g.urlVars['edit']!= "undefined"){ + // g.loadArea = "edit"; + // passid = g.urlVars['edit']; + // g.editAlbum(g.urlVars['edit']); + // }else if(typeof g.urlVars['tag']!= "undefined"){ + // g.loadArea = "albums"; + // passid = g.urlVars['tag']; + // g.loadAlbums(g.urlVars['tag']); + // }else if(g.urlVars["locale"]){ + // g.loadArea = "albums"; + // g.loadAlbums("all"); + // }else if(g.urlVars.length == 0) { + // g.loadArea = "albums"; + // g.loadAlbums("all"); + // } + // if(typeof callbackFn == "function"){ + // callbackFn.call(this,g.loadArea,passid); + // } }) var bindHandlers = function(){ $("#filter .filter_btns a").click(function(){ if(!$(this).hasClass("active")){ $(this).addClass("active"); if(g.urlVars.length == 0) - window.location = "orbit_gallery?" + $(this).attr("href"); + window.location = "albums?" + $(this).attr("href"); else window.location = window.location.href +"&"+ $(this).attr("href"); }else{ @@ -85,7 +85,7 @@ var galleryAPI = function(){ }) } this.makeNewAlbum = function(){ - $.get("add_album",function(html){ + $.get("albums/new",function(html){ rcom.modalWindow({loadHtml:html,width:400,height:320,"closeBtn":false},function(dom){ dom.find("#album_name_save_btn").click(function(){ var options ={ @@ -100,7 +100,7 @@ var galleryAPI = function(){ } } if(options.cid){ - $.post("create_album",options,function(response){ + $.post("albums/create",options,function(response){ if(g.loadArea == "albums") g.loadAlbums("all"); rcom.modalWindowClose(); @@ -116,24 +116,20 @@ var galleryAPI = function(){ } this.deleteAlbum = function(id){ if(confirm("<%= I18n.t('gallery.del_album?') %>")){ - $.post("delete_album",{aid:id},function(){ - window.location = "orbit_gallery"; + $.ajax({ + type: "DELETE", + url : "albums/"+id, + success : function(){ + window.location = "albums"; + } }) } } this.loadAlbums = function(id){ - g.loadFooterPanel(g.loadArea,id,function(headbtn){ - headbtn = $(headbtn); - headbtn.click(function(){g.makeNewAlbum();}) - g.albumArea.find(".rghead .rgfn").html(headbtn); - }) - + g.albumArea.find(".rghead .rgfn a").click(function(){g.makeNewAlbum()}); g.albumArea.addClass('o_gallery'); g.albumArea.find("#imgholder").empty(); - // var $addsign = $('
Add Album
'); - // $addsign.find("a").click(function(){g.makeNewAlbum();}) - if(id!="all"){ var cids = []; var tids = []; @@ -159,9 +155,10 @@ var galleryAPI = function(){ $.each(categories,function(x,category){ $.each(category,function(i,album){ if(album.cover == "default") - var $img = $("
"+album.name+""+album.category_name+"
"); + var $img = $("
"+album.name+""+album.category_name+"
"); else - var $img = $("
"+album.name+""+album.category_name+"
"); + var $img = $("
"+album.name+""+album.category_name+"
"); + var tag_string = ""; for(tag in album.tag_names){ tag_string+= '' + album.tag_names[tag] + ''; @@ -175,53 +172,50 @@ var galleryAPI = function(){ } this.loadImages = function(id){ var panelopen = false; - g.loadFooterPanel(g.loadArea,id,function(headerPanel){ - headarea = $(headerPanel); - g.albumArea.find(".rghead .rgfn").html(headarea); - $('.bt-tag').click(function(){ - $(this).toggleClass("active"); - var $tag_panel = $('#tag_panel'), - tag_panel_position = 0; + $('.bt-tag').click(function(){ + $(this).toggleClass("active"); + var $tag_panel = $('#tag_panel'), + tag_panel_position = 0; - if( $tag_panel.css('right') == '0px' ){ - tag_panel_position = -200; - } - $tag_panel.animate({'right':tag_panel_position}, 300); + if( $tag_panel.css('right') == '0px' ){ + tag_panel_position = -200; + } + $tag_panel.animate({'right':tag_panel_position}, 300); - g.albumArea - .delay(200) - .animate({'margin-right':tag_panel_position+200},300); - return false; - }); - g.albumArea.find("#tag_search_box").keyup(function(e){ - sval = $(this).val(); - if(sval == "<%= I18n.t('gallery.search_tags') %>") - sval = ""; - sval = sval.replace(/(^\s*)|(\s*$)/g,''); - if(sval){ - var re1 = new RegExp("^[\u4E00-\uFA29]*$"); //Chinese character range - var re2 = new RegExp("^[\uE7C7-\uE7F3]*$"); - if ((re1.test(sval) && (re2.test(sval)))){ - $("#gallery_tag_list li span:not(:contains("+sval+"))").parent().slideUp(); - }else{ - $("#gallery_tag_list li span:not(:containsi("+sval+"))").parent().slideUp(); - } + g.albumArea + .delay(200) + .animate({'margin-right':tag_panel_position+200},300); + return false; + }); + g.albumArea.find("#tag_search_box").keyup(function(e){ + sval = $(this).val(); + if(sval == "<%= I18n.t('gallery.search_tags') %>") + sval = ""; + sval = sval.replace(/(^\s*)|(\s*$)/g,''); + if(sval){ + var re1 = new RegExp("^[\u4E00-\uFA29]*$"); //Chinese character range + var re2 = new RegExp("^[\uE7C7-\uE7F3]*$"); + if ((re1.test(sval) && (re2.test(sval)))){ + $("#gallery_tag_list li span:not(:contains("+sval+"))").parent().slideUp(); }else{ - $("#gallery_tag_list li").slideDown(); + $("#gallery_tag_list li span:not(:containsi("+sval+"))").parent().slideUp(); } - }) - g.albumArea.find("#tag_panel .bt-save").click(function(){ - g.saveTags(id,g.loadArea); - }) - g.albumArea.find(".rghead .rgfn .bt-add").click(function(){ - showUploadPanel(); - }) - g.albumArea.find(".rghead .rgfn .bt-del").click(function(){ - g.deleteAlbum(id); - }) + }else{ + $("#gallery_tag_list li").slideDown(); + } }) + g.albumArea.find("#tag_panel .bt-save").click(function(){ + g.saveTags(id,g.loadArea); + }) + g.albumArea.find(".rghead .rgfn .bt-add").click(function(){ + showUploadPanel(); + }) + g.albumArea.find(".rghead .rgfn .bt-del").click(function(){ + g.deleteAlbum(id); + }) + $("#upload_panel_holder").remove(); var uploadpanel = $('
Close Panel
'); - var frame = $(''); + var frame = $(''); uploadpanel.find(".bt-cls").click(function(){ uploadpanel.hide("slide"); frame.remove(); @@ -241,7 +235,7 @@ var galleryAPI = function(){ g.albumArea.find("#imgholder").empty(); $("#filter").remove(); g.albumArea.css("margin-top",""); - $.getJSON("get_images",{aid:id},function(album){ + $.getJSON(id+"/get_images",function(album){ $.each(album.images,function(i,image){ var thumb = image.file.thumb.url; var $img = $("
"); @@ -492,12 +486,9 @@ var galleryAPI = function(){ $("#filter").remove(); g.albumArea.css("margin-top",""); var albumid = $(theater).find("#main_pic").attr("data-content"); - g.loadFooterPanel(g.loadArea,id,function(head){ - head = $(head); - g.albumArea.find(".rghead .rgfn").html(head); - g.albumArea.find(".bt-back").attr("href","orbit_gallery?album="+albumid); - g.albumArea.find(".bt-edit").attr("href","orbit_gallery?edit="+albumid); - }) + g.albumArea.find(".bt-back").attr("href","album_images?album="+albumid); + g.albumArea.find(".bt-edit").attr("href","orbit_gallery?edit="+albumid); + g.albumArea.css("margin-bottom","0"); picHeight = $(window).height() - ($("#orbit-bar").outerHeight() + $("#orbit_gallery .form-actions").outerHeight()); preparestage(albumid); @@ -512,9 +503,11 @@ var galleryAPI = function(){ }) $(".description_loader .edit_fn .bt-cover").click(function(){ - $(".bt-cover").removeClass("setcover"); - $(this).addClass("setcover"); - $.post("set_cover",{"imageid":$(this).attr("href"),"aid":id},function(){}) + $(".bt-cover").removeClass("setcover active btn-primary"); + $(".bt-cover span").removeClass("icon-white icon-star").addClass("icon-star-empty") + $(".bt-cover[for="+$(this).attr("for")+"]").addClass("setcover active btn-primary"); + $(".bt-cover[for="+$(this).attr("for")+"]").find("span").removeClass("icon-star-empty").addClass("icon-white icon-star"); + $.post("set_cover",{"imageid":$(this).attr("for")},function(){}) }) $(".description_loader .edit_fn .bt-dels").click(function(){ $(this) @@ -544,15 +537,21 @@ var galleryAPI = function(){ }) $('.bt-tag').click(function(){ $(this).toggleClass("active"); + var count = 0; + $('.bt-tag').each(function(){ + if($(this).hasClass("active")) + count++; + }) var $tag_panel = $('#tag_panel'), tag_panel_position = 0; - if( $tag_panel.css('right') == '0px' ){ - tag_panel_position = -200; + if(count == 1) + tag_panel_position = 0 + else if(count == 0){ + if( $tag_panel.css('right') == '0px' ){ + tag_panel_position = -200; + } } - if(last_clicked == $(this)) - alert("same") - else - alert("no") + $tag_panel.animate({'right':tag_panel_position}, 300); g.albumArea @@ -589,44 +588,45 @@ var galleryAPI = function(){ g.albumArea.find(".rghead .rgfn .bt-save").show(); }) g.albumArea.find(".rghead .rgfn .bt-delete").click(function(){ + var deleteurl = $(this).attr("href"); var images_to_delete = new Array(); var delete_cover = false; var doms_to_delete = new Array(); - var thiscover = $(".description_loader .edit_fn .setcover").attr("href"); + var thiscover = $(".description_loader .edit_fn .setcover").attr("for"); $(".description_loader .edit_fn .bt-dels").each(function(){ if($(this).hasClass("setdelete")){ images_to_delete.push($(this).attr("href")); - doms_to_delete.push($(this).parent().parent()); + $(".tab_content .rgphoto_edit[data-content="+$(this).attr("href")+"]").each(function(){ + doms_to_delete.push($(this)); + }) if(thiscover == $(this).attr("href")) delete_cover = true; } }) if(confirm("Deleting "+images_to_delete.length+" image(s)?")){ - $.post("delete_images",{"images":images_to_delete,"delete_cover":delete_cover,"aid":id},function(response){ - if(response.success){ + $.ajax({ + data : {"images":images_to_delete,"delete_cover":delete_cover}, + type : "DELETE", + url : deleteurl+"/"+id, // have to ask chris about delete resource + success : function(){ for(dom in doms_to_delete){ doms_to_delete[dom].hide("slide",function(){$(this).remove();}) } + g.albumArea.find(".rghead .rgfn .bt-delete").hide(); } - g.albumArea.find(".rghead .rgfn .bt-delete").hide(); }) + // $.post("delete",{"images":images_to_delete,"delete_cover":delete_cover,"aid":id},function(response){ + // if(response.success){ + + // } + // }) } }) } $("#filter").remove(); g.albumArea.addClass('o_album_edit'); g.albumArea.css("margin-top",""); - var head ='"><%= I18n.t("gallery.back_to_photos") %>'; - head+=''; - head+=''; - g.albumArea.find(".rghead .rgfn").html(head); - g.albumArea.find("#imgholder").load("edit_album?aid="+id,function(data,response,xhr){ - if(xhr.status == 404){ - $(this).text("<%= I18n.t('gallery.album_not_found') %>"); - return false; - } - bindHandlers(); - }) + bindHandlers(); } this.saveTags = function(id,tagsfor){ var tagids = new Array(); diff --git a/vendor/built_in_modules/gallery/app/assets/javascripts/upload.js b/vendor/built_in_modules/gallery/app/assets/javascripts/upload.js index f915b75a..9ac09f2b 100755 --- a/vendor/built_in_modules/gallery/app/assets/javascripts/upload.js +++ b/vendor/built_in_modules/gallery/app/assets/javascripts/upload.js @@ -4,7 +4,7 @@ $(function () { 'use strict'; // Initialize the jQuery File Upload widget: - $('#fileupload').fileupload({"aid" : parent.g.urlVars['album']},{ + $('#fileupload').fileupload({ acceptFileTypes:/(\.|\/)(jpe?g|png)$/i, headers:{ 'X-CSRF-Token': $('meta[name="csrf-token"]').attr("content") diff --git a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/album_images_controller.rb b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/album_images_controller.rb new file mode 100644 index 00000000..e7086276 --- /dev/null +++ b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/album_images_controller.rb @@ -0,0 +1,71 @@ +class Panel::Gallery::BackEnd::AlbumImagesController < OrbitBackendController + include AdminHelper + + def theater + picid = params["pic"] + @image = GalleryImage.find(picid) + @albumid = @image.gallery_album_id + album = GalleryAlbum.find(@albumid) + @images = album.gallery_images.all + render :layout=>false + end + + def destroy + images = params['images'] + images.each do |image| + img = GalleryImage.find(image) + img.delete + end + if params['delete_cover'] == "true" + album = GalleryAlbum.find(params['id']) + album.update_attributes(:cover=>"default") + end + render :json =>{"success"=>true}.to_json + end + + def update_album + # data = params['data'] + # album_name = params['name'] + # aid = params['aid'] + # data.each do |d| + # image = GalleryImage.find(d[1][:id]) + # image.update_attributes(:description=>d[1][:text]) + # end + # album = GalleryAlbum.find(aid) + # album.update_attributes(:name => album_name) + # 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! + @album = GalleryAlbum.find(params[:id]) + @album.update_attributes(params[:gallery_albums]) + + render :json =>{"success"=>true}.to_json + end + + def save_tags + case params[:tag] + when "album" + @object = GalleryAlbum.find(params[:id]) + when "pic" + @object = GalleryImage.find(params[:id]) + end + @object.update_attributes({:tag_ids => params[:tids]}) + render :json => {"success"=> "true"}.to_json + end + +end 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/albums_controller.rb similarity index 60% rename from vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/orbit_galleries_controller.rb rename to vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb index 2adc9bf5..d4f53d1c 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/albums_controller.rb @@ -1,4 +1,4 @@ -class Panel::Gallery::BackEnd::OrbitGalleriesController < OrbitBackendController +class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController include AdminHelper def index @@ -12,29 +12,17 @@ include AdminHelper @tags = GalleryTag.all end - def new_category - names = params['category'] - category = GalleryCategory.new - I18n.locale = :en - category.name = names['en'] - I18n.locale = :zh_tw - category.name = names['zh_tw'] - category.save! - render :json=>{"success"=>true,"id"=>category.id}.to_json - end - - def categorylist + def show + if is_manager? || is_admin? || is_sub_manager? + @authenticated = true #turn this value to false for view only + else + @authenticated = false + end @categorylist = GalleryCategory.all - #render :layout => false + @tags = GalleryTag.all end - def gallery_category_delete - @category = GalleryCategory.find(params['id']) - @category.delete - render :json=>{"success"=>"true"}.to_json - end - - def add_album + def new if is_manager? || is_admin? @categorylist = GalleryCategory.all elsif is_sub_manager? @@ -43,7 +31,7 @@ include AdminHelper render :layout => false end - def create_album + def create category = GalleryCategory.find(params['cid']) albumnames = params["albumname"] albumdescs = params["albumdesc"] @@ -107,26 +95,31 @@ include AdminHelper render :json=>@output.to_json end - def upload_image - albumid = params['aid']; - @album = GalleryAlbum.find(albumid) - @files = params['files'] - a = Array.new - @files.each do |file| - @image = @album.gallery_images.new - @image.file = file - @image.save! - a << {"thumbnail_url"=>@image.file.thumb.url} - end - render :json=>a.to_json + def destroy + album = GalleryAlbum.find(params[:id]) + album.delete + render :json =>{"success"=>true}.to_json end - def upload_panel - render :layout => false + def edit + if is_manager? || is_admin? || is_sub_manager? + @album = GalleryAlbum.find(params[:id]) + @images = @album.gallery_images.all + @album_name = @album.name_translations + @cover = @album.cover + @tags = GalleryTag.all + end + end + + def set_cover + album = GalleryAlbum.find(params[:album_id]) + image = GalleryImage.find(params[:imageid]) + album.update_attributes({:cover_path => image.file.thumb.url, :cover=>params[:imageid]}) + render :json =>{"success"=>true}.to_json end def get_images - @album = GalleryAlbum.find(params["aid"]) + @album = GalleryAlbum.find(params[:album_id]) @tag_names = Array.new @images = @album.gallery_images.all @output = Array.new @@ -151,96 +144,21 @@ include AdminHelper render :json=>{"images" => @output, "tags" => @album.tag_ids, "tag_names" => @tag_names}.to_json end end - - def theater - picid = params["pic"] - @image = GalleryImage.find(picid) - @albumid = @image.gallery_album_id - album = GalleryAlbum.find(@albumid) - @images = album.gallery_images.all - render :layout=>false + def upload_panel + @album = GalleryAlbum.find(params[:album_id]) + render :layout => false end - - def delete_album - aid = params['aid'] - album = GalleryAlbum.find(aid) - album.delete - render :json =>{"success"=>true}.to_json - end - - def edit_album - if is_manager? || is_admin? || is_sub_manager? - aid = params['aid'] - album = GalleryAlbum.find(aid) - @images = album.gallery_images.all - @album_name = album.name_translations - @cover = album.cover - render :layout => false + def upload_image + @album = GalleryAlbum.find(params[:album_id]) + @files = params['files'] + a = Array.new + @files.each do |file| + @image = @album.gallery_images.new + @image.file = file + @image.save! + a << {"thumbnail_url"=>@image.file.thumb.url} end - end - - def set_cover - aid = params['aid'] - album = GalleryAlbum.find(aid) - image = GalleryImage.find(params[:imageid]) - album.update_attributes({:cover_path => image.file.thumb.url, :cover=>params[:imageid]}) - render :json =>{"success"=>true}.to_json - end - - def delete_images - images = params['images'] - images.each do |image| - img = GalleryImage.find(image) - img.delete - end - if params['delete_cover'] == "true" - album = GalleryAlbum.find(params['aid']) - album.update_attributes(:cover=>"default") - end - render :json =>{"success"=>true}.to_json - end - - def update_album - # data = params['data'] - # album_name = params['name'] - # aid = params['aid'] - # data.each do |d| - # image = GalleryImage.find(d[1][:id]) - # image.update_attributes(:description=>d[1][:text]) - # end - # album = GalleryAlbum.find(aid) - # album.update_attributes(:name => album_name) - 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 - - def save_tags - case params[:tag] - when "album" - @object = GalleryAlbum.find(params[:id]) - when "pic" - @object = GalleryImage.find(params[:id]) - end - @object.update_attributes({:tag_ids => params[:tids]}) - render :json => {"success"=> "true"}.to_json + render :json=>a.to_json end end diff --git a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/gallery_categories_controller.rb b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/gallery_categories_controller.rb new file mode 100644 index 00000000..06432b1b --- /dev/null +++ b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/gallery_categories_controller.rb @@ -0,0 +1,25 @@ +class Panel::Gallery::BackEnd::GalleryCategoriesController < OrbitBackendController + + def index + @categorylist = GalleryCategory.all + #render :layout => false + end + + def new + names = params['category'] + category = GalleryCategory.new + I18n.locale = :en + category.name = names['en'] + I18n.locale = :zh_tw + category.name = names['zh_tw'] + category.save! + render :json=>{"success"=>true,"id"=>category.id}.to_json + end + + def delete + @category = GalleryCategory.find(params['id']) + @category.delete + render :json=>{"success"=>"true"}.to_json + end + +end \ No newline at end of file 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/album_images/edit.html.erb similarity index 80% rename from vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/orbit_galleries/edit_album.html.erb rename to vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/album_images/edit.html.erb index 3cef3544..a1a06364 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/album_images/edit.html.erb @@ -8,7 +8,8 @@
  • ><%= I18nVariable.from_locale(locale) %>
  • <% end %> -
    + +<%= form_for @album, :url => panel_gallery_back_end_orbit_gallery_path(@album), :html => {:class => 'clear'} do |f| %>
    <% @site_valid_locales.each_with_index do |locale, i| %> <% if i == 0 %> @@ -27,7 +28,12 @@
    - + + <%= f.fields_for :gallery_images do |j| %> + <%= j.fields_for :description_translations do |desc| %> + <%= desc.text_area locale, :value => (image.description_translations[locale]) %> + <% end %> + <% end %>
    <% if image.id.to_s == @cover %> @@ -44,7 +50,11 @@
    <% end %> - + +<% end %> + +
    +
    +
    +
    +
    +
    +
    +
    + <% + @locales = Array.new + @site_valid_locales.each do |locale| + @locales << locale + end + %> +
    +
    + +
    +
    + <% if @authenticated %> + + <% end %> + +
    + + + + +
    + +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "galleryAPI" %> +<% end %> + + + + + + + diff --git a/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/album_images/show.html.erb b/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/album_images/show.html.erb new file mode 100644 index 00000000..26c844e2 --- /dev/null +++ b/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/album_images/show.html.erb @@ -0,0 +1,94 @@ + +<%= stylesheet_link_tag "gallery" %> + + + +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "galleryAPI" %> +<% end %> + + + + + + + diff --git a/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/orbit_galleries/theater.html.erb b/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/album_images/theater.html.erb similarity index 100% rename from vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/orbit_galleries/theater.html.erb rename to vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/album_images/theater.html.erb diff --git a/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/album_images/upload_panel.html.erb b/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/album_images/upload_panel.html.erb new file mode 100755 index 00000000..be4552b6 --- /dev/null +++ b/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/album_images/upload_panel.html.erb @@ -0,0 +1,111 @@ + + +<%= csrf_meta_tag %> +<%= javascript_include_tag "jquery-latest" %> +<%= stylesheet_link_tag "jquery-ui" %> +<%= stylesheet_link_tag "jquery.fileupload-ui.css" %> + + + +
    +
    +<%= form_for @album, :url => panel_gallery_back_end_album_path(@album), :html => {:class => 'clear'} do |f| %> + + +
    + + + + + +
    + + <% end %> +
    +
    +
    +
    +
    + + + +
    + + <%= javascript_include_tag "jquery-ui.min" %> + <%= javascript_include_tag "jquery.tmpl.min" %> + <%= javascript_include_tag "jquery.iframe-transport" %> + <%= javascript_include_tag "jquery.fileupload" %> + <%= javascript_include_tag "jquery.fileupload-ui" %> + <%= javascript_include_tag "upload" %> + + + + + 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 new file mode 100644 index 00000000..621606aa --- /dev/null +++ b/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/albums/edit.html.erb @@ -0,0 +1,126 @@ +<%= stylesheet_link_tag "gallery" %> +
    - +