Orbit Location Module
This commit is contained in:
parent
c262edb041
commit
993ea67f30
|
@ -0,0 +1,6 @@
|
||||||
|
.bundle/
|
||||||
|
log/*.log
|
||||||
|
pkg/
|
||||||
|
test/dummy/db/*.sqlite3
|
||||||
|
test/dummy/log/*.log
|
||||||
|
test/dummy/tmp/
|
|
@ -0,0 +1,17 @@
|
||||||
|
source "http://rubygems.org"
|
||||||
|
|
||||||
|
# Declare your gem's dependencies in location.gemspec.
|
||||||
|
# Bundler will treat runtime dependencies like base dependencies, and
|
||||||
|
# development dependencies will be added by default to the :development group.
|
||||||
|
gemspec
|
||||||
|
|
||||||
|
# jquery-rails is used by the dummy application
|
||||||
|
gem "jquery-rails"
|
||||||
|
|
||||||
|
# Declare any dependencies that are still in development here instead of in
|
||||||
|
# your gemspec. These might include edge Rails or gems from your path or
|
||||||
|
# Git. Remember to move these dependencies to your gemspec before releasing
|
||||||
|
# your gem to rubygems.org.
|
||||||
|
|
||||||
|
# To use debugger
|
||||||
|
# gem 'ruby-debug19', :require => 'ruby-debug'
|
|
@ -0,0 +1,20 @@
|
||||||
|
Copyright 2012 YOURNAME
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,3 @@
|
||||||
|
= Location
|
||||||
|
|
||||||
|
This project rocks and uses MIT-LICENSE.
|
|
@ -0,0 +1,39 @@
|
||||||
|
#!/usr/bin/env rake
|
||||||
|
begin
|
||||||
|
require 'bundler/setup'
|
||||||
|
rescue LoadError
|
||||||
|
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
||||||
|
end
|
||||||
|
begin
|
||||||
|
require 'rdoc/task'
|
||||||
|
rescue LoadError
|
||||||
|
require 'rdoc/rdoc'
|
||||||
|
require 'rake/rdoctask'
|
||||||
|
RDoc::Task = Rake::RDocTask
|
||||||
|
end
|
||||||
|
|
||||||
|
RDoc::Task.new(:rdoc) do |rdoc|
|
||||||
|
rdoc.rdoc_dir = 'rdoc'
|
||||||
|
rdoc.title = 'Location'
|
||||||
|
rdoc.options << '--line-numbers'
|
||||||
|
rdoc.rdoc_files.include('README.rdoc')
|
||||||
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
||||||
|
end
|
||||||
|
|
||||||
|
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
||||||
|
load 'rails/tasks/engine.rake'
|
||||||
|
|
||||||
|
|
||||||
|
Bundler::GemHelper.install_tasks
|
||||||
|
|
||||||
|
require 'rake/testtask'
|
||||||
|
|
||||||
|
Rake::TestTask.new(:test) do |t|
|
||||||
|
t.libs << 'lib'
|
||||||
|
t.libs << 'test'
|
||||||
|
t.pattern = 'test/**/*_test.rb'
|
||||||
|
t.verbose = false
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
task :default => :test
|
|
@ -0,0 +1,131 @@
|
||||||
|
var Locations = function(ls){
|
||||||
|
l = this;
|
||||||
|
this.name = "Locations";
|
||||||
|
this.locations = ls;
|
||||||
|
this.markerCounts = 0;
|
||||||
|
var map = null,
|
||||||
|
infowindow = new google.maps.InfoWindow(),
|
||||||
|
default_location = new google.maps.LatLng( 24.8043107, 121.03042159999995 ),
|
||||||
|
infowindow_template = "<div class='title'></div><div class='image'><img class='thumbnail' src='' /></div>",
|
||||||
|
markers = [];
|
||||||
|
|
||||||
|
|
||||||
|
var initialize = function() {
|
||||||
|
google.maps.visualRefresh = true;
|
||||||
|
var location = ( l.locations.length ? new google.maps.LatLng( l.locations[0].latitude, l.locations[0].longitude ) : default_location ),
|
||||||
|
mapOptions = {
|
||||||
|
zoom: 16,
|
||||||
|
center: location,
|
||||||
|
mapTypeId: google.maps.MapTypeId.ROADMAP
|
||||||
|
};
|
||||||
|
|
||||||
|
map = new google.maps.Map( document.getElementById('map'), mapOptions );
|
||||||
|
|
||||||
|
for( i = 0; i < l.locations.length; i++ ){
|
||||||
|
markers.push( addMarker( new google.maps.LatLng(l.locations[i].latitude, l.locations[i].longitude), l.locations[i].color, i, function( index ){
|
||||||
|
|
||||||
|
}) );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var addMarker = function( location, pinColor, index, markerCallback ){
|
||||||
|
|
||||||
|
var pin = getPin(( pinColor.substr( 0, 1 ) == "#" ? pinColor.replace("#","") : pinColor )),
|
||||||
|
marker = new google.maps.Marker({
|
||||||
|
map: map,
|
||||||
|
icon: pin.image,
|
||||||
|
shadow: pin.shadow,
|
||||||
|
position: location,
|
||||||
|
zIndex: 10
|
||||||
|
});
|
||||||
|
|
||||||
|
google.maps.event.addListener( marker, 'click', function() {
|
||||||
|
|
||||||
|
infowindow.setContent( getTemplate( index ) );
|
||||||
|
infowindow.open( map, marker );
|
||||||
|
if( typeof markerCallback == "function" )
|
||||||
|
markerCallback.call( this, index );
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
l.markerCounts++;
|
||||||
|
return {"marker" : marker, "category_id" : l.locations[index].category_id};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var getTemplate = function( obj ){
|
||||||
|
|
||||||
|
var object = ( typeof obj == "number" ? l.locations[obj] : ( typeof obj == "object" ? obj : null ) );
|
||||||
|
|
||||||
|
if ( object ){
|
||||||
|
|
||||||
|
var template = $( "<div></div>" );
|
||||||
|
template.html( infowindow_template );
|
||||||
|
template.find( '.title' ).text( object.name );
|
||||||
|
template.find( "img.thumbnail" ).attr( "src", object.file.thumb.url );
|
||||||
|
return template.html();
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
throw new InvalidObjectError();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var getPin = function( color ){
|
||||||
|
|
||||||
|
var pinImage = new google.maps.MarkerImage("http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|" + color,
|
||||||
|
new google.maps.Size(21, 34),
|
||||||
|
new google.maps.Point(0,0),
|
||||||
|
new google.maps.Point(10, 34));
|
||||||
|
|
||||||
|
var pinShadow = new google.maps.MarkerImage("http://chart.apis.google.com/chart?chst=d_map_pin_shadow",
|
||||||
|
new google.maps.Size(40, 37),
|
||||||
|
new google.maps.Point(0, 0),
|
||||||
|
new google.maps.Point(12, 35));
|
||||||
|
|
||||||
|
return {"image":pinImage,"shadow":pinShadow};
|
||||||
|
}
|
||||||
|
|
||||||
|
this.getMarker = function( index ){
|
||||||
|
return markers[index];
|
||||||
|
}
|
||||||
|
this.getAllMarkers = function( ){
|
||||||
|
return markers;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.clearFilter = function(){
|
||||||
|
var m = l.getAllMarkers();
|
||||||
|
for( i = 0; i < m.length; i++ ){
|
||||||
|
m[i].marker.setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.filterMarkers = function( categories ){
|
||||||
|
var filtered = [],
|
||||||
|
m = l.getAllMarkers();
|
||||||
|
|
||||||
|
for( i = 0; i < m.length; i++ ){
|
||||||
|
m[i].marker.setVisible(false);
|
||||||
|
}
|
||||||
|
for( i = 0; i < categories.length; i++ ){
|
||||||
|
filtered = filtered.concat(m.filter(function(a){return a.category_id == categories[i]}));
|
||||||
|
}
|
||||||
|
for( i = 0; i < filtered.length; i++ ){
|
||||||
|
filtered[i].marker.setVisible(true);
|
||||||
|
}
|
||||||
|
return filtered;
|
||||||
|
}
|
||||||
|
initialize();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var InvalidObjectError = function(){
|
||||||
|
this.name = "InvalidObjectError";
|
||||||
|
this.message = "Object not valid";
|
||||||
|
}
|
||||||
|
|
||||||
|
InvalidObjectError.prototype = new Error();
|
||||||
|
InvalidObjectError.prototype.constructor = InvalidObjectError;
|
|
@ -0,0 +1,2 @@
|
||||||
|
// Place all the behaviors and hooks related to the matching controller here.
|
||||||
|
// All this logic will automatically be available in application.js.
|
|
@ -0,0 +1,4 @@
|
||||||
|
/*
|
||||||
|
Place all the styles related to the matching controller here.
|
||||||
|
They will automatically be included in application.css.
|
||||||
|
*/
|
|
@ -0,0 +1,4 @@
|
||||||
|
/*
|
||||||
|
Place all the styles related to the matching controller here.
|
||||||
|
They will automatically be included in application.css.
|
||||||
|
*/
|
|
@ -0,0 +1,19 @@
|
||||||
|
class Panel::Location::BackEnd::LocationCategoriesController < OrbitBackendController
|
||||||
|
def index
|
||||||
|
@module_app_id = @module_app.id rescue nil
|
||||||
|
@categories = get_categories_for_index
|
||||||
|
@categories = @categories.page(params[:page]).per(10)
|
||||||
|
respond_to do |format|
|
||||||
|
format.html # index.html.erb
|
||||||
|
format.json { render json: @categories }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def list
|
||||||
|
@module_app_id = @module_app.id rescue nil
|
||||||
|
@categories = get_categories_for_index
|
||||||
|
@categories = @categories.page(params[:page]).per(10)
|
||||||
|
render :layout => false
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,132 @@
|
||||||
|
class Panel::Location::BackEnd::LocationsController < OrbitBackendController
|
||||||
|
include AdminHelper
|
||||||
|
open_for_visitor :only => [:get_location_categories, :get_categorywise_locations]
|
||||||
|
|
||||||
|
def index
|
||||||
|
@locations = LocationInfo.all
|
||||||
|
@categories = get_categories_for_index
|
||||||
|
@location_infos = [];
|
||||||
|
@locations.each do |loc|
|
||||||
|
loc['color'] = Category.find(loc.category_id).custom_value
|
||||||
|
@location_infos << loc
|
||||||
|
end
|
||||||
|
respond_to do |format|
|
||||||
|
format.html # new.html.erb
|
||||||
|
format.json { render json: @locations }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
@location_info = LocationInfo.new
|
||||||
|
@categories = get_categories_for_index
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html # new.html.erb
|
||||||
|
format.json { render json: @location }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
@location_info = LocationInfo.find(params[:id])
|
||||||
|
@categories = get_categories_for_index
|
||||||
|
|
||||||
|
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])
|
||||||
|
@categories = get_categories_for_index
|
||||||
|
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(@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
|
||||||
|
|
||||||
|
def get_location_categories
|
||||||
|
check_mobile_api_openness
|
||||||
|
location_categories = get_categories_for_index
|
||||||
|
@data = Array.new
|
||||||
|
|
||||||
|
location_categories.each do |category|
|
||||||
|
I18n.locale = :en
|
||||||
|
name_en = category.title
|
||||||
|
I18n.locale = :zh_tw
|
||||||
|
name_zh_tw = category.title
|
||||||
|
category_id = category.id.to_s
|
||||||
|
@data << { name_en: name_en, name_zh_tw: name_zh_tw, category_id: category_id, location_link: "http://#{request.host_with_port}"+"/#{panel_location_back_end_locations_get_categorywise_locations_path}"+"?category_id=#{category_id}"}
|
||||||
|
end
|
||||||
|
|
||||||
|
render :json => JSON.pretty_generate(@data)
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_categorywise_locations
|
||||||
|
check_mobile_api_openness
|
||||||
|
location_infos = LocationInfo.where(: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 << { id: location.id.to_s,
|
||||||
|
name: location.name,
|
||||||
|
pic_url: picurl,
|
||||||
|
thumb_url: thumburl,
|
||||||
|
longitude: location.longitude,
|
||||||
|
latitude: location.latitude,
|
||||||
|
description: location.description }
|
||||||
|
end
|
||||||
|
|
||||||
|
render :json => JSON.pretty_generate(@data)
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,12 @@
|
||||||
|
class Panel::Location::FrontEnd::LocationsController < OrbitWidgetController
|
||||||
|
def index
|
||||||
|
@categories = @module_app.categories.enabled
|
||||||
|
@locations = LocationInfo.all
|
||||||
|
|
||||||
|
@location_infos = [];
|
||||||
|
@locations.each do |loc|
|
||||||
|
loc['color'] = Category.find(loc.category_id).custom_value
|
||||||
|
@location_infos << loc
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,17 @@
|
||||||
|
class Panel::Location::Widget::LocationsController < OrbitWidgetController
|
||||||
|
def location_widget
|
||||||
|
@categories = params[:category_id]
|
||||||
|
locations = LocationInfo.where(:category_id.in => @categories)
|
||||||
|
@url = "http://maps.googleapis.com/maps/api/staticmap?zoom=16&size=400x400&maptype=roadmap%20&sensor=false&"
|
||||||
|
markers = ""
|
||||||
|
locations.each do |loc|
|
||||||
|
color = Category.find(loc.category_id).custom_value
|
||||||
|
color.gsub!("#","")
|
||||||
|
markers = markers + "markers=color:0x#{color}|#{loc.latitude},#{loc.longitude}&"
|
||||||
|
end
|
||||||
|
@url = @url + markers.chop
|
||||||
|
# http://maps.googleapis.com/maps/api/staticmap?zoom=13&size=600x300&maptype=roadmap%20&markers=color:0xCF2C9B|40.702147,-74.015794&markers=color:CF2C9B|label:G|40.711614,-74.012318%20&markers=color:red|color:red|label:C|40.718217,-73.998284&sensor=false
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,84 @@
|
||||||
|
class Panel::Locations::BackEnd::LocationsController < OrbitBackendController
|
||||||
|
|
||||||
|
#before_filter :clean_values, :only => [:create, :update]
|
||||||
|
|
||||||
|
before_filter :force_order_for_visitor,:only => [:index, :new, :edit, :delete]
|
||||||
|
before_filter :force_order_for_user,:except => [:get_locations,:index]
|
||||||
|
#before_filter :for_app_sub_manager,:except => [:index, :new, :edit, :delete, :get_locations]
|
||||||
|
|
||||||
|
def index
|
||||||
|
@locations = Location.all
|
||||||
|
respond_to do |format|
|
||||||
|
format.html # new.html.erb
|
||||||
|
format.json { render json: @locations }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
@location = Location.new
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html # new.html.erb
|
||||||
|
format.json { render json: @location }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
@location = Location.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
@location = Location.find(params[:id])
|
||||||
|
respond_to do |format|
|
||||||
|
format.html
|
||||||
|
format.json { render json: @location }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@location = Location.new(params[:location])
|
||||||
|
@location.save!
|
||||||
|
redirect_to panel_gprs_back_end_locations_url
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
@location = Location.find(params[:id])
|
||||||
|
@location.update_attributes(params[:location])
|
||||||
|
redirect_to panel_gprs_back_end_locations_url
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@location = Location.find(params[:id])
|
||||||
|
@location.destroy
|
||||||
|
redirect_to panel_gprs_back_end_locations_url
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_locations
|
||||||
|
locations = Location.all
|
||||||
|
@data = Array.new
|
||||||
|
|
||||||
|
locations.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
|
||||||
|
|
||||||
|
#print readable json
|
||||||
|
render :json => JSON.pretty_generate({location: @data})
|
||||||
|
|
||||||
|
#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
|
|
@ -0,0 +1,2 @@
|
||||||
|
module Panel::Location::BackEnd::LocationsHelper
|
||||||
|
end
|
|
@ -0,0 +1,2 @@
|
||||||
|
module Panel::Locations::BackEnd::LocationsHelper
|
||||||
|
end
|
|
@ -0,0 +1,12 @@
|
||||||
|
class Location
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
include OrbitCategory::Categorizable
|
||||||
|
|
||||||
|
mount_uploader :file, LocationUploader
|
||||||
|
|
||||||
|
field :name
|
||||||
|
field :description
|
||||||
|
field :longitude, type: Float
|
||||||
|
field :latitude, type: Float
|
||||||
|
end
|
|
@ -0,0 +1,21 @@
|
||||||
|
class LocationInfo
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
include OrbitCategory::Categorizable
|
||||||
|
|
||||||
|
|
||||||
|
mount_uploader :file, LocationsUploader
|
||||||
|
|
||||||
|
field :name, localize: true
|
||||||
|
field :description, localize: true
|
||||||
|
field :longitude, type: Float
|
||||||
|
field :latitude, type: Float
|
||||||
|
|
||||||
|
validates :file, presence: true
|
||||||
|
validates :longitude,
|
||||||
|
numericality: { less_than_or_equal_to: 180.0, greater_than_or_equal_to: -180.0 },
|
||||||
|
unless: Proc.new{self.longitude.blank?}
|
||||||
|
validates :latitude,
|
||||||
|
numericality: { less_than_or_equal_to: 90.0, greater_than_or_equal_to: -90.0 },
|
||||||
|
unless: Proc.new{self.latitude.blank?}
|
||||||
|
end
|
|
@ -0,0 +1,61 @@
|
||||||
|
class LocationsUploader < CarrierWave::Uploader::Base
|
||||||
|
|
||||||
|
# Include RMagick or ImageScience support:
|
||||||
|
# include CarrierWave::RMagick
|
||||||
|
# include CarrierWave::ImageScience
|
||||||
|
include CarrierWave::MiniMagick
|
||||||
|
|
||||||
|
# Choose what kind of storage to use for this uploader:
|
||||||
|
# storage :file
|
||||||
|
# storage :s3
|
||||||
|
|
||||||
|
# Override the directory where uploaded files will be stored.
|
||||||
|
# This is a sensible default for uploaders that are meant to be mounted:
|
||||||
|
def store_dir
|
||||||
|
"location/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Provide a default URL as a default if there hasn't been a file uploaded:
|
||||||
|
# def default_url
|
||||||
|
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
||||||
|
# end
|
||||||
|
|
||||||
|
# Process files as they are uploaded:
|
||||||
|
# process :scale => [200, 300]
|
||||||
|
#
|
||||||
|
# def scale(width, height)
|
||||||
|
# # do something
|
||||||
|
# end
|
||||||
|
|
||||||
|
# Create different versions of your uploaded files:
|
||||||
|
# version :thumb do
|
||||||
|
# process :scale => [50, 50]
|
||||||
|
# end
|
||||||
|
|
||||||
|
version :thumb do
|
||||||
|
process :resize_to_fill => [150, 120]
|
||||||
|
end
|
||||||
|
|
||||||
|
# Add a white list of extensions which are allowed to be uploaded.
|
||||||
|
# For images you might use something like this:
|
||||||
|
# def extension_white_list
|
||||||
|
# %w(jpg jpeg gif png)
|
||||||
|
# end
|
||||||
|
|
||||||
|
# Override the filename of the uploaded files:
|
||||||
|
# def filename
|
||||||
|
# "something.jpg" if original_filename
|
||||||
|
# end
|
||||||
|
|
||||||
|
# def manipulate!
|
||||||
|
# raise current_path.inspect
|
||||||
|
# image = ::MiniMagick::Image.open(current_path)
|
||||||
|
# image = yield(image)
|
||||||
|
# image.write(current_path)
|
||||||
|
# ::MiniMagick::Image.open(current_path)
|
||||||
|
# rescue ::MiniMagick::Error, ::MiniMagick::Invalid => e
|
||||||
|
# raise CarrierWave::ProcessingError.new("Failed to manipulate with MiniMagick, maybe it is not an image? Original Error: #{e}")
|
||||||
|
# end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
<tr class="<%= 'disable' if category.disable %>">
|
||||||
|
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||||
|
<td>
|
||||||
|
<%= category.title_translations[locale] %>
|
||||||
|
<% if i == 0 %>
|
||||||
|
<div class="quick-edit">
|
||||||
|
<ul class="nav nav-pills">
|
||||||
|
<% if is_admin?%>
|
||||||
|
<li><%= link_to t(:edit), '#', class: "open-slide", data: {title: t(:edit_category), id: category.id.to_s, module: @module_app_id.to_s, form: category.title_translations.merge(color: category.custom_value)} %></li>
|
||||||
|
<li><%= link_to show_toggle_archive_btn(category), toggle_admin_module_app_category_path(@module_app_id, category), method: :post, remote: true, class: "archive_toggle" %></li>
|
||||||
|
<% end %>
|
||||||
|
<% if is_manager? || is_admin? %>
|
||||||
|
<li><%= link_to t(:category_auth), admin_authorizations_path(@module_app.key, 'category_authorization', category.id) %></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<% end %>
|
||||||
|
<td><span class="badge" style="background-color: <%= category.custom_value %>;"><%= category.custom_value %></span></td>
|
||||||
|
</tr>
|
|
@ -0,0 +1,12 @@
|
||||||
|
<%= flash_messages %>
|
||||||
|
<%= f.error_messages %>
|
||||||
|
<%= label_tag("color", t("location.color")) %>
|
||||||
|
<div class="input-append">
|
||||||
|
<%= f.text_field :custom_value, id: "color", :class => "color-picker miniColors input-small", :size => "7", :maxlength => "7", :autocomplete=>"off",:value=>"9100FF" %>
|
||||||
|
</div>
|
||||||
|
<%= f.fields_for :title_translations do |f| %>
|
||||||
|
<% @site_valid_locales.each do |locale| %>
|
||||||
|
<%= label_tag "name-#{locale}", "#{t(:name)} (#{I18nVariable.from_locale(locale)})" %>
|
||||||
|
<%= f.text_field locale, :class => 'input-large', :value => (@category.title_translations[locale] rescue ''), placeholder: t(:name), id: locale %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,66 @@
|
||||||
|
<%= stylesheet_link_tag "jquery.miniColors" %>
|
||||||
|
|
||||||
|
<%= javascript_include_tag "jquery.miniColors.min" %>
|
||||||
|
|
||||||
|
<%= javascript_include_tag "admin/categories" %>
|
||||||
|
|
||||||
|
<div id="categories_index">
|
||||||
|
<table class="table main-list">
|
||||||
|
<thead>
|
||||||
|
<tr class="sort-header">
|
||||||
|
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||||
|
<th class="<%= 'span5' if i <= 1 %>"><a href="#"><%= t(:_locale, :locale => locale) %></a></th>
|
||||||
|
<% end %>
|
||||||
|
<th class="span2"><a href="#"><%= t('event_category.color') %></a></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<%= render partial: 'category', collection: @categories %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="bottomnav clearfix">
|
||||||
|
<div class="action pull-right">
|
||||||
|
<%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add), '#', class: "btn btn-primary open-slide", data: {title: t(:add_category), id: 'new', module: @module_app_id.to_s } %>
|
||||||
|
</div>
|
||||||
|
<div class="pagination pagination-centered">
|
||||||
|
<%= paginate @categories unless @categories.blank? %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="pageslide">
|
||||||
|
<div class="page-title clearfix">
|
||||||
|
<a class="pull-right" href="javascript:$.pageslide.close()">
|
||||||
|
<i class="icons-arrow-left-2"></i>
|
||||||
|
</a>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
<div class="view-page">
|
||||||
|
<div class="nano">
|
||||||
|
<div class="content">
|
||||||
|
<%= form_for :category, url: nil, html:{:id=>"color"}, remote: true do |f| %>
|
||||||
|
<fieldset>
|
||||||
|
<%= render :partial => "form", :locals => { :f => f } %>
|
||||||
|
<div class="form-actions">
|
||||||
|
<a href="javascript:$.pageslide.close()" class="btn btn-small"><%= t(:cancel) %></a>
|
||||||
|
<%= f.submit t(:submit), class: 'btn btn-primary btn-small' %>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
if($('.color-picker').length > 0){
|
||||||
|
$('.color-picker').miniColors(); // just in category view
|
||||||
|
$('.miniColors-trigger').addClass('btn');
|
||||||
|
}
|
||||||
|
$("form#color").bind("ajax:complete",function(){
|
||||||
|
$.get("<%= panel_location_back_end_location_categories_list_path %>",function(data){
|
||||||
|
$("#categories_index").html(data);
|
||||||
|
openSlide();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
|
@ -0,0 +1,21 @@
|
||||||
|
<table class="table main-list">
|
||||||
|
<thead>
|
||||||
|
<tr class="sort-header">
|
||||||
|
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||||
|
<th class="<%= 'span5' if i <= 1 %>"><a href="#"><%= t(:_locale, :locale => locale) %></a></th>
|
||||||
|
<% end %>
|
||||||
|
<th class="span2"><a href="#"><%= t('location_category.color') %></a></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<%= render partial: 'category', collection: @categories %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="bottomnav clearfix">
|
||||||
|
<div class="action pull-right">
|
||||||
|
<%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add), '#', class: "btn btn-primary open-slide", data: {title: t(:add_category), id: 'new', module: @module_app_id.to_s } %>
|
||||||
|
</div>
|
||||||
|
<div class="pagination pagination-centered">
|
||||||
|
<%= paginate @categories unless @categories.blank? %>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -0,0 +1,48 @@
|
||||||
|
<% @location_info.errors.full_messages.each do |msg| %>
|
||||||
|
<li>* <%= msg %></li>
|
||||||
|
<% end %>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label" for=""><%= t "name" %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.fields_for :name_translations do |f| %>
|
||||||
|
<%= f.text_field locale, :class=>'span4', :value => (@location_info.name_translations[locale.to_s] rescue nil) %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label" for=""><%= t 'picture' %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= @location_info.file? ? ( link_to t(:view), @location_info.file.url, {:class => 'for_preview btn', :target => '_blank', :title => t(:view)}) : '' %>
|
||||||
|
<%= f.file_field :file %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label" for=""><%= t 'coordinates' %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :latitude, :class=>"span2", :placeholder => "Latitude" %>
|
||||||
|
<%= f.text_field :longitude, :class=>"span2", :placeholder => "Longitude" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Category -->
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted"><%= t(:category) %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.select :category_id, @categories.collect{|t| [ t.title, t.id ]} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label" for=""><%= t 'description' %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.fields_for :description_translations do |f| %>
|
||||||
|
<%= f.text_area locale, :class=>'span4', :cols=>"30", :row=>"5", :value => (@location_info.description_translations[locale.to_s] rescue nil) %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.submit t("submit"), :class=>"btn" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -0,0 +1,4 @@
|
||||||
|
<%= form_for @location_info, :url=> panel_location_back_end_location_path(@location_info), :html => { :class=>"form-horizontal"} do |f| %>
|
||||||
|
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||||
|
<% end %>
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
<script src="http://maps.google.com/maps/api/js?sensor=true"></script>
|
||||||
|
<%= javascript_include_tag "location" %>
|
||||||
|
<table class="table main-list">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="span1"><%= t('location.picture') %></th>
|
||||||
|
<th class="span1"><%= t('location.name') %></th>
|
||||||
|
<th class="span1"><%= t('location.longitude') %></th>
|
||||||
|
<th class="span1"><%= t('location.latitude') %></th>
|
||||||
|
<th class="span3"><%= t('location.description') %></th>
|
||||||
|
<%if is_manager? %>
|
||||||
|
<th class="span1"><%= t('location.edit') %></th>
|
||||||
|
<th class="span1"><%= t('location.delete') %></th>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="tbody_locations" class="sort-holder">
|
||||||
|
<% @location_infos.each do |location| %>
|
||||||
|
<tr class="with_action">
|
||||||
|
<td><%= image_tag(location.file, alt: location.file, size: "50x50" ) if !location.file.blank? %></td>
|
||||||
|
<td><%= location.name %></td>
|
||||||
|
<td><%= location.longitude%></td>
|
||||||
|
<td><%= location.latitude%></td>
|
||||||
|
<td><%= location.description %></td>
|
||||||
|
<%if is_manager? %>
|
||||||
|
<td><%= link_to 'Edit', edit_panel_location_back_end_location_path(location) %></td>
|
||||||
|
<td><%= link_to 'Destroy', panel_location_back_end_location_path(location), method: :delete , :confirm => t(:sure?) %></td>
|
||||||
|
<%end%>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div>
|
||||||
|
Categories :
|
||||||
|
</div>
|
||||||
|
<div class="btn-group">
|
||||||
|
<% @categories.each do |category| %>
|
||||||
|
<button class="btn cat-filter" data-category='<%= category.id %>'><%= category.title %></button>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<a href="javascript:void(0);" id="clear_filter">Clear Filter</a>
|
||||||
|
<div id="map" style="width: 100%; height: 500px;"></div>
|
||||||
|
<%if is_manager? %>
|
||||||
|
<td><%= link_to 'Add', new_panel_location_back_end_location_path, :class => "btn btn-primary pull-right", :id=>"create_event_btn", :ref=>"add-btn"%></td>
|
||||||
|
<% end %>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
var loc = new Locations(<%= @location_infos.to_json.html_safe %>);
|
||||||
|
jQuery(document).ready(function($) {
|
||||||
|
var filterCategories = [];
|
||||||
|
$("button.cat-filter").bind( clickEvent,function(){
|
||||||
|
var catid = $( this ).data('category');
|
||||||
|
|
||||||
|
if ( $( this ).hasClass('active') ){
|
||||||
|
$( this ).removeClass('active');
|
||||||
|
var index = filterCategories.indexOf(filterCategories.filter(function(a,i){ return a == catid })[0]);
|
||||||
|
filterCategories.splice( index, 1 );
|
||||||
|
}else{
|
||||||
|
$( this ).addClass('active');
|
||||||
|
filterCategories.push( catid );
|
||||||
|
}
|
||||||
|
loc.filterMarkers(filterCategories);
|
||||||
|
})
|
||||||
|
|
||||||
|
$("a#clear_filter").bind( clickEvent, function(){
|
||||||
|
filterCategories = [];
|
||||||
|
$("button.cat-filter").removeClass('active');
|
||||||
|
loc.clearFilter();
|
||||||
|
})
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<%= form_for @location_info, :url=> panel_location_back_end_locations_path, :html => { :class=>"form-horizontal"} do |f| %>
|
||||||
|
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,40 @@
|
||||||
|
<%= javascript_include_tag "location" %>
|
||||||
|
<div>
|
||||||
|
Categories :
|
||||||
|
<% @categories.each do |category| %>
|
||||||
|
<input type="checkbox" class="btn cat-filter" data-category='<%= category.id %>' /><%= category.title %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<a href="javascript:void(0);" id="clear_filter">Clear Filter</a>
|
||||||
|
<div id="map" style="width: 100%; height: 500px;"></div>
|
||||||
|
<script>
|
||||||
|
var loc = null;
|
||||||
|
var initialize = function(){
|
||||||
|
loc = new Locations(<%= @location_infos.to_json.html_safe %>);
|
||||||
|
}
|
||||||
|
|
||||||
|
jQuery(document).ready(function($) {
|
||||||
|
var filterCategories = [];
|
||||||
|
$("input.cat-filter").bind( "click",function(){
|
||||||
|
var catid = $( this ).data('category');
|
||||||
|
|
||||||
|
if ( !$( this ).is(':checked') ){
|
||||||
|
|
||||||
|
var index = filterCategories.indexOf(filterCategories.filter(function(a,i){ return a == catid })[0]);
|
||||||
|
filterCategories.splice( index, 1 );
|
||||||
|
}else{
|
||||||
|
|
||||||
|
filterCategories.push( catid );
|
||||||
|
}
|
||||||
|
loc.filterMarkers(filterCategories);
|
||||||
|
})
|
||||||
|
|
||||||
|
$("a#clear_filter").bind( "click", function(){
|
||||||
|
filterCategories = [];
|
||||||
|
$("input.cat-filter").prop('checked',false);
|
||||||
|
loc.clearFilter();
|
||||||
|
})
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<script src="http://maps.google.com/maps/api/js?sensor=true&callback=initialize"></script>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<a href="<%= panel_location_front_end_locations_path %>" >
|
||||||
|
<%= image_tag @url, :width=>"300", :height=>"300" %>
|
||||||
|
</a>
|
|
@ -0,0 +1,7 @@
|
||||||
|
en:
|
||||||
|
location:
|
||||||
|
location: Location
|
||||||
|
categories: Categories
|
||||||
|
all_locations: All Locations
|
||||||
|
add_location: Add Location
|
||||||
|
add_category: Add Category
|
|
@ -0,0 +1,7 @@
|
||||||
|
zh_tw:
|
||||||
|
location:
|
||||||
|
location: 地標
|
||||||
|
categories: 類別
|
||||||
|
all_locations: 全部地點
|
||||||
|
add_location: 新增地點
|
||||||
|
add_category: 新增類別
|
|
@ -0,0 +1,23 @@
|
||||||
|
Rails.application.routes.draw do
|
||||||
|
namespace :panel do
|
||||||
|
namespace :location do
|
||||||
|
namespace :back_end do
|
||||||
|
match 'location_categories/list' => "location_categories#list"
|
||||||
|
match "locations/get_locations" => "locations#get_locations"
|
||||||
|
match "locations/get_categorywise_locations" => "locations#get_categorywise_locations"
|
||||||
|
match "locations/get_location_categories" => "locations#get_location_categories"
|
||||||
|
resources :location_categories
|
||||||
|
match "locations/get_locations" => "locations#get_locations"
|
||||||
|
match "locations/get_categories" => "locations#get_categories"
|
||||||
|
|
||||||
|
resources :locations
|
||||||
|
end
|
||||||
|
namespace :front_end do
|
||||||
|
resources :locations
|
||||||
|
end
|
||||||
|
namespace :widget do
|
||||||
|
match "location_widget" => "locations#location_widget"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
require "location/engine"
|
||||||
|
|
||||||
|
module Location
|
||||||
|
end
|
|
@ -0,0 +1,59 @@
|
||||||
|
module Location
|
||||||
|
class Engine < Rails::Engine
|
||||||
|
initializer "location" do
|
||||||
|
OrbitApp.registration "Location",:type=> 'ModuleApp' do
|
||||||
|
module_label 'location.location'
|
||||||
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
|
|
||||||
|
version "0.1"
|
||||||
|
organization "Rulingcom"
|
||||||
|
author "RD dep"
|
||||||
|
intro "I am intro"
|
||||||
|
update_info 'some update_info'
|
||||||
|
|
||||||
|
front_end do
|
||||||
|
app_page 'locations' do
|
||||||
|
frontend_i18n 'location.location'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
categorizable
|
||||||
|
authorizable
|
||||||
|
|
||||||
|
widgets do
|
||||||
|
customize_widget "location_widget" do
|
||||||
|
widget_i18n "location.location"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
side_bar do
|
||||||
|
head_label_i18n 'location.location',:icon_class=>"icons-location"
|
||||||
|
available_for [:admin,:guest,:manager,:sub_manager]
|
||||||
|
active_for_controllers ({:private=>['locations','location_categories']})
|
||||||
|
|
||||||
|
head_link_path "panel_location_back_end_locations_path"
|
||||||
|
|
||||||
|
context_link 'location.all_locations',
|
||||||
|
:link_path=>"panel_location_back_end_locations_path" ,
|
||||||
|
:priority=>1,
|
||||||
|
:active_for_action=>{:locations=>:index},
|
||||||
|
:available_for => [:manager]
|
||||||
|
|
||||||
|
context_link 'location.add_location',
|
||||||
|
:link_path=>"new_panel_location_back_end_location_path" ,
|
||||||
|
:priority=>1,
|
||||||
|
:active_for_action=>{:locations=>:new},
|
||||||
|
:available_for => [:manager]
|
||||||
|
|
||||||
|
|
||||||
|
context_link 'location.categories',
|
||||||
|
:link_path=>"panel_location_back_end_location_categories_path" ,
|
||||||
|
:priority=>1,
|
||||||
|
:active_for_category => 'Location',
|
||||||
|
:available_for => [:manager]
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,3 @@
|
||||||
|
module Location
|
||||||
|
VERSION = "0.0.1"
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
# desc "Explaining what the task does"
|
||||||
|
# task :location do
|
||||||
|
# # Task goes here
|
||||||
|
# end
|
|
@ -0,0 +1,23 @@
|
||||||
|
$:.push File.expand_path("../lib", __FILE__)
|
||||||
|
|
||||||
|
# Maintain your gem's version:
|
||||||
|
require "location/version"
|
||||||
|
|
||||||
|
# Describe your gem and declare its dependencies:
|
||||||
|
Gem::Specification.new do |s|
|
||||||
|
s.name = "location"
|
||||||
|
s.version = Location::VERSION
|
||||||
|
s.authors = ["RulingDigital"]
|
||||||
|
s.email = ["service@rulingcom.com"]
|
||||||
|
s.homepage = "http://www.rulingcom.com"
|
||||||
|
s.summary = ""
|
||||||
|
s.description = "Orbit Location module"
|
||||||
|
|
||||||
|
s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
|
||||||
|
s.test_files = Dir["test/**/*"]
|
||||||
|
|
||||||
|
# s.add_dependency "rails", "~> 3.1.8"
|
||||||
|
# s.add_dependency "jquery-rails"
|
||||||
|
|
||||||
|
s.add_development_dependency "sqlite3"
|
||||||
|
end
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"title": "location",
|
||||||
|
"version": "0.1",
|
||||||
|
"organization": "Rulingcom",
|
||||||
|
"author": "RD dep",
|
||||||
|
"intro": "A simple blog……",
|
||||||
|
"update_info": "Some info",
|
||||||
|
"create_date": "11-11-2011",
|
||||||
|
"widgets": [],
|
||||||
|
"category": [],
|
||||||
|
"enable_frontend": false
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
||||||
|
|
||||||
|
ENGINE_PATH = File.expand_path('../..', __FILE__)
|
||||||
|
load File.expand_path('../../test/dummy/script/rails', __FILE__)
|
Loading…
Reference in New Issue