From 03153655dc68da68faf69b8f8ed2aeb19ac67fb2 Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Wed, 4 Jan 2023 15:36:28 +0100 Subject: [PATCH 01/33] update login page design --- .../stylesheets/application.css.scss.erb | 2 + app/assets/stylesheets/bioportal.scss | 2 +- app/assets/stylesheets/login.scss | 83 +++++++++++++++++++ app/views/login/index.html.erb | 32 ++++--- 4 files changed, 100 insertions(+), 19 deletions(-) create mode 100644 app/assets/stylesheets/login.scss diff --git a/app/assets/stylesheets/application.css.scss.erb b/app/assets/stylesheets/application.css.scss.erb index b07f9c917..5727552d1 100644 --- a/app/assets/stylesheets/application.css.scss.erb +++ b/app/assets/stylesheets/application.css.scss.erb @@ -42,6 +42,8 @@ @import "instances_table"; @import "file_uploader"; @import "browse"; +@import "login"; +@import "lostpassword"; /* Bootstrap and Font Awesome */ @import "bootstrap"; diff --git a/app/assets/stylesheets/bioportal.scss b/app/assets/stylesheets/bioportal.scss index c9075406a..3ccb941b1 100644 --- a/app/assets/stylesheets/bioportal.scss +++ b/app/assets/stylesheets/bioportal.scss @@ -49,7 +49,7 @@ #bd { background: #fff; } -#bd hr { +#bd > hr { border:0; height:1px; color:#e9eaeb; diff --git a/app/assets/stylesheets/login.scss b/app/assets/stylesheets/login.scss new file mode 100644 index 000000000..7769617b1 --- /dev/null +++ b/app/assets/stylesheets/login.scss @@ -0,0 +1,83 @@ +*{ + font-family: poppins; + margin: 0; + padding: 0; +} +.login-page-container{ + display: flex; + justify-content: center; +} + +.login-form{ + margin-top: 30px; + padding-top: 37px; + padding-bottom: 37px; + padding-left: 41px; + padding-right: 41px; + box-shadow: rgba(0, 0, 0, 0.08) 0px 20px 50px; + border-radius: 14px; +} + +.login-input{ + box-sizing: border-box; + outline: none; + padding: 21px; + font-size: 16px; + border: 1px solid #BDBDBD; + border-radius: 9px; + width: 357px; + +} + +.login-input:focus{ + border: 1px solid #76A7CC; +} +.login-input::placeholder{ + font-weight: 300; + color: #C1C1C1; +} + +.login-input-title{ + font-size: 13px; + margin-bottom: 5px; + font-weight: 600; + color: #666666; +} +.email-input{ + margin-bottom: 20px; +} +.password-input{ + margin-bottom: 8px; +} +.login-forgot-password{ + font-weight: 500 ; + text-align: end; + text-decoration:none; + font-size: 13px; + +} +.login-button{ + margin-top: 10px; + width: 357px; + font-size: 16px; + color: white; + padding: 17px; + background-color: #76A7CC; + border: none; + border-radius: 9px; + margin-bottom: 20px; +} +.login-button:hover{ + background-color: #6B96B7; + cursor: pointer; +} + +.dont-have-account{ + font-size: 15px; + font-weight: 600; + text-align: center; +} +.login-register-button{ + text-decoration: none; + +} \ No newline at end of file diff --git a/app/views/login/index.html.erb b/app/views/login/index.html.erb index 08110c66a..c435bab79 100644 --- a/app/views/login/index.html.erb +++ b/app/views/login/index.html.erb @@ -13,22 +13,18 @@ Errors On Form <%end%> -
- - - - - - - - - - - - -
Account Name:<%= text_field 'user', 'username', :size => 25 %>
Password:<%= password_field 'user','password', :size => 25, :autocomplete => "off" %>
<%= submit_tag "Login"%>
- Not Registered Yet? <%=link_to "Sign Up", new_user_path%>

- <%=link_to "Lost Password", '/lost_pass'%>

-
-<% end %> \ No newline at end of file +
+
+ + <%= text_field 'user', 'username', class: "login-input email-input", placeholder: "Enter your password" %> + + <%= password_field 'user','password', :autocomplete => "off", class: "login-input password-input", placeholder: "Enter your password" %> + + + +
+
+ + +<% end %> From fb49ac315d7f08f1161619aa157fa50f3e316c32 Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Wed, 4 Jan 2023 16:19:54 +0100 Subject: [PATCH 02/33] update the design of lost password page --- app/assets/stylesheets/lostpassword.scss | 95 ++++++++++++++++++++++++ app/views/login/lost_password.html.erb | 39 ++++++---- 2 files changed, 118 insertions(+), 16 deletions(-) create mode 100644 app/assets/stylesheets/lostpassword.scss diff --git a/app/assets/stylesheets/lostpassword.scss b/app/assets/stylesheets/lostpassword.scss new file mode 100644 index 000000000..297192c0d --- /dev/null +++ b/app/assets/stylesheets/lostpassword.scss @@ -0,0 +1,95 @@ +*{ + font-family: poppins; + margin: 0; + padding: 0; +} +.lost-password-page-container{ + margin: 40px; + display: flex; + justify-content: center; +} + +.lost-password-form{ + margin-top: 30px; + padding-top: 37px; + padding-bottom: 37px; + padding-left: 41px; + padding-right: 41px; + box-shadow: rgba(0, 0, 0, 0.05) 0px 20px 50px; + border-radius: 14px; +} +.lost-password-title-bar{ + display: flex; + justify-content: space-between; +} +.lost-password-arrowback{ + all: none; +} +.lost-password-title{ + font-size: 18px; + text-align: center; + font-weight: 700; +} +#lost-password-title-line{ + width: 128px ; + margin: auto !important ; + margin-bottom: 14px !important ; + margin-top: 3px !important ; + border: 1px solid #76A7CC !important ; + border-radius: 5px ; +} + +.lost-password-description{ + color: #666666; + font-size: 12.5px; + margin-bottom: 14px; + width: 357px; +} + + + +.lost-password-input{ + box-sizing: border-box; + outline: none; + padding: 21px; + font-size: 16px; + border: 1px solid #BDBDBD; + border-radius: 9px; + width: 357px; + +} + +.lost-password-input:focus{ + border: 1px solid #76A7CC; +} +.lost-password-input::placeholder{ + font-weight: 300; + color: #C1C1C1; +} + +.lost-password-input-title{ + font-size: 13px; + margin-bottom: 5px; + font-weight: 600; + color: #666666; +} +.lost-password-button{ + margin-top: 20px; + width: 357px; + font-size: 16px; + color: white; + padding: 21px; + background-color: #76A7CC; + border: none; + border-radius: 9px; + margin-bottom: 20px; + display: block; +} +.lost-password-button:hover{ + background-color: #6B96B7; + cursor: pointer; +} + + + + diff --git a/app/views/login/lost_password.html.erb b/app/views/login/lost_password.html.erb index dbbf4338e..83f3b16be 100644 --- a/app/views/login/lost_password.html.erb +++ b/app/views/login/lost_password.html.erb @@ -1,22 +1,29 @@ <%= form_for(:user , :url=>{:controller=>'login',:action=>'send_pass'}) do%> -
+
+
+
+ + + + + + +
+

+ Recover password +

+
+
+
+
+

Enter the email associated with your account and we will send an email with instructions to reset your password

+

Email

+ <%=text_field 'user', :email,class: "lost-password-input", placeholder: "Enter the email" %> - - - - - - - - - - -
Email: *<%=text_field 'user', :email%>
Account Name: *<%=text_field 'user', :account_name%>
- <%=submit_tag "Email Password Reset Instructions"%> -
-
* required
-
+ + + <%end%> \ No newline at end of file From 3f2edeff6394cedc642113797829533b32373b69 Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Wed, 4 Jan 2023 17:18:25 +0100 Subject: [PATCH 03/33] update sucess message for password reset --- app/assets/stylesheets/lostpassword.scss | 33 +++++++++++++++++++ app/controllers/login_controller.rb | 6 +++- .../login/lost_password_success.html.erb | 17 ++++++++++ config/routes.rb | 1 + 4 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 app/views/login/lost_password_success.html.erb diff --git a/app/assets/stylesheets/lostpassword.scss b/app/assets/stylesheets/lostpassword.scss index 297192c0d..570166e27 100644 --- a/app/assets/stylesheets/lostpassword.scss +++ b/app/assets/stylesheets/lostpassword.scss @@ -8,6 +8,11 @@ display: flex; justify-content: center; } +.lost-password-sucess{ + margin: 70px; + display: flex; + justify-content: center; +} .lost-password-form{ margin-top: 30px; @@ -90,6 +95,34 @@ cursor: pointer; } +.lost-password-icon{ + display: flex; + justify-content: center; + margin-bottom: 21px; +} +.lost-password-feedback{ + text-align: center; + width: 310px; + font-size: 14px; + font-weight: 500; + margin-bottom: 21px; +} +.lost-password-back-home{ + color: #76A7CC; + padding: 16px; + border: 1px solid #76A7CC; + border-radius: 9px; + display: flex; + justify-content: center; + align-items: center; + cursor: pointer; + text-decoration: none; + +} +.lost-password-back-home:hover{ + text-decoration: none; + +} diff --git a/app/controllers/login_controller.rb b/app/controllers/login_controller.rb index 2a9587268..bae176851 100755 --- a/app/controllers/login_controller.rb +++ b/app/controllers/login_controller.rb @@ -75,6 +75,10 @@ def destroy def lost_password end + def lost_password_success + end + + # Sends a new password to the user def send_pass username = params[:user][:account_name] @@ -82,7 +86,7 @@ def send_pass resp = LinkedData::Client::HTTP.post("/users/create_reset_password_token", {username: username, email: email}) if resp.nil? - redirect_to login_index_path, notice: "Please check your email for a message with reset instructions" + redirect_to "/lost_pass_success" else flash[:notice] = resp.errors.first + ". Please try again." redirect_to "/lost_pass" diff --git a/app/views/login/lost_password_success.html.erb b/app/views/login/lost_password_success.html.erb new file mode 100644 index 000000000..2634f5882 --- /dev/null +++ b/app/views/login/lost_password_success.html.erb @@ -0,0 +1,17 @@ +
+
+
+ + + +
+ +

+ A password reset email has been sent to your email, please follow the instructions in the email to reset your password. +

+ + back home + + +
+
\ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index b3662ca82..de6f0b820 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -128,6 +128,7 @@ # User get '/logout' => 'login#destroy', :as => :logout get '/lost_pass' => 'login#lost_password' + get '/lost_pass_success' => 'login#lost_password_success' get '/reset_password' => 'login#reset_password' post '/accounts/:id/custom_ontologies' => 'users#custom_ontologies', :as => :custom_ontologies get '/login_as/:login_as' => 'login#login_as' , constraints: { login_as: /[\d\w\.\-\%\+ ]+/ } From 9d55553954d551dad5d64276b71b9ff33b35e4cd Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Thu, 5 Jan 2023 06:24:55 +0100 Subject: [PATCH 04/33] update register page design --- .../stylesheets/application.css.scss.erb | 1 + app/assets/stylesheets/register.scss | 123 ++++++++++++++++++ app/controllers/users_controller.rb | 3 - app/views/users/_form.html.erb | 97 ++++++++++++++ app/views/users/new.html.haml | 19 ++- 5 files changed, 229 insertions(+), 14 deletions(-) create mode 100644 app/assets/stylesheets/register.scss create mode 100644 app/views/users/_form.html.erb diff --git a/app/assets/stylesheets/application.css.scss.erb b/app/assets/stylesheets/application.css.scss.erb index 5727552d1..4b10e28ab 100644 --- a/app/assets/stylesheets/application.css.scss.erb +++ b/app/assets/stylesheets/application.css.scss.erb @@ -44,6 +44,7 @@ @import "browse"; @import "login"; @import "lostpassword"; +@import "register"; /* Bootstrap and Font Awesome */ @import "bootstrap"; diff --git a/app/assets/stylesheets/register.scss b/app/assets/stylesheets/register.scss new file mode 100644 index 000000000..5e982b901 --- /dev/null +++ b/app/assets/stylesheets/register.scss @@ -0,0 +1,123 @@ +.register-page-container{ + display: flex; + justify-content: center; +} + +.register-form{ + margin-top: 30px; + padding-top: 37px; + padding-bottom: 37px; + padding-left: 41px; + padding-right: 41px; + box-shadow: rgba(0, 0, 0, 0.05) 0px 20px 50px; + border-radius: 14px; +} + +.register-title-bar{ + display: flex; + justify-content: space-between; +} +.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-input-icon-container{ + display: flex; +} +.register-email-list-container{ + display: flex; +} + +#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; +} diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 90245dd54..bedb0fb27 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -191,9 +191,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]) - errors << "Your Email and Email Confirmation do not match" - end if params[:password].nil? || params[:password].length < 1 errors << "Please enter a password" end diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb new file mode 100644 index 000000000..950978b13 --- /dev/null +++ b/app/views/users/_form.html.erb @@ -0,0 +1,97 @@ +
+
+
+ + + + + + +
+

+ Create new account +

+
+
+
+
+ +
+
+

First name *

+ <%= text_field :user, :firstName, value: @user.firstname, class: "register-input-short"%> +
+
+

Last name *

+ <%= text_field :user, :lastName, value: @user.lastname, class: "register-input-short"%> +
+
+ + + +

Username *

+ <%= text_field :user, :username, value: @user.username, class: "register-input-long"%> + +
+
+

ORCIDE ID (optional)

+ + + + + + + + + + + + + + +
+
+

Github ID (optional)

+ + + + + + + + + + + + +
+
+ + +

Email *

+ <%= text_field :user, :email, value: @user.email, class: "register-input-long"%> + +

Password *

+ <%= password_field :user, :password, class: "register-input-long"%> + + +

Confirm password *

+ <%= password_field :user, :password_confirmation, class: "register-input-long"%> + + <%= + if using_captcha? + recaptcha_tags + end + %> +
+ +

Register for the AgroPortal announcements email list

+
+ + + + + + +
+
\ No newline at end of file diff --git a/app/views/users/new.html.haml b/app/views/users/new.html.haml index 8f09e6e47..95b41374e 100644 --- a/app/views/users/new.html.haml +++ b/app/views/users/new.html.haml @@ -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} From 15f088e8d9c569fc5419dd74abf959194700134c Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Wed, 25 Jan 2023 11:09:08 +0100 Subject: [PATCH 05/33] Delete login.scss --- app/assets/stylesheets/login.scss | 83 ------------------------------- 1 file changed, 83 deletions(-) delete mode 100644 app/assets/stylesheets/login.scss diff --git a/app/assets/stylesheets/login.scss b/app/assets/stylesheets/login.scss deleted file mode 100644 index 7769617b1..000000000 --- a/app/assets/stylesheets/login.scss +++ /dev/null @@ -1,83 +0,0 @@ -*{ - font-family: poppins; - margin: 0; - padding: 0; -} -.login-page-container{ - display: flex; - justify-content: center; -} - -.login-form{ - margin-top: 30px; - padding-top: 37px; - padding-bottom: 37px; - padding-left: 41px; - padding-right: 41px; - box-shadow: rgba(0, 0, 0, 0.08) 0px 20px 50px; - border-radius: 14px; -} - -.login-input{ - box-sizing: border-box; - outline: none; - padding: 21px; - font-size: 16px; - border: 1px solid #BDBDBD; - border-radius: 9px; - width: 357px; - -} - -.login-input:focus{ - border: 1px solid #76A7CC; -} -.login-input::placeholder{ - font-weight: 300; - color: #C1C1C1; -} - -.login-input-title{ - font-size: 13px; - margin-bottom: 5px; - font-weight: 600; - color: #666666; -} -.email-input{ - margin-bottom: 20px; -} -.password-input{ - margin-bottom: 8px; -} -.login-forgot-password{ - font-weight: 500 ; - text-align: end; - text-decoration:none; - font-size: 13px; - -} -.login-button{ - margin-top: 10px; - width: 357px; - font-size: 16px; - color: white; - padding: 17px; - background-color: #76A7CC; - border: none; - border-radius: 9px; - margin-bottom: 20px; -} -.login-button:hover{ - background-color: #6B96B7; - cursor: pointer; -} - -.dont-have-account{ - font-size: 15px; - font-weight: 600; - text-align: center; -} -.login-register-button{ - text-decoration: none; - -} \ No newline at end of file From e574dc065e7066c0eab45cdc5f22f3a5041741dd Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Wed, 25 Jan 2023 11:09:25 +0100 Subject: [PATCH 06/33] Delete lostpassword.scss --- app/assets/stylesheets/lostpassword.scss | 128 ----------------------- 1 file changed, 128 deletions(-) delete mode 100644 app/assets/stylesheets/lostpassword.scss diff --git a/app/assets/stylesheets/lostpassword.scss b/app/assets/stylesheets/lostpassword.scss deleted file mode 100644 index 570166e27..000000000 --- a/app/assets/stylesheets/lostpassword.scss +++ /dev/null @@ -1,128 +0,0 @@ -*{ - font-family: poppins; - margin: 0; - padding: 0; -} -.lost-password-page-container{ - margin: 40px; - display: flex; - justify-content: center; -} -.lost-password-sucess{ - margin: 70px; - display: flex; - justify-content: center; -} - -.lost-password-form{ - margin-top: 30px; - padding-top: 37px; - padding-bottom: 37px; - padding-left: 41px; - padding-right: 41px; - box-shadow: rgba(0, 0, 0, 0.05) 0px 20px 50px; - border-radius: 14px; -} -.lost-password-title-bar{ - display: flex; - justify-content: space-between; -} -.lost-password-arrowback{ - all: none; -} -.lost-password-title{ - font-size: 18px; - text-align: center; - font-weight: 700; -} -#lost-password-title-line{ - width: 128px ; - margin: auto !important ; - margin-bottom: 14px !important ; - margin-top: 3px !important ; - border: 1px solid #76A7CC !important ; - border-radius: 5px ; -} - -.lost-password-description{ - color: #666666; - font-size: 12.5px; - margin-bottom: 14px; - width: 357px; -} - - - -.lost-password-input{ - box-sizing: border-box; - outline: none; - padding: 21px; - font-size: 16px; - border: 1px solid #BDBDBD; - border-radius: 9px; - width: 357px; - -} - -.lost-password-input:focus{ - border: 1px solid #76A7CC; -} -.lost-password-input::placeholder{ - font-weight: 300; - color: #C1C1C1; -} - -.lost-password-input-title{ - font-size: 13px; - margin-bottom: 5px; - font-weight: 600; - color: #666666; -} -.lost-password-button{ - margin-top: 20px; - width: 357px; - font-size: 16px; - color: white; - padding: 21px; - background-color: #76A7CC; - border: none; - border-radius: 9px; - margin-bottom: 20px; - display: block; -} -.lost-password-button:hover{ - background-color: #6B96B7; - cursor: pointer; -} - -.lost-password-icon{ - display: flex; - justify-content: center; - margin-bottom: 21px; -} -.lost-password-feedback{ - text-align: center; - width: 310px; - font-size: 14px; - font-weight: 500; - margin-bottom: 21px; -} - -.lost-password-back-home{ - color: #76A7CC; - padding: 16px; - border: 1px solid #76A7CC; - border-radius: 9px; - display: flex; - justify-content: center; - align-items: center; - cursor: pointer; - text-decoration: none; - -} -.lost-password-back-home:hover{ - text-decoration: none; - -} - - From c5c3330eafc690a1a5d2db38bef348959eaa342c Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Wed, 25 Jan 2023 11:11:17 +0100 Subject: [PATCH 07/33] Update index.html.erb --- app/views/login/index.html.erb | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/app/views/login/index.html.erb b/app/views/login/index.html.erb index c435bab79..92e458542 100644 --- a/app/views/login/index.html.erb +++ b/app/views/login/index.html.erb @@ -13,18 +13,22 @@ Errors On Form <%end%> - -
-
- - <%= text_field 'user', 'username', class: "login-input email-input", placeholder: "Enter your password" %> - - <%= password_field 'user','password', :autocomplete => "off", class: "login-input password-input", placeholder: "Enter your password" %> - - - -
-
- +
+ + + + + + + + + + + + +
Account Name:<%= text_field 'user', 'username', :size => 25 %>
Password:<%= password_field 'user','password', :size => 25, :autocomplete => "off" %>
<%= submit_tag "Login"%>
+ Not Registered Yet? <%=link_to "Sign Up", new_user_path%>

+ <%=link_to "Lost Password", '/lost_pass'%>

+
<% end %> From 97b2d03ea9c36890a2d8c2b2be8c34ae09a94e9d Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Wed, 25 Jan 2023 11:12:06 +0100 Subject: [PATCH 08/33] Delete lost_password_success.html.erb --- app/views/login/lost_password_success.html.erb | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 app/views/login/lost_password_success.html.erb diff --git a/app/views/login/lost_password_success.html.erb b/app/views/login/lost_password_success.html.erb deleted file mode 100644 index 2634f5882..000000000 --- a/app/views/login/lost_password_success.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -
-
-
- - - -
- -

- A password reset email has been sent to your email, please follow the instructions in the email to reset your password. -

- - back home - - -
-
\ No newline at end of file From 23da56e100a4e5fbc53010ed1f2f00a40a541711 Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Wed, 25 Jan 2023 11:12:48 +0100 Subject: [PATCH 09/33] Update index.html.erb From 84fa7751c9f8e1a30cba88c78194a7654724a11f Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Wed, 25 Jan 2023 11:13:28 +0100 Subject: [PATCH 10/33] Update lost_password.html.erb --- app/views/login/lost_password.html.erb | 41 +++++++++++--------------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/app/views/login/lost_password.html.erb b/app/views/login/lost_password.html.erb index 83f3b16be..750ed45a2 100644 --- a/app/views/login/lost_password.html.erb +++ b/app/views/login/lost_password.html.erb @@ -1,29 +1,22 @@ <%= form_for(:user , :url=>{:controller=>'login',:action=>'send_pass'}) do%> -
-
-
- - - - - - -
-

- Recover password -

-
-
-
-
-

Enter the email associated with your account and we will send an email with instructions to reset your password

-

Email

- <%=text_field 'user', :email,class: "lost-password-input", placeholder: "Enter the email" %> +
- -
-
+ + + + + + + + + + +
Email: *<%=text_field 'user', :email%>
Account Name: *<%=text_field 'user', :account_name%>
+ <%=submit_tag "Email Password Reset Instructions"%> +
+
* required
+ -<%end%> \ No newline at end of file +<%end%> From c682e930e343cb23c6a2d6b189139bfdb6cda5ff Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Wed, 25 Jan 2023 11:15:36 +0100 Subject: [PATCH 11/33] Update routes.rb --- config/routes.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index 2e74b6fe8..f55d67452 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -145,7 +145,6 @@ # User get '/logout' => 'login#destroy', :as => :logout get '/lost_pass' => 'login#lost_password' - get '/lost_pass_success' => 'login#lost_password_success' get '/reset_password' => 'login#reset_password' post '/accounts/:id/custom_ontologies' => 'users#custom_ontologies', :as => :custom_ontologies get '/login_as/:login_as' => 'login#login_as' , constraints: { login_as: /[\d\w\.\-\%\+ ]+/ } From 3ff2084c6dadfa9ede523ec7a03dfad0147bc69d Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Wed, 25 Jan 2023 11:16:28 +0100 Subject: [PATCH 12/33] Update index.html.erb From 701b6f3cac32829fb6b26cb9b07245ef4bdb080a Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Mon, 30 Jan 2023 07:56:06 +0100 Subject: [PATCH 13/33] Update register.scss --- app/assets/stylesheets/register.scss | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/app/assets/stylesheets/register.scss b/app/assets/stylesheets/register.scss index 5e982b901..fea9010ea 100644 --- a/app/assets/stylesheets/register.scss +++ b/app/assets/stylesheets/register.scss @@ -1,22 +1,9 @@ -.register-page-container{ - display: flex; - justify-content: center; -} - .register-form{ margin-top: 30px; - padding-top: 37px; - padding-bottom: 37px; - padding-left: 41px; - padding-right: 41px; + padding: 37px 41px; box-shadow: rgba(0, 0, 0, 0.05) 0px 20px 50px; border-radius: 14px; } - -.register-title-bar{ - display: flex; - justify-content: space-between; -} .register-arrowback{ all: none; } @@ -50,7 +37,6 @@ } .register-optional{ font-weight: 300; - } .register-input-long{ width: 363px; @@ -86,17 +72,8 @@ box-sizing: unset; } .register-input-with-icon{ - padding-left: 45px; - -} -.register-input-icon-container{ - display: flex; } -.register-email-list-container{ - display: flex; -} - #register-check-text{ margin-left: 10px; color: #666666; From ed0e95e1cb99810a1cfec76d74b2b35542b443ab Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Mon, 30 Jan 2023 07:58:54 +0100 Subject: [PATCH 14/33] Delete _form.html.erb --- app/views/users/_form.html.erb | 97 ---------------------------------- 1 file changed, 97 deletions(-) delete mode 100644 app/views/users/_form.html.erb diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb deleted file mode 100644 index 950978b13..000000000 --- a/app/views/users/_form.html.erb +++ /dev/null @@ -1,97 +0,0 @@ -
-
-
- - - - - - -
-

- Create new account -

-
-
-
-
- -
-
-

First name *

- <%= text_field :user, :firstName, value: @user.firstname, class: "register-input-short"%> -
-
-

Last name *

- <%= text_field :user, :lastName, value: @user.lastname, class: "register-input-short"%> -
-
- - - -

Username *

- <%= text_field :user, :username, value: @user.username, class: "register-input-long"%> - -
-
-

ORCIDE ID (optional)

- - - - - - - - - - - - - - -
-
-

Github ID (optional)

- - - - - - - - - - - - -
-
- - -

Email *

- <%= text_field :user, :email, value: @user.email, class: "register-input-long"%> - -

Password *

- <%= password_field :user, :password, class: "register-input-long"%> - - -

Confirm password *

- <%= password_field :user, :password_confirmation, class: "register-input-long"%> - - <%= - if using_captcha? - recaptcha_tags - end - %> -
- -

Register for the AgroPortal announcements email list

-
- - - - - - -
-
\ No newline at end of file From 001f53c4aa7bc8ad02e4a55d1553a335e5cdc546 Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Mon, 30 Jan 2023 07:59:13 +0100 Subject: [PATCH 15/33] Update _form.html.haml --- app/views/users/_form.html.haml | 93 +++++++++++++++++++-------------- 1 file changed, 55 insertions(+), 38 deletions(-) diff --git a/app/views/users/_form.html.haml b/app/views/users/_form.html.haml index a3306597f..9325085f8 100644 --- a/app/views/users/_form.html.haml +++ b/app/views/users/_form.html.haml @@ -1,38 +1,55 @@ -%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"} + %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" + .register-double-input + .register-first-input + %p.register-input-title + ORCIDE ID + %font.register-optional (optional) + %img.register-input-icon{:src => "#{asset_path("orcide.svg")}"}/ + %input.register-input-short.register-input-with-icon{:type => "text"}/ + %div + %p.register-input-title + Github ID + %font.register-optional (optional) + %img.register-input-icon{:src => "#{asset_path("github-icon.svg")}"}/ + %input.register-input-short.register-input-with-icon{:type => "text"}/ + %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" + .d-flex + %input{:type => "checkbox"}/ + %p#register-check-text Register for the AgroPortal announcements email list + %input.register-button{:type => "submit", :value => "Register"}/ From da7db76cb7bf62d6dfaf26d2f6f6d751d49ebf0a Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Mon, 30 Jan 2023 08:01:15 +0100 Subject: [PATCH 16/33] Update login_controller.rb --- app/controllers/login_controller.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/controllers/login_controller.rb b/app/controllers/login_controller.rb index bae176851..2a9587268 100755 --- a/app/controllers/login_controller.rb +++ b/app/controllers/login_controller.rb @@ -75,10 +75,6 @@ def destroy def lost_password end - def lost_password_success - end - - # Sends a new password to the user def send_pass username = params[:user][:account_name] @@ -86,7 +82,7 @@ def send_pass resp = LinkedData::Client::HTTP.post("/users/create_reset_password_token", {username: username, email: email}) if resp.nil? - redirect_to "/lost_pass_success" + redirect_to login_index_path, notice: "Please check your email for a message with reset instructions" else flash[:notice] = resp.errors.first + ". Please try again." redirect_to "/lost_pass" From d092eb12a733bc09d49e3fd8a7003d22668c7b1b Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Sat, 4 Feb 2023 10:23:30 +0100 Subject: [PATCH 17/33] Add code to remove auto added arrows from number_text_field --- app/assets/stylesheets/register.scss | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/assets/stylesheets/register.scss b/app/assets/stylesheets/register.scss index fea9010ea..909fb0403 100644 --- a/app/assets/stylesheets/register.scss +++ b/app/assets/stylesheets/register.scss @@ -98,3 +98,15 @@ 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; +} From 00bdb859a75b2a1a48c4d9ad80654f8f3a77826c Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Sat, 4 Feb 2023 10:24:19 +0100 Subject: [PATCH 18/33] Add the two fields (OrcidID & github) --- app/controllers/users_controller.rb | 36 +++++------------------------ 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 362c7a57a..038667e3a 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,5 +1,4 @@ class UsersController < ApplicationController - before_action :unescape_id, only: [:edit, :show, :update] before_action :verify_owner, only: [:edit, :show] before_action :authorize_admin, only: [:index] @@ -63,14 +62,14 @@ def create if @errors.size < 1 @user_saved = @user.save - if response_error?(@user_saved) + if @user_saved.errors @errors = response_errors(@user_saved) # @errors = {acronym: "Username already exists, please use another"} if @user_saved.status == 409 render action: "new" else # Attempt to register user to list if params[:user][:register_mail_list] - SubscribeMailer.register_for_announce_list(@user.email,@user.firstName,@user.lastName).deliver rescue nil + Notifier.register_for_announce_list(@user.email).deliver rescue nil end flash[:notice] = 'Account was successfully created' @@ -85,10 +84,10 @@ def create # PUT /users/1 # PUT /users/1.xml def update - @user = LinkedData::Client::Models::User.find(params[:id]) - @user = LinkedData::Client::Models::User.find_by_username(params[:id]).first if @user.nil? @errors = validate_update(user_params) if @errors.size < 1 + @user = LinkedData::Client::Models::User.find(params[:id]) + @user = LinkedData::Client::Models::User.find_by_username(params[:id]).first if @user.nil? if params[:user][:password] error_response = @user.update(values: { password: params[:user][:password] }) @@ -103,7 +102,7 @@ def update error_response = @user.update end - if response_error?(error_response) + if error_response @errors = response_errors(error_response) # @errors = {acronym: "Username already exists, please use another"} if error_response.status == 409 render action: "edit" @@ -159,32 +158,10 @@ def custom_ontologies redirect_to user_path(@user.username) end - - def subscribe - @user = LinkedData::Client::Models::User.find_by_username(params[:username]).first - deliver "subscribe", SubscribeMailer.register_for_announce_list(@user.email,@user.firstName,@user.lastName) - end - - def un_subscribe - @email = params[:email] - deliver "un_subscribe", SubscribeMailer.unregister_for_announce_list(@email) - end - - private - def deliver(action,job) - begin - job.deliver - flash[:success] = "You have #{action} successfully" - 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 @@ -255,5 +232,4 @@ def update_role(user) user_roles end - end From 166fc2a88a73c2cec3d27d075279db06757330b5 Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Sat, 4 Feb 2023 10:27:45 +0100 Subject: [PATCH 19/33] Add subscription to mailing list --- app/controllers/users_controller.rb | 40 +++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 038667e3a..be6c1cfd8 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,8 +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 @@ -62,14 +62,14 @@ def create if @errors.size < 1 @user_saved = @user.save - if @user_saved.errors + if response_error?(@user_saved) @errors = response_errors(@user_saved) # @errors = {acronym: "Username already exists, please use another"} if @user_saved.status == 409 render action: "new" else # Attempt to register user to list if params[:user][:register_mail_list] - Notifier.register_for_announce_list(@user.email).deliver rescue nil + SubscribeMailer.register_for_announce_list(@user.email,@user.firstName,@user.lastName).deliver rescue nil end flash[:notice] = 'Account was successfully created' @@ -84,10 +84,10 @@ def create # PUT /users/1 # PUT /users/1.xml def update + @user = LinkedData::Client::Models::User.find(params[:id]) + @user = LinkedData::Client::Models::User.find_by_username(params[:id]).first if @user.nil? @errors = validate_update(user_params) if @errors.size < 1 - @user = LinkedData::Client::Models::User.find(params[:id]) - @user = LinkedData::Client::Models::User.find_by_username(params[:id]).first if @user.nil? if params[:user][:password] error_response = @user.update(values: { password: params[:user][:password] }) @@ -102,7 +102,7 @@ def update error_response = @user.update end - if error_response + if response_error?(error_response) @errors = response_errors(error_response) # @errors = {acronym: "Username already exists, please use another"} if error_response.status == 409 render action: "edit" @@ -158,8 +158,31 @@ def custom_ontologies redirect_to user_path(@user.username) end + + def subscribe + @user = LinkedData::Client::Models::User.find_by_username(params[:username]).first + deliver "subscribe", SubscribeMailer.register_for_announce_list(@user.email,@user.firstName,@user.lastName) + end + + def un_subscribe + @email = params[:email] + deliver "unsubscribe", SubscribeMailer.unregister_for_announce_list(@email) + end + + private + def deliver(action,job) + begin + job.deliver + 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, :orcidId, :githubId, :email, :email_confirmation, :password, :password_confirmation, :register_mail_list, :admin) @@ -232,4 +255,5 @@ def update_role(user) user_roles end + end From 640aef8baaab5d07caa4a28d818eedcefa6a048c Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Sat, 4 Feb 2023 10:30:33 +0100 Subject: [PATCH 20/33] Update index.html.erb From 5633259b8ffe8520dfe851749acbd3f6cbebaadb Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Sat, 4 Feb 2023 10:30:58 +0100 Subject: [PATCH 21/33] Update _form.html.haml --- app/views/users/_form.html.haml | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/app/views/users/_form.html.haml b/app/views/users/_form.html.haml index 9325085f8..554d7e006 100644 --- a/app/views/users/_form.html.haml +++ b/app/views/users/_form.html.haml @@ -24,19 +24,16 @@ Username %font{:color => "red"} * = text_field :user, :username, value: @user.username, class: "register-input-long" - .register-double-input - .register-first-input - %p.register-input-title - ORCIDE ID - %font.register-optional (optional) - %img.register-input-icon{:src => "#{asset_path("orcide.svg")}"}/ - %input.register-input-short.register-input-with-icon{:type => "text"}/ - %div - %p.register-input-title - Github ID - %font.register-optional (optional) - %img.register-input-icon{:src => "#{asset_path("github-icon.svg")}"}/ - %input.register-input-short.register-input-with-icon{:type => "text"}/ + %p.register-input-title + ORCIDE ID + %font.register-optional (optional) + %img.register-input-icon{:src => "#{asset_path("orcide.svg")}"}/ + = 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")}"}/ + = text_field :user, :githubId, value: @user.githubId, class: "register-input-long register-input-with-icon" %p.register-input-title Email %font{:color => "red"} * @@ -50,6 +47,6 @@ %font{:color => "red"} * = password_field :user, :password_confirmation, class: "register-input-long" .d-flex - %input{:type => "checkbox"}/ - %p#register-check-text Register for the AgroPortal announcements email list + %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"}/ From 97a2f2bb6366406874fb2145c48a87ecf169fc47 Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Sat, 4 Feb 2023 11:17:16 +0100 Subject: [PATCH 22/33] Add captacha tag --- app/views/users/_form.html.haml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/views/users/_form.html.haml b/app/views/users/_form.html.haml index 554d7e006..0fafea8ad 100644 --- a/app/views/users/_form.html.haml +++ b/app/views/users/_form.html.haml @@ -46,6 +46,10 @@ Confirm password %font{:color => "red"} * = password_field :user, :password_confirmation, class: "register-input-long" + - if using_captcha? + %tr + %th + %td= recaptcha_tags .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 From d9ba13e5e805a35bd561b26967fefb3ccd7a3d86 Mon Sep 17 00:00:00 2001 From: Bilel Kihal <61744974+Bilelkihal@users.noreply.github.com> Date: Tue, 7 Feb 2023 09:02:26 +0100 Subject: [PATCH 23/33] Update _form.html.haml --- app/views/users/_form.html.haml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/views/users/_form.html.haml b/app/views/users/_form.html.haml index 0fafea8ad..a2c91c955 100644 --- a/app/views/users/_form.html.haml +++ b/app/views/users/_form.html.haml @@ -47,9 +47,7 @@ %font{:color => "red"} * = password_field :user, :password_confirmation, class: "register-input-long" - if using_captcha? - %tr - %th - %td= recaptcha_tags + recaptcha_tags .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 From 0c87360588fed201f51c5b71df376569b96d7cdc Mon Sep 17 00:00:00 2001 From: Bilel Kihal <61744974+Bilelkihal@users.noreply.github.com> Date: Tue, 7 Feb 2023 09:40:11 +0100 Subject: [PATCH 24/33] Add github icon --- app/assets/images/github-icon.svg | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 app/assets/images/github-icon.svg diff --git a/app/assets/images/github-icon.svg b/app/assets/images/github-icon.svg new file mode 100644 index 000000000..9ebf37cb4 --- /dev/null +++ b/app/assets/images/github-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + From 0c07efdc0ab80dad5c66b9eb3159c5ed379428b6 Mon Sep 17 00:00:00 2001 From: Bilel Kihal <61744974+Bilelkihal@users.noreply.github.com> Date: Tue, 7 Feb 2023 09:40:45 +0100 Subject: [PATCH 25/33] Add orcide icon --- app/assets/images/orcide.svg | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 app/assets/images/orcide.svg diff --git a/app/assets/images/orcide.svg b/app/assets/images/orcide.svg new file mode 100644 index 000000000..1f8c827df --- /dev/null +++ b/app/assets/images/orcide.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + From 7fafb7037965b1eed213a4774f9d4fbfd89a2021 Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Wed, 15 Feb 2023 17:27:25 +0100 Subject: [PATCH 26/33] Fix recaptacha tags (add "=") --- app/views/users/_form.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/_form.html.haml b/app/views/users/_form.html.haml index a2c91c955..37e892841 100644 --- a/app/views/users/_form.html.haml +++ b/app/views/users/_form.html.haml @@ -47,7 +47,7 @@ %font{:color => "red"} * = password_field :user, :password_confirmation, class: "register-input-long" - if using_captcha? - recaptcha_tags + = recaptcha_tags .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 From 5ce2550f60d5506552a1114a28cf8f5274f56511 Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Wed, 15 Feb 2023 17:31:11 +0100 Subject: [PATCH 27/33] replace "ORCIDE" by "ORCID" --- app/assets/images/{orcide.svg => orcid.svg} | 0 app/views/users/_form.html.haml | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename app/assets/images/{orcide.svg => orcid.svg} (100%) diff --git a/app/assets/images/orcide.svg b/app/assets/images/orcid.svg similarity index 100% rename from app/assets/images/orcide.svg rename to app/assets/images/orcid.svg diff --git a/app/views/users/_form.html.haml b/app/views/users/_form.html.haml index 37e892841..02e213948 100644 --- a/app/views/users/_form.html.haml +++ b/app/views/users/_form.html.haml @@ -25,9 +25,9 @@ %font{:color => "red"} * = text_field :user, :username, value: @user.username, class: "register-input-long" %p.register-input-title - ORCIDE ID + ORCID ID %font.register-optional (optional) - %img.register-input-icon{:src => "#{asset_path("orcide.svg")}"}/ + %img.register-input-icon{:src => "#{asset_path("orcid.svg")}"}/ = number_field :user, :orcidId, value: @user.orcidId, class: "register-input-long register-input-with-icon" %p.register-input-title Github ID From 825b30c5b46042fdaf495f5e5ef218900870206b Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Wed, 15 Feb 2023 18:06:17 +0100 Subject: [PATCH 28/33] =?UTF-8?q?Change=20ORCID=20ID=20=20input=20type=20f?= =?UTF-8?q?rom=20'number'=20to=20=E2=80=98text=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/stylesheets/register.scss | 12 ------------ app/views/users/_form.html.haml | 2 +- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/app/assets/stylesheets/register.scss b/app/assets/stylesheets/register.scss index 909fb0403..fea9010ea 100644 --- a/app/assets/stylesheets/register.scss +++ b/app/assets/stylesheets/register.scss @@ -98,15 +98,3 @@ 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; -} diff --git a/app/views/users/_form.html.haml b/app/views/users/_form.html.haml index 02e213948..48e8fd4c3 100644 --- a/app/views/users/_form.html.haml +++ b/app/views/users/_form.html.haml @@ -28,7 +28,7 @@ ORCID ID %font.register-optional (optional) %img.register-input-icon{:src => "#{asset_path("orcid.svg")}"}/ - = number_field :user, :orcidId, value: @user.orcidId, class: "register-input-long register-input-with-icon" + = text_field :user, :orcidId, value: @user.orcidId, class: "register-input-long register-input-with-icon" %p.register-input-title Github ID %font.register-optional (optional) From 1f87f08d4ec67d85a5a1dda587941f77d6cf51ef Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Wed, 15 Feb 2023 18:07:26 +0100 Subject: [PATCH 29/33] Extract orcidId & githubId from URLs --- app/controllers/users_controller.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index be6c1cfd8..85a745f26 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -184,6 +184,17 @@ def deliver(action,job) end def user_params + # extract githubID & orcidID from links + if params[:orcidId].to_s.include? "https://orcid.org/" + @orcidID = params[:orcidId].to_s + @orcidID["https://orcid.org/"] = '' + params[:orcidId] = @orcidID + end + if params[:githubId].to_s.include? "https://github.com/" + @githubID = params[:githubId].to_s + @githubID["https://github.com/"] = '' + params[:githubId] = @githubID + end p = params.require(:user).permit(:firstName, :lastName, :username, :orcidId, :githubId, :email, :email_confirmation, :password, :password_confirmation, :register_mail_list, :admin) p.to_h From c51fac5c7bfef99a7b4b35e0cb7e1ec19f0acd10 Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Thu, 16 Feb 2023 11:16:27 +0100 Subject: [PATCH 30/33] Extract arrow-back.svg file --- app/assets/images/arrow-back.svg | 3 +++ app/views/users/_form.html.haml | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 app/assets/images/arrow-back.svg diff --git a/app/assets/images/arrow-back.svg b/app/assets/images/arrow-back.svg new file mode 100644 index 000000000..cb934713e --- /dev/null +++ b/app/assets/images/arrow-back.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/app/views/users/_form.html.haml b/app/views/users/_form.html.haml index 48e8fd4c3..4697bc2d8 100644 --- a/app/views/users/_form.html.haml +++ b/app/views/users/_form.html.haml @@ -2,8 +2,7 @@ .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"} - %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"} + %img.lost-password-arrowback{:src => "#{asset_path("arrow-back.svg")}"} .register-title-container %h2.register-title Create new account From 1f2c0b561926c429465ff9f22d05c27f3671c6c9 Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Thu, 16 Feb 2023 13:51:57 +0100 Subject: [PATCH 31/33] Fix extract id from link --- app/controllers/users_controller.rb | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 85a745f26..ec96027e6 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -184,21 +184,20 @@ def deliver(action,job) end def user_params - # extract githubID & orcidID from links - if params[:orcidId].to_s.include? "https://orcid.org/" - @orcidID = params[:orcidId].to_s - @orcidID["https://orcid.org/"] = '' - params[:orcidId] = @orcidID - end - if params[:githubId].to_s.include? "https://github.com/" - @githubID = params[:githubId].to_s - @githubID["https://github.com/"] = '' - params[:githubId] = @githubID - end + params[:user]["orcidId"] = extract_id_from_url(params[:user]["orcidId"], 'orcid.org') + params[:user]["githubId"] = extract_id_from_url(params[:user]["githubId"], 'github.com') p = params.require(:user).permit(:firstName, :lastName, :username, :orcidId, :githubId, :email, :email_confirmation, :password, :password_confirmation, :register_mail_list, :admin) p.to_h end + + def extract_id_from_url(url, pattern) + if url.include? (pattern) + url.split('/').last + else + url + end + end def unescape_id params[:id] = CGI.unescape(params[:id]) From d1493e08ffe059f89be7075959c874a296cba528 Mon Sep 17 00:00:00 2001 From: Bilelkihal <61744974+Bilelkihal@users.noreply.github.com> Date: Thu, 16 Feb 2023 14:00:55 +0100 Subject: [PATCH 32/33] Resolve conflicts with developement branch --- .gitignore | 1 - Gemfile | 2 +- Gemfile.lock | 54 +- app/assets/images/check.svg | 3 + app/assets/images/green-check.svg | 3 + app/assets/images/red-warning.svg | 5 + app/assets/javascripts/application.js | 1 - app/assets/javascripts/bp_notes.js | 378 +------------- .../javascripts/bp_ontology_viewer.js.erb | 10 - .../stylesheets/application.css.scss.erb | 6 +- app/assets/stylesheets/bioportal.scss | 21 + app/assets/stylesheets/browse.scss | 27 - app/assets/stylesheets/card_message.scss | 40 ++ app/assets/stylesheets/feedback.scss | 113 +++++ app/assets/stylesheets/login.scss | 64 +++ app/assets/stylesheets/lostpassword.scss | 69 +++ .../stylesheets/theme-variables.scss.erb | 30 ++ app/components/card_message_component.rb | 26 + .../card_message_component.html.haml | 20 + .../ontology_subscribe_button_component.rb | 17 + ...ology_subscribe_button_component.html.haml | 6 + ...y_subscribe_button_component_controller.js | 64 +++ app/components/switch_input_component.rb | 15 +- .../switch_input_component.html.haml | 6 +- app/controllers/admin_controller.rb | 6 +- app/controllers/application_controller.rb | 19 +- app/controllers/home_controller.rb | 22 +- app/controllers/landscape_controller.rb | 2 +- app/controllers/login_controller.rb | 6 +- app/controllers/notes_controller.rb | 115 +++-- app/controllers/ontologies_controller.rb | 80 ++- .../ontologies_metadata_curator_controller.rb | 37 +- app/controllers/submissions_controller.rb | 18 +- app/helpers/application_helper.rb | 65 ++- app/helpers/notes_helper.rb | 29 +- app/helpers/ontologies_helper.rb | 8 +- app/helpers/submissions_helper.rb | 99 +++- app/helpers/turbo_helper.rb | 3 +- app/javascript/component_controllers/index.js | 5 +- app/javascript/controllers/application.js | 9 + app/javascript/controllers/index.js | 6 - app/mailers/notifier.rb | 3 +- app/mailers/subscribe_mailer.rb | 49 +- app/views/concepts/_show.html.haml | 2 +- app/views/fair_score/_details.html.haml | 219 ++++---- app/views/home/feedback.html.haml | 59 --- app/views/home/feedback/feedback.html.haml | 76 +++ .../home/feedback/feedback_complete.html.haml | 1 + app/views/home/feedback_complete.html.erb | 4 - app/views/layouts/_header.html.erb | 2 +- app/views/layouts/_ontology_viewer.html.haml | 18 +- app/views/layouts/angular.html.erb | 2 +- app/views/layouts/appliance.html.haml | 1 + app/views/layouts/application.html.erb | 1 + app/views/layouts/minimal.html.erb | 1 + app/views/layouts/popup.html.erb | 1 + app/views/login/index.html.erb | 34 -- app/views/login/index.html.haml | 20 + app/views/login/lost_password.html.erb | 22 - app/views/login/lost_password.html.haml | 15 + .../login/lost_password_success.html.haml | 1 + app/views/notes/_list.html.haml | 84 +--- app/views/notes/_new_comment.html.haml | 14 + app/views/notes/_new_proposal.html.haml | 53 ++ app/views/notes/_note_line.html.haml | 29 ++ app/views/notes/_notes.html.haml | 56 +++ app/views/notes/_ontology_list.html.haml | 107 +--- app/views/notes/_thread.html.haml | 14 +- app/views/notes/reply/_list.html.haml | 9 + app/views/notes/reply/_reply.html.haml | 11 + app/views/notes/reply/new.html.haml | 9 + app/views/notes/show.html.haml | 9 +- app/views/notifier/feedback.html.erb | 21 - app/views/ontologies/_fairs_score.html.haml | 14 +- app/views/ontologies/_submissions.html.haml | 93 ---- app/views/ontologies/browse.html.erb | 472 +++++++++--------- .../ontologies/sections/_metadata.html.haml | 10 +- .../_form_edit.html.haml | 10 +- .../_metadata_tab.html.haml | 2 +- ...lt.html.haml => _metadata_table.html.haml} | 12 +- .../_metadata_table_row.html.haml | 10 + .../shared/_ontology_picker_advanced.html.erb | 238 ++++----- app/views/submissions/_submissions.html.haml | 77 +++ app/views/submissions/index.html.haml | 1 + app/views/users/show.html.haml | 70 ++- config/bioportal_config_env.rb.sample | 5 + config/newrelic.yml | 51 ++ config/routes.rb | 9 +- spec/mailers/previews/subscribe_preview.rb | 4 - 89 files changed, 1915 insertions(+), 1620 deletions(-) create mode 100644 app/assets/images/check.svg create mode 100644 app/assets/images/green-check.svg create mode 100644 app/assets/images/red-warning.svg delete mode 100644 app/assets/javascripts/bp_ontology_viewer.js.erb delete mode 100644 app/assets/stylesheets/browse.scss create mode 100644 app/assets/stylesheets/card_message.scss create mode 100644 app/assets/stylesheets/feedback.scss create mode 100644 app/assets/stylesheets/login.scss create mode 100644 app/assets/stylesheets/lostpassword.scss create mode 100644 app/assets/stylesheets/theme-variables.scss.erb create mode 100644 app/components/card_message_component.rb create mode 100644 app/components/card_message_component/card_message_component.html.haml create mode 100644 app/components/ontology_subscribe_button_component.rb create mode 100644 app/components/ontology_subscribe_button_component/ontology_subscribe_button_component.html.haml create mode 100644 app/components/ontology_subscribe_button_component/ontology_subscribe_button_component_controller.js delete mode 100644 app/views/home/feedback.html.haml create mode 100644 app/views/home/feedback/feedback.html.haml create mode 100644 app/views/home/feedback/feedback_complete.html.haml delete mode 100644 app/views/home/feedback_complete.html.erb delete mode 100644 app/views/login/index.html.erb create mode 100644 app/views/login/index.html.haml delete mode 100644 app/views/login/lost_password.html.erb create mode 100644 app/views/login/lost_password.html.haml create mode 100644 app/views/login/lost_password_success.html.haml create mode 100644 app/views/notes/_new_comment.html.haml create mode 100644 app/views/notes/_new_proposal.html.haml create mode 100644 app/views/notes/_note_line.html.haml create mode 100644 app/views/notes/_notes.html.haml create mode 100644 app/views/notes/reply/_list.html.haml create mode 100644 app/views/notes/reply/_reply.html.haml create mode 100644 app/views/notes/reply/new.html.haml delete mode 100644 app/views/notifier/feedback.html.erb delete mode 100644 app/views/ontologies/_submissions.html.haml rename app/views/ontologies_metadata_curator/{_result.html.haml => _metadata_table.html.haml} (59%) create mode 100644 app/views/ontologies_metadata_curator/_metadata_table_row.html.haml create mode 100644 app/views/submissions/_submissions.html.haml create mode 100644 app/views/submissions/index.html.haml create mode 100644 config/newrelic.yml delete mode 100644 spec/mailers/previews/subscribe_preview.rb diff --git a/.gitignore b/.gitignore index b19fd49da..4ce7bb4e4 100644 --- a/.gitignore +++ b/.gitignore @@ -37,7 +37,6 @@ nohup.out .tags_sorted_by_file -config/newrelic.yml node_modules .env config/site_config.rb diff --git a/Gemfile b/Gemfile index b8f5df837..7de2ef3ea 100644 --- a/Gemfile +++ b/Gemfile @@ -75,7 +75,7 @@ gem 'will_paginate', '~> 3.0' gem 'ontologies_api_client', git: 'https://github.com/ontoportal-lirmm/ontologies_api_ruby_client.git', branch: 'development' -group :staging, :production do +group :staging, :production, :appliance do # application monitoring gem 'newrelic_rpm' # logs in json format, useful for shipping logs to logstash diff --git a/Gemfile.lock b/Gemfile.lock index 5f45717f3..a78e9f6b8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -91,7 +91,7 @@ GEM execjs (~> 2) bcrypt_pbkdf (1.1.0) bindex (0.8.1) - bootsnap (1.15.0) + bootsnap (1.16.0) msgpack (~> 1.2) bootstrap (4.2.1) autoprefixer-rails (>= 9.1.0) @@ -127,7 +127,7 @@ GEM chart-js-rails (0.1.7) railties (> 3.1) coderay (1.1.3) - concurrent-ruby (1.1.10) + concurrent-ruby (1.2.0) crass (1.0.6) cube-ruby (0.0.3) daemons (1.4.1) @@ -143,7 +143,7 @@ GEM erubi (1.12.0) erubis (2.7.0) eventmachine (1.2.7) - excon (0.97.1) + excon (0.99.0) execjs (2.8.1) faraday (2.0.1) faraday-net_http (~> 2.0) @@ -156,9 +156,9 @@ GEM faraday-net_http (2.1.0) ffi (1.15.5) flamegraph (0.9.5) - globalid (1.0.1) + globalid (1.1.0) activesupport (>= 5.0) - graphql (2.0.16) + graphql (2.0.17) graphql-client (0.18.0) activesupport (>= 3.0) graphql @@ -198,7 +198,7 @@ GEM crass (~> 1.0.2) nokogiri (>= 1.5.9) lz4-ruby (0.3.3) - mail (2.8.0.1) + mail (2.8.1) mini_mime (>= 0.1.1) net-imap net-pop @@ -213,7 +213,7 @@ GEM minitest (5.17.0) msgpack (1.6.0) multi_json (1.15.0) - multipart-post (2.2.3) + multipart-post (2.3.0) mysql2 (0.5.3) net-ftp (0.2.0) net-protocol @@ -233,14 +233,14 @@ GEM net-protocol net-ssh (7.0.1) netrc (0.11.0) - newrelic_rpm (8.15.0) + newrelic_rpm (8.16.0) nio4r (2.5.8) - nokogiri (1.14.0-x86_64-linux) + nokogiri (1.14.2-x86_64-linux) racc (~> 1.4) - oj (3.13.23) + oj (3.14.2) open_uri_redirections (0.2.1) parallel (1.22.1) - parser (3.2.0.0) + parser (3.2.1.0) ast (~> 2.4.1) popper_js (1.16.1) pry (0.14.2) @@ -275,10 +275,12 @@ GEM rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.4.4) + rails-html-sanitizer (1.5.0) loofah (~> 2.19, >= 2.19.1) - rails_autolink (1.1.7) - rails (> 3.1) + rails_autolink (1.1.8) + actionview (> 3.1) + activesupport (> 3.1) + railties (> 3.1) railties (7.0.3) actionpack (= 7.0.3) activesupport (= 7.0.3) @@ -294,7 +296,7 @@ GEM rdoc (6.3.3) recaptcha (5.9.0) json - regexp_parser (2.6.1) + regexp_parser (2.7.0) reline (0.3.2) io-console (~> 0.5) rest-client (2.1.0) @@ -303,7 +305,7 @@ GEM mime-types (>= 1.16, < 4.0) netrc (~> 0.8) rexml (3.2.5) - rspec-core (3.12.0) + rspec-core (3.12.1) rspec-support (~> 3.12.0) rspec-expectations (3.12.2) diff-lcs (>= 1.2.0, < 2.0) @@ -320,7 +322,7 @@ GEM rspec-mocks (~> 3.11) rspec-support (~> 3.11) rspec-support (3.12.0) - rubocop (1.43.0) + rubocop (1.45.1) json (~> 2.3) parallel (~> 1.10) parser (>= 3.2.0.0) @@ -330,8 +332,8 @@ GEM rubocop-ast (>= 1.24.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.24.1) - parser (>= 3.1.1.0) + rubocop-ast (1.26.0) + parser (>= 3.2.1.0) ruby-progressbar (1.11.0) ruby2_keywords (0.0.5) ruby_parser (3.19.2) @@ -346,7 +348,7 @@ GEM sprockets-rails tilt select2-rails (4.0.13) - selenium-webdriver (4.7.1) + selenium-webdriver (4.8.0) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) @@ -365,7 +367,7 @@ GEM stackprof (0.2.23) stimulus-rails (1.2.1) railties (>= 6.0.0) - temple (0.9.1) + temple (0.10.0) terser (1.1.13) execjs (>= 0.3.0, < 3) thin (1.8.1) @@ -376,8 +378,8 @@ GEM tilt (2.0.11) time (0.2.1) date - timeout (0.3.1) - turbo-rails (1.3.2) + timeout (0.3.2) + turbo-rails (1.3.3) actionpack (>= 6.0.0) activejob (>= 6.0.0) railties (>= 6.0.0) @@ -386,7 +388,7 @@ GEM rack (>= 1.3, < 3) rack-accept (~> 0.4) tilt (>= 1.4, < 3) - tzinfo (2.0.5) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) unf (0.1.4) unf_ext @@ -413,7 +415,7 @@ GEM will_paginate (3.3.1) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.6) + zeitwerk (2.6.7) PLATFORMS x86_64-linux @@ -482,4 +484,4 @@ DEPENDENCIES will_paginate (~> 3.0) BUNDLED WITH - 2.3.14 + 2.3.15 diff --git a/app/assets/images/check.svg b/app/assets/images/check.svg new file mode 100644 index 000000000..d75aa16ad --- /dev/null +++ b/app/assets/images/check.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/app/assets/images/green-check.svg b/app/assets/images/green-check.svg new file mode 100644 index 000000000..ae048b09d --- /dev/null +++ b/app/assets/images/green-check.svg @@ -0,0 +1,3 @@ + + + diff --git a/app/assets/images/red-warning.svg b/app/assets/images/red-warning.svg new file mode 100644 index 000000000..dea7593d6 --- /dev/null +++ b/app/assets/images/red-warning.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 879aaddce..f73139ead 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -13,7 +13,6 @@ //= require bioportal //= require admin/licenses //= require bp_ajax_controller -//= require bp_ontology_viewer //= require bp_reviews //= require bp_notes //= require bp_ontolobridge diff --git a/app/assets/javascripts/bp_notes.js b/app/assets/javascripts/bp_notes.js index eb400f1e8..61f9e8f44 100644 --- a/app/assets/javascripts/bp_notes.js +++ b/app/assets/javascripts/bp_notes.js @@ -1,348 +1,3 @@ -var ontNotesTable; -var ont_columns = { archived: 3, date: 7, subjectSort: 2 }; - - -NOTES_PROPOSAL_TYPES = { - "ProposalNewClass": "New Class Proposal", - "ProposalChangeHierarchy": "New Relationship Proposal", - "ProposalChangeProperty": "Change Property Value Proposal" -} - -function getUser() { - return jQuery(document).data().bp.user; -} - -function setupNotesFacebox() { - jQuery("a.notes_list_link").attr("rel", "facebox[.facebox_note]"); - jQuery("a.notes_list_link").each(function() { - if (!jQuery(this).data().faceboxInit) { - jQuery(this).facebox(); - jQuery(this).data().faceboxInit = true; - } - }) -} - -function setupNotesFaceboxSizing() { - jQuery(document).bind('afterReveal.facebox', function() { - jQuery("div.facebox_note").parents("div#facebox").width('850px'); - jQuery("div.facebox_note").width('820px'); - jQuery("div.facebox_note").parents("div#facebox").css("max-height", jQuery(window).height() - (jQuery("#facebox").offset().top - jQuery(window).scrollTop()) * 2 + "px"); - jQuery("div.facebox_note").parents("div#facebox").centerElement(); - }); -} - -function bindAddCommentClick() { - jQuery("a.add_comment").live('click', function(){ - var id = jQuery(this).attr("data-parent-id"); - var type = jQuery(this).attr("data-parent-type"); - addCommentBox(id, type, this); - }); -} - -function bindAddProposalClick() { - jQuery("a.add_proposal").live('click', function(){ - var id = jQuery(this).attr("data-parent-id"); - var type = jQuery(this).attr("data-parent-type"); - addProposalBox(id, type, this); - }); -} - -function bindReplyClick() { - jQuery("a.reply_reply").live('click', function(){ - addReplyBox(this); - jQuery(this).hide(); - }); -} - -function bindReplyCancelClick() { - jQuery(".reply .cancel, .create_note_form .cancel").live('click', function(){ - removeReplyBox(this); - }); -} - -function bindProposalChange() { - jQuery(".create_note_form .proposal_type").live('change', function(){ - var selector = jQuery(this); - proposalFields(selector.val(), selector.parent().children(".proposal_container")); - }); -} - -function bindReplySaveClick() { - jQuery(".reply .save, .create_note_form .save").live('click', function(){ - var user = getUser(); - var id = jQuery(this).data("parent_id"); - var type = jQuery(this).data("parent_type"); - var button = this; - var body = jQuery(this).closest(".reply_box").children(".reply_body").val(); - var subject = subjectForNote(button); - var ontology_id = jQuery(document).data().bp.ont_viewer.ontology_id; - jQuery(button).parent().children(".reply_status").html(""); - if (type === "class") { - id = {class: id, ontology: ontology_id}; - } - jQuery.ajax({ - type: "POST", - url: "/notes", - data: {parent: id, type: type, subject: subject, body: body, proposal: proposalMap(button), creator: user["id"]}, - success: function(data){ - var note = data; - var status = data[1]; - if (status && status >= 400) { - displayError(button); - } else { - addNoteOrReply(button, note); - removeReplyBox(button); - } - }, - error: function(){displayError(button);} - }); - }); -} - - -var displayError = function(button) { - jQuery(button).parent().children(".reply_status").html("Error, please try again"); -} - -function addCommentBox(id, type, button) { - var formContainer = jQuery(button).parents(".notes_list_container").children(".create_note_form"); - var commentSubject = jQuery("") - .attr("type", "text") - .attr("placeholder", "Subject") - .addClass("comment_subject") - .add("
"); - var commentFields = commentSubject.add(commentForm(id,type)); - var commentWrapper = jQuery("
").addClass("reply_box").append(commentFields); - formContainer.html(commentWrapper); - formContainer.show(); -} - -function addProposalBox(id, type, button) { - var formContainer = jQuery(button).parents(".notes_list_container").children(".create_note_form"); - var proposalForm = jQuery("
").addClass("reply_box"); - var select = jQuery("