Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
dhp-venshop
dhp-venshop
  • Overview
    • Overview
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 1
    • Merge Requests 1
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Hoang Phuc Do
  • dhp-venshopdhp-venshop
  • Merge Requests
  • !8

Merged
Opened Jun 27, 2017 by Hoang Phuc Do@phucdh 
  • Report abuse
Report abuse

[REVIEW] Order Feature

  • Discussion 18
  • Commits 6
  • Changes 36
{{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jun 27, 2017
    Resolved by Hoang Phuc Do Jun 30, 2017
    app/views/orders/_product_item.html.erb 0 → 100644
    1 <tr>
    2 <td class="product-image-td"></td>
    3 <td class="product-name-td">
    4 <h2 class="product-name">
    5 <%= link_to product_item.product.title, product_url(product_item.product) %>
    6 </h2>
    7 </td>
    8 <td><%= number_to_currency(product_item.product.price) %></td>
    9 <td><%= product_item.quantity %></td>
    10 <td><%= number_to_currency(product_item.product.price * product_item.quantity) %></td>
    • Trong Huu Nguyen @huunt commented Jun 27, 2017
      Master

      Please put into model

      Edited Jun 30, 2017
      Please put into model
    • Hoang Phuc Do @phucdh

      changed this line in version 2 of the diff

      Jun 27, 2017

      changed this line in version 2 of the diff

      changed this line in [version 2 of the diff](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/8/diffs?diff_id=3387&start_sha=6e703ffa6724a2bed18931800991aac06e9dd7b4#dd341d9f053d2581dfd45ea2a195887b5d5a7f7d_10_10)
      Toggle commit list
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jun 27, 2017
    Resolved by Hoang Phuc Do Jun 30, 2017
    app/views/orders/_order.html.erb 0 → 100644
    19 </thead>
    20 </table>
    21
    22 <div class="cart-table-wrap">
    23 <table class="cart-table">
    24 <thead>
    25 <tr>
    26 <th></th>
    27 <th>Product Name</th>
    28 <th>Unit Price</th>
    29 <th>Qty</th>
    30 <th>Subtotal</th>
    31 </tr>
    32 </thead>
    33 <tbody>
    34 <% order.product_items.each do |product_item| %>
    • Trong Huu Nguyen @huunt commented Jun 27, 2017
      Master

      Please use collection rails for this one. Note: Rubocop syntax { |value| }

      Edited Jun 30, 2017
      Please use collection rails for this one. Note: Rubocop syntax { |value| }
    • Hoang Phuc Do @phucdh

      changed this line in version 2 of the diff

      Jun 27, 2017

      changed this line in version 2 of the diff

      changed this line in [version 2 of the diff](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/8/diffs?diff_id=3387&start_sha=6e703ffa6724a2bed18931800991aac06e9dd7b4#6c150234443786bc0a36613cd7a748bde31eff0b_34_34)
      Toggle commit list
    Please register or sign in to reply
  • Hoang Phuc Do @phucdh

    added 1 commit

    • bc299fdc - Add order for user

    Compare with previous version

    Jun 27, 2017

    added 1 commit

    • bc299fdc - Add order for user

    Compare with previous version

    added 1 commit * bc299fdc - Add order for user [Compare with previous version](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/8/diffs?diff_id=3387&start_sha=6e703ffa6724a2bed18931800991aac06e9dd7b4)
    Toggle commit list
  • Hoang Phuc Do @phucdh

    added 1 commit

    • d1deeb42 - Add order for user

    Compare with previous version

    Jun 30, 2017

    added 1 commit

    • d1deeb42 - Add order for user

    Compare with previous version

    added 1 commit * d1deeb42 - Add order for user [Compare with previous version](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/8/diffs?diff_id=3414&start_sha=bc299fdc02641a0f56c8a214886b64cde9f6a538)
    Toggle commit list
  • Hoang Phuc Do @phucdh

    added 3 commits

    • d1deeb42...9c71bd06 - 2 commits from branch development
    • 38bb1ce2 - Merge remote-tracking branch 'origin/development' into dhp_order

    Compare with previous version

    Jun 30, 2017

    added 3 commits

    • d1deeb42...9c71bd06 - 2 commits from branch development
    • 38bb1ce2 - Merge remote-tracking branch 'origin/development' into dhp_order

    Compare with previous version

    added 3 commits * d1deeb42...9c71bd06 - 2 commits from branch `development` * 38bb1ce2 - Merge remote-tracking branch &#x27;origin&#x2F;development&#x27; into dhp_order [Compare with previous version](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/8/diffs?diff_id=3418&start_sha=d1deeb42b0ff96408511002bc92d2502485b5fda)
    Toggle commit list
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jun 30, 2017
    Resolved by Hoang Phuc Do Jun 30, 2017
    app/controllers/categories_controller.rb
    1 1 class CategoriesController < ApplicationController
    2 2 def show
    3 3 @category = Category.find(params[:id])
    4 @products = @category.products.take(6)
    4 @products = @products = @category.products.page(params[:page]).per(5)
    • Trong Huu Nguyen @huunt commented Jun 30, 2017
      Master

      Please delete one @products

      Edited Jun 30, 2017
      Please delete one `@products`
    • Hoang Phuc Do @phucdh

      changed this line in version 6 of the diff

      Jun 30, 2017

      changed this line in version 6 of the diff

      changed this line in [version 6 of the diff](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/8/diffs?diff_id=3420&start_sha=38bb1ce22c5f7e127f705d7ac3c606afcd409923#02295c1314f573f6884dc6050a9ed09bb8ef3131_4_4)
      Toggle commit list
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jun 30, 2017
    Last updated by Hoang Phuc Do Jun 30, 2017
    app/controllers/orders_controller.rb
    33 50
    34 51 private
    35 52
    53 # Never trust parameters from the scary internet, only allow the white list through.
    54 def order_params
    55 default_params = { order_status: Order.default_order_status }
    • Trong Huu Nguyen @huunt commented Jun 30, 2017
      Master

      Please change default_order_status to default_status

      Please change `default_order_status` to `default_status`
    • Hoang Phuc Do @phucdh

      changed this line in version 6 of the diff

      Jun 30, 2017

      changed this line in version 6 of the diff

      changed this line in [version 6 of the diff](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/8/diffs?diff_id=3420&start_sha=38bb1ce22c5f7e127f705d7ac3c606afcd409923#412f6f83f5d315532fb15d1dbba9c839bb9012f6_55_55)
      Toggle commit list
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jun 30, 2017
    Resolved by Hoang Phuc Do Jun 30, 2017
    app/helpers/application_helper.rb
    1 1 module ApplicationHelper
    • Trong Huu Nguyen @huunt commented Jun 30, 2017
      Master

      Please remove this file.

      Edited Jun 30, 2017
      Please remove this file.
    • Hoang Phuc Do @phucdh

      changed this line in version 6 of the diff

      Jun 30, 2017

      changed this line in version 6 of the diff

      changed this line in [version 6 of the diff](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/8/diffs?diff_id=3420&start_sha=38bb1ce22c5f7e127f705d7ac3c606afcd409923#040453e670f9bf522378f941c96f3881076fee1f_1_0)
      Toggle commit list
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jun 30, 2017
    Resolved by Hoang Phuc Do Jun 30, 2017
    app/models/concerns/solr_product.rb 0 → 100644
    1 require 'active_support/concern'
    • Trong Huu Nguyen @huunt commented Jun 30, 2017
      Master

      Please move this one to controller

      Edited Jun 30, 2017 by Trong Huu Nguyen
      Please move this one to controller
    • Hoang Phuc Do @phucdh

      changed this line in version 6 of the diff

      Jun 30, 2017

      changed this line in version 6 of the diff

      changed this line in [version 6 of the diff](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/8/diffs?diff_id=3420&start_sha=38bb1ce22c5f7e127f705d7ac3c606afcd409923#158c64a81e405b71f33043d913a44db9ef45f770_1_0)
      Toggle commit list
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jun 30, 2017
    Resolved by Hoang Phuc Do Jun 30, 2017
    app/models/order.rb
    1 1 class Order < ApplicationRecord
    2 2 has_many :product_items, dependent: :destroy
    3 3 belongs_to :user
    4 enum order_status: { 'Pending' => 0, 'Done' => 1 }
    5
    6 validates :order_status, presence: true
    7 validate :validate_pending_order, on: :create
    8
    9 def self.default_order_status
    10 'Pending'
    11 end
    12
    13 def validate_pending_order
    • Trong Huu Nguyen @huunt commented Jun 30, 2017
      Master

      Please change validate_pending_order to validate_order_status

      Edited Jun 30, 2017
      Please change `validate_pending_order` to `validate_order_status`
    • Hoang Phuc Do @phucdh

      changed this line in version 6 of the diff

      Jun 30, 2017

      changed this line in version 6 of the diff

      changed this line in [version 6 of the diff](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/8/diffs?diff_id=3420&start_sha=38bb1ce22c5f7e127f705d7ac3c606afcd409923#2415de75d5c0d684f4737421a375530268dc6c90_13_13)
      Toggle commit list
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jun 30, 2017
    Resolved by Hoang Phuc Do Jun 30, 2017
    app/models/order.rb
    1 1 class Order < ApplicationRecord
    2 2 has_many :product_items, dependent: :destroy
    3 3 belongs_to :user
    4 enum order_status: { 'Pending' => 0, 'Done' => 1 }
    5
    6 validates :order_status, presence: true
    7 validate :validate_pending_order, on: :create
    8
    9 def self.default_order_status
    10 'Pending'
    11 end
    12
    13 def validate_pending_order
    14 errors.add(:base, 'Error') if order_status != 'Pending'
    • Trong Huu Nguyen @huunt commented Jun 30, 2017
      Master

      Please change base to order_status

      Edited Jun 30, 2017
      Please change base to `order_status`
    • Hoang Phuc Do @phucdh

      changed this line in version 6 of the diff

      Jun 30, 2017

      changed this line in version 6 of the diff

      changed this line in [version 6 of the diff](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/8/diffs?diff_id=3420&start_sha=38bb1ce22c5f7e127f705d7ac3c606afcd409923#2415de75d5c0d684f4737421a375530268dc6c90_14_13)
      Toggle commit list
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jun 30, 2017
    Resolved by Hoang Phuc Do Jun 30, 2017
    db/migrate/20170619091633_add_order_status_to_orders.rb 0 → 100644
    1 class AddOrderStatusToOrders < ActiveRecord::Migration[5.1]
    2 def change
    3 add_column :orders, :order_status, :integer, null: false, default: 0
    • Trong Huu Nguyen @huunt commented Jun 30, 2017
      Master

      Please change order_status to status

      Edited Jun 30, 2017
      Please change `order_status` to `status`
    • Hoang Phuc Do @phucdh

      changed this line in version 6 of the diff

      Jun 30, 2017

      changed this line in version 6 of the diff

      changed this line in [version 6 of the diff](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/8/diffs?diff_id=3420&start_sha=38bb1ce22c5f7e127f705d7ac3c606afcd409923#340458d0ae4f484c82211c030fa054fce9fe869d_3_3)
      Toggle commit list
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jun 30, 2017
    Resolved by Hoang Phuc Do Jun 30, 2017
    db/migrate/20170623064632_add_admin_to_users.rb 0 → 100644
    1 class AddAdminToUsers < ActiveRecord::Migration[5.1]
    2 def change
    3 add_column :users, :admin, :boolean, null: false, default: false
    • Trong Huu Nguyen @huunt commented Jun 30, 2017
      Master

      Please change admin is is_admin

      Edited Jun 30, 2017
      Please change `admin` is `is_admin`
    • Hoang Phuc Do @phucdh

      changed this line in version 6 of the diff

      Jun 30, 2017

      changed this line in version 6 of the diff

      changed this line in [version 6 of the diff](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/8/diffs?diff_id=3420&start_sha=38bb1ce22c5f7e127f705d7ac3c606afcd409923#ef1a40f035cf76fa7bd59be34f847959787d1ed9_3_3)
      Toggle commit list
    Please register or sign in to reply
  • Hoang Phuc Do @phucdh

    added 1 commit

    • 6d600565 - Merge remote-tracking branch 'origin/development' into dhp_order

    Compare with previous version

    Jun 30, 2017

    added 1 commit

    • 6d600565 - Merge remote-tracking branch 'origin/development' into dhp_order

    Compare with previous version

    added 1 commit * 6d600565 - Merge remote-tracking branch &#x27;origin&#x2F;development&#x27; into dhp_order [Compare with previous version](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/8/diffs?diff_id=3420&start_sha=38bb1ce22c5f7e127f705d7ac3c606afcd409923)
    Toggle commit list
  • Trong Huu Nguyen
    @huunt started a discussion on the diff Jun 30, 2017
    Resolved by Hoang Phuc Do Jun 30, 2017
    app/controllers/application_controller.rb
    16 16 end
    17 17 end
    18 18
    19 def user_is_admin?
    20 return false unless user_signed_in?
    21 unless current_user.is_admin?
    22 redirect_to root_url, notice: "You don't have access to this page"
    • Trong Huu Nguyen @huunt commented Jun 30, 2017
      Master

      Please change redirect_to root_url, notice: "You don't have access to this page"to return redirect_to root_url, notice: "You don't have access to this page"

      Edited Jun 30, 2017 by Trong Huu Nguyen
      Please change `redirect_to root_url, notice: "You don't have access to this page"`to return `redirect_to root_url, notice: "You don't have access to this page"`
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jun 30, 2017
    Resolved by Hoang Phuc Do Jun 30, 2017
    app/controllers/orders_controller.rb
    33 50
    34 51 private
    35 52
    36 def set_order_items
    37 @order_items = @cart.product_items
    53 # Never trust parameters from the scary internet, only allow the white list through.
    54 def order_params
    55 default_params = { status: Order.default_status }
    • Trong Huu Nguyen @huunt commented Jun 30, 2017
      Master

      Please change Order.default_status to Order.statuses[:Pending]

      Edited Jun 30, 2017
      Please change `Order.default_status` to Order.statuses[:Pending]
    • Hoang Phuc Do @phucdh

      changed this line in version 7 of the diff

      Jun 30, 2017

      changed this line in version 7 of the diff

      changed this line in [version 7 of the diff](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/8/diffs?diff_id=3423&start_sha=6d600565393ce59ceac3eeaff1d8aff3de61be84#412f6f83f5d315532fb15d1dbba9c839bb9012f6_55_55)
      Toggle commit list
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jun 30, 2017
    Resolved by Hoang Phuc Do Jun 30, 2017
    app/controllers/orders_controller.rb
    33 50
    34 51 private
    35 52
    36 def set_order_items
    37 @order_items = @cart.product_items
    53 # Never trust parameters from the scary internet, only allow the white list through.
    54 def order_params
    55 default_params = { status: Order.default_status }
    56 params.require(:order).permit(:status).reverse_merge(default_params)
    • Trong Huu Nguyen @huunt commented Jun 30, 2017
      Master

      Please try params.require(:order).permit(:status).merge(status:Order.statuses[:Pending])

      Edited Jun 30, 2017
      Please try `params.require(:order).permit(:status)`.merge(`status:`Order.statuses[:Pending])
    • Hoang Phuc Do @phucdh

      changed this line in version 7 of the diff

      Jun 30, 2017

      changed this line in version 7 of the diff

      changed this line in [version 7 of the diff](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/8/diffs?diff_id=3423&start_sha=6d600565393ce59ceac3eeaff1d8aff3de61be84#412f6f83f5d315532fb15d1dbba9c839bb9012f6_56_55)
      Toggle commit list
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jun 30, 2017
    Resolved by Hoang Phuc Do Jun 30, 2017
    app/models/order.rb
    1 1 class Order < ApplicationRecord
    2 2 has_many :product_items, dependent: :destroy
    3 3 belongs_to :user
    4 enum status: { 'Pending' => 0, 'Done' => 1 }
    5
    6 validates :status, presence: true
    7 validate :validate_status, on: :create
    8
    9 def self.default_status
    • Trong Huu Nguyen @huunt commented Jun 30, 2017
      Master

      Please remove this method

      Edited Jun 30, 2017
      Please remove this method
    • Hoang Phuc Do @phucdh

      changed this line in version 8 of the diff

      Jun 30, 2017

      changed this line in version 8 of the diff

      changed this line in [version 8 of the diff](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/8/diffs?diff_id=3424&start_sha=274b68991d56ff9b157a7b5108a2e9b050cb1c1e#2415de75d5c0d684f4737421a375530268dc6c90_9_9)
      Toggle commit list
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jun 30, 2017
    Resolved by Hoang Phuc Do Jun 30, 2017
    app/models/order.rb
    1 1 class Order < ApplicationRecord
    2 2 has_many :product_items, dependent: :destroy
    3 3 belongs_to :user
    4 enum status: { 'Pending' => 0, 'Done' => 1 }
    5
    6 validates :status, presence: true
    7 validate :validate_status, on: :create
    8
    9 def self.default_status
    10 'Pending'
    11 end
    12
    13 def validate_status
    14 errors.add(:order_status, 'Error') if status != 'Pending'
    • Trong Huu Nguyen @huunt commented Jun 30, 2017
      Master

      Please change status != 'Pending' to status != self.statuses[:Pending]

      Edited Jun 30, 2017
      Please change `status != 'Pending'` to `status != self.statuses[:Pending]`
    • Hoang Phuc Do @phucdh

      changed this line in version 7 of the diff

      Jun 30, 2017

      changed this line in version 7 of the diff

      changed this line in [version 7 of the diff](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/8/diffs?diff_id=3423&start_sha=6d600565393ce59ceac3eeaff1d8aff3de61be84#2415de75d5c0d684f4737421a375530268dc6c90_14_14)
      Toggle commit list
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on the diff Jun 30, 2017
    Last updated by Trong Huu Nguyen Jun 30, 2017
    app/views/admin/orders.html.erb 0 → 100644
    1 <div class="container">
    2 <div class="row">
    3 <div class="col-md-9 col-md-push-3 my-account">
    4 <h2 class="h2 heading-primary font-weight-normal">
    5 Orders
    6 </h2>
    7 <%= render 'admin/orders/order_table' %>
    8 <div class="toolbar-bottom">
    9 <div class="toolbar">
    10 <div class="sorter">
    11 <%= paginate @orders, theme: 'bootstrap' %>
    • Trong Huu Nguyen @huunt commented Jun 30, 2017
      Master

      What happen when @orders.blank?

      What happen when @orders.blank?
    • Hoang Phuc Do @phucdh commented Jun 30, 2017
      Master

      Render an empty table?

      Render an empty table?
    • Trong Huu Nguyen @huunt commented Jun 30, 2017
      Master

      OK

      OK
    Please register or sign in to reply
  • Hoang Phuc Do @phucdh

    added 1 commit

    • 274b6899 - Merge remote-tracking branch 'origin/development' into dhp_order

    Compare with previous version

    Jun 30, 2017

    added 1 commit

    • 274b6899 - Merge remote-tracking branch 'origin/development' into dhp_order

    Compare with previous version

    added 1 commit * 274b6899 - Merge remote-tracking branch &#x27;origin&#x2F;development&#x27; into dhp_order [Compare with previous version](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/8/diffs?diff_id=3423&start_sha=6d600565393ce59ceac3eeaff1d8aff3de61be84)
    Toggle commit list
  • Hoang Phuc Do @phucdh

    added 1 commit

    • 4c819563 - Merge remote-tracking branch 'origin/development' into dhp_order

    Compare with previous version

    Jun 30, 2017

    added 1 commit

    • 4c819563 - Merge remote-tracking branch 'origin/development' into dhp_order

    Compare with previous version

    added 1 commit * 4c819563 - Merge remote-tracking branch &#x27;origin&#x2F;development&#x27; into dhp_order [Compare with previous version](https://gitlab.zigexn.vn/phucdh/dhp-venshop/merge_requests/8/diffs?diff_id=3424&start_sha=274b68991d56ff9b157a7b5108a2e9b050cb1c1e)
    Toggle commit list
  • Trong Huu Nguyen @huunt

    mentioned in commit 598b3bb5

    Jun 30, 2017

    mentioned in commit 598b3bb5

    mentioned in commit 598b3bb5736f60046b3da11ac872930b6109e52c
    Toggle commit list
  • Trong Huu Nguyen @huunt

    merged

    Jun 30, 2017

    merged

    merged
    Toggle commit list
  • Write
  • Preview
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 sign in to comment
Trong Huu Nguyen
Assignee
Trong Huu Nguyen @huunt
Assign to
None
Milestone
None
Assign milestone
Time tracking
2
2 participants
Reference: phucdh/dhp-venshop!8
×

Revert this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.
×

Cherry-pick this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.