Skip to content

Commit 30eb353

Browse files
authored
Merge pull request #85 from we-have-TTA/fix#84
Fix #84
2 parents 292a8bd + e2a0b7f commit 30eb353

File tree

14 files changed

+72
-77
lines changed

14 files changed

+72
-77
lines changed
Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
11
# frozen_string_literal: true
22

33
class ApplicationController < ActionController::Base
4-
before_action :configure_permitted_parameters, if: :devise_controller?
5-
6-
def after_sign_in_path_for(_resource)
7-
rooms_path
8-
end
9-
10-
private
11-
12-
def configure_permitted_parameters
13-
devise_parameter_sanitizer.permit(:sign_up, keys: [:username])
14-
devise_parameter_sanitizer.permit(:account_update, keys: [:username])
15-
end
164
end

app/controllers/questions_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ class QuestionsController < ApplicationController
44
layout 'dashboard'
55
before_action :find_question, only: %i[show edit update destroy]
66
def index
7-
keyword = params[:keyword]
8-
@questions = Question.where('title like ?', "%#{keyword}%")
7+
@questions = Question.where(team: current_user.team)
8+
@questions = Question.where('title like ?', "%#{params[:keyword]}%") if params[:keyword]
99
end
1010

1111
def new

app/controllers/users/registrations_controller.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
module Users
44
class RegistrationsController < Devise::RegistrationsController
5-
# before_action :configure_sign_up_params, only: [:create]
6-
# before_action :configure_account_update_params, only: [:update]
5+
before_action :configure_sign_up_params, only: [:create]
6+
before_action :configure_account_update_params, only: [:update]
77
# GET /resource/sign_up
88
# def new
99
# super
@@ -41,19 +41,19 @@ class RegistrationsController < Devise::RegistrationsController
4141
# protected
4242

4343
# If you have extra params to permit, append them to the sanitizer.
44-
# def configure_sign_up_params
45-
# devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute])
46-
# end
44+
def configure_sign_up_params
45+
devise_parameter_sanitizer.permit(:sign_up, keys: [:username])
46+
end
4747

4848
# If you have extra params to permit, append them to the sanitizer.
49-
# def configure_account_update_params
50-
# devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])
51-
# end
49+
def configure_account_update_params
50+
devise_parameter_sanitizer.permit(:account_update, keys: [:username])
51+
end
5252

5353
# The path used after sign up.
54-
# def after_sign_up_path_for(resource)
55-
# super(resource)
56-
# end
54+
def after_sign_up_path_for(_resource)
55+
room_path
56+
end
5757

5858
# The path used after sign up for inactive accounts.
5959
# def after_inactive_sign_up_path_for(resource)

app/javascript/stylesheets/rooms/room.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
font-family: "Source Code Pro", monospace;
6363
font-size: 14px;
6464
font-weight: 400;
65-
height: 560px;
65+
height: 100vh;
6666
letter-spacing: normal;
6767
line-height: 20px;
6868
padding: 10px;
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
.btnstyle {
2-
@apply inline-block px-10 py-2 bg-indigo-700 text-white rounded-full;
3-
cursor: pointer;
1+
.btn-dashboard-create {
2+
@apply px-3 py-1 border-2 text-white bg-purple-500 hover:bg-purple-800 font-bold rounded-md;
43
}
54
.btnstyle_dashboard {
6-
@apply px-3 py-5 border-2 text-white bg-blue-500 hover:bg-blue-800 font-bold rounded-md inline-block my-2;
5+
@apply px-3 py-1 border-2 text-white bg-blue-500 hover:bg-blue-800 font-bold rounded-md inline-block;
6+
}
7+
8+
.btn-index {
9+
@apply inline-block px-10 py-2 bg-indigo-700 text-white rounded-full;
10+
cursor: pointer;
711
}

app/mailers/room_mailer.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
class RoomMailer < ApplicationMailer
44
def send_invitation_to(user, room)
55
@user = user
6-
@room_url = Rails.application.routes.url_helpers.room_uuid_url(uuid: room.uuid, host: 'localhost', port: 3000)
6+
host_ip = if ENV['RAILS_ENV'] == 'production'
7+
ENV.fetch('HOST_IP', nil)
8+
else
9+
'127.0.0.1'
10+
end
11+
@room_url = Rails.application.routes.url_helpers.room_uuid_url(uuid: room.uuid, host: host_ip, port: 3000)
712
mail to: @user.email, subject: '你好!!'
813
end
914
end

app/views/pages/_hero_block.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{<b class="text-yellow-400">i</b>}Coder</h1>
88
<p>Developers trust {<b class="text-yellow-400">i</b>}Coder to help hire the right candidates because
99
it’s simple – and just works</p>
10-
<a href="/users" class="btnstyle">免費註冊</a>
10+
<a href="/users" class="btn-index">免費註冊</a>
1111
</div>
1212
<div class="img">
1313
<%= image_tag("coderpic.jpg") %>

app/views/questions/_form.html.erb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@
2020
<%= form.label :code, "題目內容", class: "mb-1 block" %>
2121
<%= form.text_area :code, class: "border border-gray-900 mb-5" %>
2222
</div>
23-
<div>
24-
<%= form.submit "建立題目", class: "btnstyle_dashboard"%>
25-
</div>
23+
<%= form.submit "建立題目", class: "btn-dashboard-create mb-4"%>
2624
</div>
2725
</div>
2826
<% end %>
29-
<%= link_to "返回", questions_path, class: "btnstyle_dashboard" %>
27+
<%= link_to "返回", questions_path, class: "btn-dashboard-create" %>

app/views/questions/index.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<div class="flex justify-between mt-3">
22
<h2 class="font-bold text-2xl">面試題庫目錄</h2>
3-
<%= link_to "創建題目", new_question_path , :class => "createBtn", class: "btnstyle_dashboard" %></div>
3+
<%= link_to "創建題目", new_question_path ,class: "btn-dashboard-create" %></div>
44
<span class="block mb-10">管理您的面試的題庫,創建題目、進行查詢、與調整及刪除。</span>
55
<div class="rounded">
66
<div>
7-
<form action="./questions" method="get" class="mt-2">
7+
<form action="./questions" method="get" class="mt-2 mb-4">
88
搜尋:<input type="text" placeholder="關鍵字查詢" name="keyword" class="px-2 border border-black">
99
<button>送出</button>
1010
</form>
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<p><%= @user.username %>你好</p>
2-
<p>今天你也有過得開心嗎!</p>
3-
<p>謝謝你的來信,再見!</p>
1+
<p>親愛的 <%= @user.username %>您好</p>
2+
<p>我們是 We-have-tta</p>
3+
<p>很高興您願意參與此次線上面試,請您透過以下連結進入</p>
44
<p><%= link_to "會議室連結(開新視窗)", @room_url, target: '_blank' %></p>
5+
<br>
6+
<p>We-have-tta 團隊敬上</p>

0 commit comments

Comments
 (0)