few updates with fb integration and some other changes in user and supports data to android

This commit is contained in:
harrybomrah authored and Matt K. Fu committed 2013-06-18 15:59:11 +08:00
1 parent c4db6e5830
commit 0354bf5b15
14 files changed
+267 -285

No files matched your search

@@ -16,7 +16,7 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
end
@categorylist = GalleryCategory.all
@cid = params['cat']
@tags = get_tags
@tags = GalleryTag.all
end
def show
@@ -26,7 +26,7 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
@authenticated = false
end
@album = GalleryAlbum.find(params[:id])
@tags = get_tags
@tags = GalleryTag.all
end
def new
@@ -55,10 +55,10 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
if @tags
if @tags.kind_of?(Array)
@tags.each do |tag|
@albums << GalleryAlbum.where(tagged_ids: tag)
@albums << GalleryAlbum.where(tag_ids: tag)
end
else
@albums << GalleryAlbum.where(tagged_ids: @tags)
@albums << GalleryAlbum.where(tag_ids: @tags)
end
else
@albums << GalleryAlbum.all
@@ -69,10 +69,10 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
if @tags
if @tags.kind_of?(Array)
@tags.each do |tag|
@albums << category.gallery_albums.where(tagged_ids: tag)
@albums << category.gallery_albums.where(tag_ids: tag)
end
else
@albums << category.gallery_albums.where(tagged_ids: @tags)
@albums << category.gallery_albums.where(tag_ids: @tags)
end
else
@albums << category.gallery_albums.all
@@ -83,7 +83,10 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
@albums.each do |album|
@albs = Array.new
album.each do |values|
tags = Tag.find(values.tagged_ids).map{|t| t.name}
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_back_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
@@ -92,6 +95,8 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
render :json=>@output.to_json
end
def destroy
album = GalleryAlbum.find(params[:id])
album.delete
@@ -104,7 +109,7 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
@images = @album.gallery_images.all
@album_name = @album.name_translations
@cover = @album.cover
@tags = get_tags
@tags = GalleryTag.all
end
end
@@ -120,13 +125,21 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
output = Array.new
albums.each do |album|
tag_names = Tag.find(album.tagged_ids).map{|t| t.name}
tag_names = Array.new
album.tag_ids.each do |tag|
tag_names << GalleryTag.find(tag)[I18n.locale]
end
if album.cover_path
cover_path = album.cover_path
else
cover_path = "/assets/gallery/default.jpg"
end
output << {
album_cover_file: "http://#{request.host_with_port}#{album.cover_path}",
album_cover_file: "http://#{request.host_with_port}"+cover_path,
album_name: album.name,
album_tag_names: tag_names,
album_link:"http://#{request.host_with_port}#{panel_gallery_back_end_album_get_imgs_json_path(album)}"
album_link:"http://#{request.host_with_port}#{panel_gallery_back_end_album_get_imgs_json_path(album)}",
}
end
@@ -139,7 +152,11 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
output = Array.new
images.each do |image|
tags = Tag.find(image.tagged_ids).map{|t| t.name}
tags = Array.new
image.tag_ids.each do |tag|
tags << GalleryTag.find(tag)[I18n.locale]
end
output << {
image_title: image.title,
@@ -158,7 +175,10 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
@images = @album.gallery_images.all
@output = Array.new
@images.each do |values|
tags = Tag.find(values.tagged_ids).map{|t| t.name}
tags = Array.new
values.tag_ids.each do |tag|
tags << GalleryTag.find(tag)[I18n.locale]
end
@output << { _id: values.id,
theater_link: panel_gallery_back_end_album_image_path(values),
description: values.description,
@@ -176,8 +196,8 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
if @authenticated
render :json=>{"images" => @output, "tags" => @album.tag_ids}.to_json
else
@album.tagged_ids.each do |tag|
@tag_names << Tag.find(tag).name
@album.tag_ids.each do |tag|
@tag_names << GalleryTag.find(tag)[I18n.locale]
end
render :json=>{"images" => @output, "tags" => @album.tag_ids, "tag_names" => @tag_names}.to_json
end
@@ -221,7 +241,7 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
if params['delete_cover'] == "true"
@album.update_attributes(:cover=>"default")
end
@tags = get_tags
@tags = GalleryTag.all
render :action => :show
end
end
+1
View File
@@ -4,6 +4,7 @@ Rails.application.routes.draw do
namespace :gallery do
namespace :back_end 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"
@@ -2,7 +2,7 @@ class Panel::Location::BackEnd::LocationsController < OrbitBackendController
include AdminHelper
before_filter :force_order_for_visitor,:only => [:index, :new, :edit, :create, :update, :delete]
before_filter :force_order_for_user,:except => [:get_locations,:index]
before_filter :force_order_for_user,:except => [:get_locations,:index,:get_categories]
def index
@location_infos = LocationInfo.all
@@ -72,6 +72,14 @@ class Panel::Location::BackEnd::LocationsController < OrbitBackendController
description: location.description }
end
render :json => JSON.pretty_generate({location: @data})
render :json => JSON.pretty_generate(@data)
end
def get_categories
@data = Array.new
@data << { name: "Department",
link: "http://#{request.host_with_port}"+"/panel/location/back_end/locations/get_locations?locale=en" }
render :json => JSON.pretty_generate(@data)
end
end
@@ -74,4 +74,11 @@ class Panel::Locations::BackEnd::LocationsController < OrbitBackendController
#render :json => {location: @data}.to_json
end
def get_categories
@data = Array.new
@data << { name: "Department",
link: "http://#{request.host_with_port}"+"/panel/location/back_end/location/get_locations" }
render :json => JSON.pretty_generate(@data)
end
end
+1
View File
@@ -4,6 +4,7 @@ Rails.application.routes.draw do
namespace :back_end do
match "locations/get_locations" => "locations#get_locations"
match "locations/get_categories" => "locations#get_categories"
resources :locations
end