From 44f5a98a694b6af30e7bbc33e5cc3153906d014d Mon Sep 17 00:00:00 2001 From: saurabhbhatia Date: Thu, 3 Oct 2013 17:30:05 +0800 Subject: [PATCH] Updated Location and loction categories to pass ids --- .../location/back_end/location_categories_controller.rb | 3 ++- .../panel/location/back_end/locations_controller.rb | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/vendor/built_in_modules/location/app/controllers/panel/location/back_end/location_categories_controller.rb b/vendor/built_in_modules/location/app/controllers/panel/location/back_end/location_categories_controller.rb index 950ebbe25..aac07d222 100644 --- a/vendor/built_in_modules/location/app/controllers/panel/location/back_end/location_categories_controller.rb +++ b/vendor/built_in_modules/location/app/controllers/panel/location/back_end/location_categories_controller.rb @@ -42,7 +42,8 @@ class Panel::Location::BackEnd::LocationCategoriesController < OrbitBackendContr 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" } + category_id = category.id.to_s + @data << { name_en: name_en, name_zh_tw: name_zh_tw, category_id: category_id, location_link: "http://ntue.tp.rulingcom.com/panel/location/back_end/locations/get_categorywise_locations?category_id[]=#{category_id}"} end render :json => JSON.pretty_generate({location_category: @data}) diff --git a/vendor/built_in_modules/location/app/controllers/panel/location/back_end/locations_controller.rb b/vendor/built_in_modules/location/app/controllers/panel/location/back_end/locations_controller.rb index d744ea721..8adaba7c3 100644 --- a/vendor/built_in_modules/location/app/controllers/panel/location/back_end/locations_controller.rb +++ b/vendor/built_in_modules/location/app/controllers/panel/location/back_end/locations_controller.rb @@ -75,12 +75,15 @@ class Panel::Location::BackEnd::LocationsController < OrbitBackendController end def get_categorywise_locations - location_infos = LocationInfo.where(:location_category_id => params[:category_id]) - @data = Array.new + @category_id = params[:category_id].first + location_infos = LocationInfo.where(:location_category_id => @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,