Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
V
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
  • Truong Ba Dieu
  • VenShop
  • Merge Requests
  • !1

Closed
Opened Jul 15, 2015 by Truong Ba Dieu@dieutb 
  • Report abuse
Report abuse

Feature item display

×

Check out, review, and merge locally

Step 1. Fetch and check out the branch for this merge request

git fetch origin
git checkout -b feature-item-display origin/feature-item-display

Step 2. Review the changes locally

Step 3. Merge the branch and fix any conflicts that come up

git checkout dev
git merge --no-ff feature-item-display

Step 4. Push the result of the merge to GitLab

git push origin dev

Note that pushing to GitLab requires write access to this repository.

Tip: You can also checkout merge requests locally by following these guidelines.

  • Discussion 12
  • Commits 4
  • Changes
{{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved
  • Truong Ba Dieu @dieutb

    Added 1 commit:

    • f6cdd883 - Restruct space
    Jul 15, 2015

    Added 1 commit:

    • f6cdd883 - Restruct space
    Added 1 commit: * f6cdd883 - Restruct space
    Toggle commit list
  • Truong Ba Dieu @dieutb

    Added 1 commit:

    • da5d87f3 - 2.2 User management feature, 2.3 Item posting feature
    Jul 15, 2015

    Added 1 commit:

    • da5d87f3 - 2.2 User management feature, 2.3 Item posting feature
    Added 1 commit: * da5d87f3 - 2.2 User management feature, 2.3 Item posting feature
    Toggle commit list
  • Nguyen Ngoc Lan
    @lannn started a discussion on the diff Jul 16, 2015
    app/controllers/categories_controller.rb 0 → 100644
    1 class CategoriesController < ApplicationController
    2 before_filter :get_categories
    3
    4 def show
    5 params[:per_page] ||= 5
    • Nguyen Ngoc Lan @lannn commented Jul 16, 2015
      Master

      @dieutb per_page should belong to model. Can you move it to Category model?

      https://github.com/amatsuda/kaminari#configuring-default-per_page-value-for-each-model

      @dieutb per_page should belong to model. Can you move it to Category model? https://github.com/amatsuda/kaminari#configuring-default-per_page-value-for-each-model
    Please register or sign in to reply
  • Nguyen Ngoc Lan
    @lannn started a discussion on the diff Jul 16, 2015
    app/controllers/categories_controller.rb 0 → 100644
    1 class CategoriesController < ApplicationController
    2 before_filter :get_categories
    3
    4 def show
    5 params[:per_page] ||= 5
    6 params[:page] ||= 1
    • Nguyen Ngoc Lan @lannn commented Jul 16, 2015
      Master

      @dieutb You set default page in here. But kaminari sets to first page if params[:page] is blank. So you don't need to set params[:page] here

      Edited Jul 16, 2015
      @dieutb You set default page in here. But kaminari sets to first page if params[:page] is blank. So you don't need to set params[:page] here
    Please register or sign in to reply
  • Nguyen Ngoc Lan
    @lannn started a discussion on the diff Jul 16, 2015
    app/controllers/home_controller.rb
    1 1 class HomeController < ApplicationController
    2 def index
    3
    4 end
    2 add_breadcrumb "Home", :root_path
    3
    4 before_filter :get_categories
    • Nguyen Ngoc Lan @lannn commented Jul 16, 2015
      Master

      @dieutb in rails 4, we use before_action. Please check all controller and change to before_action

      @dieutb in rails 4, we use before_action. Please check all controller and change to before_action
    Please register or sign in to reply
  • Nguyen Ngoc Lan
    @lannn started a discussion on the diff Jul 16, 2015
    app/controllers/products_controller.rb 0 → 100644
    1 class ProductsController < ApplicationController
    2 before_filter :get_categories
    • Nguyen Ngoc Lan @lannn commented Jul 16, 2015
      Master

      @dieutb need new line between methods. It looks easier

      Edited Jul 16, 2015
      @dieutb need new line between methods. It looks easier
    Please register or sign in to reply
  • Nguyen Ngoc Lan
    @lannn started a discussion on the diff Jul 16, 2015
    app/helpers/application_helper.rb
    1 1 module ApplicationHelper
    2 def currency_number(price=0, currency="usd")
    • Nguyen Ngoc Lan @lannn commented Jul 16, 2015
      Master

      @dieutb rails has helpers like number_to_currency. You can use it instead of write new method http://api.rubyonrails.org/

      @dieutb rails has helpers like number_to_currency. You can use it instead of write new method http://api.rubyonrails.org/
    Please register or sign in to reply
  • Nguyen Ngoc Lan
    @lannn started a discussion on the diff Jul 16, 2015
    app/models/product.rb 0 → 100644
    1 class Product < ActiveRecord::Base
    2 belongs_to :category
    3 belongs_to :user
    4
    5 dragonfly_accessor :image do
    6 # default 'public/images/product_default.jpg'
    7 end
    8
    9 validates :pid, :title, :price, :category_id, :image, :stock, :release_date, :public_date, presence: true
    10 validates :pid, uniqueness: true
    11
    12 scope :recommend, -> {where(recommend: true)}
    • Nguyen Ngoc Lan @lannn commented Jul 16, 2015
      Master

      @dieutb use space before } and after { Please take a look on convention

      http://wiki.zigexn.vn/doku.php?id=coding_rule

      https://github.com/bbatsov/ruby-style-guide

      Edited Jul 16, 2015
      @dieutb use space before } and after { Please take a look on convention http://wiki.zigexn.vn/doku.php?id=coding_rule https://github.com/bbatsov/ruby-style-guide
    Please register or sign in to reply
  • Nguyen Ngoc Lan
    @lannn started a discussion on the diff Jul 16, 2015
    app/services/datetime_service.rb 0 → 100644
    1 class DatetimeService
    2 def self.strptime(str = nil, type="%Y-%m-%d")
    • Nguyen Ngoc Lan @lannn commented Jul 16, 2015
      Master

      @dieutb Where does this method be used? If it is only used in views. Just put it in helper

      @dieutb Where does this method be used? If it is only used in views. Just put it in helper
    Please register or sign in to reply
  • Nguyen Ngoc Lan
    @lannn started a discussion on the diff Jul 16, 2015
    app/views/home/index.html.slim
  • Nguyen Ngoc Lan
    @lannn started a discussion on the diff Jul 16, 2015
    app/views/layouts/_navigation.html.slim
    9 9 span.icon-bar
    10 = link_to 'Home', root_path, class: 'navbar-brand'
    10 h1.logo
    11 a(href="#{root_path}" class='navbar-brand')
    12 = image_tag "logo.png"
    13 'Venshop
    11 14 .collapse.navbar-collapse
    12 15 ul.nav.navbar-nav
    13 16 = render 'layouts/navigation_links'
    14
    17
    15 18 ul.nav.navbar-nav.navbar-right
    16 19 - if current_user.present?
    17 20 li
    18 a= current_user.email
    21 = link_to (current_user.name || current_user.email), edit_user_registration_path
    • Nguyen Ngoc Lan @lannn commented Jul 16, 2015
      Master

      @dieutb You can use decorator to wrap this method instead of putting in views There is a gem for decorator: https://github.com/drapergem/draper

      @dieutb You can use decorator to wrap this method instead of putting in views There is a gem for decorator: https://github.com/drapergem/draper
    Please register or sign in to reply
  • Truong Ba Dieu
    @dieutb started a discussion on the diff Jul 16, 2015
    app/services/datetime_service.rb 0 → 100644
    1 class DatetimeService
    2 def self.strptime(str = nil, type="%Y-%m-%d")
    • Truong Ba Dieu @dieutb commented Jul 16, 2015
      Master

      Yes I have use it in controller, too

      Yes I have use it in controller, too
    Please register or sign in to reply
  • Truong Ba Dieu
    @dieutb started a discussion on the diff Jul 16, 2015
    app/helpers/application_helper.rb
    1 1 module ApplicationHelper
    2 def currency_number(price=0, currency="usd")
    • Truong Ba Dieu @dieutb commented Jul 16, 2015
      Master

      It is the syntax for currency in view. In view have many places show price. When we want change syntax, we just only edit function in helper

      It is the syntax for currency in view. In view have many places show price. When we want change syntax, we just only edit function in helper
    Please register or sign in to reply
  • Tran Hoang Viet
    @vietth started a discussion on the diff Jul 29, 2015
    app/helpers/application_helper.rb
    1 1 module ApplicationHelper
    2 def currency_number(price=0, currency="usd")
    • Tran Hoang Viet @vietth commented Jul 29, 2015
      Reporter

      'In view have many places show price' --> so you can write currency_number to wrap number_to_currency

      'In view have many places show price' --> so you can write `currency_number` to wrap `number_to_currency`
    Please register or sign in to reply
  • Truong Ba Dieu @dieutb

    Status changed to closed

    Jul 31, 2015

    Status changed to closed

    Status changed to closed
    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
Nguyen Ngoc Lan
Assignee
Nguyen Ngoc Lan @lannn
Assign to
None
Milestone
None
Assign milestone
Time tracking
1
Labels
Review
Assign labels
  • View labels
3
3 participants
Reference: dieutb/VenShop!1