Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
V
venjobs_app
  • 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
  • Quang Vinh Nguyen
  • venjobs_app
  • Merge Requests
  • !8

Merged
Opened Jun 25, 2018 by Quang Vinh Nguyen@vinhnq 
  • Report abuse
Report abuse

Add job apply

×

Check out, review, and merge locally

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

git fetch origin
git checkout -b add-job-apply origin/add-job-apply

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 add-job-apply

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 14
  • Commits 6
  • Changes 34
{{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved
  • Van Toan Vu
    @toanvv started a discussion on an old version of the diff Jun 25, 2018
    Last updated by Quang Vinh Nguyen Jun 25, 2018
    app/controllers/entries_controller.rb 0 → 100644
    23 end
    24
    25 # GET /entries/1/edit
    26 def edit; end
    27
    28 # POST /entries
    29 # POST /entries.json
    30 def create
    31 @entry = Entry.new(entry_params)
    32
    33 @job = Job.find(params[:job_id])
    34
    35 @user = User.find_by(email: params[:entry][:entry_email]) ||
    36 User.create(name: params[:entry][:entry_name],
    37 email: params[:entry][:entry_email],
    38 password: 'password',
    • Van Toan Vu @toanvv commented Jun 25, 2018
      Master

      use SecureRandom to generate password

      use SecureRandom to generate password
    • Quang Vinh Nguyen @vinhnq

      changed this line in version 2 of the diff

      Jun 25, 2018

      changed this line in version 2 of the diff

      changed this line in [version 2 of the diff](https://gitlab.zigexn.vn/vinhnq/venjobs_app/merge_requests/8/diffs?diff_id=3926&start_sha=70f021b108e1f8142ca26a68a73c3f4536d285e7#b1ba06efa22f1e30bc94f06833f701b5d49f294b_38_32)
      Toggle commit list
    Please register or sign in to reply
  • Van Toan Vu
    @toanvv started a discussion on an old version of the diff Jun 25, 2018
    Last updated by Quang Vinh Nguyen Jun 25, 2018
    app/controllers/entries_controller.rb 0 → 100644
    3 class EntriesController < ApplicationController
    4 before_action :set_entry, only: [:show, :edit, :update, :destroy]
    5
    6 # GET /entries
    7 # GET /entries.json
    8 def index
    9 @entries = Entry.all
    10 end
    11
    12 # GET /entries/1
    13 # GET /entries/1.json
    14 def show; end
    15
    16 # GET /entries/new
    17 def new
    18 if params[:entry_name].blank? && params[:entry_email]
    • Van Toan Vu @toanvv commented Jun 25, 2018
      Master

      do we need if/else here?

      do we need if/else here?
    • Quang Vinh Nguyen @vinhnq

      changed this line in version 2 of the diff

      Jun 25, 2018

      changed this line in version 2 of the diff

      changed this line in [version 2 of the diff](https://gitlab.zigexn.vn/vinhnq/venjobs_app/merge_requests/8/diffs?diff_id=3926&start_sha=70f021b108e1f8142ca26a68a73c3f4536d285e7#b1ba06efa22f1e30bc94f06833f701b5d49f294b_18_13)
      Toggle commit list
    Please register or sign in to reply
  • Van Toan Vu
    @toanvv started a discussion on an old version of the diff Jun 25, 2018
    Last updated by Quang Vinh Nguyen Jun 25, 2018
    app/controllers/entries_controller.rb 0 → 100644
    32
    33 @job = Job.find(params[:job_id])
    34
    35 @user = User.find_by(email: params[:entry][:entry_email]) ||
    36 User.create(name: params[:entry][:entry_name],
    37 email: params[:entry][:entry_email],
    38 password: 'password',
    39 password_confirmation: 'password')
    40
    41 @entry.user_id = @user.id
    42 @entry.job_id = @job.id
    43
    44 if @user.jobs.include?(@job)
    45 # redirect_to job_url(@job), notice: 'You has been entry this job.'
    46 redirect_to job_url(@job), flash: { secondary: 'You has been entry this job.' }
    47 elsif
    • Van Toan Vu @toanvv commented Jun 25, 2018
      Master

      what condition for elsif?

      what condition for elsif?
    • Quang Vinh Nguyen @vinhnq

      changed this line in version 2 of the diff

      Jun 25, 2018

      changed this line in version 2 of the diff

      changed this line in [version 2 of the diff](https://gitlab.zigexn.vn/vinhnq/venjobs_app/merge_requests/8/diffs?diff_id=3926&start_sha=70f021b108e1f8142ca26a68a73c3f4536d285e7#b1ba06efa22f1e30bc94f06833f701b5d49f294b_47_49)
      Toggle commit list
    Please register or sign in to reply
  • Van Toan Vu
    @toanvv started a discussion on an old version of the diff Jun 25, 2018
    Last updated by Quang Vinh Nguyen Jun 25, 2018
    app/controllers/entries_controller.rb 0 → 100644
    55 end
    56
    57 # PATCH/PUT /entries/1
    58 # PATCH/PUT /entries/1.json
    59 def update
    60 if @entry.update(entry_params)
    61 redirect_to @entry, notice: 'Entry was successfully updated.'
    62 else
    63 render :edit
    64 end
    65 end
    66
    67 # DELETE /entries/1
    68 # DELETE /entries/1.json
    69 def destroy
    70 @entry.destroy
    • Van Toan Vu @toanvv commented Jun 25, 2018
      Master

      we don't need destroy for end-user here

      we don't need destroy for end-user here
    • Quang Vinh Nguyen @vinhnq

      changed this line in version 2 of the diff

      Jun 25, 2018

      changed this line in version 2 of the diff

      changed this line in [version 2 of the diff](https://gitlab.zigexn.vn/vinhnq/venjobs_app/merge_requests/8/diffs?diff_id=3926&start_sha=70f021b108e1f8142ca26a68a73c3f4536d285e7#b1ba06efa22f1e30bc94f06833f701b5d49f294b_70_69)
      Toggle commit list
    Please register or sign in to reply
  • Van Toan Vu
    @toanvv started a discussion on an old version of the diff Jun 25, 2018
    Last updated by Quang Vinh Nguyen Jun 26, 2018
    app/models/job.rb
    11 11 dependent: :destroy
    12 12 has_many :industries, through: :industries_jobs
    13 13
    14 has_many :entries, foreign_key: 'job_id',
    • Van Toan Vu @toanvv commented Jun 25, 2018
      Master

      oops, not good, when you destroy job entry will destroy also

      Edited Jun 25, 2018 by Van Toan Vu
      oops, not good, when you destroy job entry will destroy also
    • Van Toan Vu @toanvv commented Jun 25, 2018
      Master

      has_many entries, foreign_key job_id, please check again

      has_many entries, foreign_key job_id, please check again
    • Quang Vinh Nguyen @vinhnq

      changed this line in version 3 of the diff

      Jun 26, 2018

      changed this line in version 3 of the diff

      changed this line in [version 3 of the diff](https://gitlab.zigexn.vn/vinhnq/venjobs_app/merge_requests/8/diffs?diff_id=3927&start_sha=f87141f5636dda4b4f129b8e03bb3018a0776208#742abd5cbc2b12d2da315862ace6297c7d6dcb87_14_14)
      Toggle commit list
    Please register or sign in to reply
  • Van Toan Vu
    @toanvv started a discussion on an old version of the diff Jun 25, 2018
    Last updated by Quang Vinh Nguyen Jun 25, 2018
    app/models/job.rb
    11 11 dependent: :destroy
    12 12 has_many :industries, through: :industries_jobs
    13 13
    14 has_many :entries, foreign_key: 'job_id',
    15 dependent: :destroy
    16 has_many :users, through: :entries
    17
    14 18 has_many :entries, dependent: :destroy
    15 19 has_many :favorite_jobs, dependent: :destroy
    • Van Toan Vu @toanvv commented Jun 25, 2018
      Master

      why jobs has favorite jobs?

      why jobs has favorite jobs?
    • Quang Vinh Nguyen @vinhnq

      changed this line in version 2 of the diff

      Jun 25, 2018

      changed this line in version 2 of the diff

      changed this line in [version 2 of the diff](https://gitlab.zigexn.vn/vinhnq/venjobs_app/merge_requests/8/diffs?diff_id=3926&start_sha=70f021b108e1f8142ca26a68a73c3f4536d285e7#742abd5cbc2b12d2da315862ace6297c7d6dcb87_19_18)
      Toggle commit list
    Please register or sign in to reply
  • Van Toan Vu
    @toanvv started a discussion on the diff Jun 25, 2018
    app/models/user.rb
    2 2 # Include default devise modules. Others available are:
    3 3 # :confirmable, :lockable, :timeoutable and :omniauthable
    4 4 devise :database_authenticatable, :registerable,
    5 :recoverable, :rememberable, :trackable, :validatable,
    5 :recoverable, :rememberable, :validatable,
    6 6 :confirmable
    7 7
    8 8 has_many :entries, dependent: :destroy
    9 9 has_many :favorite_jobs, dependent: :destroy
    10 10
    11 has_many :entries, foreign_key: 'user_id',
    • Van Toan Vu @toanvv commented Jun 25, 2018
      Master

      when user being delete, entry will being delete too

      when user being delete, entry will being delete too
    Please register or sign in to reply
  • Van Toan Vu
    @toanvv started a discussion on an old version of the diff Jun 25, 2018
    Last updated by Quang Vinh Nguyen Jun 25, 2018
    app/views/entries/_form.html.erb 0 → 100644
    5
    6 <ul>
    7 <% entry.errors.full_messages.each do |message| %>
    8 <li><%= message %></li>
    9 <% end %>
    10 </ul>
    11 </div>
    12 <% end %>
    13
    14 <%= hidden_field_tag :job_id, @job.id %>
    15
    16 <%= form.label :name %><br>
    17 <%= form.text_field :entry_name, class: 'form-control col-sm-4' %><br>
    18
    19 <%= form.label :email %><br>
    20 <%= form.email_field :entry_email, class: 'form-control col-sm-4' %><br>
    • Van Toan Vu @toanvv commented Jun 25, 2018
      Master

      please add more field such as phone number, address, we need to contact them

      please add more field such as phone number, address, we need to contact them
    • Quang Vinh Nguyen @vinhnq

      changed this line in version 2 of the diff

      Jun 25, 2018

      changed this line in version 2 of the diff

      changed this line in [version 2 of the diff](https://gitlab.zigexn.vn/vinhnq/venjobs_app/merge_requests/8/diffs?diff_id=3926&start_sha=70f021b108e1f8142ca26a68a73c3f4536d285e7#4687589654ca10a09bfdd0790cc49c930dcf5b65_20_20)
      Toggle commit list
    Please register or sign in to reply
  • Van Toan Vu
    @toanvv started a discussion on an old version of the diff Jun 25, 2018
    Last updated by Quang Vinh Nguyen Jun 25, 2018
    app/views/entries/index.html.erb 0 → 100644
    1 <p id="notice"><%= notice %></p>
    • Van Toan Vu @toanvv commented Jun 25, 2018
      Master

      we don't need this view

      we don't need this view
    • Quang Vinh Nguyen @vinhnq

      changed this line in version 2 of the diff

      Jun 25, 2018

      changed this line in version 2 of the diff

      changed this line in [version 2 of the diff](https://gitlab.zigexn.vn/vinhnq/venjobs_app/merge_requests/8/diffs?diff_id=3926&start_sha=70f021b108e1f8142ca26a68a73c3f4536d285e7#97553ff83555f1ed9b8e6683775fee089f08399e_1_0)
      Toggle commit list
    Please register or sign in to reply
  • Van Toan Vu
    @toanvv started a discussion on an old version of the diff Jun 25, 2018
    Last updated by Quang Vinh Nguyen Jun 25, 2018
    app/views/jobs/show.html.erb
    10 10 <p>
    11 11 <%= @job.description %>
    12 12 </p>
    13
    14 <% if user_signed_in? %>
    15 <%= link_to "Apply", { controller: "entries", action: "new", job_id: @job.id,
    16 entry_name: current_user.name, entry_email: current_user.email },
    17 class: "btn btn-secondary" %>
    18 <% else %>
    19 <%= link_to "Apply", apply_path(job_id: @job.id),
    20 class: "btn btn-secondary" %>
    • Van Toan Vu @toanvv commented Jun 25, 2018
      Master

      you don't need to do that, you can get current_user.name on entries_controller

      you don't need to do that, you can get current_user.name on entries_controller
    • Quang Vinh Nguyen @vinhnq

      changed this line in version 2 of the diff

      Jun 25, 2018

      changed this line in version 2 of the diff

      changed this line in [version 2 of the diff](https://gitlab.zigexn.vn/vinhnq/venjobs_app/merge_requests/8/diffs?diff_id=3926&start_sha=70f021b108e1f8142ca26a68a73c3f4536d285e7#ca1dced2048c1aa2fb1f535b6ec69018f9a4ba2a_20_16)
      Toggle commit list
    Please register or sign in to reply
  • Van Toan Vu
    @toanvv started a discussion on an old version of the diff Jun 25, 2018
    Last updated by Quang Vinh Nguyen Jun 25, 2018
    app/views/user_mailer/job_apply.html.erb 0 → 100644
    1 <p>Dear <%= @user.name %></p>
    2
    3 <p>Job title: <%= @job.title %></p>
    4 <p>Location: <%= @job.cities.first.name %></p>
    5 <p>Company: <%= Company.find(@job.company_id).name %></p>
    • Van Toan Vu @toanvv commented Jun 25, 2018
      Master

      you can use @job.company.name

      you can use @job.company.name
    • Quang Vinh Nguyen @vinhnq

      changed this line in version 2 of the diff

      Jun 25, 2018

      changed this line in version 2 of the diff

      changed this line in [version 2 of the diff](https://gitlab.zigexn.vn/vinhnq/venjobs_app/merge_requests/8/diffs?diff_id=3926&start_sha=70f021b108e1f8142ca26a68a73c3f4536d285e7#ac8d061f9b2749d651fdf65b3b352dc8a72fe49f_5_5)
      Toggle commit list
    Please register or sign in to reply
  • Van Toan Vu
    @toanvv started a discussion on an old version of the diff Jun 25, 2018
    Last updated by Quang Vinh Nguyen Jun 25, 2018
    app/views/user_mailer/job_apply.html.erb 0 → 100644
    1 <p>Dear <%= @user.name %></p>
    2
    3 <p>Job title: <%= @job.title %></p>
    4 <p>Location: <%= @job.cities.first.name %></p>
    5 <p>Company: <%= Company.find(@job.company_id).name %></p>
    • Van Toan Vu @toanvv commented Jun 25, 2018
      Master

      you can use @job.company.name

      you can use @job.company.name
    • Quang Vinh Nguyen @vinhnq

      changed this line in version 2 of the diff

      Jun 25, 2018

      changed this line in version 2 of the diff

      changed this line in [version 2 of the diff](https://gitlab.zigexn.vn/vinhnq/venjobs_app/merge_requests/8/diffs?diff_id=3926&start_sha=70f021b108e1f8142ca26a68a73c3f4536d285e7#ac8d061f9b2749d651fdf65b3b352dc8a72fe49f_5_5)
      Toggle commit list
    Please register or sign in to reply
  • Quang Vinh Nguyen @vinhnq

    added 2 commits

    • 13c666b9 - fix almost error from review
    • f87141f5 - add random password

    Compare with previous version

    Jun 25, 2018

    added 2 commits

    • 13c666b9 - fix almost error from review
    • f87141f5 - add random password

    Compare with previous version

    added 2 commits * 13c666b9 - fix almost error from review * f87141f5 - add random password [Compare with previous version](https://gitlab.zigexn.vn/vinhnq/venjobs_app/merge_requests/8/diffs?diff_id=3926&start_sha=70f021b108e1f8142ca26a68a73c3f4536d285e7)
    Toggle commit list
  • Van Toan Vu
    @toanvv started a discussion on an old version of the diff Jun 26, 2018
    Last updated by Quang Vinh Nguyen Jun 26, 2018
    app/controllers/entries_controller.rb 0 → 100644
    15 entry_email: current_user.email,
    16 entry_phone: current_user.phone,
    17 entry_address: current_user.address)
    18 else
    19 Entry.new
    20 end
    21 end
    22
    23 # POST /entries
    24 # POST /entries.json
    25 def create
    26 @entry = Entry.new(entry_params)
    27
    28 @job = Job.find(params[:job_id])
    29
    30 random_password = Devise.friendly_token
    • Van Toan Vu @toanvv commented Jun 26, 2018
      Master

      random_password need only when create new user, when you don't need it don't call it

      Edited Jun 26, 2018 by Van Toan Vu
      random_password need **only** when create new user, when you don't need it don't call it
    • Quang Vinh Nguyen @vinhnq

      changed this line in version 3 of the diff

      Jun 26, 2018

      changed this line in version 3 of the diff

      changed this line in [version 3 of the diff](https://gitlab.zigexn.vn/vinhnq/venjobs_app/merge_requests/8/diffs?diff_id=3927&start_sha=f87141f5636dda4b4f129b8e03bb3018a0776208#b1ba06efa22f1e30bc94f06833f701b5d49f294b_30_29)
      Toggle commit list
    Please register or sign in to reply
  • Quang Vinh Nguyen @vinhnq

    added 1 commit

    • 81a7e69f - fix entries dependent job destroy

    Compare with previous version

    Jun 26, 2018

    added 1 commit

    • 81a7e69f - fix entries dependent job destroy

    Compare with previous version

    added 1 commit * 81a7e69f - fix entries dependent job destroy [Compare with previous version](https://gitlab.zigexn.vn/vinhnq/venjobs_app/merge_requests/8/diffs?diff_id=3927&start_sha=f87141f5636dda4b4f129b8e03bb3018a0776208)
    Toggle commit list
  • Quang Vinh Nguyen @vinhnq

    mentioned in commit 77d9a1de

    Jun 26, 2018

    mentioned in commit 77d9a1de

    mentioned in commit 77d9a1de7fd250f4cd781eb10943e35ae4474f86
    Toggle commit list
  • Quang Vinh Nguyen @vinhnq

    merged

    Jun 26, 2018

    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: vinhnq/venjobs_app!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.