Skip to content

Commit

Permalink
Merge branch 'release/0.40.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Haeffner committed Dec 13, 2014
2 parents 09b0db2 + 9f9a21e commit 20a82f0
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 38 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# The Internet 0.40.0 (12-12-2014)
# The Internet 0.40.1 (12-13-2014)
=======

An example application that captures prominent and ugly functionality found on the web. Perfect for writing automated acceptance tests against.
Expand Down
2 changes: 1 addition & 1 deletion README.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# The Internet 0.40.0 (12-12-2014)
# The Internet 0.40.1 (12-13-2014)
=======

An example application that captures prominent and ugly functionality found on the web. Perfect for writing automated acceptance tests against.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.40.0
0.40.1
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#0.40.1
+ Fixed a bug in the /shifting_content random example and down-sized it all down to one route that handles all use cases (e.g., normal, random, and specified pixel count). Also added helper text with links to the view

#0.40.0
+ Made is so the number of pixels can be specified in the URL for /shifting_content and /shifting_content/random

Expand Down
52 changes: 17 additions & 35 deletions server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
require 'zurb-foundation'
require 'compass'
require 'faker'
#require 'logger'

helpers Sinatra::Cookies
set :cookie_options, :domain => nil
enable :sessions
enable :sessions, :logging

configure :production do
require 'newrelic_rpm'
Expand Down Expand Up @@ -361,46 +362,27 @@ def authorized?
end

get '/shifting_content' do
pixel_count = [0, 25]
cookies[:page_visit_count] ||= '0'
page_visit_count = cookies[:page_visit_count].to_i

if page_visit_count.even?
@pixel_shift = pixel_count[0]
if params[:pixel_shift]
pixel_count = [0, params[:pixel_shift].to_i]
else
@pixel_shift = pixel_count[1]
pixel_count = [0, 25]
end

page_visit_count += 1
cookies[:page_visit_count] = page_visit_count.to_s
erb :shifting_content
end

get '/shifting_content/:pixel_shift' do |pixel_shift|
pixel_count = [0, pixel_shift]
cookies[:page_visit_count] ||= '0'
page_visit_count = cookies[:page_visit_count].to_i

if page_visit_count.even?
@pixel_shift = pixel_count[0]
if params[:mode] == 'random'
@pixel_shift = pixel_count[rand(2)]
else
@pixel_shift = pixel_count[1]
end

page_visit_count += 1
cookies[:page_visit_count] = page_visit_count.to_s
erb :shifting_content
end
cookies[:page_visit_count] ||= '0'
page_visit_count = cookies[:page_visit_count].to_i

get '/shifting_content/random' do
pixel_count = [0, 25]
@pixel_shift = pixel_count[rand(2)]
erb :shifting_content
end
if page_visit_count.even?
@pixel_shift = pixel_count[0]
else
@pixel_shift = pixel_count[1]
end
page_visit_count += 1
cookies[:page_visit_count] = page_visit_count.to_s
end

get '/shifting_content/random/:pixel_shift' do |pixel_shift|
pixel_count = [0, pixel_shift]
@pixel_shift = pixel_count[rand(2)]
erb :shifting_content
end

Expand Down
4 changes: 4 additions & 0 deletions views/shifting_content.erb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ li a:hover {
<h3>Shifting Content</h3>
<p>This example demonstrates elements on a page shifting a few pixels in either direction on each page load. This is meant to demonstrate some of the subtle rendering issues that occur cross-browser.</p>

<p>To load it randomly, append <code>?mode=random</code> to the URL. Or <a href='/shifting_content?mode=random'>click here</a>.</p>
<p>To specify a different number of pixels to shift the example, append <code>?pixel_shift=100</code> to the URL. Or <a href='/shifting_content?pixel_shift=100'>click here</a>.</p>
<p>To do both together, use <code>?mode=random&pixel_shift=100</code>. Or <a href='/shifting_content?mode=random&pixel_shift=100'>click here</a>.</p>

<hr>

<ul>
Expand Down

0 comments on commit 20a82f0

Please sign in to comment.