Skip to content
This repository has been archived by the owner on Apr 17, 2020. It is now read-only.

Commit

Permalink
update styles and overrides for 1.0.x new base theme
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Topolyanskiy committed Feb 3, 2012
1 parent cabd6a8 commit ebdd983
Show file tree
Hide file tree
Showing 64 changed files with 223 additions and 169 deletions.
135 changes: 68 additions & 67 deletions app/assets/javascripts/store/checkout.js
Original file line number Diff line number Diff line change
@@ -1,82 +1,83 @@
(function($){
$(document).ready(function(){
if($('.edit_order').is('*')){
//$('#checkout_form_address').validate();

var get_states = function(region){
var country = $('span#' + region + 'country :only-child').val();
return state_mapper[country];
}
//$('#checkout_form_address').validate();

var update_state = function(region) {
var states = get_states(region);

var state_select = $('span#' + region + 'state select');
var state_input = $('span#' + region + 'state input');

if(states) {
var selected = state_select.val();
state_select.html('');
var states_with_blank = [["",""]].concat(states);
$.each(states_with_blank, function(pos,id_nm) {
var opt = $(document.createElement('option'))
.attr('value', id_nm[0])
.html(id_nm[1]);
if(selected==id_nm[0]){
opt.attr('selected', 'selected');
}
state_select.append(opt);
});
state_select.removeAttr('disabled').show();
state_input.hide().attr('disabled', 'disabled');

} else {
state_input.removeAttr('disabled').show();
state_select.hide().attr('disabled', 'disabled');
}
var get_states = function(region){
var country = $('span#' + region + 'country :only-child').val();
return state_mapper[country];
}

};
var update_state = function(region) {
var states = get_states(region);

var show_payment_method = function(){
$('li.payment_method').hide();
var id = $("input[name='order[payments_attributes][][payment_method_id]']:checked").val()
var state_select = $('span#' + region + 'state select');
var state_input = $('span#' + region + 'state input');

if(states) {
var selected = state_select.val();
state_select.html('');
var states_with_blank = [["",""]].concat(states);
$.each(states_with_blank, function(pos,id_nm) {
var opt = $(document.createElement('option'))
.attr('value', id_nm[0])
.html(id_nm[1]);
if(selected==id_nm[0]){
opt.attr('selected', 'selected');
}
state_select.append(opt);
});
state_select.removeAttr('disabled').show();
state_input.hide().attr('disabled', 'disabled');

$('li.payment_method.' + id).show();
} else {
state_input.removeAttr('disabled').show();
state_select.hide().attr('disabled', 'disabled');
}

// Show fields for the selected payment method
$("input[type='radio'][name='order[payments_attributes][][payment_method_id]']").change(function(){
show_payment_method();
})

$('span#bcountry select').change(function() { update_state('b'); });
$('span#scountry select').change(function() { update_state('s'); });
update_state('b');
update_state('s');
show_payment_method()

$('input#order_use_billing').click(function() {
if($(this).is(':checked')) {
$('#shipping .inner').hide();
$('#shipping .inner input, #shipping .inner select').attr('disabled', 'disabled');
} else {
$('#shipping .inner').show();
$('#shipping .inner input, #shipping .inner select').removeAttr('disabled', 'disabled');

//only want to enable relevant field
if(get_states('s')){
$('span#sstate input').hide().attr('disabled', 'disabled');
}else{
$('span#sstate select').hide().attr('disabled', 'disabled');
}
};

var show_payment_method = function(){
$('li.payment_method').hide();
var id = $("input[name='order[payments_attributes][][payment_method_id]']:checked").val()

$('li.payment_method.' + id).show();
}

// Show fields for the selected payment method
$("input[type='radio'][name='order[payments_attributes][][payment_method_id]']").change(function(){
show_payment_method();
})

$('span#bcountry select').change(function() { update_state('b'); });
$('span#scountry select').change(function() { update_state('s'); });
update_state('b');
update_state('s');
show_payment_method()

$('input#order_use_billing').click(function() {
if($(this).is(':checked')) {
$('#shipping .inner').hide();
$('#shipping .inner input, #shipping .inner select').attr('disabled', 'disabled');
} else {
$('#shipping .inner').show();
$('#shipping .inner input, #shipping .inner select').removeAttr('disabled', 'disabled');

//only want to enable relevant field
if(get_states('s')){
$('span#sstate input').hide().attr('disabled', 'disabled');
}else{
$('span#sstate select').hide().attr('disabled', 'disabled');
}
}).triggerHandler('click');

$('form.edit_checkout').submit(function() {
$(this).find(':submit, :image').attr('disabled', true).removeClass('primary').addClass('disabled');
});
}
}).triggerHandler('click');

$('form.edit_checkout').submit(function() {
$(this).find(':submit, :image').attr('disabled', true).removeClass('primary').addClass('disabled');
});


}
});
})(jQuery);

8 changes: 8 additions & 0 deletions app/assets/javascripts/store/rdr_wishlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,12 @@ $(document).ready(function() {
return false;
});
}

// Remove an item from the cart by setting its quantity to zero and posting the update form
$('form#updatecart a.delete').show().click(function(){
$(this).parents('tr').find('input.line_item_quantity').val(0);
$(this).parents('form').submit();
return false;
});

});
Empty file.
4 changes: 3 additions & 1 deletion app/assets/stylesheets/store/checkout.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ select {
color: #333;
}

input[type='text'], input[type='password'] {
input[type='text'], input[type='password'],
input[type="email"], input[type="url"],
input[type="phone"] {
font-size: 18px;
padding: 7px 5px 5px;
border: 2px solid #A0A0A0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,7 @@ footer #copyright {
text-align: right;
}





button, a.button {
button, a.button, .button {
border: none;
background-color: #0095DA;
color: #fff!important;
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/store/login.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ body#login #local_login input[type='password'] {
width: 100%
}

body#login #local_login button {
body#login #local_login .button {
margin: 0 33%;
}
21 changes: 18 additions & 3 deletions app/assets/stylesheets/store/products.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ body#product-details #product-description {
#product-images #thumbnails li a {
display: block;
width: 45px;
height: 35px;
float: left;
border: 2px solid #ccc;
margin: 0 2px 0 2px;
border: 2px solid #CCC;
margin: 2px;
text-align: center;
border-image: initial;
}

#product-images #thumbnails li a img {
Expand Down Expand Up @@ -116,3 +116,18 @@ dl.part-numbers dd {
margin-left: 20px;
display: block;
}

#product-variants ul{
margin: 0;
list-style: none;
}
#product-variants ul li {
margin-bottom: 10px;
}
#product-variants ul li span.price {
font-size: 12px;
color: red;
}
#product-variants ul li label {
display: inline;
}
2 changes: 1 addition & 1 deletion app/assets/stylesheets/store/rdr.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*= require store/reset
*= require store/typography
*= require store/misc
*= require store/screen
*= require store/display
*= require store/taxonomy
*= require store/products
*= require store/cart
Expand Down
Empty file.
Empty file.
4 changes: 2 additions & 2 deletions app/overrides/add_related_products_to_cart_form.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
if Rails.application.railties.all.map(&:railtie_name).include? "spree_related_products"

Deface::Override.new(:virtual_path => %q{products/show},
Deface::Override.new(:virtual_path => %q{spree/products/show},
:name => %q{add_related_products_to_cart_form},
:replace => %q{[data-hook='cart_form'] hr},
:sequence => {:after => "replace_cart_form" },
Expand All @@ -10,7 +10,7 @@
<p>
<%= check_box_tag "variants[#{cross_sell.master.id}]", 1 %>
<label for="">
Add <em>'<%= link_to cross_sell.name, product_url(cross_sell) %>'</em> for <%= product_price(cross_sell) %>
Add <em>'<%= link_to cross_sell.name, product_url(cross_sell) %>'</em> for <%=number_to_currency(cross_sell.price) %>
</label>
</p>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/overrides/add_taxonomies_to_product_show.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Deface::Override.new(:virtual_path => %q{products/show},
Deface::Override.new(:virtual_path => %q{spree/products/show},
:name => %q{add_taxonomies_to_product_show},
:insert_after => %q{[data-hook='product_show']},
:sequence => {:after => 'add_recently_viewed_products_to_products_show'},
Expand Down
2 changes: 1 addition & 1 deletion app/overrides/add_to_head.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Deface::Override.new(:virtual_path => %q{shared/_head},
Deface::Override.new(:virtual_path => %q{spree/shared/_head},
:name => %q{add_to_head},
:insert_after => %q{code[erb-loud]:contains('stylesheet_link_tag')},
:text => %q{<link href="<%=request.protocol%>fonts.googleapis.com/css?family=Arvo:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">})
2 changes: 1 addition & 1 deletion app/overrides/drop_icon_from_add_to_wishlist.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Deface::Override.new(:virtual_path => 'products/show',
Deface::Override.new(:virtual_path => 'spree/products/show',
:name => 'drop_icon_from_add_to_wishlist',
:replace => "code[erb-loud]:contains('icons/add-to-cart')",
:text => %q{<%= t('add_to_wishlist') %>},
Expand Down
4 changes: 2 additions & 2 deletions app/overrides/redefine_add_socials_to_login_extras.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
if Rails.application.railties.all.map(&:railtie_name).include? "spree_social"

Deface::Override.new(:virtual_path => "user_registrations/new",
Deface::Override.new(:virtual_path => "spree/user_registrations/new",
:name => "add_socials_to_login_extras",
:disabled => true)

Deface::Override.new(:virtual_path => "user_sessions/new",
Deface::Override.new(:virtual_path => "spree/user_sessions/new",
:name => "add_socials_to_login_extras",
:disabled => true)

Expand Down
2 changes: 1 addition & 1 deletion app/overrides/redefine_add_wish_to_cart_form.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
if Rails.application.railties.all.map(&:railtie_name).include? "spree_wishlist"

Deface::Override.new(:virtual_path => 'products/show',
Deface::Override.new(:virtual_path => 'spree/products/show',
:name => 'add_wish_to_cart_form',
:sequence => {:after => 'replace_product_show'})

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
if Rails.application.railties.all.map(&:railtie_name).include? "spree_wishlist"

Deface::Override.new(:virtual_path => "users/show",
Deface::Override.new(:virtual_path => "spree/users/show",
:name => "add_wishlists_to_account_my_orders",
:text => %q{<h3>
My Wishlists:
Expand Down
6 changes: 3 additions & 3 deletions app/overrides/redefine_recently_viewed_overrides.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
if Rails.application.railties.all.map(&:railtie_name).include? "spree_recently_viewed"

Deface::Override.new(:virtual_path => 'shared/_products',
Deface::Override.new(:virtual_path => 'spree/shared/_products',
:name => 'add_recently_viewed_products_to_products_index',
:disabled => true)

Deface::Override.new(:virtual_path => 'products/show',
Deface::Override.new(:virtual_path => 'spree/products/show',
:name => 'add_recently_viewed_products_to_products_show',
:disabled => true)

Deface::Override.new(:virtual_path => 'shared/_recently_viewed_products',
Deface::Override.new(:virtual_path => 'spree/shared/_recently_viewed_products',
:name => 'change_title',
:replace => 'h3',
:text => '<h2>Recently Viewed</h2>')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
if Rails.application.railties.all.map(&:railtie_name).include? "spree_social"

Deface::Override.new(:virtual_path => "users/show",
Deface::Override.new(:virtual_path => "spree/users/show",
:name => "replace_account_summary_with_social_logins",
:replace => "[data-hook='account_summary']",
:sequence => {:after => 'replace_account_my_orders'},
Expand Down
2 changes: 1 addition & 1 deletion app/overrides/remove_account_summary.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Deface::Override.new(:virtual_path => %q{users/show},
Deface::Override.new(:virtual_path => %q{spree/users/show},
:name => %q{remove_account_summary},
:remove => %q{[data-hook='account_summary']})
2 changes: 1 addition & 1 deletion app/overrides/remove_brs_from_login_form.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Deface::Override.new(:virtual_path => %q{shared/_login},
Deface::Override.new(:virtual_path => %q{spree/shared/_login},
:name => %q{remove_brs_from_login_form},
:remove => %q{br})
2 changes: 1 addition & 1 deletion app/overrides/remove_brs_from_user_form.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Deface::Override.new(:virtual_path => %q{shared/_user_form},
Deface::Override.new(:virtual_path => %q{spree/shared/_user_form},
:name => %q{remove_brs_from_user_form},
:remove => %q{br})

2 changes: 1 addition & 1 deletion app/overrides/remove_card_expiration.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Deface::Override.new(:virtual_path => %q{checkout/payment/_gateway},
Deface::Override.new(:virtual_path => %q{spree/checkout/payment/_gateway},
:name => %q{remove_card_expiration},
:remove => %q{[data-hook='card_expiration']})
2 changes: 1 addition & 1 deletion app/overrides/remove_cart_code.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Deface::Override.new(:virtual_path => %q{checkout/payment/_gateway},
Deface::Override.new(:virtual_path => %q{spree/checkout/payment/_gateway},
:name => %q{remove_cart_code},
:remove => %q{[data-hook='cart_code']})
2 changes: 1 addition & 1 deletion app/overrides/remove_checkout_registration_header.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Deface::Override.new(:virtual_path => %q{checkout/registration},
Deface::Override.new(:virtual_path => %q{spree/checkout/registration},
:name => %q{remove_checkout_registration_header},
:remove => %q{h2},
:sequence => {:before => 'replace_checkout_registration' })
2 changes: 1 addition & 1 deletion app/overrides/remove_confirm_buttons.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Deface::Override.new(:virtual_path => %q{checkout/_confirm},
Deface::Override.new(:virtual_path => %q{spree/checkout/_confirm},
:name => %q{remove_confirm_buttons},
:remove => %q{[data-hook='buttons']})
2 changes: 1 addition & 1 deletion app/overrides/remove_delivery_buttons.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Deface::Override.new(:virtual_path => %q{checkout/_delivery},
Deface::Override.new(:virtual_path => %q{spree/checkout/_delivery},
:name => %q{remove_delivery_buttons},
:remove => %q{[data-hook='buttons']})
2 changes: 1 addition & 1 deletion app/overrides/remove_gateway_icons.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Deface::Override.new(:virtual_path => %q{checkout/payment/_gateway},
Deface::Override.new(:virtual_path => %q{spree/checkout/payment/_gateway},
:name => %q{remove_gateway_icons},
:remove => %q{code[erb-loud]:contains('image_tag')},
:sequence => {:before => 'replace_gateway_fields' })
Expand Down
2 changes: 1 addition & 1 deletion app/overrides/remove_orders_show_header.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Deface::Override.new(:virtual_path => %q{orders/show},
Deface::Override.new(:virtual_path => %q{spree/orders/show},
:name => %q{remove_orders_show_header},
:remove => %q{h1},
:sequence => {:before => 'replace_orders_show' })
Expand Down
2 changes: 1 addition & 1 deletion app/overrides/remove_payment_buttons.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Deface::Override.new(:virtual_path => %q{checkout/_payment},
Deface::Override.new(:virtual_path => %q{spree/checkout/_payment},
:name => %q{remove_payment_buttons},
:remove => %q{[data-hook='buttons']})
2 changes: 1 addition & 1 deletion app/overrides/remove_shipping.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Deface::Override.new(:virtual_path => %q{checkout/_address},
Deface::Override.new(:virtual_path => %q{spree/checkout/_address},
:name => %q{remove_shipping},
:remove => %q{#shipping[data-hook]})
2 changes: 1 addition & 1 deletion app/overrides/remove_summary_title.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Deface::Override.new(:virtual_path => %q{checkout/_summary},
Deface::Override.new(:virtual_path => %q{spree/checkout/_summary},
:name => %q{remove_summary_title},
:remove => %q{h3},
:sequence => {:before => 'replace_order_summary'})
Loading

0 comments on commit ebdd983

Please sign in to comment.