-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from appirits/implement-home-page
Implement the home page
- Loading branch information
Showing
15 changed files
with
240 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ def instance | |
end | ||
|
||
def default_name | ||
'Comable store' | ||
Comable.t('default_store_name') | ||
end | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module Comable | ||
class HomeController < Comable::ApplicationController | ||
before_filter :load_products, only: :show | ||
|
||
def show | ||
end | ||
|
||
private | ||
|
||
def load_products | ||
@products = Comable::Product.limit(5) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#comable-home | ||
section.comable-home-top | ||
= image_tag 'comable/frontend/home-top.jpg' | ||
|
||
section#comable-product | ||
.container | ||
.products | ||
= render 'comable/shared/products' | ||
|
||
section.comable-home-one | ||
h2 | ||
= Comable.t('sample_header') | ||
h3 | ||
= Comable.t('sample_subheader') | ||
p | ||
= Comable.t('sample_text') | ||
|
||
section.comable-home-two | ||
h2 | ||
= Comable.t('sample_header') | ||
h3 | ||
= Comable.t('sample_subheader') | ||
p | ||
= Comable.t('sample_text') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,39 @@ | ||
footer | ||
| Powered by #{link_to 'Comable', 'https://github.com/appirits/comable'} | ||
.container | ||
.row | ||
.col-md-4 | ||
h3 | ||
= Comable.t('support') | ||
ul.list-unstyled | ||
li | ||
i.glyphicon.glyphicon-earphone> | ||
| 0123-XX-XXXX | ||
li | ||
i.glyphicon.glyphicon-envelope> | ||
| comable@example.com | ||
.col-md-4 | ||
h3 | ||
= Comable.t('pages') | ||
ul.list-unstyled | ||
li | ||
= link_to Comable.t('home'), comable.root_path | ||
li | ||
= link_to Comable.t('products'), comable.products_path | ||
li | ||
= link_to Comable.t('cart'), comable.cart_path | ||
li | ||
= link_to Comable.t('my_account'), comable.user_path | ||
.col-md-4 | ||
h3 | ||
= Comable.t('my_account') | ||
ul.list-unstyled | ||
li | ||
= link_to Comable.t('sign_in'), comable.new_user_session_path | ||
li | ||
= link_to Comable.t('my_account'), comable.user_path | ||
li | ||
= link_to Comable.t('change_email_or_password'), comable.edit_user_path | ||
li | ||
= link_to Comable.t('edit_your_address_book'), comable.addresses_user_path | ||
.credit | ||
| Powered by #{link_to 'Comable', 'https://github.com/appirits/comable'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
ul.row | ||
- @products.each do |product| | ||
li.col-xs-6.col-sm-3 | ||
.thumbnail.text-center | ||
= link_to comable.product_path(product) do | ||
= image_tag product.image_url, width: '100%' | ||
h5 | ||
= link_to product.name, comable.product_path(product) | ||
- if product.caption.present? | ||
p | ||
= product.caption | ||
strong | ||
= number_to_currency product.price | ||
p | ||
= form_tag comable.add_cart_path do | ||
- stock = product.stocks.first | ||
- if stock && stock.stocked? | ||
.add_cart.form-inline.form-group | ||
= hidden_field_tag :stock_id, stock.id | ||
= submit_tag Comable.t('add_to_cart'), class: 'btn btn-default' | ||
- else | ||
.soldout | ||
= submit_tag Comable.t('soldout'), class: 'btn btn-default', disabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
describe Comable::HomeController do | ||
describe 'GET show' do | ||
it 'assigns the products as @products' do | ||
product = create(:product) | ||
get :show | ||
expect(assigns(:products)).to include(product) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
describe 'comable/home/show' do | ||
let!(:product) { create(:product) } | ||
|
||
before { assign(:products, [product]) } | ||
|
||
it 'renders attributes in products' do | ||
render | ||
expect(rendered).to include(product.name) | ||
end | ||
end |