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 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Nguyen Ngoc Nghia
  • VeNJOB
  • Merge Requests
  • !22

Merged
Opened Mar 02, 2020 by Nguyen Ngoc Nghia@nghiann 
  • Report abuse
Report abuse

Feature/admin page

×

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/admin_page origin/feature/admin_page

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 feature/admin_page

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 8
  • Commits 9
  • Changes 9
{{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved
  • Nguyen Ngoc Nghia @nghiann

    added 1 commit

    • 4d284329 - check if user is admin

    Compare with previous version

    Mar 02, 2020

    added 1 commit

    • 4d284329 - check if user is admin

    Compare with previous version

    added 1 commit * 4d284329 - check if user is admin [Compare with previous version](https://gitlab.zigexn.vn/nghiann/VeNJOB/merge_requests/22/diffs?diff_id=4726&start_sha=ae2ea70336c3726143ef1cbd42f035e6c60c6970)
    Toggle commit list
  • Nguyen Ngoc Nghia @nghiann

    added 1 commit

    • 4c7dfb8c - choose user's email

    Compare with previous version

    Mar 03, 2020

    added 1 commit

    • 4c7dfb8c - choose user's email

    Compare with previous version

    added 1 commit * 4c7dfb8c - choose user's email [Compare with previous version](https://gitlab.zigexn.vn/nghiann/VeNJOB/merge_requests/22/diffs?diff_id=4727&start_sha=4d2843298e7c02c7cd19f70a1357fa3d0f3c9d23)
    Toggle commit list
  • Nguyen Ngoc Nghia @nghiann

    added 1 commit

    • 7b646fb6 - delete unused file

    Compare with previous version

    Mar 03, 2020

    added 1 commit

    • 7b646fb6 - delete unused file

    Compare with previous version

    added 1 commit * 7b646fb6 - delete unused file [Compare with previous version](https://gitlab.zigexn.vn/nghiann/VeNJOB/merge_requests/22/diffs?diff_id=4728&start_sha=4c7dfb8cfb41996a7a87086747b6b594145e77ab)
    Toggle commit list
  • Van Hau Le
    @haulv started a discussion on an old version of the diff Mar 03, 2020
    Automatically resolved by Nguyen Ngoc Nghia with a push Mar 04, 2020
    app/controllers/users/admins_controller.rb 0 → 100644
    1 class Users::AdminsController < ApplicationController
    2 before_action :authenticate_user!, only: :index
    3
    4 def index
    5 redirect_to root_path unless current_user.role?
    6 params[:search_user] ||= ""
    7 @applied_jobs = get_applied_jobs(params[:search_user])
    8 @user = User.find_by(email: params[:search_user])
    9 @users = User.all
    10 end
    11
    12 private
    13
    14 def user_params
    • Van Hau Le @haulv commented Mar 03, 2020
      Master

      @nghiann where did we use this method?

      @nghiann where did we use this method?
    • Nguyen Ngoc Nghia @nghiann

      changed this line in version 5 of the diff

      Mar 04, 2020

      changed this line in version 5 of the diff

      changed this line in [version 5 of the diff](https://gitlab.zigexn.vn/nghiann/VeNJOB/merge_requests/22/diffs?diff_id=4729&start_sha=7b646fb6283e17c6c37c120e443076dd898c576f#485ba946a398f21d1c0010201c51df0183fb929b_14_14)
      Toggle commit list
    Please register or sign in to reply
  • Van Hau Le
    @haulv started a discussion on an old version of the diff Mar 03, 2020
    Automatically resolved by Nguyen Ngoc Nghia with a push Mar 04, 2020
    app/controllers/users/admins_controller.rb 0 → 100644
    1 class Users::AdminsController < ApplicationController
    2 before_action :authenticate_user!, only: :index
    3
    4 def index
    5 redirect_to root_path unless current_user.role?
    6 params[:search_user] ||= ""
    7 @applied_jobs = get_applied_jobs(params[:search_user])
    8 @user = User.find_by(email: params[:search_user])
    9 @users = User.all
    • Van Hau Le @haulv commented Mar 03, 2020
      Master

      @nghiann need to updated

      @nghiann need to updated
    • Nguyen Ngoc Nghia @nghiann

      changed this line in version 5 of the diff

      Mar 04, 2020

      changed this line in version 5 of the diff

      changed this line in [version 5 of the diff](https://gitlab.zigexn.vn/nghiann/VeNJOB/merge_requests/22/diffs?diff_id=4729&start_sha=7b646fb6283e17c6c37c120e443076dd898c576f#485ba946a398f21d1c0010201c51df0183fb929b_9_10)
      Toggle commit list
    Please register or sign in to reply
  • Van Hau Le
    @haulv started a discussion on an old version of the diff Mar 03, 2020
    Automatically resolved by Nguyen Ngoc Nghia with a push Mar 04, 2020
    app/controllers/users/admins_controller.rb 0 → 100644
    15 params.require(:user).permit(:id, :email, :first_name, :last_name, :role)
    16 end
    17
    18 def get_applied_jobs(email)
    19 applied_jobs = []
    20 if email != ""
    21 user = User.find_by(email: email)
    22 return redirect_to users_admin_path, notice: "User/job not found!" if user.blank?
    23
    24 applied_jobs = user.jobs
    25 elsif email = "" || nil
    26 all_applied_jobs = UserJob.where.not(applied_at: nil).to_a
    27
    28 (0..all_applied_jobs.count - 1).each do |each_job|
    29 applied_jobs << (all_applied_jobs[each_job].job)
    30 end
    • Van Hau Le @haulv commented Mar 03, 2020
      Master

      @nghiann

      if params[:search_user]
        user = User.find_by(email: params[:search_user])
        return redirect_to users_admin_path, notice: "User/job not found!" if user.blank?
        user.jobs
      esle
       UserJob.where.not(applied_at: nil).select { |uj| uj.job }
      end
      Edited Mar 03, 2020 by Van Hau Le
      @nghiann ``` ruby if params[:search_user] user = User.find_by(email: params[:search_user]) return redirect_to users_admin_path, notice: "User/job not found!" if user.blank? user.jobs esle UserJob.where.not(applied_at: nil).select { |uj| uj.job } end ```
    • Nguyen Ngoc Nghia @nghiann

      changed this line in version 5 of the diff

      Mar 04, 2020

      changed this line in version 5 of the diff

      changed this line in [version 5 of the diff](https://gitlab.zigexn.vn/nghiann/VeNJOB/merge_requests/22/diffs?diff_id=4729&start_sha=7b646fb6283e17c6c37c120e443076dd898c576f#485ba946a398f21d1c0010201c51df0183fb929b_30_19)
      Toggle commit list
    Please register or sign in to reply
  • Nguyen Ngoc Nghia @nghiann

    resolved all discussions

    Mar 04, 2020

    resolved all discussions

    resolved all discussions
    Toggle commit list
  • Nguyen Ngoc Nghia @nghiann

    added 1 commit

    • 9bcc6ad4 - refatoring code

    Compare with previous version

    Mar 04, 2020

    added 1 commit

    • 9bcc6ad4 - refatoring code

    Compare with previous version

    added 1 commit * 9bcc6ad4 - refatoring code [Compare with previous version](https://gitlab.zigexn.vn/nghiann/VeNJOB/merge_requests/22/diffs?diff_id=4729&start_sha=7b646fb6283e17c6c37c120e443076dd898c576f)
    Toggle commit list
  • Nguyen Ngoc Nghia @nghiann

    added 1 commit

    • 55f7c946 - refactoring code

    Compare with previous version

    Mar 04, 2020

    added 1 commit

    • 55f7c946 - refactoring code

    Compare with previous version

    added 1 commit * 55f7c946 - refactoring code [Compare with previous version](https://gitlab.zigexn.vn/nghiann/VeNJOB/merge_requests/22/diffs?diff_id=4730&start_sha=9bcc6ad4bee904b9ee334ac3dd454db8f4b91695)
    Toggle commit list
  • Van Hau Le
    @haulv started a discussion on an old version of the diff Mar 05, 2020
    Automatically resolved by Nguyen Ngoc Nghia with a push Mar 05, 2020
    app/controllers/users/admins_controller.rb 0 → 100644
    6 params[:search_user]
    7 @applied_jobs = get_applied_jobs
    8
    9 @user = User.find_by(email: params[:search_user])
    10 end
    11
    12 private
    13
    14 def get_applied_jobs
    15 if params[:search_user]
    16 user = User.find_by(email: params[:search_user])
    17 return redirect_to users_admin_path, notice: "User/job not found!" if user.blank?
    18
    19 user.jobs
    20 else
    21 UserJob.where.not(applied_at: nil).collect { |uj| uj.job }
    • Van Hau Le @haulv commented Mar 05, 2020
      Master

      @nghiann should we paginate result?

      @nghiann should we paginate result?
    • Nguyen Ngoc Nghia @nghiann

      changed this line in version 7 of the diff

      Mar 05, 2020

      changed this line in version 7 of the diff

      changed this line in [version 7 of the diff](https://gitlab.zigexn.vn/nghiann/VeNJOB/merge_requests/22/diffs?diff_id=4735&start_sha=55f7c9465d16437ad60799794bfe40a4a092933d#485ba946a398f21d1c0010201c51df0183fb929b_21_22)
      Toggle commit list
    Please register or sign in to reply
  • Van Hau Le
    @haulv started a discussion on an old version of the diff Mar 05, 2020
    Automatically resolved by Nguyen Ngoc Nghia with a push Mar 05, 2020
    app/helpers/job_helper.rb
    3 3 params[:city_id] ? "City: #{@jobs[0]["city"]}" :
    4 4 (params[:industry_id] ? "Industry: #{@jobs[0]["industry"]}" : params[:search])
    5 5 end
    6
    7 def job_applied_at(job)
    8 job.user_jobs[0].applied_at
    • Van Hau Le @haulv commented Mar 05, 2020
      Master

      @nghiann why do you take first user job?

      @nghiann why do you take first user job?
    • Nguyen Ngoc Nghia @nghiann

      changed this line in version 7 of the diff

      Mar 05, 2020

      changed this line in version 7 of the diff

      changed this line in [version 7 of the diff](https://gitlab.zigexn.vn/nghiann/VeNJOB/merge_requests/22/diffs?diff_id=4735&start_sha=55f7c9465d16437ad60799794bfe40a4a092933d#f595945add42f9b111acd113e6cbc743380281dd_8_8)
      Toggle commit list
    Please register or sign in to reply
  • Van Hau Le
    @haulv started a discussion on an old version of the diff Mar 05, 2020
    Automatically resolved by Nguyen Ngoc Nghia with a push Mar 05, 2020
    app/helpers/job_helper.rb
    3 3 params[:city_id] ? "City: #{@jobs[0]["city"]}" :
    4 4 (params[:industry_id] ? "Industry: #{@jobs[0]["industry"]}" : params[:search])
    5 5 end
    6
    7 def job_applied_at(job)
    8 job.user_jobs[0].applied_at
    9 end
    10
    11 def get_all_user
    12 User.all
    • Van Hau Le @haulv commented Mar 05, 2020
      Master

      @nghiann redundant method

      @nghiann redundant method
    • Nguyen Ngoc Nghia @nghiann

      changed this line in version 7 of the diff

      Mar 05, 2020

      changed this line in version 7 of the diff

      changed this line in [version 7 of the diff](https://gitlab.zigexn.vn/nghiann/VeNJOB/merge_requests/22/diffs?diff_id=4735&start_sha=55f7c9465d16437ad60799794bfe40a4a092933d#f595945add42f9b111acd113e6cbc743380281dd_12_8)
      Toggle commit list
    Please register or sign in to reply
  • Van Hau Le
    @haulv started a discussion on an old version of the diff Mar 05, 2020
    Automatically resolved by Nguyen Ngoc Nghia with a push Mar 05, 2020
    app/views/users/admins/index.html.erb 0 → 100644
    1 <h4>Search user's applied jobs:</h4>
    2
    3 <%= form_tag(users_admin_path, method: :get) do |f| %>
    4 <%= select_tag :search_user, options_from_collection_for_select(get_all_user, "email", "email", params[:search_user]), include_blank: "Choose user's email" %>
    • Van Hau Le @haulv commented Mar 05, 2020
      Master

      @nghiann only fetch necessary infomation (list emails)

      Edited Mar 05, 2020 by Van Hau Le
      @nghiann only fetch necessary infomation (list emails)
    • Nguyen Ngoc Nghia @nghiann

      changed this line in version 7 of the diff

      Mar 05, 2020

      changed this line in version 7 of the diff

      changed this line in [version 7 of the diff](https://gitlab.zigexn.vn/nghiann/VeNJOB/merge_requests/22/diffs?diff_id=4735&start_sha=55f7c9465d16437ad60799794bfe40a4a092933d#1248e1dc4334610c4c48fa6a128feb1af6cbfa9b_4_4)
      Toggle commit list
    Please register or sign in to reply
  • Nguyen Ngoc Nghia @nghiann

    resolved all discussions

    Mar 05, 2020

    resolved all discussions

    resolved all discussions
    Toggle commit list
  • Nguyen Ngoc Nghia @nghiann

    added 1 commit

    • 8c905bbe - fetch necessary information

    Compare with previous version

    Mar 05, 2020

    added 1 commit

    • 8c905bbe - fetch necessary information

    Compare with previous version

    added 1 commit * 8c905bbe - fetch necessary information [Compare with previous version](https://gitlab.zigexn.vn/nghiann/VeNJOB/merge_requests/22/diffs?diff_id=4735&start_sha=55f7c9465d16437ad60799794bfe40a4a092933d)
    Toggle commit list
  • Nguyen Ngoc Nghia @nghiann

    added 1 commit

    • d927cd18 - paginate applied jobs

    Compare with previous version

    Mar 05, 2020

    added 1 commit

    • d927cd18 - paginate applied jobs

    Compare with previous version

    added 1 commit * d927cd18 - paginate applied jobs [Compare with previous version](https://gitlab.zigexn.vn/nghiann/VeNJOB/merge_requests/22/diffs?diff_id=4736&start_sha=8c905bbeed2e57fa2e7abf501bc09f6a487aa3d8)
    Toggle commit list
  • Van Hau Le
    @haulv started a discussion on an old version of the diff Mar 05, 2020
    Automatically resolved by Nguyen Ngoc Nghia with a push Mar 05, 2020
    app/models/user.rb
    35 35 # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
    36 36 devise :database_authenticatable, :registerable,
    37 37 :recoverable, :rememberable, :validatable
    38
    39 def self.list_emails
    40 @emails ||= self.all.pluck(:email)
    • Van Hau Le @haulv commented Mar 05, 2020
      Master

      @nghiann @emails ||= all.pluck(:email) No need to use self anymore

      @nghiann `@emails ||= all.pluck(:email)` No need to use self anymore
    • Nguyen Ngoc Nghia @nghiann

      changed this line in version 9 of the diff

      Mar 05, 2020

      changed this line in version 9 of the diff

      changed this line in [version 9 of the diff](https://gitlab.zigexn.vn/nghiann/VeNJOB/merge_requests/22/diffs?diff_id=4737&start_sha=d927cd181eaf3a2c28f04a6034dae97915234678#4ed0c03b53dbc8320da88e7887465514cd9e90a4_40_40)
      Toggle commit list
    Please register or sign in to reply
  • Nguyen Ngoc Nghia @nghiann

    resolved all discussions

    Mar 05, 2020

    resolved all discussions

    resolved all discussions
    Toggle commit list
  • Nguyen Ngoc Nghia @nghiann

    added 1 commit

    • 71dc2fcf - change route

    Compare with previous version

    Mar 05, 2020

    added 1 commit

    • 71dc2fcf - change route

    Compare with previous version

    added 1 commit * 71dc2fcf - change route [Compare with previous version](https://gitlab.zigexn.vn/nghiann/VeNJOB/merge_requests/22/diffs?diff_id=4737&start_sha=d927cd181eaf3a2c28f04a6034dae97915234678)
    Toggle commit list
  • Van Hau Le @haulv

    mentioned in commit a1a78ac9

    Mar 05, 2020

    mentioned in commit a1a78ac9

    mentioned in commit a1a78ac97f862a7bc2ec72a62515d4836ecb5c9f
    Toggle commit list
  • Van Hau Le @haulv

    merged

    Mar 05, 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
Nguyen Ngoc Nghia
Assignee
Nguyen Ngoc Nghia @nghiann
Assign to
None
Milestone
None
Assign milestone
Time tracking
2
2 participants
Reference: nghiann/VeNJOB!22
×

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.