Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Update register template #144

Merged
merged 35 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
0315365
update login page design
Bilelkihal Jan 4, 2023
fb49ac3
update the design of lost password page
Bilelkihal Jan 4, 2023
3f2edef
update sucess message for password reset
Bilelkihal Jan 4, 2023
9d55553
update register page design
Bilelkihal Jan 5, 2023
3d0ca7d
Merge branch 'development' into update/register
syphax-bouazzouni Jan 23, 2023
15f088e
Delete login.scss
Bilelkihal Jan 25, 2023
e574dc0
Delete lostpassword.scss
Bilelkihal Jan 25, 2023
c5c3330
Update index.html.erb
Bilelkihal Jan 25, 2023
97b2d03
Delete lost_password_success.html.erb
Bilelkihal Jan 25, 2023
23da56e
Update index.html.erb
Bilelkihal Jan 25, 2023
84fa775
Update lost_password.html.erb
Bilelkihal Jan 25, 2023
c682e93
Update routes.rb
Bilelkihal Jan 25, 2023
3ff2084
Update index.html.erb
Bilelkihal Jan 25, 2023
701b6f3
Update register.scss
Bilelkihal Jan 30, 2023
ed0e95e
Delete _form.html.erb
Bilelkihal Jan 30, 2023
001f53c
Update _form.html.haml
Bilelkihal Jan 30, 2023
da7db76
Update login_controller.rb
Bilelkihal Jan 30, 2023
d092eb1
Add code to remove auto added arrows from number_text_field
Bilelkihal Feb 4, 2023
00bdb85
Add the two fields (OrcidID & github)
Bilelkihal Feb 4, 2023
166fc2a
Add subscription to mailing list
Bilelkihal Feb 4, 2023
640aef8
Update index.html.erb
Bilelkihal Feb 4, 2023
5633259
Update _form.html.haml
Bilelkihal Feb 4, 2023
97a2f2b
Add captacha tag
Bilelkihal Feb 4, 2023
d9ba13e
Update _form.html.haml
Bilelkihal Feb 7, 2023
0c87360
Add github icon
Bilelkihal Feb 7, 2023
0c07efd
Add orcide icon
Bilelkihal Feb 7, 2023
7fafb70
Fix recaptacha tags (add "=")
Bilelkihal Feb 15, 2023
5ce2550
replace "ORCIDE" by "ORCID"
Bilelkihal Feb 15, 2023
825b30c
Change ORCID ID input type from 'number' to ‘text’
Bilelkihal Feb 15, 2023
1f87f08
Extract orcidId & githubId from URLs
Bilelkihal Feb 15, 2023
c51fac5
Extract arrow-back.svg file
Bilelkihal Feb 16, 2023
1f2c0b5
Fix extract id from link
Bilelkihal Feb 16, 2023
d1493e0
Resolve conflicts with developement branch
Bilelkihal Feb 16, 2023
1442665
Merge branch 'development' into update/register
Bilelkihal Feb 16, 2023
63f6886
remove import browse
Bilelkihal Feb 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/assets/stylesheets/application.css.scss.erb
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@
@import "instances_table";
@import "file_uploader";
@import "browse";
Bilelkihal marked this conversation as resolved.
Show resolved Hide resolved
@import "register";
@import "flatpickr/dist/themes/light";


/* Bootstrap and Font Awesome */
@import "bootstrap";
@import "bootstrap_overrides";
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/bioportal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#bd {
background: #fff;
}
#bd hr {
#bd > hr {
Bilelkihal marked this conversation as resolved.
Show resolved Hide resolved
border:0;
height:1px;
color:#e9eaeb;
Expand Down
112 changes: 112 additions & 0 deletions app/assets/stylesheets/register.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
.register-form{
margin-top: 30px;
padding: 37px 41px;
box-shadow: rgba(0, 0, 0, 0.05) 0px 20px 50px;
border-radius: 14px;
}
.register-arrowback{
all: none;
}
.register-title{
font-size: 18px;
text-align: center;
font-weight: 700;
}
#register-title-line{
width: 128px;
margin: auto;
margin-bottom: 20px;
margin-top: 3px;
border: 0.5px solid #76A7CC;
border-radius: 5px;
}

.register-double-input{
display: flex;
margin-bottom: 14px;
}
.register-first-input{
margin-right: 19px;
}

.register-input-title{
font-size: 12px;
color: #666666;
margin-bottom: 5px;
font-weight: 600;
}
.register-optional{
font-weight: 300;
}
.register-input-long{
width: 363px;
outline: none;
padding: 14px;
font-size: 15px;
font-weight: 500;
border: 1px solid #BDBDBD;
border-radius: 9px;
margin-bottom: 14px;
}
.register-input-long:focus{
border: 1px solid #76A7CC;
}

.register-input-short{
width: 172px;
outline: none;
padding: 14px;
font-size: 15px;
font-weight: 500;
border: 1px solid #BDBDBD;
border-radius: 9px;
}
.register-input-short:focus{
border: 1px solid #76A7CC;
}


.register-input-icon{
position: absolute;
padding: 18px;
box-sizing: unset;
}
.register-input-with-icon{
padding-left: 45px;
}
#register-check-text{
margin-left: 10px;
color: #666666;
font-size: 12px;
font-weight: 400;
margin-bottom: 0;
}

.register-button{
margin-top: 20px;
width: 363px;
font-size: 16px;
color: white;
padding: 17px;
background-color: #76A7CC;
border: none;
border-radius: 9px;

}

.register-button:hover{
background-color: #6B96B7;
cursor: pointer;
}
/* This is used to remove the auto added arrows in the number_text_field*/
/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}

/* Firefox */
input[type=number] {
-moz-appearance: textfield;
}
15 changes: 6 additions & 9 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
class UsersController < ApplicationController

before_action :unescape_id, only: [:edit, :show, :update]
before_action :verify_owner, only: [:edit, :show]
before_action :authorize_admin, only: [:index]

before_action :verify_owner, only: [:edit, :show, :subscribe, :un_subscribe]
before_action :authorize_admin, only: [:index,:subscribe, :un_subscribe]
layout :determine_layout

# GET /users
Expand Down Expand Up @@ -167,7 +166,7 @@ def subscribe

def un_subscribe
@email = params[:email]
deliver "un_subscribe", SubscribeMailer.unregister_for_announce_list(@email)
deliver "unsubscribe", SubscribeMailer.unregister_for_announce_list(@email)
end


Expand All @@ -176,15 +175,16 @@ def un_subscribe
def deliver(action,job)
begin
job.deliver
flash[:success] = "You have #{action} successfully"
to_or_from = action.eql?("subscribe") ? "to" : "from"
flash[:success] = "You have successfully #{action} #{to_or_from} our user mailing list: #{$ANNOUNCE_LIST}"
rescue => exception
flash[:error] = "Something went wrong ..."
end
redirect_to '/account'
end

def user_params
p = params.require(:user).permit(:firstName, :lastName, :username, :email, :email_confirmation, :password,
p = params.require(:user).permit(:firstName, :lastName, :username, :orcidId, :githubId, :email, :email_confirmation, :password,
:password_confirmation, :register_mail_list, :admin)
p.to_h
end
Expand Down Expand Up @@ -214,9 +214,6 @@ def validate(params)
if params[:email].nil? || params[:email].length < 1 || !params[:email].match(/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i)
errors << "Please enter an email address"
end
if !params[:email].eql?(params[:email_confirmation])
Bilelkihal marked this conversation as resolved.
Show resolved Hide resolved
errors << "Your Email and Email Confirmation do not match"
end
if params[:password].nil? || params[:password].length < 1
errors << "Please enter a password"
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/login/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ Errors On Form
<span style="font-size:1.2em;"><%=link_to "Lost Password", '/lost_pass'%></span><br><br>
</center>

<% end %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/login/lost_password.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
</center>


<%end%>
<%end%>
92 changes: 54 additions & 38 deletions app/views/users/_form.html.haml
Original file line number Diff line number Diff line change
@@ -1,38 +1,54 @@
%table.form{:width => "70%"}
%tr
%th First Name:
%td.top= text_field :user, :firstName, value: @user.firstname
%tr
%th Last Name:
%td= text_field :user, :lastName, value: @user.lastname
%tr
%th Account Name:*
%td= text_field :user, :username, value: @user.username
%tr
%th Email Address:*
%td= text_field :user, :email, value: @user.email
%tr
%th Re-enter Email Address:*
%td= text_field :user, :email_confirmation, value: @user.email_confirmation
%tr
%th Password:*
%td= password_field :user, :password, :autocomplete => "off"
%tr
%th Re-enter Password:*
%td= password_field :user, :password_confirmation, :autocomplete => "off"
- if using_captcha?
%tr
%th
%td= recaptcha_tags
- unless $ANNOUNCE_LIST.nil? || $ANNOUNCE_LIST.empty?
%tr
%td{:colspan => "2", :style => "text-align: right;"}
%div{:style => "float: right; margin-left: 10px; position: relative; top: 5px;"}
%input#user_register_mail_list{:checked => "checked", :name => "user[register_mail_list]", :type => "checkbox", :value => "1"}/
%div{:style => "overflow: hidden; line-height: 12px;"}
%label{:for => "user_register_mail_list"}
Register for the #{$SITE} announcements email list
%br/
%span{:style => "font-size: x-small;"} (approximately two emails per month -- confirmation via email required)
%tr
%td{:colspan => "2", :style => "text-align: right;"}= submit_tag "Create"
.d-flex.justify-content-center
.register-form
.d-flex.justify-content-between
%a{:href => "javascript:javascript:history.go(-1)"}
%svg.register-arrowback{:fill => "none", :height => "12", :viewbox => "0 0 15 12", :width => "15", :xmlns => "http://www.w3.org/2000/svg"}
Bilelkihal marked this conversation as resolved.
Show resolved Hide resolved
%path{:d => "M5.64176 1L1 6L5.64176 11M14 6H1.13", :stroke => "black", "stroke-linecap" => "round", "stroke-linejoin" => "round", "stroke-miterlimit" => "10", "stroke-width" => "1.5"}
.register-title-container
%h2.register-title
Create new account
%hr#register-title-line/
%div
.register-double-input
.register-first-input
%p.register-input-title
First name
%font{:color => "red"} *
= text_field :user, :firstName, value: @user.firstname, class: "register-input-short"
%div
%p.register-input-title
Last name
%font{:color => "red"} *
= text_field :user, :lastName, value: @user.lastname, class: "register-input-short"
%p.register-input-title
Username
%font{:color => "red"} *
= text_field :user, :username, value: @user.username, class: "register-input-long"
%p.register-input-title
ORCIDE ID
%font.register-optional (optional)
%img.register-input-icon{:src => "#{asset_path("orcide.svg")}"}/
Bilelkihal marked this conversation as resolved.
Show resolved Hide resolved
= number_field :user, :orcidId, value: @user.orcidId, class: "register-input-long register-input-with-icon"
%p.register-input-title
Github ID
%font.register-optional (optional)
%img.register-input-icon{:src => "#{asset_path("github-icon.svg")}"}/
Bilelkihal marked this conversation as resolved.
Show resolved Hide resolved
= text_field :user, :githubId, value: @user.githubId, class: "register-input-long register-input-with-icon"
%p.register-input-title
Email
%font{:color => "red"} *
= text_field :user, :email, value: @user.email, class: "register-input-long"
%p.register-input-title
Password
%font{:color => "red"} *
= password_field :user, :password, class: "register-input-long"
%p.register-input-title
Confirm password
%font{:color => "red"} *
= password_field :user, :password_confirmation, class: "register-input-long"
- if using_captcha?
recaptcha_tags
Bilelkihal marked this conversation as resolved.
Show resolved Hide resolved
.d-flex
%input#user_register_mail_list{:checked => "checked", :name => "user[register_mail_list]", :type => "checkbox", :value => "1"}/
%p#register-check-text Register for the AgroPortal's mailing list
%input.register-button{:type => "submit", :value => "Register"}/
19 changes: 8 additions & 11 deletions app/views/users/new.html.haml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
- @title = "Register"
%div{:style => "padding: 1em;"}
%h1
New #{$SITE} Account
= form_for(:user, :url => users_path) do |f|
- unless @errors.nil?
.enable-lists{:style => "color: red; padding: 1em;"}
Errors creating your account:
%ul
- for error in @errors
%li= error
= render :partial => 'form', :locals => {:f => f}
= form_for(:user, :url => users_path) do |f|
- unless @errors.nil?
.enable-lists{:style => "color: red; padding: 1em;"}
Errors creating your account:
%ul
- for error in @errors
%li= error
= render :partial => 'form', :locals => {:f => f}