Commit 34942df5 by Ngô Trung Hưng

use link_to_if

parent 3ed7b149
Pipeline #887 canceled with stages
in 0 seconds
......@@ -22,7 +22,7 @@
/public/assets
.byebug_history
.env
# Ignore master key for decrypting credentials and more.
/config/master.key
/lib/csv
......@@ -45,6 +45,7 @@ gem 'bootsnap', '>= 1.1.0', require: false
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
gem 'dotenv-rails'
end
group :development do
......
......@@ -94,6 +94,10 @@ GEM
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
dotenv (2.7.6)
dotenv-rails (2.7.6)
dotenv (= 2.7.6)
railties (>= 3.2)
draper (4.0.1)
actionpack (>= 5.0)
activemodel (>= 5.0)
......@@ -253,6 +257,7 @@ DEPENDENCIES
chromedriver-helper
coffee-rails (~> 4.2)
devise
dotenv-rails
draper
jbuilder (~> 2.5)
kaminari
......
# frozen_string_literal: true
class RegistrationsController < Devise::RegistrationsController
def after_inactive_sign_up_path_for(resource)
confirm_sign_up_path(code: 2)
end
def after_update_path_for(resource)
my_page_path
end
end
......@@ -2,15 +2,11 @@
# User controller
class UsersController < ApplicationController
before_action :authenticate_user!, only: :my_page
def confirm_sign_up
render :confirm
end
def my_page
if user_signed_in?
render :my_page
else
redirect_to root_path
end
end
end
......@@ -3,7 +3,6 @@
<ul>
<% resource.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% flash[:error] = 'Vui lòng kiểm tra lại thông tin' %>
<% end %>
</ul>
</div>
......
......@@ -15,21 +15,16 @@
<li class="list_item_menu_header_right">
<%= link_to 'History', '#', class: 'link_item_menu_header_right' %>
</li>
<% if user_signed_in? %>
<li class="list_item_menu_header_right">
<%= link_to 'My page', my_page_path, class: 'link_item_menu_header_right' %>
<%= link_to_if(user_signed_in?, 'My page', my_page_path, class: 'link_item_menu_header_right') do
link_to 'Sign in', new_user_session_path, class: 'link_item_menu_header_right'
end %>
</li>
<li class="list_item_menu_header_right">
<%= link_to 'Log out', destroy_user_session_path, method: :delete, class: 'link_item_menu_header_right' %>
<%= link_to_if(user_signed_in?, 'Log out', destroy_user_session_path, method: :delete, class: 'link_item_menu_header_right') do
link_to 'Register', new_user_registration_path, class: 'link_item_menu_header_right'
end %>
</li>
<% else %>
<li class="list_item_menu_header_right">
<%= link_to 'Sign in', new_user_session_path, class: 'link_item_menu_header_right' %>
</li>
<li class="list_item_menu_header_right">
<%= link_to 'Register', new_user_registration_path, class: 'link_item_menu_header_right' %>
</li>
<% end %>
</ul>
</div>
<%# mobile %>
......@@ -44,22 +39,16 @@
<li class = "item_menu_mobile_vertical">
<%= link_to 'History', '#', class: 'link_item_menu_mobile' %>
</li>
<% if user_signed_in? %>
<li class = "item_menu_mobile_vertical">
<%= link_to 'My page', my_page_path, class: 'link_item_menu_mobile' %>
</li>
<li class = "item_menu_mobile_vertical">
<%= link_to 'Log out', destroy_user_session_path, method: :delete, class: 'link_item_menu_mobile' %>
<li class="item_menu_mobile_vertical">
<%= link_to_if(user_signed_in?, 'My page', my_page_path, class: 'link_item_menu_mobile') do
link_to 'Sign in', new_user_session_path, class: 'link_item_menu_mobile'
end %>
</li>
<% else %>
<li class = "item_menu_mobile_vertical">
<%= link_to 'Sign in', new_user_session_path, class: 'link_item_menu_mobile' %>
</li>
<li class = "item_menu_mobile_vertical">
<%= link_to 'Register', new_user_registration_path, class: 'link_item_menu_mobile' %>
<li class="item_menu_mobile_vertical">
<%= link_to_if(user_signed_in?, 'Log out', destroy_user_session_path, method: :delete, class: 'link_item_menu_mobile') do
link_to 'Register', new_user_registration_path, class: 'link_item_menu_mobile'
end %>
</li>
<% end %>
</ul>
</div>
<div>
......
......@@ -10,14 +10,18 @@
<hr>
<div class="row">
<div class="col-lg-12">
<span>Email: <%= user_signed_in? ? current_user.name : 'N/A'%> </span>
<span>Email: <%= current_user.email %> </span>
</div>
<div class="col-lg-12">
<span>Name: <%= user_signed_in? ? current_user.email : 'N/A'%></span>
<span>Name: <%= current_user.name %></span>
</div>
<div class="col-lg-12">
CV: <%= link_to user_signed_in? ? current_user.cv.identifier : 'N/A', current_user.cv.url, target: '_blank', class: 'link_ct pdf' %>
<% if current_user.cv.identifier %>
CV: <%= link_to current_user.cv.identifier, current_user.cv.url, target: '_blank', class: 'link_ct pdf' %>
<%= link_to '<i class="fas fa-download"></i>'.html_safe, current_user.cv.url, download: current_user.cv.identifier %>
<% else %>
CV: <span class="link_ct">No file</span>
<% end %>
</div>
<hr>
<div class="col-lg-6">
......
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
config.action_mailer.default_url_options = { host: 'localhost', port: 1234 }
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
user_name: ENV['SENDMAIL_USERNAME'],
password: ENV['SENDMAIL_PASSWORD'],
domain: ENV['MAIL_HOST'],
address: 'smtp.gmail.com',
port: '587',
authentication: :plain,
enable_starttls_auto: true
}
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
......
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
config.action_mailer.default_url_options = { host: 'hungnt-venjob.herokuapp.com' }
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
user_name: ENV['SENDMAIL_USERNAME'],
password: ENV['SENDMAIL_PASSWORD'],
domain: 'hungnt-venjob.herokuapp.com',
address: 'smtp.gmail.com',
port: '587',
authentication: :plain,
enable_starttls_auto: true
}
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
......
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