Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
V
veNJOB
  • 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 2
    • Merge Requests 2
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Thanh Hung Pham
  • veNJOB
  • Merge Requests
  • !4

Open
Opened Jul 11, 2017 by Thanh Hung Pham@hungpt 
  • Report abuse
Report abuse

Hungpt jobs

All features of job

×

Check out, review, and merge locally

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

git fetch origin
git checkout -b hungpt_jobs origin/hungpt_jobs

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 hungpt_jobs

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 62
  • Commits 44
  • Changes 55
{{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved
  • Thanh Hung Pham @hungpt

    added 1 commit

    • 904865d8 - Change pagin with kaminari gem

    Compare with previous version

    Jul 11, 2017

    added 1 commit

    • 904865d8 - Change pagin with kaminari gem

    Compare with previous version

    added 1 commit * 904865d8 - Change pagin with kaminari gem [Compare with previous version](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3472&start_sha=0981b6516152cd6472832c886909c1588df49a7b)
    Toggle commit list
  • Tan Phat Nguyen
    @phatnt started a discussion on the diff Jul 20, 2017
    Last updated by Thanh Hung Pham Jul 24, 2017
    app/controllers/jobs_controller.rb
    1 1 class JobsController < ApplicationController
    2 2 def applied_jobs
    3 3 @applied_jobs = Apply.where(user_id: current_user.id)
    4 render :applied_jobs
    4 end
    5
    6 def detail
    7 @job = Job.find(params[:id])
    • Tan Phat Nguyen @phatnt commented Jul 20, 2017
      Master

      @hungpt Can you rescue exception render 404 page not found, if find(id) error?

      @hungpt Can you rescue exception render 404 page not found, if find(id) error?
    • Thanh Hung Pham @hungpt commented Jul 20, 2017
      Master

      fixed

      fixed
    • Trong Huu Nguyen @huunt commented Jul 21, 2017
      Master

      I think we should use Job.find_by_id(params[:id]) redirect 404 if job.blank?

      I think we should use Job.find_by_id(`params[:id]`) redirect 404 if job.blank?
    • Thanh Hung Pham @hungpt commented Jul 24, 2017
      Master

      I have cached an error ActiveRecord::RecordNotFound in application_controller and render 404 page.

      I have cached an error ActiveRecord::RecordNotFound in application_controller and render 404 page.
    Please register or sign in to reply
  • Tan Phat Nguyen
    @phatnt started a discussion on an old version of the diff Jul 20, 2017
    Last updated by Thanh Hung Pham Jul 20, 2017
    app/controllers/jobs_controller.rb
    1 1 class JobsController < ApplicationController
    2 2 def applied_jobs
    3 3 @applied_jobs = Apply.where(user_id: current_user.id)
    4 render :applied_jobs
    4 end
    5
    6 def detail
    7 @job = Job.find(params[:id])
    8 History.new(user: current_user, job: @job).save if History.where(user: current_user, job: @job).blank?
    • Tan Phat Nguyen @phatnt commented Jul 20, 2017
      Master

      @hungpt If existed, please update updated_at, except save a lot of same content

      @hungpt If existed, please update ``updated_at``, except save a lot of same content
    • Thanh Hung Pham @hungpt

      changed this line in version 5 of the diff

      Jul 20, 2017

      changed this line in version 5 of the diff

      changed this line in [version 5 of the diff](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3480&start_sha=5ca75397cc0c7b63e2b855e46d822efc94a9443f#6fa69a07843a58f190bf4d7e0692b9cc5b0bf52b_8_8)
      Toggle commit list
    • Thanh Hung Pham @hungpt commented Jul 20, 2017
      Master

      fixed

      fixed
    Please register or sign in to reply
  • Tan Phat Nguyen
    @phatnt started a discussion on an old version of the diff Jul 20, 2017
    Last updated by Thanh Hung Pham Jul 21, 2017
    app/controllers/jobs_controller.rb
    12 @job_id = params[:job_id]
    13 end
    14
    15 def confirm
    16 @fullname = params[:fullname]
    17 @email = params[:email]
    18 @job_id = params[:job_id]
    19 end
    20
    21 def done
    22 @email = params[:email]
    23 @fullname = params[:fullname]
    24 @cv_link = 'link to download'
    25 @job = Job.find(params[:job_id])
    26
    27 @apply_job = Apply.new(user: current_user, job: @job, applied_at: Time.zone.now).save
    • Tan Phat Nguyen @phatnt commented Jul 20, 2017
      Master

      @hungpt Where to validate the fields on screen?

      @hungpt Where to validate the fields on screen?
    • Van Toan Vu @toanvv commented Jul 21, 2017
      Master

      we dont need instance variable here: @cv_link = 'link to download'

      and

      if @apply_job.save flash sucess else flash error and redirect, or render end

      Edited Jul 21, 2017 by Van Toan Vu
      we dont need instance variable here: `@cv_link = 'link to download'` and `if @apply_job.save flash sucess else flash error and redirect, or render end`
    • Thanh Hung Pham @hungpt

      changed this line in version 7 of the diff

      Jul 21, 2017

      changed this line in version 7 of the diff

      changed this line in [version 7 of the diff](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3482&start_sha=98594865c3d24664a7c8a6e7fccbc1e8cf6e3c24#6fa69a07843a58f190bf4d7e0692b9cc5b0bf52b_30_48)
      Toggle commit list
    • Thanh Hung Pham @hungpt commented Jul 21, 2017
      Master

      fixed, variable: @cv_link use in send mail conent.

      fixed, variable: @cv_link use in send mail conent.
    Please register or sign in to reply
  • Tan Phat Nguyen
    @phatnt started a discussion on an old version of the diff Jul 20, 2017
    Last updated by Van Toan Vu Jul 21, 2017
    app/controllers/jobs_controller.rb
    17 @email = params[:email]
    18 @job_id = params[:job_id]
    19 end
    20
    21 def done
    22 @email = params[:email]
    23 @fullname = params[:fullname]
    24 @cv_link = 'link to download'
    25 @job = Job.find(params[:job_id])
    26
    27 @apply_job = Apply.new(user: current_user, job: @job, applied_at: Time.zone.now).save
    28 ApplyMailer.apply_mail(@email, @fullname, @cv_link, @job).deliver
    29 end
    30
    31 def show
    32 unless params[:city_id].nil?
    • Tan Phat Nguyen @phatnt commented Jul 20, 2017
      Master

      @hungpt you should use method blank? or present? existed on rails

      @hungpt you should use method ``blank?`` or ``present?`` existed on rails
    • Thanh Hung Pham @hungpt

      changed this line in version 3 of the diff

      Jul 20, 2017

      changed this line in version 3 of the diff

      changed this line in [version 3 of the diff](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3478&start_sha=904865d860ca28bd9acbe0490716f0741ec7c992#6fa69a07843a58f190bf4d7e0692b9cc5b0bf52b_32_32)
      Toggle commit list
    • Thanh Hung Pham @hungpt commented Jul 20, 2017
      Master

      fixed

      Edited Jul 20, 2017 by Thanh Hung Pham
      fixed
    • Van Toan Vu @toanvv commented Jul 21, 2017
      Master

      preference different between deliver vs deliver_now, deliver_later https://stackoverflow.com/questions/32619366/difference-between-action-job-mailers-deliver-now-and-deliver-later

      preference different between deliver vs deliver_now, deliver_later https://stackoverflow.com/questions/32619366/difference-between-action-job-mailers-deliver-now-and-deliver-later
    Please register or sign in to reply
  • Tan Phat Nguyen
    @phatnt started a discussion on an old version of the diff Jul 20, 2017
    Last updated by Thanh Hung Pham Jul 20, 2017
    app/controllers/jobs_controller.rb
    23 @fullname = params[:fullname]
    24 @cv_link = 'link to download'
    25 @job = Job.find(params[:job_id])
    26
    27 @apply_job = Apply.new(user: current_user, job: @job, applied_at: Time.zone.now).save
    28 ApplyMailer.apply_mail(@email, @fullname, @cv_link, @job).deliver
    29 end
    30
    31 def show
    32 unless params[:city_id].nil?
    33 @job_count = Job.where(city_id: params[:city_id]).count
    34 @jobs = Job.where(city_id: params[:city_id]).page params[:page]
    35 @search_conditions = "All jobs in #{City.find(params[:city_id]).name}"
    36 end
    37
    38 unless params[:category_id].nil?
    • Tan Phat Nguyen @phatnt commented Jul 20, 2017
      Master

      @hungpt you should use method blank? or present? existed on rails

      @hungpt you should use method `blank?` or `present?` existed on rails
    • Thanh Hung Pham @hungpt

      changed this line in version 3 of the diff

      Jul 20, 2017

      changed this line in version 3 of the diff

      changed this line in [version 3 of the diff](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3478&start_sha=904865d860ca28bd9acbe0490716f0741ec7c992#6fa69a07843a58f190bf4d7e0692b9cc5b0bf52b_38_38)
      Toggle commit list
    • Thanh Hung Pham @hungpt commented Jul 20, 2017
      Master

      fixed

      fixed
    Please register or sign in to reply
  • Tan Phat Nguyen
    @phatnt started a discussion on an old version of the diff Jul 20, 2017
    Last updated by Thanh Hung Pham Jul 20, 2017
    app/controllers/jobs_controller.rb
    30
    31 def show
    32 unless params[:city_id].nil?
    33 @job_count = Job.where(city_id: params[:city_id]).count
    34 @jobs = Job.where(city_id: params[:city_id]).page params[:page]
    35 @search_conditions = "All jobs in #{City.find(params[:city_id]).name}"
    36 end
    37
    38 unless params[:category_id].nil?
    39 @job_ids = JobCategory.where(category_id: params[:category_id]).select(:job_id)
    40 @job_count = Job.where(id: @job_ids).count
    41 @jobs = Job.where(id: @job_ids).page params[:page]
    42 @search_conditions = "All jobs in #{Category.find(params[:category_id]).name}"
    43 end
    44
    45 unless params[:company_id].nil?
    • Tan Phat Nguyen @phatnt commented Jul 20, 2017
      Master

      @hungpt you should use method blank? or present? existed on rails

      @hungpt you should use method `blank?` or `present?` existed on rails
    • Thanh Hung Pham @hungpt

      changed this line in version 3 of the diff

      Jul 20, 2017

      changed this line in version 3 of the diff

      changed this line in [version 3 of the diff](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3478&start_sha=904865d860ca28bd9acbe0490716f0741ec7c992#6fa69a07843a58f190bf4d7e0692b9cc5b0bf52b_45_45)
      Toggle commit list
    • Thanh Hung Pham @hungpt commented Jul 20, 2017
      Master

      fixed

      fixed
    Please register or sign in to reply
  • Thanh Hung Pham @hungpt

    added 1 commit

    • c70037cd - change nil? to blank?

    Compare with previous version

    Jul 20, 2017

    added 1 commit

    • c70037cd - change nil? to blank?

    Compare with previous version

    added 1 commit * c70037cd - change nil? to blank? [Compare with previous version](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3478&start_sha=904865d860ca28bd9acbe0490716f0741ec7c992)
    Toggle commit list
  • Thanh Hung Pham @hungpt

    added 1 commit

    • 5ca75397 - Add 404 page

    Compare with previous version

    Jul 20, 2017

    added 1 commit

    • 5ca75397 - Add 404 page

    Compare with previous version

    added 1 commit * 5ca75397 - Add 404 page [Compare with previous version](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3479&start_sha=c70037cd5ed8fc51049232aa5d2dfe99f4b3ff3f)
    Toggle commit list
  • Thanh Hung Pham @hungpt

    added 1 commit

    • 9efeecec - fix update history

    Compare with previous version

    Jul 20, 2017

    added 1 commit

    • 9efeecec - fix update history

    Compare with previous version

    added 1 commit * 9efeecec - fix update history [Compare with previous version](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3480&start_sha=5ca75397cc0c7b63e2b855e46d822efc94a9443f)
    Toggle commit list
  • Thanh Hung Pham @hungpt

    added 1 commit

    • 98594865 - Validate form

    Compare with previous version

    Jul 20, 2017

    added 1 commit

    • 98594865 - Validate form

    Compare with previous version

    added 1 commit * 98594865 - Validate form [Compare with previous version](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3481&start_sha=9efeecec8e7e4bbf8f72020663fb1e67156b3630)
    Toggle commit list
  • Van Toan Vu @toanvv

    assigned to @toanvv

    Jul 21, 2017

    assigned to @toanvv

    assigned to @toanvv
    Toggle commit list
  • Thanh Hung Pham @hungpt

    added 1 commit

    • fa9f23e6 - Fix comment validate

    Compare with previous version

    Jul 21, 2017

    added 1 commit

    • fa9f23e6 - Fix comment validate

    Compare with previous version

    added 1 commit * fa9f23e6 - Fix comment validate [Compare with previous version](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3482&start_sha=98594865c3d24664a7c8a6e7fccbc1e8cf6e3c24)
    Toggle commit list
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jul 21, 2017
    Last updated by Thanh Hung Pham Jul 24, 2017
    app/assets/javascripts/custom.js 0 → 100644
    1 $(function() {
    2 $( ".favorite_add" ).on( "click", function() {
    • Trong Huu Nguyen @huunt commented Jul 21, 2017
      Master

      I think we use remote: true is better use javascript.

      I think we use remote: true is better use javascript.
    • Thanh Hung Pham @hungpt commented Jul 24, 2017
      Master

      fixed

      fixed
    • Thanh Hung Pham @hungpt

      changed this line in version 16 of the diff

      Jul 24, 2017

      changed this line in version 16 of the diff

      changed this line in [version 16 of the diff](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3491&start_sha=0226f7a2ba3b26ea5671a5f1917527cf1b44e265#7d1e77be2ec6eb770958c170bedec015ae798b8e_2_2)
      Toggle commit list
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jul 21, 2017
    Last updated by Thanh Hung Pham Jul 24, 2017
    app/controllers/jobs_controller.rb
    1 1 class JobsController < ApplicationController
    2 2 def applied_jobs
    3 3 @applied_jobs = Apply.where(user_id: current_user.id)
    • Trong Huu Nguyen @huunt commented Jul 21, 2017
      Master

      Please change Apply.where(user_id: current_user.id) to current_user.applies

      Please change `Apply.where(user_id: current_user.id)` to `current_user`.applies
    • Thanh Hung Pham @hungpt

      changed this line in version 8 of the diff

      Jul 24, 2017

      changed this line in version 8 of the diff

      changed this line in [version 8 of the diff](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3483&start_sha=fa9f23e6a9daef97145c077b56aa01b76bb25479#6fa69a07843a58f190bf4d7e0692b9cc5b0bf52b_3_3)
      Toggle commit list
    • Thanh Hung Pham @hungpt commented Jul 24, 2017
      Master

      fixed

      fixed
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jul 21, 2017
    Last updated by Thanh Hung Pham Jul 24, 2017
    app/controllers/jobs_controller.rb
    1 1 class JobsController < ApplicationController
    2 2 def applied_jobs
    3 3 @applied_jobs = Apply.where(user_id: current_user.id)
    4 render :applied_jobs
    4 end
    5
    6 def detail
    7 @job = Job.find(params[:id])
    8 @history = History.find_or_create_by(user: current_user, job: @job)
    9 @history.touch(:updated_at)
    • Trong Huu Nguyen @huunt commented Jul 21, 2017
      Master

      Please remove this line.

      Please remove this line.
    • Thanh Hung Pham @hungpt commented Jul 24, 2017
      Master

      fixed

      fixed
    • Thanh Hung Pham @hungpt

      changed this line in version 17 of the diff

      Jul 24, 2017

      changed this line in version 17 of the diff

      changed this line in [version 17 of the diff](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3492&start_sha=ba345db22c99a3835b18846f283c68c5884ebd4c#6fa69a07843a58f190bf4d7e0692b9cc5b0bf52b_9_9)
      Toggle commit list
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on the diff Jul 21, 2017
    Last updated by Thanh Hung Pham Jul 24, 2017
    app/controllers/jobs_controller.rb
    1 1 class JobsController < ApplicationController
    2 2 def applied_jobs
    3 3 @applied_jobs = Apply.where(user_id: current_user.id)
    4 render :applied_jobs
    4 end
    5
    6 def detail
    7 @job = Job.find(params[:id])
    8 @history = History.find_or_create_by(user: current_user, job: @job)
    9 @history.touch(:updated_at)
    10 end
    11
    12 def apply
    13 @apply_form = ApplyForm.new(apply_params)
    14 @apply_form.fullname ||= current_user.fullname
    • Trong Huu Nguyen @huunt commented Jul 21, 2017
      Master

      Why did you assign fullname?

      Why did you assign fullname?
    • Thanh Hung Pham @hungpt commented Jul 24, 2017
      Master

      These are two cases, first time: get value from current_user.fullname, else case: get value from params.

      These are two cases, first time: get value from current_user.fullname, else case: get value from params.
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on the diff Jul 21, 2017
    Last updated by Van Toan Vu Jul 24, 2017
    app/controllers/jobs_controller.rb
    12 def apply
    13 @apply_form = ApplyForm.new(apply_params)
    14 @apply_form.fullname ||= current_user.fullname
    15 @apply_form.email ||= current_user.email
    16 @apply_form.job_id ||= params[:job_id]
    17 end
    18
    19 def apply_params
    20 params.permit(:fullname, :email)
    21 end
    22
    23 def confirm
    24 @apply_form = ApplyForm.new(confirm_params)
    25 return if @apply_form.valid?
    26 flash[:error] = @apply_form.errors.full_messages.to_sentence
    27 render jobs_apply_path
    • Trong Huu Nguyen @huunt commented Jul 21, 2017
      Master

      Please change render to redirect.

      Please change render to redirect.
    • Thanh Hung Pham @hungpt commented Jul 24, 2017
      Master

      It just reloads page to show the error message and keep stage of the page.

      It just reloads page to show the error message and keep stage of the page.
    • Van Toan Vu @toanvv commented Jul 24, 2017
      Master

      try render :apply

      try render :apply
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jul 21, 2017
    Last updated by Thanh Hung Pham Jul 24, 2017
    app/controllers/jobs_controller.rb
    26 flash[:error] = @apply_form.errors.full_messages.to_sentence
    27 render jobs_apply_path
    28 end
    29
    30 def confirm_params
    31 params.require(:apply_form).permit(:fullname, :email, :job_id)
    32 end
    33
    34 def done
    35 @apply_form = ApplyForm.new(confirm_params)
    36 @cv_link = 'link to download'
    37 @job = Job.find(@apply_form.job_id)
    38
    39 @apply_job = Apply.new(user: current_user, job: @job, applied_at: Time.zone.now)
    40 if @apply_job.save
    41 ApplyMailer.apply_mail(@apply_form.email, @apply_form.fullname, @cv_link, @job).deliver_now
    • Trong Huu Nguyen @huunt commented Jul 21, 2017
      Master

      Please change ApplyMailer.apply_mail(@apply_form.email, @apply_form.fullname, @cv_link, @job) to ApplyMailer.apply_mail(@apply_form, @job, @cv_link)

      Please change `ApplyMailer.apply_mail(@apply_form.email, @apply_form.fullname, @cv_link, @job)` to `ApplyMailer.apply_mail(@apply_form, @job, @cv_link)`
    • Thanh Hung Pham @hungpt

      changed this line in version 9 of the diff

      Jul 24, 2017

      changed this line in version 9 of the diff

      changed this line in [version 9 of the diff](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3484&start_sha=90635aefc038401fa8b9335573931ca1fc0c0f1f#6fa69a07843a58f190bf4d7e0692b9cc5b0bf52b_41_41)
      Toggle commit list
    • Thanh Hung Pham @hungpt commented Jul 24, 2017
      Master

      fixed

      fixed
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jul 21, 2017
    Last updated by Thanh Hung Pham Jul 24, 2017
    app/controllers/jobs_controller.rb
    36 @cv_link = 'link to download'
    37 @job = Job.find(@apply_form.job_id)
    38
    39 @apply_job = Apply.new(user: current_user, job: @job, applied_at: Time.zone.now)
    40 if @apply_job.save
    41 ApplyMailer.apply_mail(@apply_form.email, @apply_form.fullname, @cv_link, @job).deliver_now
    42 flash[:success] = 'Apply success!'
    43 else
    44 flash[:error] = 'Apply error!'
    45 render jobs_apply_path
    46 end
    47
    48 end
    49
    50 def show
    51 unless params[:city_id].blank?
    • Trong Huu Nguyen @huunt commented Jul 21, 2017
      Master

      Please change if params[:city_id].present?

      Please change if `params[:city_id].present?`
    • Thanh Hung Pham @hungpt

      changed this line in version 10 of the diff

      Jul 24, 2017

      changed this line in version 10 of the diff

      changed this line in [version 10 of the diff](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3485&start_sha=fbedec7d2b965d147ddefe09295a6a9bf92248c7#6fa69a07843a58f190bf4d7e0692b9cc5b0bf52b_51_51)
      Toggle commit list
    • Thanh Hung Pham @hungpt commented Jul 24, 2017
      Master

      fixed

      fixed
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jul 21, 2017
    Last updated by Thanh Hung Pham Jul 24, 2017
    app/controllers/jobs_controller.rb
    37 @job = Job.find(@apply_form.job_id)
    38
    39 @apply_job = Apply.new(user: current_user, job: @job, applied_at: Time.zone.now)
    40 if @apply_job.save
    41 ApplyMailer.apply_mail(@apply_form.email, @apply_form.fullname, @cv_link, @job).deliver_now
    42 flash[:success] = 'Apply success!'
    43 else
    44 flash[:error] = 'Apply error!'
    45 render jobs_apply_path
    46 end
    47
    48 end
    49
    50 def show
    51 unless params[:city_id].blank?
    52 @job_count = Job.where(city_id: params[:city_id]).count
    • Trong Huu Nguyen @huunt commented Jul 21, 2017
      Master

      Please put Job.where(city_id: params[:city_id]) to scope.

      Please put `Job.where(city_id: params[:city_id])` to scope.
    • Thanh Hung Pham @hungpt

      changed this line in version 11 of the diff

      Jul 24, 2017

      changed this line in version 11 of the diff

      changed this line in [version 11 of the diff](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3486&start_sha=12e304a8c95779efc37877c8ca18eb8915385f11#6fa69a07843a58f190bf4d7e0692b9cc5b0bf52b_52_52)
      Toggle commit list
    • Thanh Hung Pham @hungpt commented Jul 24, 2017
      Master

      fixed

      fixed
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jul 21, 2017
    Last updated by Thanh Hung Pham Jul 24, 2017
    app/controllers/jobs_controller.rb
    42 flash[:success] = 'Apply success!'
    43 else
    44 flash[:error] = 'Apply error!'
    45 render jobs_apply_path
    46 end
    47
    48 end
    49
    50 def show
    51 unless params[:city_id].blank?
    52 @job_count = Job.where(city_id: params[:city_id]).count
    53 @jobs = Job.where(city_id: params[:city_id]).page params[:page]
    54 @search_conditions = "All jobs in #{City.find(params[:city_id]).name}"
    55 end
    56
    57 unless params[:category_id].blank?
    • Trong Huu Nguyen @huunt commented Jul 21, 2017
      Master

      Please change to if params[:category_id].present?

      Please change to if `params[:category_id].present?`
    • Thanh Hung Pham @hungpt

      changed this line in version 10 of the diff

      Jul 24, 2017

      changed this line in version 10 of the diff

      changed this line in [version 10 of the diff](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3485&start_sha=fbedec7d2b965d147ddefe09295a6a9bf92248c7#6fa69a07843a58f190bf4d7e0692b9cc5b0bf52b_57_57)
      Toggle commit list
    • Thanh Hung Pham @hungpt commented Jul 24, 2017
      Master

      fixed

      fixed
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jul 21, 2017
    Last updated by Thanh Hung Pham Jul 24, 2017
    app/views/apply_mailer/apply_mail.html.erb 0 → 100644
    1 <!DOCTYPE html>
    2 <html>
    3 <head>
    4 <meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
    5 </head>
    6 <body>
    7 <p> Dear <%= @fullname %></p>
    8 <p> Thank you for applied with VenJOB. Your applied job's information is as follow: </p>
    9 <p> Job title: <%= @job.name %> </p>
    10 <p> Location: <%= @job.city.name unless @job.city.nil? %> </p>
    • Trong Huu Nguyen @huunt commented Jul 21, 2017
      Master

      please change @job.city.try(:name)

      please change `@job.city.try(:name)`
    • Thanh Hung Pham @hungpt

      changed this line in version 12 of the diff

      Jul 24, 2017

      changed this line in version 12 of the diff

      changed this line in [version 12 of the diff](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3487&start_sha=4c890014b832af237b58ba105a73073b8e99cd67#de41a5a516143575740b23658c4fcb3e4de1f193_10_10)
      Toggle commit list
    • Thanh Hung Pham @hungpt commented Jul 24, 2017
      Master

      fixed

      fixed
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jul 21, 2017
    Last updated by Thanh Hung Pham Jul 24, 2017
    app/views/apply_mailer/apply_mail.html.erb 0 → 100644
    1 <!DOCTYPE html>
    2 <html>
    3 <head>
    4 <meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
    5 </head>
    6 <body>
    7 <p> Dear <%= @fullname %></p>
    8 <p> Thank you for applied with VenJOB. Your applied job's information is as follow: </p>
    9 <p> Job title: <%= @job.name %> </p>
    10 <p> Location: <%= @job.city.name unless @job.city.nil? %> </p>
    11 <p> Company: <%= @job.company.name unless @job.company.nil? %> </p>
    • Trong Huu Nguyen @huunt commented Jul 21, 2017
      Master

      Please change @job.company.try(:name)

      Please change `@job.company.try(:name)`
    • Thanh Hung Pham @hungpt

      changed this line in version 12 of the diff

      Jul 24, 2017

      changed this line in version 12 of the diff

      changed this line in [version 12 of the diff](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3487&start_sha=4c890014b832af237b58ba105a73073b8e99cd67#de41a5a516143575740b23658c4fcb3e4de1f193_11_10)
      Toggle commit list
    • Thanh Hung Pham @hungpt commented Jul 24, 2017
      Master

      fixed

      fixed
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jul 21, 2017
    Last updated by Thanh Hung Pham Jul 24, 2017
    app/views/apply_mailer/apply_mail.text.erb 0 → 100644
    1 Dear <%= @fullname %>
    2 Thank you for applied with VenJOB. Your applied job's information is as follow:
    3 Job title: <%= @job.name %>
    4 Location: <%= @job.city.name unless @job.city.nil? %>
    • Trong Huu Nguyen @huunt commented Jul 21, 2017
      Master

      The same above

      The same above
    • Thanh Hung Pham @hungpt

      changed this line in version 12 of the diff

      Jul 24, 2017

      changed this line in version 12 of the diff

      changed this line in [version 12 of the diff](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3487&start_sha=4c890014b832af237b58ba105a73073b8e99cd67#7b0894b7b358ebca64a59c168cd1898f7a7ffb3a_4_4)
      Toggle commit list
    • Thanh Hung Pham @hungpt commented Jul 24, 2017
      Master

      fixed

      fixed
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jul 21, 2017
    Last updated by Thanh Hung Pham Jul 24, 2017
    app/views/apply_mailer/apply_mail.text.erb 0 → 100644
    1 Dear <%= @fullname %>
    2 Thank you for applied with VenJOB. Your applied job's information is as follow:
    3 Job title: <%= @job.name %>
    4 Location: <%= @job.city.name unless @job.city.nil? %>
    5 Company: <%= @job.company.name unless @job.company.nil? %>
    • Trong Huu Nguyen @huunt commented Jul 21, 2017
      Master

      The same above

      The same above
    • Thanh Hung Pham @hungpt

      changed this line in version 12 of the diff

      Jul 24, 2017

      changed this line in version 12 of the diff

      changed this line in [version 12 of the diff](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3487&start_sha=4c890014b832af237b58ba105a73073b8e99cd67#7b0894b7b358ebca64a59c168cd1898f7a7ffb3a_5_4)
      Toggle commit list
    • Thanh Hung Pham @hungpt commented Jul 24, 2017
      Master

      fixed

      fixed
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jul 21, 2017
    Last updated by Thanh Hung Pham Jul 24, 2017
    app/views/categories/show.html.erb
    1 1 <%- provide('title', 'Industries') -%>
    2 2 <div class="well">
    3 <p> Industry list </p>
    3 <h3> Industry list </h3>
    4 4 <div class="list_categories">
    5 5 <div class="row">
    6 6 <%- @categories.each do |category| -%>
    7 7 <%- if category.job_category.count > 0 -%>
    8 8 <div class="col-md-3">
    9 <%= category.name %>
    9 <%= link_to category.name, jobs_show_path(category_id: category.id) %>
    • Trong Huu Nguyen @huunt commented Jul 21, 2017
      Master

      Please change jobs_show_path(category_id: category.id) to jobs_show_path(category.id)

      Please change `jobs_show_path(category_id: category.id)` to `jobs_show_path(category.id)`
    • Thanh Hung Pham @hungpt

      changed this line in version 15 of the diff

      Jul 24, 2017

      changed this line in version 15 of the diff

      changed this line in [version 15 of the diff](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3490&start_sha=b6201f91a96fb60ffdb37bf2f4e8c5b1a72e16cd#78c2bd047e2d531898c563c6723f5003dbe00f95_9_0)
      Toggle commit list
    • Thanh Hung Pham @hungpt commented Jul 24, 2017
      Master

      fixed

      fixed
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jul 24, 2017
    Last updated by Thanh Hung Pham Jul 24, 2017
    app/views/cities/show.html.erb
    13 13 </div>
    14 14 <%- @areas.each do |area| -%>
    15 15 <div class="well">
    16 <p> <%= area.name %> </p>
    16 <h3> <%= area.name %> </h3>
    17 17 <div class="row">
    18 18 <%- get_city_by_area(area).each do |city| -%>
    • Trong Huu Nguyen @huunt commented Jul 24, 2017
      Master

      Please put this method in area model

      Please put this method in area model
    • Thanh Hung Pham @hungpt

      changed this line in version 14 of the diff

      Jul 24, 2017

      changed this line in version 14 of the diff

      changed this line in [version 14 of the diff](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3489&start_sha=5293c7aef771b53cfd5d84921c4cf857344a9603#075273e4cb5c5ae60bf33ea9baa40f6f7428ee6c_18_18)
      Toggle commit list
    • Thanh Hung Pham @hungpt commented Jul 24, 2017
      Master

      fixed

      fixed
    Please register or sign in to reply
  • Trong Huu Nguyen
    @huunt started a discussion on an old version of the diff Jul 24, 2017
    Last updated by Thanh Hung Pham Jul 24, 2017
    app/views/jobs/applied_jobs.html.erb
    23 <%- end -%>
    5 <div class="table-responsive">
    6 <table class="table">
    7 <thead>
    8 <th> Job </th>
    9 <th> Description </th>
    10 <th> Location </th>
    11 <th style="width: 150px;"> Salary </th>
    12 <th style="width: 100px;"> Applied At </th>
    13 </thead>
    14 <tbody>
    15 <%- @applied_jobs.each do |apply| -%>
    16 <tr>
    17 <td> <%= link_to apply.job.name, jobs_detail_path(id: apply.job.id) %> </td>
    18 <td> <%= truncate(apply.job.description, length: 250) %> </td>
    19 <td> <%= apply.job.city.name unless apply.job.city.nil? %> </td>
    • Trong Huu Nguyen @huunt commented Jul 24, 2017
      Master

      Please change apply.job.city.try(:name)

      Please change apply.job.city.try(:name)
    • Thanh Hung Pham @hungpt

      changed this line in version 13 of the diff

      Jul 24, 2017

      changed this line in version 13 of the diff

      changed this line in [version 13 of the diff](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3488&start_sha=346c6529f4a0ba35a4e3095307f38c927ff8a759#497dc52227c3e0acc53d62720a754904d71c01ec_19_19)
      Toggle commit list
    • Thanh Hung Pham @hungpt commented Jul 24, 2017
      Master

      fixed

      fixed
    Please register or sign in to reply
  • Thanh Hung Pham @hungpt

    added 1 commit

    • 90635aef - Fix comment- current_user.applies

    Compare with previous version

    Jul 24, 2017

    added 1 commit

    • 90635aef - Fix comment- current_user.applies

    Compare with previous version

    added 1 commit * 90635aef - Fix comment- current_user.applies [Compare with previous version](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3483&start_sha=fa9f23e6a9daef97145c077b56aa01b76bb25479)
    Toggle commit list
  • Thanh Hung Pham @hungpt

    added 1 commit

    • fbedec7d - Fix comment - pass param to ApplyMailer.apply_mail method

    Compare with previous version

    Jul 24, 2017

    added 1 commit

    • fbedec7d - Fix comment - pass param to ApplyMailer.apply_mail method

    Compare with previous version

    added 1 commit * fbedec7d - Fix comment - pass param to ApplyMailer.apply_mail method [Compare with previous version](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3484&start_sha=90635aefc038401fa8b9335573931ca1fc0c0f1f)
    Toggle commit list
  • Thanh Hung Pham @hungpt

    added 1 commit

    • 12e304a8 - Fix comment - change unless .blank? to if .present

    Compare with previous version

    Jul 24, 2017

    added 1 commit

    • 12e304a8 - Fix comment - change unless .blank? to if .present

    Compare with previous version

    added 1 commit * 12e304a8 - Fix comment - change unless .blank? to if .present [Compare with previous version](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3485&start_sha=fbedec7d2b965d147ddefe09295a6a9bf92248c7)
    Toggle commit list
  • Thanh Hung Pham @hungpt

    added 1 commit

    • 4c890014 - Fix comment - create scope to find all jobs by city,company

    Compare with previous version

    Jul 24, 2017

    added 1 commit

    • 4c890014 - Fix comment - create scope to find all jobs by city,company

    Compare with previous version

    added 1 commit * 4c890014 - Fix comment - create scope to find all jobs by city,company [Compare with previous version](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3486&start_sha=12e304a8c95779efc37877c8ca18eb8915385f11)
    Toggle commit list
  • Thanh Hung Pham @hungpt

    added 1 commit

    • 346c6529 - Fix comment - use method @job.city.try(:name)

    Compare with previous version

    Jul 24, 2017

    added 1 commit

    • 346c6529 - Fix comment - use method @job.city.try(:name)

    Compare with previous version

    added 1 commit * 346c6529 - Fix comment - use method @job.city.try(:name) [Compare with previous version](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3487&start_sha=4c890014b832af237b58ba105a73073b8e99cd67)
    Toggle commit list
  • Thanh Hung Pham @hungpt

    added 1 commit

    • 5293c7ae - Fix comment - use .try(:name) method

    Compare with previous version

    Jul 24, 2017

    added 1 commit

    • 5293c7ae - Fix comment - use .try(:name) method

    Compare with previous version

    added 1 commit * 5293c7ae - Fix comment - use .try(:name) method [Compare with previous version](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3488&start_sha=346c6529f4a0ba35a4e3095307f38c927ff8a759)
    Toggle commit list
  • Thanh Hung Pham @hungpt

    added 1 commit

    • b6201f91 - Fix comment - move method to model

    Compare with previous version

    Jul 24, 2017

    added 1 commit

    • b6201f91 - Fix comment - move method to model

    Compare with previous version

    added 1 commit * b6201f91 - Fix comment - move method to model [Compare with previous version](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3489&start_sha=5293c7aef771b53cfd5d84921c4cf857344a9603)
    Toggle commit list
  • Thanh Hung Pham @hungpt

    added 1 commit

    • 0226f7a2 - Fix comment - change path

    Compare with previous version

    Jul 24, 2017

    added 1 commit

    • 0226f7a2 - Fix comment - change path

    Compare with previous version

    added 1 commit * 0226f7a2 - Fix comment - change path [Compare with previous version](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3490&start_sha=b6201f91a96fb60ffdb37bf2f4e8c5b1a72e16cd)
    Toggle commit list
  • Thanh Hung Pham @hungpt

    added 1 commit

    • ba345db2 - Fix comment - change javascript to remote:true

    Compare with previous version

    Jul 24, 2017

    added 1 commit

    • ba345db2 - Fix comment - change javascript to remote:true

    Compare with previous version

    added 1 commit * ba345db2 - Fix comment - change javascript to remote:true [Compare with previous version](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3491&start_sha=0226f7a2ba3b26ea5671a5f1917527cf1b44e265)
    Toggle commit list
  • Thanh Hung Pham @hungpt

    added 1 commit

    • 93f0a097 - Fix comment - remove method touch

    Compare with previous version

    Jul 24, 2017

    added 1 commit

    • 93f0a097 - Fix comment - remove method touch

    Compare with previous version

    added 1 commit * 93f0a097 - Fix comment - remove method touch [Compare with previous version](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3492&start_sha=ba345db22c99a3835b18846f283c68c5884ebd4c)
    Toggle commit list
  • Thanh Hung Pham @hungpt

    added 1 commit

    • 6300126d - Fix comment - remove js

    Compare with previous version

    Jul 24, 2017

    added 1 commit

    • 6300126d - Fix comment - remove js

    Compare with previous version

    added 1 commit * 6300126d - Fix comment - remove js [Compare with previous version](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3493&start_sha=93f0a097e6e6f975c6a72ce22c5a1bd4410e07f5)
    Toggle commit list
  • Van Toan Vu
    @toanvv started a discussion on an old version of the diff Jul 24, 2017
    Last updated by Thanh Hung Pham Jul 24, 2017
    app/views/jobs/index.html.erb 0 → 100644
    22 <tr>
    23 <th>Job</th>
    24 <th>Description</th>
    25 <th>Location</th>
    26 <th>Salary</th>
    27 </tr>
    28 </thead>
    29 <tbody>
    30 <%- @jobs.each do |job| -%>
    31 <tr>
    32 <td> <%= link_to job.name, job_path(job.id) %> </td>
    33 <td> <%= truncate(job.description, length: 250) %> </td>
    34 <td> <%= job.city.try(:name) %> </td>
    35 <td> <%= job.salary %> </td>
    36 <td>
    37 <%- if Favorite.where(user: current_user, job: job).blank? -%>
    • Van Toan Vu @toanvv commented Jul 24, 2017
      Master

      don't query DB in view.

      don't query DB in view.
    • Thanh Hung Pham @hungpt

      changed this line in version 19 of the diff

      Jul 24, 2017

      changed this line in version 19 of the diff

      changed this line in [version 19 of the diff](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3494&start_sha=6300126dd5526bdf230fefa637e198495b20db29#fd4909543e4d41ae0af907baf233a50d8e08d125_37_37)
      Toggle commit list
    • Thanh Hung Pham @hungpt commented Jul 24, 2017
      Master

      fixed

      fixed
    Please register or sign in to reply
  • Van Toan Vu
    @toanvv started a discussion on an old version of the diff Jul 24, 2017
    Last updated by Thanh Hung Pham Jul 24, 2017
    app/views/jobs/index.html.erb 0 → 100644
    29 <tbody>
    30 <%- @jobs.each do |job| -%>
    31 <tr>
    32 <td> <%= link_to job.name, job_path(job.id) %> </td>
    33 <td> <%= truncate(job.description, length: 250) %> </td>
    34 <td> <%= job.city.try(:name) %> </td>
    35 <td> <%= job.salary %> </td>
    36 <td>
    37 <%- if Favorite.where(user: current_user, job: job).blank? -%>
    38 <div class="col-md-3" id="favorite_<%= job.id %>">
    39 <%- if user_signed_in? -%>
    40 <%= link_to 'Favorite', jobs_favorite_path(job_id: job.id, format: 'js'), remote: true, class: 'favorite_add' %>
    41 <%- else -%>
    42 <%= link_to 'Favorite', new_user_session_path %>
    43 <%- end -%>
    44 <input type="hidden" id="job_id" name="job_id" value="<%= job.id %>">
    • Van Toan Vu @toanvv commented Jul 24, 2017
      Master

      what the purpose of this field?

      what the purpose of this field?
    • Thanh Hung Pham @hungpt

      changed this line in version 20 of the diff

      Jul 24, 2017

      changed this line in version 20 of the diff

      changed this line in [version 20 of the diff](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3495&start_sha=45cb0dd97bee20d3b97c4a83e1beb86847fa8929#fd4909543e4d41ae0af907baf233a50d8e08d125_44_39)
      Toggle commit list
    • Thanh Hung Pham @hungpt commented Jul 24, 2017
      Master

      fixed

      fixed
    Please register or sign in to reply
  • Van Toan Vu
    @toanvv started a discussion on the diff Jul 24, 2017
    Last updated by Thanh Hung Pham Jul 24, 2017
    app/views/layouts/_header.html.erb
    1 1 <header class="navbar navbar-fixed-top navbar-inverse">
    2 2 <div class="container">
    3 <%= link_to image_tag('', alt: 'veNJOB'), root_path, id: 'logo' %>
    3 <%= link_to image_tag('http://images.careerbuilder.vn/background/ok_cb_vipbn_vtlc_1440x430_1496992170.jpg', width: '100px'), root_path, id: 'logo'%>
    4 4 <nav>
    5 5 <ul class="nav navbar-nav navbar-right">
    6 6 <%- if user_signed_in? -%>
    7 7 <li> <%= link_to 'My profile', registrations_show_path %> </li>
    8 8 <li> <%= link_to 'Log out', destroy_user_session_path, method: :delete %> </li>
    9 <li> <%= link_to 'Favorite', jobs_favorited_jobs_path %> </li>
    10 <li> <%= link_to 'History', jobs_history_jobs_path %> </li>
    9 11 <%- else -%>
    10 12 <li> <%= link_to 'Login', new_user_session_path %> </li>
    • Van Toan Vu @toanvv commented Jul 24, 2017
      Master

      if user not signed in, redirect to signin page by controller.

      if user not signed in, redirect to signin page by controller.
    • Thanh Hung Pham @hungpt commented Jul 24, 2017
      Master

      fixed

      fixed
    Please register or sign in to reply
  • Van Toan Vu
    @toanvv started a discussion on the diff Jul 24, 2017
    app/controllers/companies_controller.rb 0 → 100644
    1 class CompaniesController < ApplicationController
    2
    3 def show
    4 @job_count = Job.all_jobs_in_company_id(params[:id]).count
    5 @jobs = Job.where(company_id: params[:id]).page params[:page]
    6 @search_conditions = "All jobs in #{Company.find(params[:id]).name}"
    • Van Toan Vu @toanvv commented Jul 24, 2017
      Master

      @company = Company.find(params[:id])

      so in view you can reuse it, for example @company.address, @company.something

      All jobs in <%= @company.name %>

      Edited Jul 24, 2017 by Van Toan Vu
      `@company = Company.find(params[:id])` so in view you can reuse it, for example @company.address, @company.something `All jobs in <%= @company.name %> `
    Please register or sign in to reply
  • Van Toan Vu
    @toanvv started a discussion on the diff Jul 24, 2017
    app/controllers/jobs_controller.rb
    1 1 class JobsController < ApplicationController
    2 2 def applied_jobs
    3 @applied_jobs = Apply.where(user_id: current_user.id)
    4 render :applied_jobs
    3 @applied_jobs = current_user.applies
    4 end
    5
    6 def show
    7 @job = Job.find(params[:id])
    8 @history = History.find_or_create_by(user: current_user, job: @job)
    9 @history.updated_at = Time.zone.now
    10 @history.save
    11 end
    12
    13 def apply
    14 @apply_form = ApplyForm.new(apply_params)
    • Van Toan Vu @toanvv commented Jul 24, 2017
      Master

      @apply_form being used in many actions, you should use before_action to DRY. same for @job, @jobs etc

      @apply_form being used in many actions, you should use before_action to DRY. same for @job, @jobs etc
    Please register or sign in to reply
  • Thanh Hung Pham @hungpt

    added 1 commit

    • 45cb0dd9 - Fix comment - change <%- -%> to <% %>

    Compare with previous version

    Jul 24, 2017

    added 1 commit

    • 45cb0dd9 - Fix comment - change <%- -%> to <% %>

    Compare with previous version

    added 1 commit * 45cb0dd9 - Fix comment - change &lt;%- -%&gt; to &lt;% %&gt; [Compare with previous version](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3494&start_sha=6300126dd5526bdf230fefa637e198495b20db29)
    Toggle commit list
  • Van Toan Vu
    @toanvv started a discussion on the diff Jul 24, 2017
    app/controllers/jobs_controller.rb
    3 @applied_jobs = Apply.where(user_id: current_user.id)
    4 render :applied_jobs
    3 @applied_jobs = current_user.applies
    4 end
    5
    6 def show
    7 @job = Job.find(params[:id])
    8 @history = History.find_or_create_by(user: current_user, job: @job)
    9 @history.updated_at = Time.zone.now
    10 @history.save
    11 end
    12
    13 def apply
    14 @apply_form = ApplyForm.new(apply_params)
    15 @apply_form.fullname ||= current_user.fullname
    16 @apply_form.email ||= current_user.email
    • Van Toan Vu @toanvv commented Jul 24, 2017
      Master

      what happen if current_user not exist? don't let logic in front end, never trust front end

      Edited Jul 24, 2017 by Van Toan Vu
      what happen if current_user not exist? don't let logic in front end, never trust front end
    Please register or sign in to reply
  • Van Toan Vu
    @toanvv started a discussion on the diff Jul 24, 2017
    app/controllers/jobs_controller.rb
    5
    6 def show
    7 @job = Job.find(params[:id])
    8 @history = History.find_or_create_by(user: current_user, job: @job)
    9 @history.updated_at = Time.zone.now
    10 @history.save
    11 end
    12
    13 def apply
    14 @apply_form = ApplyForm.new(apply_params)
    15 @apply_form.fullname ||= current_user.fullname
    16 @apply_form.email ||= current_user.email
    17 @apply_form.job_id ||= params[:job_id]
    18 end
    19
    20 def apply_params
    • Van Toan Vu @toanvv commented Jul 24, 2017
      Master

      params must place under private

      Edited Jul 24, 2017 by Van Toan Vu
      params must place under **private**
    Please register or sign in to reply
  • Van Toan Vu
    @toanvv started a discussion on an old version of the diff Jul 24, 2017
    Last updated by Thanh Hung Pham Jul 24, 2017
    app/controllers/jobs_controller.rb
    42 ApplyMailer.apply_mail(@apply_form, @cv_link, @job).deliver_now
    43 flash[:success] = 'Apply success!'
    44 else
    45 flash[:error] = 'Apply error!'
    46 render jobs_apply_path
    47 end
    48
    49 end
    50
    51 def index
    52 end
    53
    54 def favorite
    55 @job_id = params[:job_id]
    56 job = Job.find(@job_id)
    57 Favorite.new(user: current_user, job: job).save if Favorite.where(user: current_user, job: job).blank?
    • Van Toan Vu @toanvv commented Jul 24, 2017
      Master

      Favorite.find_or_initialize_by(user: current_user, job: job)

      Edited Jul 24, 2017 by Van Toan Vu
      `Favorite.find_or_initialize_by(user: current_user, job: job)`
    • Thanh Hung Pham @hungpt

      changed this line in version 20 of the diff

      Jul 24, 2017

      changed this line in version 20 of the diff

      changed this line in [version 20 of the diff](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3495&start_sha=45cb0dd97bee20d3b97c4a83e1beb86847fa8929#6fa69a07843a58f190bf4d7e0692b9cc5b0bf52b_57_55)
      Toggle commit list
    Please register or sign in to reply
  • Van Toan Vu
    @toanvv started a discussion on the diff Jul 24, 2017
    app/controllers/jobs_controller.rb
    48
    49 end
    50
    51 def index
    52 end
    53
    54 def favorite
    55 @job_id = params[:job_id]
    56 job = Job.find(@job_id)
    57 Favorite.new(user: current_user, job: job).save if Favorite.where(user: current_user, job: job).blank?
    58 end
    59
    60 def favorite_remove
    61 @job_id = params[:job_id]
    62 job = Job.find(@job_id)
    63 Favorite.where(user: current_user, job: job).destroy_all
    • Van Toan Vu @toanvv commented Jul 24, 2017
      Master

      what happen if Favorite.where(user: current_user, job: job) not found

      what happen if `Favorite.where(user: current_user, job: job)` not found
    Please register or sign in to reply
  • Van Toan Vu
    @toanvv started a discussion on the diff Jul 24, 2017
    app/controllers/jobs_controller.rb
    57 Favorite.new(user: current_user, job: job).save if Favorite.where(user: current_user, job: job).blank?
    58 end
    59
    60 def favorite_remove
    61 @job_id = params[:job_id]
    62 job = Job.find(@job_id)
    63 Favorite.where(user: current_user, job: job).destroy_all
    64 end
    65
    66 def favorited_jobs
    67 @favorited_jobs = Favorite.where(user: current_user)
    68
    69 end
    70
    71 def history_jobs
    72 @history_jobs = History.all
    • Van Toan Vu @toanvv commented Jul 24, 2017
      Master

      paginate man

      paginate man
    Please register or sign in to reply
  • Thanh Hung Pham @hungpt

    added 1 commit

    • 58da1976 - Fix comment - Check signed in by controller

    Compare with previous version

    Jul 24, 2017

    added 1 commit

    • 58da1976 - Fix comment - Check signed in by controller

    Compare with previous version

    added 1 commit * 58da1976 - Fix comment - Check signed in by controller [Compare with previous version](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3495&start_sha=45cb0dd97bee20d3b97c4a83e1beb86847fa8929)
    Toggle commit list
  • Thanh Hung Pham @hungpt

    added 1 commit

    • 0173688a - Fix comment - Don't query DB in view

    Compare with previous version

    Jul 24, 2017

    added 1 commit

    • 0173688a - Fix comment - Don't query DB in view

    Compare with previous version

    added 1 commit * 0173688a - Fix comment - Don&#x27;t query DB in view [Compare with previous version](https://gitlab.zigexn.vn/hungpt/veNJOB/merge_requests/4/diffs?diff_id=3496&start_sha=58da197694733a0028ee245425719da762977367)
    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
Van Toan Vu
Assignee
Van Toan Vu @toanvv
Assign to
None
Milestone
None
Assign milestone
Time tracking
4
4 participants
Reference: hungpt/veNJOB!4