make gallery json format to two layer
This commit is contained in:
parent
81f67fc08a
commit
47075944e7
|
@ -1,7 +1,7 @@
|
||||||
class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
|
class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
|
||||||
include AdminHelper
|
include AdminHelper
|
||||||
|
|
||||||
before_filter :force_order_for_user, :except => [:index,:get_album_json,:get_img_json]
|
before_filter :force_order_for_user, :except => [:index,:get_album_json,:get_imgs_json]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
if is_manager? || is_admin? || is_sub_manager?
|
if is_manager? || is_admin? || is_sub_manager?
|
||||||
|
@ -128,14 +128,14 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
|
||||||
album_cover_file: "http://#{request.host_with_port}#{album.cover_path}",
|
album_cover_file: "http://#{request.host_with_port}#{album.cover_path}",
|
||||||
album_name: album.name,
|
album_name: album.name,
|
||||||
album_tag_names: tag_names,
|
album_tag_names: tag_names,
|
||||||
album_link:"http://#{request.host_with_port}"
|
album_link:"http://#{request.host_with_port}#{panel_gallery_back_end_album_get_imgs_json_path(album)}"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
render :json=>JSON.pretty_generate(output)
|
render :json=>JSON.pretty_generate(output)
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_img_json
|
def get_imgs_json
|
||||||
album = GalleryAlbum.find(params[:album_id])
|
album = GalleryAlbum.find(params[:album_id])
|
||||||
images = album.gallery_images.all
|
images = album.gallery_images.all
|
||||||
output = Array.new
|
output = Array.new
|
||||||
|
@ -147,7 +147,7 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
|
||||||
tags << GalleryTag.find(tag)[I18n.locale]
|
tags << GalleryTag.find(tag)[I18n.locale]
|
||||||
end
|
end
|
||||||
|
|
||||||
all_image << {
|
output << {
|
||||||
image_title: image.title,
|
image_title: image.title,
|
||||||
image_description: image.description,
|
image_description: image.description,
|
||||||
image_file: { url: "http://#{request.host_with_port}#{image.file.url}",
|
image_file: { url: "http://#{request.host_with_port}#{image.file.url}",
|
||||||
|
|
|
@ -2,61 +2,62 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
namespace :panel do
|
namespace :panel do
|
||||||
namespace :gallery do
|
namespace :gallery do
|
||||||
namespace :back_end do
|
namespace :back_end do
|
||||||
match "get_albums" => "albums#get_albums"
|
match "get_albums" => "albums#get_albums"
|
||||||
match "upload_image" => "albums#upload_image"
|
match "upload_image" => "albums#upload_image"
|
||||||
match "save_tags" => "tags#save_tags"
|
match "save_tags" => "tags#save_tags"
|
||||||
match "albums/save_tags" => "tags#save_tags"
|
match "albums/save_tags" => "tags#save_tags"
|
||||||
resources :albums do
|
resources :albums do
|
||||||
match "set_cover" => "albums#set_cover"
|
match "set_cover" => "albums#set_cover"
|
||||||
match "imgs" => "albums#imgs"
|
match "imgs" => "albums#imgs"
|
||||||
match "upload_panel" => "albums#upload_panel"
|
match "upload_panel" => "albums#upload_panel"
|
||||||
match "images_tags" => "albums#images_tags"
|
match "images_tags" => "albums#images_tags"
|
||||||
match "get_img_json/:album_id" => "album_images#get_img_json"
|
match "get_imgs_json" => "albums#get_imgs_json"
|
||||||
|
|
||||||
collection do
|
collection do
|
||||||
get "get_album_json"
|
get "get_album_json"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
match "album_images/#!/:id" => "album_images#show"
|
match "album_images/#!/:id" => "album_images#show"
|
||||||
|
|
||||||
resources :album_images
|
resources :album_images
|
||||||
resources :gallery_categories
|
resources :gallery_categories
|
||||||
resources :tags
|
resources :tags
|
||||||
end
|
end
|
||||||
|
|
||||||
namespace :front_end do
|
namespace :front_end do
|
||||||
match "orbit_galleries" => "orbit_galleries#index"
|
match "orbit_galleries" => "orbit_galleries#index"
|
||||||
match "get_albums" => "albums#get_albums"
|
match "get_albums" => "albums#get_albums"
|
||||||
# match "orbit_galleries" => "orbit_galleries#index"
|
# match "orbit_galleries" => "orbit_galleries#index"
|
||||||
# match "gallery_category_save" => "orbit_galleries#new_category"
|
# match "gallery_category_save" => "orbit_galleries#new_category"
|
||||||
# match "categorylist" => "orbit_galleries#categorylist"
|
# match "categorylist" => "orbit_galleries#categorylist"
|
||||||
# match "gallery_category_delete" => "orbit_galleries#gallery_category_delete"
|
# match "gallery_category_delete" => "orbit_galleries#gallery_category_delete"
|
||||||
# match "add_album" => "orbit_galleries#add_album"
|
# match "add_album" => "orbit_galleries#add_album"
|
||||||
# match "create_album" => "orbit_galleries#create_album"
|
# match "create_album" => "orbit_galleries#create_album"
|
||||||
# match "get_albums" => "orbit_galleries#get_albums"
|
# match "get_albums" => "orbit_galleries#get_albums"
|
||||||
# match "upload_image" => "orbit_galleries#upload_image"
|
# match "upload_image" => "orbit_galleries#upload_image"
|
||||||
# match "upload_panel" => "orbit_galleries#upload_panel"
|
# match "upload_panel" => "orbit_galleries#upload_panel"
|
||||||
# match "get_images" => "orbit_galleries#get_images"
|
# match "get_images" => "orbit_galleries#get_images"
|
||||||
# match "theater" => "orbit_galleries#theater"
|
# match "theater" => "orbit_galleries#theater"
|
||||||
# match "delete_album" => "orbit_galleries#delete_album"
|
# match "delete_album" => "orbit_galleries#delete_album"
|
||||||
# match "edit_album" => "orbit_galleries#edit_album"
|
# match "edit_album" => "orbit_galleries#edit_album"
|
||||||
# match "set_cover" => "orbit_galleries#set_cover"
|
# match "set_cover" => "orbit_galleries#set_cover"
|
||||||
# match "delete_images" => "orbit_galleries#delete_images"
|
# match "delete_images" => "orbit_galleries#delete_images"
|
||||||
# match "update_album" => "orbit_galleries#update_album"
|
# match "update_album" => "orbit_galleries#update_album"
|
||||||
# match "save_tags" => "orbit_galleries#save_tags"
|
# match "save_tags" => "orbit_galleries#save_tags"
|
||||||
resources :albums do
|
resources :albums do
|
||||||
member do
|
member do
|
||||||
get "imgs"
|
get "imgs"
|
||||||
get "theater"
|
get "theater"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
resources :album_images
|
resources :album_images
|
||||||
end
|
end
|
||||||
namespace :widget do
|
|
||||||
match "widget1" => "albums#widget1"
|
namespace :widget do
|
||||||
end
|
match "widget1" => "albums#widget1"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue