travlrmap 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
data/config.ru CHANGED
@@ -1,14 +1,12 @@
1
1
  $: << File.join(File.dirname(__FILE__), "lib")
2
2
 
3
- require 'bundler/setup'
3
+ Bundler.require(:default)
4
4
 
5
5
  require 'travlrmap'
6
- require 'yaml'
7
6
 
8
7
  set :run, false
9
8
 
10
9
  APPROOT = File.dirname(__FILE__)
11
-
12
10
  config = YAML.load_file(File.join(APPROOT, "config", "travlrmap.yaml"))
13
11
 
14
12
  run Travlrmap::SinatraApp.new(config)
data/lib/travlrmap.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'bundler/setup'
3
+ require 'yaml'
4
+ require 'sinatra'
3
5
 
4
6
  Bundler.require(:default)
5
7
 
@@ -5,6 +5,9 @@ module Travlrmap
5
5
  @map = @config[:map]
6
6
  @types = @config[:types]
7
7
 
8
+ raise "The constant APPROOT should be set in config.ru to the directory your webserver is serving from" unless defined?(APPROOT)
9
+ raise "The directory %s set in APPROOT does not exist" % APPROOT unless File.directory?(APPROOT)
10
+
8
11
  load_map
9
12
 
10
13
  super()
@@ -100,5 +103,17 @@ module Travlrmap
100
103
  content_type :"application/vnd.google-earth.kml+xml"
101
104
  to_kml
102
105
  end
106
+
107
+ get '/images/*' do
108
+ requested_file = params[:splat].first
109
+ file = File.expand_path(File.join("images", requested_file), APPROOT)
110
+
111
+ if File.exist?(file)
112
+ send_file(file)
113
+ else
114
+ status 404
115
+ "Not Found"
116
+ end
117
+ end
103
118
  end
104
119
  end
@@ -1,3 +1,3 @@
1
1
  module Travlmap
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
data/views/_footer.erb ADDED
@@ -0,0 +1,8 @@
1
+ <div align=center>
2
+ <br />
3
+ <% @config[:types].sort_by{|_, s| s[:description]}.each do |_, settings| %>
4
+ <img src="<%= settings[:icon] %>">&nbsp;<%= settings[:description] %>
5
+ <% end %>
6
+ <br />
7
+ <%= @points.size %> locations in <%= @points.map{|p| p[:country]}.uniq.size %> countries
8
+ </div>
data/views/_map_js.erb CHANGED
@@ -9,7 +9,7 @@
9
9
  lng: <%= @map_view[:lon] %>,
10
10
  });
11
11
  map.loadFromKML({
12
- url: '<%= base_url %>/kml?t=<%= Time.now.to_i %>',
12
+ url: '<%= base_url %>/kml?t=<%= (Time.now.to_i/600.to_f).round * 600 %>',
13
13
  suppressInfoWindows: true,
14
14
  preserveViewport: true,
15
15
  events: {
data/views/layout.erb CHANGED
@@ -4,17 +4,16 @@
4
4
  <meta charset="utf-8">
5
5
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1">
7
- <meta name="description" content="">
8
- <meta name="author" content="">
9
- <link rel="icon" href="../../favicon.ico">
7
+ <meta name="description" content="Travlrmap version <%= Travlmap::VERSION %>">
8
+ <meta name="author" content="R.I.Pienaar <rip@devco.net>">
9
+ <link rel="icon" href="/favicon.ico">
10
10
 
11
11
  <title><%= @map[:title] %></title>
12
12
 
13
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
14
- <script src="http://maps.google.com/maps/api/js?sensor=true"></script>
15
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
16
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
17
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css">
13
+ <script src="///ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
14
+ <script src="///maps.google.com/maps/api/js?sensor=true"></script>
15
+ <script src="///maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
16
+ <link rel="stylesheet" href="///maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
18
17
  <link rel="stylesheet" href="/travlrmap.css">
19
18
  <script src="/gmaps.js"></script>
20
19
 
@@ -30,6 +29,12 @@
30
29
  <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
31
30
  <div class="container">
32
31
  <div class="navbar-header">
32
+ <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
33
+ <span class="sr-only">Toggle navigation</span>
34
+ <span class="icon-bar"></span>
35
+ <span class="icon-bar"></span>
36
+ <span class="icon-bar"></span>
37
+ </button>
33
38
  <a class="navbar-brand" href="/"><%= @map[:title] %></a>
34
39
  </div>
35
40
  <div id="navbar" class="collapse navbar-collapse">
@@ -49,8 +54,7 @@
49
54
 
50
55
  <div class="container" style="width:<%= @map[:width] %>; height:<%= @map[:height] %>;">
51
56
  <%= yield %>
57
+ <%= erb :"_footer", :layout => false, :locals => {:points => @points, :config => @config} %>
52
58
  </div>
53
59
  </body>
54
60
  </html>
55
-
56
-
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: travlrmap
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 10
10
- version: 0.0.10
9
+ - 11
10
+ version: 0.0.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - R.I.Pienaar
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2014-12-23 00:00:00 +00:00
18
+ date: 2015-01-02 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -74,6 +74,52 @@ dependencies:
74
74
  version: "0"
75
75
  type: :runtime
76
76
  version_requirements: *id004
77
+ - !ruby/object:Gem::Dependency
78
+ name: gli
79
+ prerelease: false
80
+ requirement: &id005 !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ hash: 3
86
+ segments:
87
+ - 0
88
+ version: "0"
89
+ type: :runtime
90
+ version_requirements: *id005
91
+ - !ruby/object:Gem::Dependency
92
+ name: httparty
93
+ prerelease: false
94
+ requirement: &id006 !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - "="
98
+ - !ruby/object:Gem::Version
99
+ hash: 51
100
+ segments:
101
+ - 0
102
+ - 11
103
+ - 0
104
+ version: 0.11.0
105
+ type: :runtime
106
+ version_requirements: *id006
107
+ - !ruby/object:Gem::Dependency
108
+ name: nokogiri
109
+ prerelease: false
110
+ requirement: &id007 !ruby/object:Gem::Requirement
111
+ none: false
112
+ requirements:
113
+ - - "="
114
+ - !ruby/object:Gem::Version
115
+ hash: 7
116
+ segments:
117
+ - 1
118
+ - 5
119
+ - 2
120
+ version: 1.5.2
121
+ type: :runtime
122
+ version_requirements: *id007
77
123
  description: "description: Sinatra based map builder"
78
124
  email: rip@devco.net
79
125
  executables: []
@@ -89,6 +135,7 @@ files:
89
135
  - views/layout.erb
90
136
  - views/index.erb
91
137
  - views/_point_comment.erb
138
+ - views/_footer.erb
92
139
  - views/_map_js.erb
93
140
  - public/travlrmap.css
94
141
  - public/favicon.ico