Commit a284126b by Hoang Phuc Committed by Hoang Phuc Do

Quantity input in product show

parent d84cb7a5
...@@ -52,6 +52,8 @@ gem 'ckeditor', '~> 4.2', '>= 4.2.3' ...@@ -52,6 +52,8 @@ gem 'ckeditor', '~> 4.2', '>= 4.2.3'
gem 'font-awesome-rails', '~> 4.7', '>= 4.7.0.2' gem 'font-awesome-rails', '~> 4.7', '>= 4.7.0.2'
# Use jquery as the JavaScript library # Use jquery as the JavaScript library
gem 'jquery-rails' gem 'jquery-rails'
# Bootstrap TouchSpin is a mobile and touch friendly input spinner component for Bootstrap
gem 'rails-assets-bootstrap-touchspin', source: 'https://rails-assets.org'
# Use Capistrano for deployment # Use Capistrano for deployment
# gem 'capistrano-rails', group: :development # gem 'capistrano-rails', group: :development
......
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
remote: https://rails-assets.org/
specs: specs:
actioncable (5.1.1) actioncable (5.1.1)
actionpack (= 5.1.1) actionpack (= 5.1.1)
...@@ -193,6 +194,12 @@ GEM ...@@ -193,6 +194,12 @@ GEM
bundler (>= 1.3.0, < 2.0) bundler (>= 1.3.0, < 2.0)
railties (= 5.1.1) railties (= 5.1.1)
sprockets-rails (>= 2.0.0) sprockets-rails (>= 2.0.0)
rails-assets-bootstrap (3.3.7)
rails-assets-jquery (>= 1.9.1, < 4)
rails-assets-bootstrap-touchspin (3.1.2)
rails-assets-bootstrap (>= 3.0.0)
rails-assets-jquery (>= 1.9.0)
rails-assets-jquery (3.2.1)
rails-dom-testing (2.0.3) rails-dom-testing (2.0.3)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
nokogiri (>= 1.6) nokogiri (>= 1.6)
...@@ -300,6 +307,7 @@ DEPENDENCIES ...@@ -300,6 +307,7 @@ DEPENDENCIES
mysql2 (>= 0.3.18, < 0.5) mysql2 (>= 0.3.18, < 0.5)
puma (~> 3.7) puma (~> 3.7)
rails (~> 5.1.1) rails (~> 5.1.1)
rails-assets-bootstrap-touchspin!
rubocop (~> 0.49.1) rubocop (~> 0.49.1)
sass-rails (~> 5.0) sass-rails (~> 5.0)
selenium-webdriver selenium-webdriver
...@@ -311,4 +319,4 @@ DEPENDENCIES ...@@ -311,4 +319,4 @@ DEPENDENCIES
web-console (>= 3.3.0) web-console (>= 3.3.0)
BUNDLED WITH BUNDLED WITH
1.15.0 1.15.1
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
// //
//= require jquery //= require jquery
//= require jquery_ujs //= require jquery_ujs
//= require bootstrap-touchspin
//# require rails-ujs //# require rails-ujs
//= require turbolinks //= require turbolinks
//# require_tree . //# require_tree .
(function($) {
// Vertical Spinner - Touchspin - Product Details Quantity input
if ( $.fn.TouchSpin ) {
$('#product_vqty').TouchSpin({
verticalbuttons: true
});
$('#qty_input').TouchSpin();
}
}).apply(this, [jQuery]);
\ No newline at end of file
//= require shop-14
\ No newline at end of file
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
* *
*# require_tree . *# require_tree .
*= require_self *= require_self
*= require bootstrap-touchspin
*= require font-awesome
*= require custom *= require custom
*= require main_style *= require main_style
*= require skin_14 *= require skin_14
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
/* /*
* Common styles * Common styles
*/ */
...@@ -69,6 +70,7 @@ a { ...@@ -69,6 +70,7 @@ a {
width: 1280px; width: 1280px;
} }
} }
@media (min-width: 992px) { @media (min-width: 992px) {
.col-md-9 { .col-md-9 {
padding-right: 12px; padding-right: 12px;
...@@ -85,6 +87,7 @@ a { ...@@ -85,6 +87,7 @@ a {
padding-right: 12px; padding-right: 12px;
} }
} }
/* /*
* Header * Header
*/ */
...@@ -92,6 +95,7 @@ a { ...@@ -92,6 +95,7 @@ a {
float: left; float: left;
position: relative; position: relative;
} }
.minicart-icon:before { .minicart-icon:before {
font-family: "minicart-font" !important; font-family: "minicart-font" !important;
font-style: normal !important; font-style: normal !important;
...@@ -107,6 +111,7 @@ a { ...@@ -107,6 +111,7 @@ a {
.minicart-icon:before { .minicart-icon:before {
content: "\e800"; content: "\e800";
} }
#header .header-row { #header .header-row {
display: table-row; display: table-row;
clear: both; clear: both;
...@@ -125,15 +130,18 @@ a { ...@@ -125,15 +130,18 @@ a {
display: block; display: block;
clear: right; clear: right;
} }
#header .cart-area { #header .cart-area {
float: right; float: right;
vertical-align: middle; vertical-align: middle;
} }
@media (max-width: 991px) { @media (max-width: 991px) {
#header .cart-area { #header .cart-area {
margin-top: 5.5px; margin-top: 5.5px;
} }
} }
#header .cart-dropdown { #header .cart-dropdown {
position: relative; position: relative;
display: inline-block; display: inline-block;
...@@ -141,6 +149,7 @@ a { ...@@ -141,6 +149,7 @@ a {
padding-left: 7px; padding-left: 7px;
padding-right: 7px; padding-right: 7px;
} }
#header .cart-dropdown .cart-dropdown-icon { #header .cart-dropdown .cart-dropdown-icon {
position: relative; position: relative;
display: inline-block; display: inline-block;
...@@ -152,10 +161,12 @@ a { ...@@ -152,10 +161,12 @@ a {
color: #fff; color: #fff;
text-decoration: none !important; text-decoration: none !important;
} }
#header .cart-dropdown .cart-dropdown-icon i { #header .cart-dropdown .cart-dropdown-icon i {
font-size: 35px; font-size: 35px;
color: #000; color: #000;
} }
#header .cart-dropdown .cart-dropdown-icon .cart-info { #header .cart-dropdown .cart-dropdown-icon .cart-info {
position: absolute; position: absolute;
width: 100%; width: 100%;
...@@ -167,10 +178,12 @@ a { ...@@ -167,10 +178,12 @@ a {
display: block; display: block;
line-height: 1; line-height: 1;
} }
#header .cart-dropdown .cart-dropdown-icon .cart-info .cart-qty { #header .cart-dropdown .cart-dropdown-icon .cart-info .cart-qty {
font-size: 14px; font-size: 14px;
font-weight: 600; font-weight: 600;
} }
/* /*
* Button * Button
*/ */
...@@ -188,36 +201,45 @@ a { ...@@ -188,36 +201,45 @@ a {
padding: 0; padding: 0;
margin: 0 -10px 0; margin: 0 -10px 0;
} }
.products-grid:after { .products-grid:after {
content: ''; content: '';
display: table; display: table;
clear: both; clear: both;
} }
.products-grid li { .products-grid li {
width: 100%; width: 100%;
padding: 10px 10px 0; padding: 10px 10px 0;
} }
.products-grid.columns6 { .products-grid.columns6 {
margin: 0 -5px; margin: 0 -5px;
} }
.products-grid.columns6 li { .products-grid.columns6 li {
padding-left: 5px; padding-left: 5px;
padding-right: 5px; padding-right: 5px;
} }
.products-grid.columns7 { .products-grid.columns7 {
margin: 0 -4px; margin: 0 -4px;
} }
.products-grid.columns7 li { .products-grid.columns7 li {
padding-left: 4px; padding-left: 4px;
padding-right: 4px; padding-right: 4px;
} }
.products-grid.columns8 { .products-grid.columns8 {
margin: 0 -3px; margin: 0 -3px;
} }
.products-grid.columns8 li { .products-grid.columns8 li {
padding-left: 3px; padding-left: 3px;
padding-right: 3px; padding-right: 3px;
} }
@media (min-width: 480px) { @media (min-width: 480px) {
.products-grid li { .products-grid li {
float: left; float: left;
...@@ -236,6 +258,7 @@ a { ...@@ -236,6 +258,7 @@ a {
clear: left; clear: left;
} }
} }
@media (min-width: 768px) { @media (min-width: 768px) {
.products-grid.columns3 li, .products-grid.columns4 li { .products-grid.columns3 li, .products-grid.columns4 li {
width: 33.33%; width: 33.33%;
...@@ -256,6 +279,7 @@ a { ...@@ -256,6 +279,7 @@ a {
clear: left; clear: left;
} }
} }
@media (min-width: 992px) { @media (min-width: 992px) {
.products-grid.columns6 li, .products-grid.columns7 li, .products-grid.columns8 li { .products-grid.columns6 li, .products-grid.columns7 li, .products-grid.columns8 li {
width: 20%; width: 20%;
...@@ -267,6 +291,7 @@ a { ...@@ -267,6 +291,7 @@ a {
clear: left; clear: left;
} }
} }
@media (min-width: 1200px) { @media (min-width: 1200px) {
.products-grid.columns4 li { .products-grid.columns4 li {
width: 25%; width: 25%;
...@@ -323,6 +348,7 @@ a { ...@@ -323,6 +348,7 @@ a {
padding: 0; padding: 0;
margin: 0 -10px 0; margin: 0 -10px 0;
} }
.products-list li { .products-list li {
padding: 10px; padding: 10px;
width: 100%; width: 100%;
...@@ -331,18 +357,21 @@ a { ...@@ -331,18 +357,21 @@ a {
.product { .product {
position: relative; position: relative;
} }
.product .product-image-area { .product .product-image-area {
overflow: hidden; overflow: hidden;
position: relative; position: relative;
background-color: #fff; background-color: #fff;
border-radius: 0; border-radius: 0;
} }
.product .product-image-area .product-image { .product .product-image-area .product-image {
display: block; display: block;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
border-radius: 0; border-radius: 0;
} }
.product .product-image-area .product-image img { .product .product-image-area .product-image img {
display: block; display: block;
width: 100%; width: 100%;
...@@ -351,6 +380,7 @@ a { ...@@ -351,6 +380,7 @@ a {
-moz-transition: all 0.3s; -moz-transition: all 0.3s;
transition: all 0.3s; transition: all 0.3s;
} }
.product .product-image-area .product-image .product-hover-image { .product .product-image-area .product-image .product-hover-image {
position: absolute; position: absolute;
left: 0; left: 0;
...@@ -358,6 +388,7 @@ a { ...@@ -358,6 +388,7 @@ a {
opacity: 0; opacity: 0;
visibility: hidden; visibility: hidden;
} }
.product .product-image-area .product-actions { .product .product-image-area .product-actions {
position: absolute; position: absolute;
width: 100%; width: 100%;
...@@ -371,6 +402,7 @@ a { ...@@ -371,6 +402,7 @@ a {
-moz-transition: opacity 0.2s; -moz-transition: opacity 0.2s;
transition: opacity 0.2s; transition: opacity 0.2s;
} }
.product .product-image-area .product-actions .addtocart, .product .product-image-area .product-actions .addtocart,
.product .product-image-area .product-actions .comparelink, .product .product-image-area .product-actions .comparelink,
.product .product-image-area .product-actions .addtowishlist { .product .product-image-area .product-actions .addtowishlist {
...@@ -390,6 +422,7 @@ a { ...@@ -390,6 +422,7 @@ a {
margin-top: 0; margin-top: 0;
margin-bottom: 0; margin-bottom: 0;
} }
.product .product-quickview { .product .product-quickview {
position: absolute; position: absolute;
right: 0; right: 0;
...@@ -407,17 +440,21 @@ a { ...@@ -407,17 +440,21 @@ a {
font-size: 12px; font-size: 12px;
line-height: 1.4; line-height: 1.4;
} }
.product .product-quickview span { .product .product-quickview span {
margin-left: 2px; margin-left: 2px;
} }
.product .product-quickview:hover, .product .product-quickview:focus { .product .product-quickview:hover, .product .product-quickview:focus {
opacity: 0.9 !important; opacity: 0.9 !important;
color: #fff; color: #fff;
text-decoration: none; text-decoration: none;
} }
.product .product-quickview:hover span, .product .product-quickview:focus span { .product .product-quickview:hover span, .product .product-quickview:focus span {
text-decoration: underline; text-decoration: underline;
} }
.product .product-label { .product .product-label {
position: absolute; position: absolute;
right: 10px; right: 10px;
...@@ -427,9 +464,11 @@ a { ...@@ -427,9 +464,11 @@ a {
z-index: 5; z-index: 5;
text-align: center; text-align: center;
} }
.product .product-label + .product-label { .product .product-label + .product-label {
top: 40px; top: 40px;
} }
.product .product-label span { .product .product-label span {
display: block; display: block;
position: relative; position: relative;
...@@ -439,56 +478,70 @@ a { ...@@ -439,56 +478,70 @@ a {
text-transform: uppercase; text-transform: uppercase;
border-radius: 0; border-radius: 0;
} }
.product .product-label span.discount { .product .product-label span.discount {
background-color: #e27c7c; background-color: #e27c7c;
} }
.product .product-label span.new { .product .product-label span.new {
background-color: #62b959; background-color: #62b959;
} }
.product .product-details-area { .product .product-details-area {
padding: 10px; padding: 10px;
text-align: center; text-align: center;
} }
.product .product-details-area .product-actions { .product .product-details-area .product-actions {
margin: 0 -10px; margin: 0 -10px;
} }
.product .product-name { .product .product-name {
color: #777; color: #777;
font-weight: 400; font-weight: 400;
font-size: 14px; font-size: 14px;
margin: 0 0 3px; margin: 0 0 3px;
} }
.product .product-name a { .product .product-name a {
color: #777; color: #777;
} }
.product .product-name a:hover, .product .product-name a:focus { .product .product-name a:hover, .product .product-name a:focus {
color: #000; color: #000;
text-decoration: none; text-decoration: none;
} }
.product:hover .product-image-area .product-actions { .product:hover .product-image-area .product-actions {
visibility: visible; visibility: visible;
opacity: 1; opacity: 1;
} }
.product:hover .product-image-area .product-actions .addtocart { .product:hover .product-image-area .product-actions .addtocart {
color: #000; color: #000;
background-color: #fff; background-color: #fff;
border: 1px solid #000; border: 1px solid #000;
} }
.product:hover .product-image-area .product-actions .addtocart:hover, .product:hover .product-image-area .product-actions .addtocart:focus { .product:hover .product-image-area .product-actions .addtocart:hover, .product:hover .product-image-area .product-actions .addtocart:focus {
color: #fff; color: #fff;
border-color: #000; border-color: #000;
background-color: #000; background-color: #000;
} }
.product:hover .product-image-area .product-actions .comparelink:hover, .product:hover .product-image-area .product-actions .comparelink:focus { .product:hover .product-image-area .product-actions .comparelink:hover, .product:hover .product-image-area .product-actions .comparelink:focus {
background-color: #52b9b5; background-color: #52b9b5;
} }
.product:hover .product-image-area .product-actions .addtowishlist:hover, .product:hover .product-image-area .product-actions .addtowishlist:focus { .product:hover .product-image-area .product-actions .addtowishlist:hover, .product:hover .product-image-area .product-actions .addtowishlist:focus {
background-color: #ed4949; background-color: #ed4949;
} }
.product:hover .product-image-area .product-image .product-hover-image { .product:hover .product-image-area .product-image .product-hover-image {
visibility: visible; visibility: visible;
opacity: 1; opacity: 1;
} }
.product:hover .product-quickview { .product:hover .product-quickview {
visibility: visible; visibility: visible;
opacity: 1; opacity: 1;
...@@ -498,20 +551,24 @@ a { ...@@ -498,20 +551,24 @@ a {
font-size: 0; font-size: 0;
margin: 5px 0 3px; margin: 5px 0 3px;
} }
.product-price-box .old-price, .product-price-box .old-price,
.product-price-box .product-price { .product-price-box .product-price {
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
font-weight: 600; font-weight: 600;
} }
.product-price-box .old-price { .product-price-box .old-price {
color: #999; color: #999;
font-size: 14px; font-size: 14px;
text-decoration: line-through; text-decoration: line-through;
} }
.product-price-box .old-price + .product-price { .product-price-box .old-price + .product-price {
margin-left: 6px; margin-left: 6px;
} }
.product-price-box .product-price { .product-price-box .product-price {
font-size: 20px; font-size: 20px;
color: #444; color: #444;
...@@ -528,9 +585,11 @@ a { ...@@ -528,9 +585,11 @@ a {
-moz-transition: all 0.3s; -moz-transition: all 0.3s;
transition: all 0.3s; transition: all 0.3s;
} }
.product-actions a:hover, .product-actions a:focus { .product-actions a:hover, .product-actions a:focus {
text-decoration: none; text-decoration: none;
} }
.product-actions a.addtocart { .product-actions a.addtocart {
color: #333; color: #333;
background-color: #fff; background-color: #fff;
...@@ -540,24 +599,29 @@ a { ...@@ -540,24 +599,29 @@ a {
line-height: 30px; line-height: 30px;
border: 1px solid #ccc; border: 1px solid #ccc;
} }
.product-actions a.addtocart i { .product-actions a.addtocart i {
font-size: 15px; font-size: 15px;
margin-right: 2px; margin-right: 2px;
} }
.product:hover .product-actions a.addtocart { .product:hover .product-actions a.addtocart {
background-color: #000; background-color: #000;
border-color: #000; border-color: #000;
color: #fff; color: #fff;
} }
.product-actions a.addtocart.outofstock { .product-actions a.addtocart.outofstock {
padding: 0 10px; padding: 0 10px;
cursor: default; cursor: default;
} }
.product:hover .product-actions a.addtocart.outofstock { .product:hover .product-actions a.addtocart.outofstock {
color: #333 !important; color: #333 !important;
background-color: #fff !important; background-color: #fff !important;
border-color: #ccc !important; border-color: #ccc !important;
} }
.product-actions a.addtowishlist, .product-actions a.comparelink, .product-actions a.quickview { .product-actions a.addtowishlist, .product-actions a.comparelink, .product-actions a.quickview {
font-size: 17px; font-size: 17px;
height: 32px; height: 32px;
...@@ -567,43 +631,52 @@ a { ...@@ -567,43 +631,52 @@ a {
visibility: hidden; visibility: hidden;
opacity: 0; opacity: 0;
} }
.hide-addtolinks .product-actions a.addtowishlist, .hide-addtolinks .product-actions a.comparelink, .hide-addtolinks .product-actions a.quickview { .hide-addtolinks .product-actions a.addtowishlist, .hide-addtolinks .product-actions a.comparelink, .hide-addtolinks .product-actions a.quickview {
display: none; display: none;
} }
.product-actions a.addtowishlist { .product-actions a.addtowishlist {
right: -37px; right: -37px;
color: #ed4949; color: #ed4949;
border: 1px solid #ed4949; border: 1px solid #ed4949;
} }
.product-actions a.addtowishlist:hover { .product-actions a.addtowishlist:hover {
color: #fff; color: #fff;
background-color: #ed4949; background-color: #ed4949;
} }
.product:hover .product-actions a.addtowishlist { .product:hover .product-actions a.addtowishlist {
visibility: visible; visibility: visible;
opacity: 1; opacity: 1;
right: 0; right: 0;
} }
.product-actions a.comparelink { .product-actions a.comparelink {
left: -37px; left: -37px;
color: #52b9b5; color: #52b9b5;
border: 1px solid #52b9b5; border: 1px solid #52b9b5;
} }
.product-actions a.comparelink:hover { .product-actions a.comparelink:hover {
color: #fff; color: #fff;
background-color: #52b9b5; background-color: #52b9b5;
} }
.product:hover .product-actions a.comparelink { .product:hover .product-actions a.comparelink {
visibility: visible; visibility: visible;
opacity: 1; opacity: 1;
left: 0; left: 0;
} }
.product-actions a.quickview { .product-actions a.quickview {
visibility: visible; visibility: visible;
opacity: 1; opacity: 1;
color: #000; color: #000;
border: 1px solid #000; border: 1px solid #000;
} }
.product-actions a.quickview:hover { .product-actions a.quickview:hover {
color: #fff; color: #fff;
background-color: #000; background-color: #000;
...@@ -614,39 +687,48 @@ a { ...@@ -614,39 +687,48 @@ a {
display: table; display: table;
clear: both; clear: both;
} }
.product.product-list .product-details-area { .product.product-list .product-details-area {
text-align: left; text-align: left;
padding: 0 20px; padding: 0 20px;
} }
.product.product-list .product-short-desc { .product.product-list .product-short-desc {
font-size: 14px; font-size: 14px;
line-height: 1.5; line-height: 1.5;
} }
.product.product-list .product-ratings { .product.product-list .product-ratings {
background: none; background: none;
margin-bottom: 10px; margin-bottom: 10px;
} }
.product.product-list .product-name { .product.product-list .product-name {
font-size: 18px; font-size: 18px;
margin: 10px 0; margin: 10px 0;
} }
.product.product-list .product-price-box { .product.product-list .product-price-box {
margin-top: 10px; margin-top: 10px;
} }
.product.product-list .product-actions { .product.product-list .product-actions {
margin: 0; margin: 0;
} }
.product.product-list .product-actions a.addtowishlist, .product.product-list .product-actions a.comparelink, .product.product-list .product-actions a.quickview { .product.product-list .product-actions a.addtowishlist, .product.product-list .product-actions a.comparelink, .product.product-list .product-actions a.quickview {
left: auto; left: auto;
right: auto; right: auto;
visibility: visible; visibility: visible;
opacity: 1; opacity: 1;
} }
.product.product-list .product-actions a.addtocart { .product.product-list .product-actions a.addtocart {
background-color: #000; background-color: #000;
border-color: #000; border-color: #000;
color: #fff; color: #fff;
} }
@media (min-width: 600px) { @media (min-width: 600px) {
.product.product-list .product-image-area { .product.product-list .product-image-area {
float: left; float: left;
...@@ -666,38 +748,47 @@ a { ...@@ -666,38 +748,47 @@ a {
padding: 6px 0 8px; padding: 6px 0 8px;
max-width: 300px; max-width: 300px;
} }
.product.product-sm:after { .product.product-sm:after {
content: ''; content: '';
display: table; display: table;
clear: both; clear: both;
} }
.product.product-sm .product-image-area { .product.product-sm .product-image-area {
width: 33%; width: 33%;
float: left; float: left;
padding: 2px; padding: 2px;
} }
.product.product-sm .product-details-area { .product.product-sm .product-details-area {
float: left; float: left;
width: 67%; width: 67%;
text-align: left; text-align: left;
padding: 10px 16px; padding: 10px 16px;
} }
.product.product-sm .product-name { .product.product-sm .product-name {
font-size: 12px; font-size: 12px;
} }
.product.product-sm .product-ratings { .product.product-sm .product-ratings {
background: none; background: none;
margin-bottom: 5px; margin-bottom: 5px;
} }
.product.product-sm .product-price-box { .product.product-sm .product-price-box {
margin: 2px 0 3px; margin: 2px 0 3px;
} }
.product.product-sm .product-price-box .old-price { .product.product-sm .product-price-box .old-price {
font-size: 11px; font-size: 11px;
} }
.product.product-sm .product-price-box .old-price + .product-price { .product.product-sm .product-price-box .old-price + .product-price {
margin-left: 3px; margin-left: 3px;
} }
.product.product-sm .product-price-box .product-price { .product.product-sm .product-price-box .product-price {
font-size: 15px; font-size: 15px;
} }
...@@ -709,21 +800,26 @@ a { ...@@ -709,21 +800,26 @@ a {
text-align: center; text-align: center;
margin-top: 20px; margin-top: 20px;
} }
.toolbar-bottom .toolbar { .toolbar-bottom .toolbar {
display: inline-block; display: inline-block;
} }
.toolbar { .toolbar {
margin-bottom: 8px; margin-bottom: 8px;
} }
.toolbar .sorter:after { .toolbar .sorter:after {
content: ''; content: '';
display: table; display: table;
clear: both; clear: both;
} }
.toolbar .sorter .pagination { .toolbar .sorter .pagination {
float: right; float: right;
margin: 0 0 5px 8px; margin: 0 0 5px 8px;
} }
.toolbar .sorter .pagination a, .toolbar .sorter .pagination a,
.toolbar .sorter .pagination span { .toolbar .sorter .pagination span {
border-radius: 0; border-radius: 0;
...@@ -739,40 +835,50 @@ a { ...@@ -739,40 +835,50 @@ a {
.form-section { .form-section {
overflow: hidden; overflow: hidden;
} }
.form-section .featured-box { .form-section .featured-box {
margin-bottom: 30px; margin-bottom: 30px;
} }
.form-section .featured-box .box-content { .form-section .featured-box .box-content {
padding: 35px 25px; padding: 35px 25px;
} }
@media (min-width: 768px) { @media (min-width: 768px) {
.form-section .form-content { .form-section .form-content {
min-height: 275px; min-height: 275px;
} }
} }
.form-section p { .form-section p {
margin-bottom: 15px; margin-bottom: 15px;
} }
.form-section .form-action { .form-section .form-action {
padding-top: 8px; padding-top: 8px;
margin-top: 1em; margin-top: 1em;
text-align: right; text-align: right;
} }
.form-section .form-action a:not(.btn) { .form-section .form-action a:not(.btn) {
color: #000; color: #000;
} }
.form-section .form-action a:not(.btn).pull-left { .form-section .form-action a:not(.btn).pull-left {
line-height: 38px; line-height: 38px;
} }
.form-section .form-action a:not(.btn):hover, .form-section .form-action a:not(.btn):focus { .form-section .form-action a:not(.btn):hover, .form-section .form-action a:not(.btn):focus {
color: #050505; color: #050505;
text-decoration: underline; text-decoration: underline;
} }
.form-section .required { .form-section .required {
color: #eb340a; color: #eb340a;
font-size: 11px; font-size: 11px;
text-align: right; text-align: right;
} }
@media (min-width: 992px) { @media (min-width: 992px) {
.form-section.register-form .row { .form-section.register-form .row {
margin-left: -30px; margin-left: -30px;
...@@ -783,12 +889,14 @@ a { ...@@ -783,12 +889,14 @@ a {
padding-right: 30px; padding-right: 30px;
} }
} }
.form-control { .form-control {
border-radius: 0; border-radius: 0;
height: 38px; height: 38px;
padding-top: 8px; padding-top: 8px;
padding-bottom: 8px; padding-bottom: 8px;
} }
.form-group .field_with_errors { .form-group .field_with_errors {
display: inline; display: inline;
} }
...@@ -798,7 +906,7 @@ a { ...@@ -798,7 +906,7 @@ a {
*/ */
.featured-box { .featured-box {
background: #F5F5F5; background: #F5F5F5;
background: -webkit-linear-gradient( top , #FFF 1%, #fcfcfc 98%) repeat scroll 0 0 transparent; background: -webkit-linear-gradient(top, #FFF 1%, #fcfcfc 98%) repeat scroll 0 0 transparent;
background: linear-gradient(to bottom, #FFF 1%, #fcfcfc 98%) repeat scroll 0 0 transparent; background: linear-gradient(to bottom, #FFF 1%, #fcfcfc 98%) repeat scroll 0 0 transparent;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
...@@ -822,6 +930,7 @@ html .featured-box-primary .box-content { ...@@ -822,6 +930,7 @@ html .featured-box-primary .box-content {
.featured-box { .featured-box {
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.08); box-shadow: 0 2px 3px rgba(0, 0, 0, 0.08);
} }
.featured-box .box-content { .featured-box .box-content {
border-radius: 8px; border-radius: 8px;
border-top: 4px solid #CCC; border-top: 4px solid #CCC;
...@@ -829,6 +938,7 @@ html .featured-box-primary .box-content { ...@@ -829,6 +938,7 @@ html .featured-box-primary .box-content {
position: relative; position: relative;
top: -1px; top: -1px;
} }
/* Featured Box Left */ /* Featured Box Left */
.featured-box-text-left { .featured-box-text-left {
text-align: left; text-align: left;
...@@ -837,17 +947,54 @@ html .featured-box-primary .box-content { ...@@ -837,17 +947,54 @@ html .featured-box-primary .box-content {
/* /*
* Product details * Product details
*/ */
.product-details-box .product-detail-qty {
display: inline-block;
vertical-align: middle;
margin-right: 7px;
width: 60px;
}
.product-details-box .product-detail-qty #product_vqty {
border-radius: 0;
width: 35px !important;
border-color: #e1e1e1;
color: #000;
padding-left: 2px;
padding-right: 2px;
text-align: center;
}
.product-details-box .product-detail-qty .btn {
border-radius: 0;
}
.product-details-box .product-detail-qty .btn.btn-default {
color: #ccc;
font-size: 8px;
border-color: #e1e1e1;
}
.product-details-box .product-detail-qty .btn.btn-default.bootstrap-touchspin-up {
margin-top: -2px;
}
.product-details-box .product-detail-qty .btn.btn-default.bootstrap-touchspin-down {
margin-bottom: -2px;
}
.product-details-box .product-actions { .product-details-box .product-actions {
margin-top: 10px; margin-top: 10px;
padding-bottom: 10px; padding-bottom: 10px;
margin-bottom: 20px; margin-bottom: 20px;
border-bottom: 1px solid #ebebeb; border-bottom: 1px solid #ebebeb;
} }
.product-details-box .product-actions:after { .product-details-box .product-actions:after {
content: ''; content: '';
display: table; display: table;
clear: both; clear: both;
} }
.product-details-box .product-actions .addtocart { .product-details-box .product-actions .addtocart {
color: #fff; color: #fff;
border-color: #000; border-color: #000;
...@@ -856,13 +1003,50 @@ html .featured-box-primary .box-content { ...@@ -856,13 +1003,50 @@ html .featured-box-primary .box-content {
height: 38px; height: 38px;
min-width: 160px; min-width: 160px;
text-align: center; text-align: center;
vertical-align: middle;
} }
.product-details-box .product-actions .addtocart:hover, .product-details-box .product-actions .addtocart:focus { .product-details-box .product-actions .addtocart:hover, .product-details-box .product-actions .addtocart:focus {
color: #fff; color: #fff;
border-color: #0f0f0f; border-color: #0f0f0f;
background-color: #0f0f0f; background-color: #0f0f0f;
} }
.bootstrap-touchspin .input-group-btn-vertical {
position: relative;
white-space: nowrap;
width: 1%;
vertical-align: middle;
display: table-cell;
}
.bootstrap-touchspin .input-group-btn-vertical > .btn {
display: block;
float: none;
width: 100%;
max-width: 100%;
padding: 9px 10px;
margin-left: -1px;
position: relative;
}
.bootstrap-touchspin .input-group-btn-vertical .bootstrap-touchspin-up {
border-radius: 0;
}
.bootstrap-touchspin .input-group-btn-vertical .bootstrap-touchspin-down {
margin-top: -2px;
border-radius: 0;
}
.bootstrap-touchspin .input-group-btn-vertical i {
position: absolute;
top: 5px;
left: 6px;
font-size: 9px;
font-weight: normal;
}
/* /*
* Cart table * Cart table
*/ */
...@@ -875,6 +1059,7 @@ html .featured-box-primary .box-content { ...@@ -875,6 +1059,7 @@ html .featured-box-primary .box-content {
margin-bottom: 50px; margin-bottom: 50px;
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.08); box-shadow: 0 2px 3px rgba(0, 0, 0, 0.08);
} }
@media (min-width: 992px) { @media (min-width: 992px) {
.cart-table-wrap { .cart-table-wrap {
margin-bottom: 60px; margin-bottom: 60px;
...@@ -887,9 +1072,11 @@ html .featured-box-primary .box-content { ...@@ -887,9 +1072,11 @@ html .featured-box-primary .box-content {
border-spacing: 0; border-spacing: 0;
font-size: 14px; font-size: 14px;
} }
.cart-table thead tr { .cart-table thead tr {
border-bottom: 1px solid #dcdcdc; border-bottom: 1px solid #dcdcdc;
} }
.cart-table thead tr th { .cart-table thead tr th {
font-weight: 600; font-weight: 600;
padding: 15px 10px; padding: 15px 10px;
...@@ -898,44 +1085,55 @@ html .featured-box-primary .box-content { ...@@ -898,44 +1085,55 @@ html .featured-box-primary .box-content {
vertical-align: middle; vertical-align: middle;
line-height: 1; line-height: 1;
} }
.cart-table tbody tr td { .cart-table tbody tr td {
border-bottom: 1px solid #dcdcdc; border-bottom: 1px solid #dcdcdc;
padding: 15px 10px; padding: 15px 10px;
line-height: 1.3; line-height: 1.3;
} }
.cart-table tbody tr td.product-action-td { .cart-table tbody tr td.product-action-td {
padding-left: 0; padding-left: 0;
padding-right: 0; padding-right: 0;
} }
.cart-table tbody tr td.product-image-td a { .cart-table tbody tr td.product-image-td a {
display: block; display: block;
} }
.cart-table tbody tr td.product-image-td a img { .cart-table tbody tr td.product-image-td a img {
display: block; display: block;
width: 100px; width: 100px;
height: auto; height: auto;
} }
.cart-table tbody tr td.product-name-td h2 { .cart-table tbody tr td.product-name-td h2 {
font-size: 14px; font-size: 14px;
font-weight: 400; font-weight: 400;
margin-bottom: 0; margin-bottom: 0;
} }
.cart-table tbody tr td.product-name-td h2 a { .cart-table tbody tr td.product-name-td h2 a {
color: #000; color: #000;
} }
.cart-table tbody tr td.product-name-td h2 a:hover, .cart-table tbody tr td.product-name-td h2 a:focus { .cart-table tbody tr td.product-name-td h2 a:hover, .cart-table tbody tr td.product-name-td h2 a:focus {
color: #000; color: #000;
} }
.cart-table tfoot td { .cart-table tfoot td {
padding: 15px 5px 0; padding: 15px 5px 0;
} }
.cart-table tfoot .btn.btn-default.btn-continue { .cart-table tfoot .btn.btn-default.btn-continue {
float: left; float: left;
} }
.cart-table tfoot .btn.btn-default.btn-update { .cart-table tfoot .btn.btn-default.btn-update {
float: right; float: right;
margin-left: 10px; margin-left: 10px;
} }
.cart-table tfoot .btn.btn-default.btn-clear { .cart-table tfoot .btn.btn-default.btn-clear {
float: right; float: right;
} }
...@@ -993,12 +1191,35 @@ html .featured-box-primary .box-content { ...@@ -993,12 +1191,35 @@ html .featured-box-primary .box-content {
margin: 0 0 10px; margin: 0 0 10px;
} }
} }
.cart .sidebar.shop-sidebar .panel .btn-block + .btn-block { .cart .sidebar.shop-sidebar .panel .btn-block + .btn-block {
margin-top: 0; margin-top: 0;
} }
.cart .sidebar.shop-sidebar .panel .btn-link { .cart .sidebar.shop-sidebar .panel .btn-link {
font-size: 13px; font-size: 13px;
} }
.qty-input {
display: inline-block;
vertical-align: middle;
width: 35px !important;
font-size: 14px;
text-align: center;
color: #777;
height: 30px;
border-radius: 0;
border: 1px solid #ccc;
margin: 0 -1px;
outline: none;
}
.qty-holder {
display: inline-block;
width: 125px;
white-space: nowrap;
vertical-align: middle;
font-size: 0;
}
/* /*
* Totals table * Totals table
*/ */
...@@ -1006,12 +1227,15 @@ html .featured-box-primary .box-content { ...@@ -1006,12 +1227,15 @@ html .featured-box-primary .box-content {
width: 100%; width: 100%;
margin-bottom: 5px; margin-bottom: 5px;
} }
.totals-table tbody tr { .totals-table tbody tr {
border-bottom: 1px solid #dcdcdc; border-bottom: 1px solid #dcdcdc;
} }
.totals-table tbody tr:last-child { .totals-table tbody tr:last-child {
border-bottom: none; border-bottom: none;
} }
.totals-table tbody tr td { .totals-table tbody tr td {
padding: 10px; padding: 10px;
line-height: 1.4; line-height: 1.4;
...@@ -1019,14 +1243,17 @@ html .featured-box-primary .box-content { ...@@ -1019,14 +1243,17 @@ html .featured-box-primary .box-content {
font-weight: 300; font-weight: 300;
text-align: left !important; text-align: left !important;
} }
.totals-table tbody tr td:last-child { .totals-table tbody tr td:last-child {
color: #000; color: #000;
text-align: right !important; text-align: right !important;
font-weight: 600; font-weight: 600;
} }
.totals-table tbody tr:last-child td:last-child { .totals-table tbody tr:last-child td:last-child {
font-size: 17px; font-size: 17px;
} }
/* /*
* Checkout * Checkout
*/ */
...@@ -1034,9 +1261,11 @@ html .featured-box-primary .box-content { ...@@ -1034,9 +1261,11 @@ html .featured-box-primary .box-content {
color: #393939; color: #393939;
margin-bottom: 30px; margin-bottom: 30px;
} }
.form-col .checkout-review-action { .form-col .checkout-review-action {
border-top: 1px solid #b6b6b6; border-top: 1px solid #b6b6b6;
} }
.form-col .checkout-review-action h5 { .form-col .checkout-review-action h5 {
color: #3f3f3f; color: #3f3f3f;
font-size: 16px; font-size: 16px;
...@@ -1044,6 +1273,7 @@ html .featured-box-primary .box-content { ...@@ -1044,6 +1273,7 @@ html .featured-box-primary .box-content {
margin-top: 30px; margin-top: 30px;
margin-bottom: 10px; margin-bottom: 10px;
} }
.form-col .checkout-review-action h5 span { .form-col .checkout-review-action h5 span {
margin-left: 45px; margin-left: 45px;
} }
\ No newline at end of file
...@@ -13,14 +13,11 @@ class CartsController < ApplicationController ...@@ -13,14 +13,11 @@ class CartsController < ApplicationController
end end
def delete_line_item def delete_line_item
product_id = params[:id] remove_from_cart(params[:id])
if @cart.has_key? product_id product_title = Product.select(:title).find(params[:id]).title
@cart.delete(product_id)
session[:cart] = @cart
product_title = Product.select(:title).find(product_id).title
respond_to do |format| respond_to do |format|
format.html { redirect_to cart_index_url, notice: "#{product_title} was sucessfully removed from your cart" } format.html { redirect_to cart_index_url, notice: "#{product_title} was sucessfully removed from your cart" }
end format.js
end end
end end
......
...@@ -2,11 +2,10 @@ class LineItemsController < ApplicationController ...@@ -2,11 +2,10 @@ class LineItemsController < ApplicationController
include CartsHelper include CartsHelper
before_action :set_cart, only: [:create] before_action :set_cart, only: [:create]
before_action :set_line_item, only: [:show, :edit, :update, :destroy]
def create def create
product = Product.find(params[:product_id]) product = Product.find(params[:product_id])
@line_items = add_to_cart(product, 1) add_to_cart(product, params[:product_vqty].to_i)
respond_to do |format| respond_to do |format|
format.html { redirect_to cart_index_url, notice: "#{product.title} was sucessfully added to your cart" } format.html { redirect_to cart_index_url, notice: "#{product.title} was sucessfully added to your cart" }
...@@ -14,22 +13,4 @@ class LineItemsController < ApplicationController ...@@ -14,22 +13,4 @@ class LineItemsController < ApplicationController
format.json { render 'show' } format.json { render 'show' }
end end
end end
def destroy
@line_item.destroy
respond_to do |format|
format.html { redirect_to cart_index_url, notice: "#{product.title} was sucessfully removed from your cart" }
format.json { head :no_content }
end
end
private
def set_line_item
@line_item = LineItem.find(params[:id])
end
def line_item_params
params.require(:line_item).permit(:product_id)
end
end end
\ No newline at end of file
...@@ -6,14 +6,23 @@ module CartsHelper ...@@ -6,14 +6,23 @@ module CartsHelper
end end
def add_to_cart(product, quantity) def add_to_cart(product, quantity)
cart_key = product.id cart_key = product.id.to_s
if @cart.has_key? cart_key.to_s return remove_from_cart(cart_key) if quantity.zero?
@cart[cart_key.to_s]['quantity'] += quantity if @cart.key?(cart_key)
@cart[cart_key][:quantity.to_s] += quantity
else else
@cart[cart_key] = { quantity: quantity } @cart[cart_key] = { quantity: quantity }
end end
end end
def update_cart_item(product_id, quantity)
end
def remove_from_cart(product_id)
@cart = @cart.delete(product_id) if @cart.key?(product_id)
end
def destroy_cart_session def destroy_cart_session
session[:cart] = nil session[:cart] = nil
end end
...@@ -28,10 +37,10 @@ module CartsHelper ...@@ -28,10 +37,10 @@ module CartsHelper
end end
def cart_total_items def cart_total_items
if @cart.nil? if session[:cart].nil?
total = 0 total = 0
else else
total = session[:cart].sum { |product_id, product_attrs| product_attrs['quantity'] || product_attrs[:quantity] } total = session[:cart].sum { |product_id, product_attrs| product_attrs[:quantity.to_s] || product_attrs[:quantity] }
end end
total total
end end
......
...@@ -33,7 +33,14 @@ ...@@ -33,7 +33,14 @@
</h2> </h2>
</td> </td>
<td><%= number_to_currency(line_item[:product].price) %></td> <td><%= number_to_currency(line_item[:product].price) %></td>
<td><%= line_item[:quantity] %></td> <td>
<%= form_tag do %>
<div class="qty-holder">
<%= number_field_tag :qty_input, line_item[:quantity], class: 'qty-input' %>
<%= button_tag nil, class: 'edit-qty' do fa_icon('pencil') end %>
</div>
<% end %>
</td>
<td><%= number_to_currency(line_item[:product].price * line_item[:quantity]) %></td> <td><%= number_to_currency(line_item[:product].price * line_item[:quantity]) %></td>
</tr> </tr>
<% end %> <% end %>
......
...@@ -14,5 +14,6 @@ ...@@ -14,5 +14,6 @@
<%= yield %> <%= yield %>
</div> </div>
<%= render 'layouts/footer' %> <%= render 'layouts/footer' %>
<%= javascript_include_tag 'theme-main' %>
</body> </body>
</html> </html>
<div class="products-grid columns3">
<% @recommended_products.each do |product| %> <% @recommended_products.each do |product| %>
<li class="product-<%= product.id %>"> <li class="product-<%= product.id %>">
<div class="product"> <div class="product">
...@@ -18,4 +17,3 @@ ...@@ -18,4 +17,3 @@
</div> </div>
</li> </li>
<% end %> <% end %>
\ No newline at end of file
</div>
\ No newline at end of file
...@@ -22,9 +22,12 @@ ...@@ -22,9 +22,12 @@
</div> </div>
</div> </div>
<div class="product-actions"> <div class="product-actions">
<%= form_tag line_items_path(product_id: @product), remote: true do %>
<div class="product-detail-qty"> <div class="product-detail-qty">
<%= number_field_tag :product_vqty, 1, min: 0, class: 'vertical-spinner' %>
</div> </div>
<%= button_to 'Add to cart', line_items_path(product_id: @product), remote: true, class: 'addtocart' %> <%= submit_tag 'Add to cart', class: 'addtocart' %>
<% end %>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -12,3 +12,4 @@ Rails.application.config.assets.paths << Rails.root.join('node_modules') ...@@ -12,3 +12,4 @@ Rails.application.config.assets.paths << Rails.root.join('node_modules')
# application.js, application.css, and all non-JS/CSS in the app/assets # application.js, application.css, and all non-JS/CSS in the app/assets
# folder are already added. # folder are already added.
# Rails.application.config.assets.precompile += %w( admin.js admin.css ) # Rails.application.config.assets.precompile += %w( admin.js admin.css )
Rails.application.config.assets.precompile += %w( theme-main.js )
...@@ -8,6 +8,7 @@ Rails.application.routes.draw do ...@@ -8,6 +8,7 @@ Rails.application.routes.draw do
resources :cart, only: :index, controller: 'carts' resources :cart, only: :index, controller: 'carts'
delete '/cart/remove/line_item/:id', to: 'carts#delete_line_item', as: 'remove_line_item_cart' delete '/cart/remove/line_item/:id', to: 'carts#delete_line_item', as: 'remove_line_item_cart'
delete '/cart/remove', to: 'carts#destroy', as: 'remove_cart' delete '/cart/remove', to: 'carts#destroy', as: 'remove_cart'
post 'cart/update', to: 'carts#update', as: 'update_cart'
devise_for :users devise_for :users
ActiveAdmin.routes(self) ActiveAdmin.routes(self)
mount Ckeditor::Engine => '/ckeditor' mount Ckeditor::Engine => '/ckeditor'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment