frontend update
This commit is contained in:
1 parent
202d736a5d
commit
4a12c9d6fb
17 files changed
+854
-372
No files matched your search
Vendored
-11
@@ -33,19 +33,8 @@ include AdminHelper
|
||||
end
|
||||
|
||||
def create
|
||||
# category = GalleryCategory.find(params['cid'])
|
||||
# albumnames = params["albumname"]
|
||||
# albumdescs = params["albumdesc"]
|
||||
# album = category.gallery_albums.new
|
||||
# I18n.locale = :en
|
||||
# album.name = albumnames["en"]
|
||||
# album.description = albumdescs["en"]
|
||||
# I18n.locale = :zh_tw
|
||||
# album.name = albumnames["zh_tw"]
|
||||
# album.description = albumdescs["zh_tw"]
|
||||
album = GalleryAlbum.new(params[:gallery_album])
|
||||
album.save!
|
||||
# render :json=>{"success"=>true,"id"=>album.id}.to_json
|
||||
respond_to do |h|
|
||||
h.js
|
||||
end
|
||||
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
class Panel::Gallery::FrontEnd::AlbumImagesController < OrbitWidgetController
|
||||
|
||||
def show
|
||||
@tags = GalleryTag.all
|
||||
@image = GalleryImage.find(params[:album_id])
|
||||
@albumid = @image.gallery_album_id
|
||||
@album = GalleryAlbum.find(@albumid)
|
||||
@images = @album.gallery_images.all
|
||||
end
|
||||
|
||||
end
|
||||
Vendored
+114
@@ -0,0 +1,114 @@
|
||||
class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController
|
||||
|
||||
def index
|
||||
|
||||
end
|
||||
|
||||
def show
|
||||
@album = GalleryAlbum.find(params[:id])
|
||||
@tags = Array.new
|
||||
@album.tag_ids.each do |tag|
|
||||
@tags << GalleryTag.find(tag)[I18n.locale]
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
if is_manager? || is_admin?
|
||||
@categorylist = GalleryCategory.all
|
||||
elsif is_sub_manager?
|
||||
@categorylist = GalleryCategory.authed_for_user(current_user,"new_album")
|
||||
end
|
||||
@album = GalleryAlbum.new
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
def create
|
||||
album = GalleryAlbum.new(params[:gallery_album])
|
||||
album.save!
|
||||
respond_to do |h|
|
||||
h.js
|
||||
end
|
||||
end
|
||||
|
||||
def get_albums
|
||||
@categoryids = params["cid"]
|
||||
@tags = params["tid"]
|
||||
@albums = Array.new
|
||||
if @categoryids == "all"
|
||||
if @tags
|
||||
if @tags.kind_of?(Array)
|
||||
@tags.each do |tag|
|
||||
@albums << GalleryAlbum.where(tag_ids: tag)
|
||||
end
|
||||
else
|
||||
@albums << GalleryAlbum.where(tag_ids: @tags)
|
||||
end
|
||||
else
|
||||
@albums << GalleryAlbum.all
|
||||
end
|
||||
else
|
||||
@categoryids.each do |id|
|
||||
category = GalleryCategory.find(id)
|
||||
if @tags
|
||||
if @tags.kind_of?(Array)
|
||||
@tags.each do |tag|
|
||||
@albums << category.gallery_albums.where(tag_ids: tag)
|
||||
end
|
||||
else
|
||||
@albums << category.gallery_albums.where(tag_ids: @tags)
|
||||
end
|
||||
else
|
||||
@albums << category.gallery_albums.all
|
||||
end
|
||||
end
|
||||
end
|
||||
@output = Array.new
|
||||
@albums.each do |album|
|
||||
@albs = Array.new
|
||||
album.each do |values|
|
||||
tags = Array.new
|
||||
values.tag_ids.each do |tag|
|
||||
tags << GalleryTag.find(tag)[I18n.locale]
|
||||
end
|
||||
category = GalleryCategory.find(values.gallery_category_id).name
|
||||
@albs << {"_id"=>values.id,"show_path"=>panel_gallery_front_end_album_path(values),"cover"=>values.cover,"cover_path"=>values.cover_path,"description"=>values.description,"category_name"=>category,"gallery_category_id" => values.gallery_category_id,"name"=>values.name,"tag_ids"=>values.tag_ids,"tag_names"=>tags}
|
||||
end
|
||||
@output << @albs
|
||||
end
|
||||
render :json=>@output.to_json
|
||||
end
|
||||
|
||||
|
||||
|
||||
def imgs
|
||||
@album = GalleryAlbum.find(params[:album_id])
|
||||
@images = @album.gallery_images.all
|
||||
@output = Array.new
|
||||
@images.each do |values|
|
||||
tags = Array.new
|
||||
values.tag_ids.each do |tag|
|
||||
tags << GalleryTag.find(tag)[I18n.locale]
|
||||
end
|
||||
@output << {"_id"=>values.id,"theater_link"=>panel_gallery_front_end_album_path(values)+"/theater","description"=>values.description,"title"=>values.title,"file"=>values.file,"gallery_album_id"=>values.gallery_album_id,"tag_ids"=>values.tag_ids,"tag_names"=>tags}
|
||||
end
|
||||
render :json=>{"images" => @output}.to_json
|
||||
end
|
||||
|
||||
def images_tags
|
||||
album = GalleryAlbum.find(params[:album_id])
|
||||
tags = Array.new
|
||||
images = album.gallery_images.all
|
||||
images.each do |image|
|
||||
tags << {"id"=>image.id, "tags" => image.tag_ids}
|
||||
end
|
||||
render :json=>tags.to_json
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user