diff --git a/Gemfile b/Gemfile index 9b98a6d..d60cb81 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,8 @@ source 'http://rubygems.org' -gem 'rails', '3.0.10' +gem 'rails', '3.2.18' -gem 'sqlite3-ruby', :require => 'sqlite3', :group => [:development, :test] +gem "sqlite3", :require => "sqlite3", :group => [:development, :test] gem "mysql", :require => "mysql", :group => [:production] # God monitors the auto-updater script. diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index 381fc65..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,125 +0,0 @@ -GIT - remote: git://github.com/bamnet/devise_cas_authenticatable.git - revision: d08f41d3cb2f903aa3a4ad01f97997ecc424441b - specs: - devise_cas_authenticatable (1.0.0.alpha4) - devise (>= 1.0.6) - rubycas-client (~> 2.1.0) - -GEM - remote: http://rubygems.org/ - specs: - POpen4 (0.1.4) - Platform (>= 0.4.0) - open4 - Platform (0.4.0) - RedCloth (4.2.8) - abstract (1.0.0) - actionmailer (3.0.10) - actionpack (= 3.0.10) - mail (~> 2.2.19) - actionpack (3.0.10) - activemodel (= 3.0.10) - activesupport (= 3.0.10) - builder (~> 2.1.2) - erubis (~> 2.6.6) - i18n (~> 0.5.0) - rack (~> 1.2.1) - rack-mount (~> 0.6.14) - rack-test (~> 0.5.7) - tzinfo (~> 0.3.23) - activemodel (3.0.10) - activesupport (= 3.0.10) - builder (~> 2.1.2) - i18n (~> 0.5.0) - activerecord (3.0.10) - activemodel (= 3.0.10) - activesupport (= 3.0.10) - arel (~> 2.0.10) - tzinfo (~> 0.3.23) - activeresource (3.0.10) - activemodel (= 3.0.10) - activesupport (= 3.0.10) - activesupport (3.0.10) - arel (2.0.10) - bcrypt-ruby (2.1.4) - builder (2.1.2) - cancan (1.6.5) - chronic_duration (0.9.6) - numerizer (~> 0.1.1) - devise (1.4.2) - bcrypt-ruby (~> 2.1.2) - orm_adapter (~> 0.0.3) - warden (~> 1.0.3) - erubis (2.6.6) - abstract (>= 1.0.0) - god (0.11.0) - i18n (0.5.0) - jammit (0.6.3) - yui-compressor (>= 0.9.3) - kaminari (0.12.4) - activesupport (>= 2.3.6) - i18n (>= 0.4.0) - mime-types (~> 1.16) - rails (>= 3.0.0) - treetop (~> 1.4.8) - mail (2.2.19) - mime-types (1.16) - mysql (2.8.1) - numerizer (0.1.1) - open4 (1.1.0) - orm_adapter (0.0.5) - polyglot (0.3.2) - rack (1.2.3) - rack-mount (0.6.14) - rack (>= 1.0.0) - rack-test (0.5.7) - rack (>= 1.0) - rails (3.0.10) - actionmailer (= 3.0.10) - actionpack (= 3.0.10) - activerecord (= 3.0.10) - activeresource (= 3.0.10) - activesupport (= 3.0.10) - bundler (~> 1.0) - railties (= 3.0.10) - railties (3.0.10) - actionpack (= 3.0.10) - activesupport (= 3.0.10) - rake (>= 0.8.7) - rdoc (~> 3.4) - thor (~> 0.14.4) - rake (0.9.2) - rdoc (3.9.4) - rmagick (2.12.2) - rubycas-client (2.1.0) - activesupport - sqlite3 (1.3.4) - sqlite3-ruby (1.3.3) - sqlite3 (>= 1.3.3) - thor (0.14.6) - treetop (1.4.10) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.29) - warden (1.0.5) - rack (>= 1.0) - yui-compressor (0.9.6) - POpen4 (>= 0.1.4) - -PLATFORMS - ruby - -DEPENDENCIES - RedCloth - cancan - chronic_duration - devise - devise_cas_authenticatable! - god - jammit - kaminari - mysql - rails (= 3.0.10) - rmagick (= 2.12.2) - sqlite3-ruby diff --git a/app/controllers/displays_controller.rb b/app/controllers/displays_controller.rb index ba4c049..6cc43e6 100644 --- a/app/controllers/displays_controller.rb +++ b/app/controllers/displays_controller.rb @@ -1,8 +1,20 @@ class DisplaysController < ApplicationController def index - @pages = Page.order("name").frontpage - render :layout => 'full_map' + # Is this coming from an Android WebView? + if request.user_agent.include? "Mobile Safari" or params[:mobile] == "1" + # Redirect outdated applications to Play Store. + if request.headers['X-Requested-With'] == 'com.aktarer.rpishuttle' + render :file => "#{Rails.root}/public/mobile_redirect.html", :status => 403, :layout => false + else + # Placeholder for WebViews. + @pages = Page.order("name").frontpage + render :layout => 'full_map' + end + else + @pages = Page.order("name").frontpage + render :layout => 'full_map' + end end # Generate a static KML file, a snapshot of the system. diff --git a/app/views/displays/index_mobile.html.erb b/app/views/displays/index_mobile.html.erb new file mode 100755 index 0000000..4f15749 --- /dev/null +++ b/app/views/displays/index_mobile.html.erb @@ -0,0 +1,54 @@ +<% content_for :js_ready do %> + //Setup the overlays + $("a[rel]").overlay({ + top: 150, + onBeforeLoad: function() { + var wrap = this.getOverlay().find(".contentWrap"); + wrap.load(this.getTrigger().attr("href")); + } + }); + //Map work + var point = {latitude: <%= MAP_CENTER[:lat] %>, longitude: <%= MAP_CENTER[:long] %>}; + map = setup_map(point, 15); + $.ajaxSetup({ + timeout: <%= AJAX_TIMEOUT %> + }); + $('#status').ajaxError(function(e, xhr, settings, exception){ + $(this).text("Unable to load data."); + $('#loading_icon').hide(); + $('#error_icon').show(); + }); + $('#status').ajaxStart(function(){ + $(this).text("Loading..."); + $('#error_icon').hide(); + $('#loading_icon').show(); + }); + $('#status').ajaxSuccess(function(){ + $('#loading_icon').hide(); + }); + updater = setInterval("update()", <%= UPDATE_INTERVAL %>); + routes_and_stops(); + update(); //Run the first update instead of waiting. +<% end %> +<% content_for :js do %> + var current_data_path = '<%= current_vehicles_path(:format => 'js') %>'; + var netlink_data_path = '<%= displays_netlink_path(:format => 'js') %>'; + var base_icon = '<%= rotate_icon_path(:id => ':id', :heading => ':heading', :format => 'png') %>'; + var stop_icon_path = '<%= image_path "blue_dot.png" %>'; +<% end %> +
Please download an updated version from the Google Play Store.
+