added get_categorywise_locations
This commit is contained in:
parent
ec6ef5a871
commit
746bcbed96
|
@ -38,7 +38,11 @@ class Panel::Location::BackEnd::LocationCategoriesController < OrbitBackendContr
|
|||
@data = Array.new
|
||||
|
||||
location_categories.each do |category|
|
||||
@data << { name: category.name }
|
||||
I18n.locale = :en
|
||||
name_en = category.name
|
||||
I18n.locale = :zh_tw
|
||||
name_zh_tw = category.name
|
||||
@data << { name_en: name_en, name_zh_tw: name_zh_tw, category_id: category.id.to_s, location_link: "http://ntue.tp.rulingcom.com/panel/location/back_end/locations/get_categorywise_locations" }
|
||||
end
|
||||
|
||||
render :json => JSON.pretty_generate({location_category: @data})
|
||||
|
|
|
@ -71,6 +71,24 @@ class Panel::Location::BackEnd::LocationsController < OrbitBackendController
|
|||
description: location.description }
|
||||
end
|
||||
|
||||
render :json => JSON.pretty_generate({location: @data})
|
||||
end
|
||||
|
||||
def get_categorywise_locations
|
||||
location_infos = LocationInfo.where(:location_category_id => params[:category_id])
|
||||
@data = Array.new
|
||||
|
||||
location_infos.each do |location|
|
||||
picurl = location.file.blank? ? '' : "http://#{request.host_with_port + location.file.url}"
|
||||
thumburl = location.file.blank? ? '' : "http://#{request.host_with_port + location.file.thumb.url}"
|
||||
@data << { name: location.name,
|
||||
pic_url: picurl,
|
||||
thumb_url: thumburl,
|
||||
longitude: location.longitude,
|
||||
latitude: location.latitude,
|
||||
description: location.description }
|
||||
end
|
||||
|
||||
render :json => JSON.pretty_generate({location: @data})
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ Rails.application.routes.draw do
|
|||
namespace :back_end do
|
||||
|
||||
match "locations/get_locations" => "locations#get_locations"
|
||||
match "locations/get_categorywise_locations" => "locations#get_categorywise_locations"
|
||||
|
||||
resources :locations
|
||||
resources :location_categories, :except => [:show]
|
||||
|
|
Loading…
Reference in New Issue