Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
V
venjob_nth
  • 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 3
    • Merge Requests 3
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Ngô Trung Hưng
  • venjob_nth
  • Merge Requests
  • !11

Merged
Opened Aug 19, 2020 by Ngô Trung Hưng@hungnt 
  • Report abuse
Report abuse

create func favorite

×

Check out, review, and merge locally

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

git fetch origin
git checkout -b ID8_Favorite origin/ID8_Favorite

Step 2. Review the changes locally

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

git checkout master
git merge --no-ff ID8_Favorite

Step 4. Push the result of the merge to GitLab

git push origin master

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

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

  • Discussion 10
  • Commits 4
  • Pipelines 4
  • Changes 37
{{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved
  • Ngô Trung Hưng @hungnt

    added 1 commit

    • d0f4baff - continue create ID8

    Compare with previous version

    Aug 20, 2020

    added 1 commit

    • d0f4baff - continue create ID8

    Compare with previous version

    added 1 commit * d0f4baff - continue create ID8 [Compare with previous version](https://gitlab.zigexn.vn/hungnt/venjob_nth/merge_requests/11/diffs?diff_id=5122&start_sha=1f8ea29263e7ad7ec798a19b1095798a10ca184c)
    Toggle commit list
  • Ngô Trung Hưng @hungnt

    added 1 commit

    • e17efe61 - apply job in list favorited

    Compare with previous version

    Aug 21, 2020

    added 1 commit

    • e17efe61 - apply job in list favorited

    Compare with previous version

    added 1 commit * e17efe61 - apply job in list favorited [Compare with previous version](https://gitlab.zigexn.vn/hungnt/venjob_nth/merge_requests/11/diffs?diff_id=5126&start_sha=d0f4baff291aeaed2e9e34e0d0a7927eabbf1030)
    Toggle commit list
  • Hoang Phuc Do
    @phucdh started a discussion on an old version of the diff Aug 21, 2020
    Last updated by Ngô Trung Hưng Aug 21, 2020
    app/views/users/sign_in.js.erb 0 → 100644
    1 alert('You will be redirected to log in.');
    2 window.location = '/users/sign_in';
    • Hoang Phuc Do @phucdh commented Aug 21, 2020
      Master

      Thay vì sử dụng url trực tiếp /user/sign_in, sử dụng path helper của Rails

      Edited Aug 21, 2020
      Thay vì sử dụng url trực tiếp `/user/sign_in`, sử dụng path helper của Rails
    • Ngô Trung Hưng @hungnt commented Aug 21, 2020
      Master

      Dạ anh

      Dạ anh
    • Ngô Trung Hưng @hungnt

      changed this line in version 4 of the diff

      Aug 21, 2020

      changed this line in version 4 of the diff

      changed this line in [version 4 of the diff](https://gitlab.zigexn.vn/hungnt/venjob_nth/merge_requests/11/diffs?diff_id=5127&start_sha=e17efe61a95663d01afa6e392c270c8d0d10566e#7f9e9c4cdc19692a2cbca3f443ed0f32c84a26fc_2_0)
      Toggle commit list
    Please register or sign in to reply
  • Hoang Phuc Do
    @phucdh started a discussion on an old version of the diff Aug 21, 2020
    Resolved by Ngô Trung Hưng Aug 21, 2020
    config/routes.rb
    14 14 post 'confirm', to: 'apply_job#confirm', as: :confirm
    15 15 post 'done', to: 'apply_job#done', as: :done
    16 16 get 'my/jobs', to: 'apply_job#index', as: :list_applied_jobs
    17 # Fovorite
    18 post 'favorite', to: 'favorite#create', as: :favorite
    19 delete 'favorite', to: 'favorite#destroy', as: :destroy_favorite
    20 get 'favorite', to: 'favorite#index', as: :favorite_index
    • Hoang Phuc Do @phucdh commented Aug 21, 2020
      Master
          post 'favorite', to: 'favorite#create', as: :favorite
          delete 'favorite', to: 'favorite#destroy', as: :destroy_favorite
          get 'favorite', to: 'favorite#index', as: :favorite_index

      3 dòng trên có thể gom thành 1 như sau:

      resources :favorites, only: %i[index create destroy]
      Edited Aug 21, 2020
      ```ruby post 'favorite', to: 'favorite#create', as: :favorite delete 'favorite', to: 'favorite#destroy', as: :destroy_favorite get 'favorite', to: 'favorite#index', as: :favorite_index ``` 3 dòng trên có thể gom thành 1 như sau: ```ruby resources :favorites, only: %i[index create destroy] ```
    • Ngô Trung Hưng @hungnt

      changed this line in version 4 of the diff

      Aug 21, 2020

      changed this line in version 4 of the diff

      changed this line in [version 4 of the diff](https://gitlab.zigexn.vn/hungnt/venjob_nth/merge_requests/11/diffs?diff_id=5127&start_sha=e17efe61a95663d01afa6e392c270c8d0d10566e#e801163eb9182955dca3eb9817d59af634f6665d_20_18)
      Toggle commit list
    Please register or sign in to reply
  • Hoang Phuc Do
    @phucdh started a discussion on an old version of the diff Aug 21, 2020
    Resolved by Ngô Trung Hưng Aug 21, 2020
    app/helpers/application_helper.rb
    13 13 next if message.blank?
    14 14 type = 'success' if type == 'notice'
    15 15 type = 'error' if type == 'alert'
    16 type = 'warning' if type == 'alert'
    • Hoang Phuc Do @phucdh commented Aug 21, 2020
      Master

      Dòng này bị lặp với dòng trên.

      Edited Aug 21, 2020
      Dòng này bị lặp với dòng trên.
    • Ngô Trung Hưng @hungnt

      changed this line in version 4 of the diff

      Aug 21, 2020

      changed this line in version 4 of the diff

      changed this line in [version 4 of the diff](https://gitlab.zigexn.vn/hungnt/venjob_nth/merge_requests/11/diffs?diff_id=5127&start_sha=e17efe61a95663d01afa6e392c270c8d0d10566e#040453e670f9bf522378f941c96f3881076fee1f_16_17)
      Toggle commit list
    Please register or sign in to reply
  • Hoang Phuc Do
    @phucdh started a discussion on an old version of the diff Aug 21, 2020
    Resolved by Hoang Phuc Do Aug 24, 2020
    app/views/job/_block_info_job.html.erb
    43 <span><%= link_to '<i class="far fa-heart"></i>'.html_safe, '#', class: 'link_favorite' %><span>
    44 </div>
    45 </div>
    46 <% else %>
    47 <div class="box_link_favotite">
    48 <div class="block_click_favorite lg">
    49 <span><i class="far fa-heart"></i> <%= t('pages.index.btn_text_favorite') %><span>
    50 </div>
    51 <div class="block_click_favorite md">
    52 <span><i class="far fa-heart"></i><span>
    53 </div>
    54 </div>
    55 <% end %>
    40 <div class="link_favorite_top block_link_favorite">
    41 <% if user_signed_in? %>
    42 <% @favorite_id = current_user.favorites.find_by(job_id: data.id) %>
    • Hoang Phuc Do @phucdh commented Aug 21, 2020
      Master

      Sao cần gán instance variable ở đây ?

      Sao cần gán instance variable ở đây ?
    • Ngô Trung Hưng @hungnt commented Aug 21, 2020
      Master

      Khúc đó e nhầm

      Khúc đó e nhầm
    • Ngô Trung Hưng @hungnt

      changed this line in version 4 of the diff

      Aug 21, 2020

      changed this line in version 4 of the diff

      changed this line in [version 4 of the diff](https://gitlab.zigexn.vn/hungnt/venjob_nth/merge_requests/11/diffs?diff_id=5127&start_sha=e17efe61a95663d01afa6e392c270c8d0d10566e#a5a13672e91fdd4ff6b1a307c1a140709aed1452_42_42)
      Toggle commit list
    Please register or sign in to reply
  • Hoang Phuc Do
    @phucdh started a discussion on an old version of the diff Aug 21, 2020
    Resolved by Hoang Phuc Do Aug 24, 2020
    app/views/layouts/_header.html.erb
    10 10 <div class="header_top_menu_right">
    11 11 <ul class="list_menu_header_right">
    12 12 <li class="list_item_menu_header_right">
    13 <%= link_to t('pages.index.favorite'), '#', class: 'link_item_menu_header_right' %>
    13 <% if user_signed_in? %>
    • Hoang Phuc Do @phucdh commented Aug 21, 2020
      Master

      Có thể dùng link_to_if

      Có thể dùng `link_to_if`
    • Ngô Trung Hưng @hungnt

      changed this line in version 4 of the diff

      Aug 21, 2020

      changed this line in version 4 of the diff

      changed this line in [version 4 of the diff](https://gitlab.zigexn.vn/hungnt/venjob_nth/merge_requests/11/diffs?diff_id=5127&start_sha=e17efe61a95663d01afa6e392c270c8d0d10566e#12e0ffa73350b6f8b572afab727eeab71ee1df63_13_13)
      Toggle commit list
    Please register or sign in to reply
  • Hoang Phuc Do
    @phucdh started a discussion on the diff Aug 21, 2020
    Resolved by Hoang Phuc Do Aug 24, 2020
    app/controllers/favorite_controller.rb 0 → 100644
    8 end
    9
    10 def create
    11 return redirect_to root_path if Job.find(params[:job_id]).blank?
    12
    13 @favorite = current_user.favorites.new(job_id: params[:job_id])
    14 if @favorite.invalid?
    15 helpers.render_errors(@favorite)
    16 redirect_to favorite_index_path
    17 end
    18 respond_to :js if @favorite.save
    19 end
    20
    21 def destroy
    22 @favorite = current_user.favorites.find_by(id: params[:favorite_id])
    23 return redirect_to favorite_index_path if @favorite.blank?
    • Hoang Phuc Do @phucdh commented Aug 21, 2020
      Master

      Sao ở đây cần dùng return ?

      Sao ở đây cần dùng return ?
    • Ngô Trung Hưng @hungnt commented Aug 21, 2020
      Master

      Dạ return để nó dừng luôn method đó, nếu chỉ để redirect_to thì các dòng code còn lại vẫn thực thi

      Dạ return để nó dừng luôn method đó, nếu chỉ để `redirect_to` thì các dòng code còn lại vẫn thực thi
    Please register or sign in to reply
  • Hoang Phuc Do
    @phucdh started a discussion on an old version of the diff Aug 21, 2020
    Resolved by Hoang Phuc Do Aug 24, 2020
    app/controllers/favorite_controller.rb 0 → 100644
    1 # frozen_string_literal: true
    2
    3 class FavoriteController < ApplicationController
    4 before_action :authenticate_user!
    5
    6 def index
    7 @favorites = current_user.favorites.map(&:job)
    8 end
    9
    10 def create
    11 return redirect_to root_path if Job.find(params[:job_id]).blank?
    12
    13 @favorite = current_user.favorites.new(job_id: params[:job_id])
    14 if @favorite.invalid?
    15 helpers.render_errors(@favorite)
    16 redirect_to favorite_index_path
    • Hoang Phuc Do @phucdh commented Aug 21, 2020
      Master

      Vì sao ở đây không dùng return như method destroy ở dưới ?

      Vì sao ở đây không dùng return như method `destroy` ở dưới ?
    • Ngô Trung Hưng @hungnt

      changed this line in version 4 of the diff

      Aug 21, 2020

      changed this line in version 4 of the diff

      changed this line in [version 4 of the diff](https://gitlab.zigexn.vn/hungnt/venjob_nth/merge_requests/11/diffs?diff_id=5127&start_sha=e17efe61a95663d01afa6e392c270c8d0d10566e#d422c6489073f658b3fd86d59c1ba7eb80243e1f_16_16)
      Toggle commit list
    Please register or sign in to reply
  • Ngô Trung Hưng @hungnt

    added 1 commit

    • e105f69b - fix code favorite

    Compare with previous version

    Aug 21, 2020

    added 1 commit

    • e105f69b - fix code favorite

    Compare with previous version

    added 1 commit * e105f69b - fix code favorite [Compare with previous version](https://gitlab.zigexn.vn/hungnt/venjob_nth/merge_requests/11/diffs?diff_id=5127&start_sha=e17efe61a95663d01afa6e392c270c8d0d10566e)
    Toggle commit list
  • Hoang Phuc Do @phucdh

    enabled an automatic merge when the pipeline for e105f69b succeeds

    Aug 21, 2020

    enabled an automatic merge when the pipeline for e105f69b succeeds

    enabled an automatic merge when the pipeline for e105f69bfecacdc999919b2b0347a61d4844ff35 succeeds
    Toggle commit list
  • Ngô Trung Hưng @hungnt

    canceled the automatic merge

    Aug 21, 2020

    canceled the automatic merge

    canceled the automatic merge
    Toggle commit list
  • Ngô Trung Hưng @hungnt

    mentioned in commit 1872940f

    Aug 21, 2020

    mentioned in commit 1872940f

    mentioned in commit 1872940f93cd1dcf0d2023716c47bcd282e7de1e
    Toggle commit list
  • Ngô Trung Hưng @hungnt

    merged

    Aug 21, 2020

    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
Assignee
No assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
2
2 participants
Reference: hungnt/venjob_nth!11
×

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.