Commit 77d96b2b by Tô Ngọc Ánh

id11 id13

parent 1a181a6c
Pipeline #880 canceled with stages
in 0 seconds
......@@ -27,4 +27,4 @@
/config/master.key
/lib/data
/public/uploads/user
/public/uploads/
......@@ -16,6 +16,9 @@
$main-color: #1da173;
.min-vh-80 {
min-height: 80vh;
}
.navbar {
background-color: $main-color;
}
......@@ -53,3 +56,15 @@
}
}
}
.card-img-rounded {
border-radius: 50%;
background-color: mediumseagreen;
height: 220px; width: 220px;
margin-top: 50px;
padding: 10px;
.card-img {
margin-top: 40px;
}
}
......@@ -5,5 +5,6 @@ class ApplicationController < ActionController::Base
def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up, keys: [:full_name, :curriculum_vitae])
devise_parameter_sanitizer.permit(:account_update, keys: [:full_name, :curriculum_vitae])
end
end
# frozen_string_literal: true
class Users::SessionsController < Devise::SessionsController
# before_action :configure_sign_in_params, only: [:create]
# GET /resource/sign_in
# def new
# super
# end
# POST /resource/sign_in
# def create
# super
# end
# DELETE /resource/sign_out
# def destroy
# super
# end
# protected
# If you have extra params to permit, append them to the sanitizer.
# def configure_sign_in_params
# devise_parameter_sanitizer.permit(:sign_in, keys: [:attribute])
# end
def after_sign_in_path_for(resource)
my_page_path #your path
end
end
class UsersController < ApplicationController
before_action :authenticate_user!, only: :my_page
def show
@user = User.find_by(id: params[:id])
end
def my_page
end
end
module ApplicationHelper
def is_current_user?(user)
current_user == user
end
end
<h2>Edit <%= resource_name.to_s.humanize %></h2>
<div class="col-md-7 col-sm-12 mx-auto my-5">
<h2 class="text-center font-weight-bold text-success">Edit My Profile</h2>
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
<%= render 'devise/shared/error_messages', resource: resource %>
<div class="form-group">
......@@ -8,6 +9,16 @@
<%= f.email_field :email, autofocus: true, autocomplete: 'email', class: 'form-control' %>
</div>
<div class="form-group">
<%= f.label :full_name %><br />
<%= f.text_field :full_name, required: true, class: 'form-control' %>
</div>
<div class="form-group">
<%= f.label :curriculum_vitae %><br />
<%= f.file_field :curriculum_vitae, accept: '.doc, .pdf, .xls, .xlsx, .zip', class: 'form-control' %>
</div>
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
<% end %>
......@@ -16,8 +27,6 @@
<%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
<%= f.password_field :password, autocomplete: 'new-password', class: 'form-control' %>
<% if @minimum_password_length %>
<br />
<em><%= @minimum_password_length %> characters minimum</em>
<% end %>
</div>
......@@ -31,13 +40,14 @@
<%= f.password_field :current_password, autocomplete: 'current-password', class: 'form-control' %>
</div>
<div class="actions">
<%= f.submit 'Update' %>
<div class="actions text-center">
<%= f.submit 'Update', class: 'btn btn-outline-success' %>
</div>
<% end %>
<h3>Cancel my account</h3>
<p>Unhappy? <%= button_to 'Cancel my account', registration_path(resource_name), data: { confirm: 'Are you sure?' }, method: :delete %></p>
<% end %>
<%= link_to 'Back', :back %>
<h3 class="text-center">Unhappy?</h3>
<p class="text-center">
<%= link_to 'Cancel my account', registration_path(resource_name), data: { confirm: 'Are you sure?' }, method: :delete,
class: 'btn btn-outline-danger' %>
</p>
</div>
<% if notice %>
<div class="alert alert-success">
<a href="#" data-dismiss="alert" class="close">×</a>
<p><%= notice %></p>
</div>
<% end %>
<% if alert %>
<div class="alert alert-danger">
<a href="#" data-dismiss="alert" class="close">×</a>
<p><%= alert %></p>
</div>
<% end %>
......@@ -11,9 +11,8 @@
<body>
<%= render 'shared/header' %>
<div class='container'>
<%= content_tag :p, notice, class: 'alert alert-success' if notice %>
<%= content_tag :p, alert, class: 'alert alert-danger' if alert %>
<div class='container min-vh-80'>
<%= render 'devise/shared/show_errors' %>
<%= yield %>
</div>
<%= render 'shared/footer' %>
......
......@@ -10,6 +10,15 @@
<ul class='navbar-nav ml-auto'>
<% if user_signed_in? %>
<li class="nav-item">
<%= link_to '<i class="fas fa-heart"></i>'.html_safe, '#', class: 'nav-link text-white', title: 'Favorite' %>
</li>
<li class="nav-item">
<%= link_to '<i class="fas fa-history"></i>'.html_safe, '#', class: 'nav-link text-white', title: 'History' %>
</li>
<li class="nav-item">
<%= link_to 'My Page', my_page_path, class: 'nav-link text-white' %>
</li>
<li class="nav-item">
<%= link_to 'Log out', destroy_user_session_path, method: :delete, class: 'nav-link text-white' %>
</li>
<% else %>
......
<div class="col-lg-8 col-md-12 mx-auto">
<div class="card my-3">
<div class="row no-gutters">
<div class="col-md-4">
<div class="card-img-rounded mx-auto">
<%= image_tag 'venjob-logo.png', class: 'card-img' %>
</div>
</div>
<div class="col-md-8">
<div class="card-body">
<p class="card-title font-weight-bold text-center my-2 color-success display-4">Profile</p>
<p class="card-text"><strong>Email:</strong> <%= user.email %></p>
<p class="card-text"><strong>Full Name:</strong> <%= user.full_name %></p>
<p class="card-text"><strong>Curriculum Vitae:</strong>
<% if user.curriculum_vitae.present? %>
<%= link_to user.curriculum_vitae.identifier, user.curriculum_vitae.url, download: user.curriculum_vitae.identifier %>
<%= link_to '<i class="fas fa-eye"></i>'.html_safe, user.curriculum_vitae.url, target: '_blank', class: 'text-dark' %>
<% else %>
You don't have any curriculum vitae
<% end %>
</p>
<p class="card-text">
<% if is_current_user?(user) %>
<div class="row">
<div class="col text-right">
<%= link_to 'Update', edit_user_registration_path, class: 'btn btn-outline-primary btn-lg' %>
</div>
<div class="col text-left">
<%= link_to 'My Jobs', '#', class: 'btn btn-outline-primary btn-lg' %>
</div>
</div>
<% end %>
</p>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
<%= render 'users/user', user: current_user %>
<%= render 'users/user', user: @user %>
Rails.application.routes.draw do
devise_for :users
devise_for :users, controllers: { sessions: 'users/sessions' }
root to: 'home#index'
get 'cities', to: 'locations#index'
get 'industries', to: 'industries#index'
get 'detail/:id', to: 'jobs#show', as: :job
get 'jobs/:model/:slug', to: 'jobs#index', as: :jobs
get 'my', to: 'users#my_page', as: :my_page
resources :users, only: :show
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
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 to comment