Skip to content

Commit

Permalink
Caching front-page. Added GetClickly code.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmwatson committed Mar 18, 2009
1 parent d529bbf commit 433f82f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 16 deletions.
4 changes: 4 additions & 0 deletions app/controllers/cities_controller.rb
@@ -1,5 +1,7 @@
class CitiesController < ApplicationController
layout 'base'

caches_page :index

def index
@cities = City.find :all, :order => 'country, name', :conditions => {:hidden => false}
Expand Down Expand Up @@ -33,6 +35,8 @@ def check

def create
@city = City.find(:first, :conditions => {:name => params[:city][:name]}) || City.new(params[:city])

expire_page :controller => '/', :action => :index

if @city.save
flash[:notice] = 'City was successfully created.'
Expand Down
34 changes: 20 additions & 14 deletions app/views/layouts/base.html.erb
Expand Up @@ -25,19 +25,25 @@
<a href="<%= @photo.url %>"><%= @photo.title %></a> by <%= @photo.photographer %>
</div>
</div>
<script type="text/javascript">
var not_iphone = navigator.userAgent.indexOf('iPhone') <= 0;
if (not_iphone)
{
$('body').addClass('not_iphone');
}
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-265441-9");
pageTracker._trackPageview();
} catch(err) {}</script>
<%- if RAILS_ENV == "production" -%>
<script type="text/javascript">
var not_iphone = navigator.userAgent.indexOf('iPhone') <= 0;
if (not_iphone)
{
$('body').addClass('not_iphone');
}
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-265441-9");
pageTracker._trackPageview();
} catch(err) {}</script>

<a title="Clicky Web Analytics" href="http://getclicky.com/81343"><img alt="Clicky Web Analytics" src="http://static.getclicky.com/media/links/badge.gif" border="0" /></a>
<script src="http://static.getclicky.com/81343.js" type="text/javascript"></script>
<noscript><p><img alt="Clicky" width="1" height="1" src="http://static.getclicky.com/81343-db10.gif" /></p></noscript>
<%- end -%>
</body>
</html>
2 changes: 1 addition & 1 deletion config/deploy.rb
@@ -1,7 +1,7 @@
set :user, 'deploy'
set :application, "sickcity.org"
set :scm, :git
set :repository, "git@github.com:paulmwatson/sickcity.git"
set :repository, "git://github.com/paulmwatson/sickcity.git"
after "deploy:update_code", "deploy:symlink_configs"

# If you aren't deploying to /u/apps/#{application} on the target
Expand Down
2 changes: 1 addition & 1 deletion config/environments/development.rb
Expand Up @@ -11,7 +11,7 @@
# Show full error reports and disable caching
config.action_controller.consider_all_requests_local = true
config.action_view.debug_rjs = true
config.action_controller.perform_caching = false
config.action_controller.perform_caching = true

# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false
Expand Down

0 comments on commit 433f82f

Please sign in to comment.