gprs byebye, location have two language, must have picture, long, lang have limit
This commit is contained in:
1 parent
c888d9cae4
commit
f1b6771b34
81 files changed
+196
-167
No files matched your search
Whitespace-only changes.
Vendored
+77
@@ -0,0 +1,77 @@
|
||||
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]
|
||||
|
||||
def index
|
||||
@location_infos = LocationInfo.all
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @locations }
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
@location_info = LocationInfo.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @location }
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@location_info = LocationInfo.find(params[:id])
|
||||
end
|
||||
|
||||
def show
|
||||
@location_info = LocationInfo.find(params[:id])
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.json { render json: @location }
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@location_info = LocationInfo.new(params[:location_info])
|
||||
if @location_info.save
|
||||
flash[:success] = "Success!!"
|
||||
redirect_to panel_location_back_end_locations_url
|
||||
else
|
||||
error_msg = @location_info.errors.full_messages
|
||||
render 'new'
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
@location_info = LocationInfo.find(params[:id])
|
||||
@location_info.update_attributes(params[:location_info])
|
||||
redirect_to panel_location_back_end_locations_url
|
||||
end
|
||||
|
||||
def destroy
|
||||
@location_info = LocationInfo.find(params[:id])
|
||||
@location_info.destroy
|
||||
redirect_to panel_location_back_end_locations_url
|
||||
|
||||
end
|
||||
|
||||
def get_locations
|
||||
location_infos = LocationInfo.all
|
||||
@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
|
||||
Reference in new issue
Block a user