Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:railsrumble/giant-robots
Browse files Browse the repository at this point in the history
  • Loading branch information
Chad Pytel committed Oct 19, 2008
2 parents 93828c8 + 83bb6bb commit c50f344
Show file tree
Hide file tree
Showing 10 changed files with 111 additions and 28 deletions.
3 changes: 3 additions & 0 deletions app/models/quantity.rb
@@ -1,6 +1,7 @@
module Quantity
def self.quantities
[ "12 pack",
"2L",
"30 pack",
"baker's dozen",
"bottle",
Expand All @@ -14,7 +15,9 @@ def self.quantities
"half gallon",
"jar",
"jumbo",
"loaf",
"six pack",
"slice",
"quart" ]
end

Expand Down
21 changes: 12 additions & 9 deletions app/views/purchases/stores/_index.html.erb
@@ -1,11 +1,14 @@
<div class="map"><iframe width="400" height="165" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&amp;hl=en&amp;geocode=&amp;q=13031&amp;ie=UTF8&amp;z=12&amp;iwloc=addr&amp;ll=43.082179,-76.289062&amp;output=embed&amp;s=AARTsJrLXLIbU3SkIaqtfD9LRJnYR4XcaA"></iframe></div>
<div class="stores_container">
<% content_tag_for :div, @purchase, :map_for,
:style => "width: 400px; height: 160px;",
:class => 'map' do end %>

<ul class="other-stores">
<% @stores.each do |store| -%>
<% content_tag_for :li, store do %>
<span class="other-store-name"><%=h store.name %></span>
<span class="other-store-price"><%= number_to_formatted_currency(@item.purchases.cheapest.price) %></span>
<ol class="other-stores">
<% @stores.each do |store| -%>
<% content_tag_for :li, store do %>
<span class="other-store-name"><%=h store.name %></span>
<span class="other-store-price"><%= number_to_formatted_currency(@item.purchases.cheapest.price) %></span>
<% end -%>
<% end -%>
<% end -%>
</ul>
<br class="clear"/>
</ol>
</div>
11 changes: 10 additions & 1 deletion app/views/purchases/stores/index.js.rjs
@@ -1,3 +1,12 @@
page.replace_html dom_id(@purchase, :stores_for),
:partial => 'index'
page.visual_effect :blind_down, dom_id(@purchase, :stores_for)
page << <<-END
new Effect.BlindDown(#{dom_id(@purchase, :stores_for).inspect}, {
afterFinish: function() {
new StoreViewer({
mapContainer: #{dom_id(@purchase, :map_for).inspect},
stores: #{@stores.to_json}
});
}
});
END
Binary file modified design/home 03 - title top corner.psd
Binary file not shown.
Binary file modified design/mockups/header-text.psd
Binary file not shown.
Binary file added public/images/black-grad.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion public/javascripts/map.js
Expand Up @@ -235,8 +235,8 @@ StoreViewer = Class.create({
centerOnStore:
function(store) {
if (this.centered) {
this.map.panTo(new GLatLng(store.latitude, store.longitude));
this.map.setZoom(this.options.zoom);
this.map.panTo(new GLatLng(store.latitude, store.longitude));
} else {
this.map.setCenter(new GLatLng(store.latitude, store.longitude), this.options.zoom);
this.centered = true;
Expand Down
92 changes: 80 additions & 12 deletions public/stylesheets/main.css
@@ -1,3 +1,5 @@
/* @override http://localhost:3000/stylesheets/main.css?1224445200 */

html {
}

Expand Down Expand Up @@ -87,15 +89,15 @@ h1 {
color: white;
}

body.purchase-new li#purchases-new,
body.purchases-index li#purchases-index,
body.stores-index li#stores-index,
body.sessions-new li#sessions-new,
body.users-new li#users-new,
#menu li.active {
padding-bottom: 14px;
border-style: none;
background: #91cfd3 url(../images/active-tab-top.png) no-repeat 0 0;
width: 87px;
width: 94px;
margin-top: -8px;
height: 21px;
padding-left: 35px;
Expand Down Expand Up @@ -188,24 +190,25 @@ ul#purchases {
border-left: 1px solid #dae4e5;
border-top: 1px solid #dae4e5;
padding: 5px;
color: #57999d;
}

#new-item-name input {
input#purchase_item_name {
width: 455px;
margin-right: 20px;
color: #57999d;
font-size: 3em;
font-weight: bold;
}

#new-item-price input {
input#purchase_price {
width: 107px;
margin-right: 20px;
color: #57999d;
font-size: 3em;
}

#new-item-qty input {
input#purchase_quantity {
width: 130px;
margin-right: 20px;
color: #57999d;
Expand Down Expand Up @@ -418,6 +421,13 @@ li.purchase {

#purchases .more-info {
margin-top: 0px;
padding: 0px;
height: 220px;
}

#purchases .stores_container {
padding: 30px;
height: 160px;
}

.more-info .map {
Expand All @@ -434,24 +444,23 @@ li.purchase {
width: 390px;
}

ul.other-stores li {
ol.other-stores li {
color: #88e197;
clear: both;
float: right;
clear: both;
float: right;
margin-top: 10px;
padding: 10px;
display: block;
width: 100%;
font-size: 1em;
border-bottom: 1px dotted #aadde0;

border-bottom: 1px dotted #aadde0;
}

ul.other-stores li:last-child {
ol.other-stores li:last-child {
border-bottom-style: none;
}

ul.other-stores li:hover {
ol.other-stores li:hover {
color: #41c037;
}

Expand Down Expand Up @@ -898,6 +907,7 @@ body.items-index .copy li {
float: right;
margin-top: 3px;
margin-right: 412px;
padding-right: 18px;
}

.reminder input {
Expand Down Expand Up @@ -939,4 +949,62 @@ body.error .copy p {
margin-top: 20px;
}

/* @end */

/* @group flashes */

#flash_notice {
background-color: #f9eeb3;
padding: 10px;
color: #57999d;
margin-bottom: 20px;
background-image: url(../images/white-grad-small.png);
}

#errorExplanation {
color: #fff;
padding: 10px 30px;
background: rgba(255,0,4,0.65) url(../images/black-grad.png) repeat-x;
line-height: 1.5;
position: fixed;
top: 0;
width: 100%;
left: 0;
}

.fieldWithErrors input#purchase_quantity {
border-bottom: 4px solid #ff595c;
}

.fieldWithErrors input#purchase_item_name {
border-bottom: 4px solid #ff595c;
}

.fieldWithErrors input#purchase_price {
border-bottom: 4px solid #ff595c;
}

#errorExplanation h2 {
color: #651516;
font-size: 2em;
}

#errorExplanation p {
margin-top: 5px;
margin-bottom: 5px;
margin-left: 10px;
color: #901d1f;
}

.errorExplanation ul {
margin-left: 20px;
}

.errorExplanation li {
list-style-type: disc;
list-style-position: outside;
}



/* @end */
2 changes: 1 addition & 1 deletion test/functional/purchases_controller_test.rb
Expand Up @@ -36,7 +36,7 @@ class PurchasesControllerTest < ActionController::TestCase
end

before_should "paginate the purchases" do
@purchases.expects(:paginate).with().returns(@purchases)
@purchases.expects(:paginate).returns(@purchases)
end

should_eventually "paginate purchases" do
Expand Down
8 changes: 4 additions & 4 deletions test/functional/stores_controller_test.rb
Expand Up @@ -77,8 +77,8 @@ class StoresControllerTest < ActionController::TestCase

context "on JS POST to create with valid params" do
setup do
@latitude = 42.3971
@longitude = -71.126
@latitude = '42.3971'
@longitude = '-71.126'
post :create, :store => { :name => "store",
:location => 'Fairy land',
:latitude => @latitude,
Expand All @@ -93,11 +93,11 @@ class StoresControllerTest < ActionController::TestCase
should_change "Store.count", :by => 1

should "keep the passed latitude" do
assert_equal @latitude, assigns(:store).latitude
assert_equal BigDecimal.new(@latitude), assigns(:store).latitude
end

should "keep the passed longitude" do
assert_equal @longitude, assigns(:store).longitude
assert_equal BigDecimal.new(@longitude), assigns(:store).longitude
end

should "set the store id on the form" do
Expand Down

0 comments on commit c50f344

Please sign in to comment.