Commit a9b16269 by Tran Hoang Viet

VietTH: Implement feature share scocials and update layout venshop

parent ceb74a0c
......@@ -31,7 +31,18 @@ label.error{
#content{
.products-list-detail{
.product-item{
margin-bottom: 30px;
position: relative;
min-height: 380px;
&:hover{
-webkit-box-shadow: 0px 1px 5px 0px rgba(0,0,0,0.72);
-moz-box-shadow: 0px 1px 5px 0px rgba(0,0,0,0.72);
box-shadow: 0px 1px 5px 0px rgba(0,0,0,0.72);
background-color: #F3F3F3;
.share-scocial{
display: block;
}
}
padding-bottom: 30px;
.product-image{
position: relative;
&.disable{
......@@ -44,6 +55,23 @@ label.error{
}
}
.share-scocial{
display: none;
text-align: center;
margin-left: -15px;
position: absolute;
bottom: 0;
width: 100%;
.facebook, .twitter{
img{
min-width: 10px;
width: 100px;
margin-bottom: 10px;
height: auto;
}
}
}
.product-title{
margin: 10px 0;
}
......@@ -136,4 +164,8 @@ footer{
.text-left{
text-align: left !important;
}
.breadcrumb{
margin-bottom: 0;
}
\ No newline at end of file
......@@ -9,4 +9,8 @@
.product-title{
font-size: 16px;
}
.share-scocial{
display: block !important;
}
}
\ No newline at end of file
class CategoriesController < ApplicationController
before_action :set_category, only: [:show]
before_action :set_meta, only: [:show]
before_action :add_breadcrumb_home
def show
......@@ -12,4 +13,9 @@ class CategoriesController < ApplicationController
@category = Category.find(params[:id])
end
def set_meta
Meta.title = @category.decorate.title
Meta.name = @category.decorate.title
end
end
\ No newline at end of file
......@@ -3,6 +3,7 @@ class ProductsController < ApplicationController
before_action :set_categories, only: [:new, :create]
before_action :add_breadcrumb_home
before_action :authenticate_user!, only: [:new, :create, :add_cart]
before_action :set_meta, only: [:show]
def new
@product = Product.new
......@@ -55,4 +56,13 @@ class ProductsController < ApplicationController
@cart_service ||= CartService.new(current_user, params)
end
def set_meta
Meta.title = @product.title
Meta.name = @product.title
Meta.image = @product.image_md_url
Meta.image_lg = @product.image_lg_url
Meta.description = "#{@product.title} - #{@product.price}"
Meta.author = @product.user.email
end
end
\ No newline at end of file
module ScocialHelper
def facebook_share_url(url)
"https://www.facebook.com/sharer/sharer.php?u=#{url || request.original_url}"
end
def twitter_share_url(url)
"https://twitter.com/home?status=#{url || request.original_url}"
end
end
\ No newline at end of file
class Meta
class << self
attr_accessor :title, :description, :name, :image, :image_lg, :author
def title
@title || 'Venshop Zigexn VeNtura'
end
def image
@image || ActionController::Base.helpers.asset_url('logo.png')
end
def image_lg
@image_lg || image
end
end
end
\ No newline at end of file
.navbar-header
%button.navbar-toggle.collapsed{"aria-controls" => "navbar", "aria-expanded" => "false", "data-target" => "#navbar", "data-toggle" => "collapse", :type => "button"}
%span.sr-only Toggle navigation
%span.icon-bar
%span.icon-bar
%span.icon-bar
%a.navbar-brand.logo{:href => "/"}
%img{src: 'http://zigexn.vn/assets/logo-main-e75d68f895f288e75637440f337c1687.png'}
#navbar.navbar-collapse.collapse
%ul.nav.navbar-nav.navbar-right
- if user_signed_in?
%li
= link_to 'Logout', destroy_user_session_path, method: :delete
%li
= link_to 'Change profile', edit_user_registration_path
%li
= link_to 'New product', new_product_path
%nav.navbar.navbar-inverse.navbar-fixed-top
.container-fluid
.navbar-header
%button.navbar-toggle.collapsed{"aria-controls" => "navbar", "aria-expanded" => "false", "data-target" => "#navbar", "data-toggle" => "collapse", :type => "button"}
%span.sr-only Toggle navigation
%span.icon-bar
%span.icon-bar
%span.icon-bar
= link_to root_path, class: 'navbar-brand logo' do
%img{src: 'http://zigexn.vn/assets/logo-main-e75d68f895f288e75637440f337c1687.png'}
#navbar.navbar-collapse.collapse
%ul.nav.navbar-nav.navbar-right
- if user_signed_in?
%li
= link_to 'Logout', destroy_user_session_path, method: :delete
%li
= link_to 'Change profile', edit_user_registration_path
%li
= link_to 'New product', new_product_path
- else
%li
= link_to('Login', new_user_session_path)
%li
= link_to 'Register', new_user_registration_path
.navbar-form.navbar-right
= form_tag search_products_path, method: :get do
.input-group
= text_field_tag :query, params[:query], class: 'form-control', placeholder: 'Search for title...'
%span.input-group-btn
%button.btn.btn-default{type: "submit"} Go!
- else
%li
= link_to('Login', new_user_session_path)
%li
= link_to 'Register', new_user_registration_path
%title= Meta.title || 'Venshop Zigexn VeNtura'
%meta{content: Meta.description, name: "description"}
/ Schema.org markup for Google+
%meta{content: Meta.name, itemprop: "name"}
%meta{content: Meta.description, itemprop: "description"}
%meta{content: Meta.image, itemprop: "image"}
/ Twitter Card data
%meta{content: Meta.image_lg, name: "twitter:card"}
%meta{content: Meta.title, name: "twitter:title"}
%meta{content: Meta.description, name: "twitter:description"}
%meta{content: Meta.author, name: "twitter:creator"}
/ Twitter summary card with large image must be at least 280x150px
%meta{content: Meta.image_lg, name: "twitter:image:src"}
/ Open Graph data
%meta{content: Meta.title, property: "og:title"}
%meta{content: "article", property: "og:type"}
%meta{content: Settings.base_url, property: "og:url"}
%meta{content: Meta.image, property: "og:image"}
%meta{content: Meta.description, property: "og:description"}
%meta{content: Meta.title, property: "og:site_name"}
%meta{content: ENV['FB_APP_ID'], property: "fb:admins"}
\ No newline at end of file
= form_tag search_products_path, method: :get do
.input-group
= text_field_tag :query, params[:query], class: 'form-control', placeholder: 'Search for title...'
%span.input-group-btn
%button.btn.btn-default{type: "submit"} Go!
!!!
%html{:lang => "en"}
%title Vendor
= stylesheet_link_tag 'application', media: 'all'
= javascript_include_tag 'application'
= csrf_meta_tags
= render 'layouts/meta'
%body
%nav.navbar.navbar-inverse.navbar-fixed-top
.container-fluid
= render '/layouts/header'
= render 'layouts/header'
#wrapper.container-fluid
= render '/layouts/message'
= render 'layouts/message'
.row
.col-md-6.search-wrapper
......@@ -28,6 +29,9 @@
.row
.col-md-12
= render 'layouts/cart'
.row
.col-md-12
= render 'layouts/share_scocial'
.col-md-10
= yield
......
......@@ -4,4 +4,4 @@
= text_field_tag :quantity, 1, class: 'form-control quantity'
= hidden_field_tag :stock, max_quantity, class: 'max-quantity'
.input-group-btn
= submit_tag 'Add', class: "btn-add btn btn-default", disabled: product.stock.zero?
= submit_tag 'Add', class: "btn-add btn btn-danger", disabled: product.stock.zero?
.product-item.col-md-4.text-center
.product-item.col-md-3.text-center
.product-title
= link_to product.decorate.short_title, product
.product-price
......@@ -11,3 +11,11 @@
Stock:
= product.stock
= render 'products/add_to_cart_btn', product: product
.clearfix
.share-scocial
= link_to facebook_share_url(product_url(product)), class: 'facebook', target: '_blank' do
= image_tag 'facebook.png'
= link_to twitter_share_url(product_url(product)), class: 'twitter', target: '_blank' do
= image_tag 'twitter.png'
\ No newline at end of file
#product-detail.products-list-detail
= render 'product', product: @product
.clearfix
.col-md-4.text-center
.col-md-3.text-center
.product-id
Item ID:
= @product.id
......
......@@ -3,4 +3,6 @@ AWS_ACCESS: AKIAJ77C4CTZOP7TUVWQ
AWS_SECRET: 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
AWS_TAG: zigexn6400-22
FB_APP_ID: 1629224294024346
SOLR_URL: http://localhost:8080/solr/venshop
\ No newline at end of file
Kaminari.configure do |config|
config.default_per_page = 6
config.default_per_page = 8
# config.max_per_page = nil
# config.window = 4
# config.outer_window = 0
......
defaults: &defaults
limit_category: 6
limit_product_recommended: 6
limit_product_newest: 9
limit_category: 8
limit_product_recommended: 8
limit_product_newest: 12
limit_length_category_title: 50
development:
<<: *defaults
solr_url: http://localhost:8080/solr/venshop
base_url: http://locahost:3000
test:
<<: *defaults
solr_url: http://localhost:8080/solr/venshop_test
base_url: http://locahost:3000
production:
<<: *defaults
solr_url: http://localhost:8080/solr/venshop
base_url: http://192.168.1.204:3005
staging:
<<: *defaults
solr_url: http://localhost:8080/solr/venshop
\ No newline at end of file
solr_url: http://localhost:8080/solr/venshop
base_url: http://alicuche.koding.io
\ No newline at end of file
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