NTUE localtion categories as json for Android App

This commit is contained in:
saurabhbhatia 2013-10-03 15:06:59 +08:00
parent 8aa1e2dae0
commit ec6ef5a871
3 changed files with 17 additions and 1 deletions

View File

@ -5,6 +5,9 @@ class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController
def show def show
@album = GalleryAlbum.find(params[:id]) @album = GalleryAlbum.find(params[:id])
@tags = Tag.find(@album.tagged_ids).map{|t| t.name} @tags = Tag.find(@album.tagged_ids).map{|t| t.name}
respond_to do |format|
format.json { render json: @album }
end
end end
def get_albums def get_albums

View File

@ -33,4 +33,15 @@ class Panel::Location::BackEnd::LocationCategoriesController < OrbitBackendContr
render :json=>{"success"=>"true"}.to_json render :json=>{"success"=>"true"}.to_json
end end
def get_location_categories
location_categories = LocationCategory.all
@data = Array.new
location_categories.each do |category|
@data << { name: category.name }
end
render :json => JSON.pretty_generate({location_category: @data})
end
end end

View File

@ -6,7 +6,9 @@ Rails.application.routes.draw do
match "locations/get_locations" => "locations#get_locations" match "locations/get_locations" => "locations#get_locations"
resources :locations resources :locations
resources :location_categories resources :location_categories, :except => [:show]
match "location_categories/get_location_categories" => "location_categories#get_location_categories"
end end
end end
end end