Skip to content

Commit

Permalink
Merge pull request #211 from ontoportal-lirmm/development
Browse files Browse the repository at this point in the history
Merge to master: Release 2.4.7
  • Loading branch information
syphax-bouazzouni authored May 7, 2023
2 parents 877bf08 + dc9dfeb commit 25959ff
Show file tree
Hide file tree
Showing 15 changed files with 516 additions and 242 deletions.
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -485,3 +485,4 @@ DEPENDENCIES

BUNDLED WITH
2.3.23

44 changes: 44 additions & 0 deletions app/assets/images/empty-box.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
223 changes: 223 additions & 0 deletions app/assets/stylesheets/account.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@

.account-page-center{
display: flex;
justify-content: center;
margin: 30px 0;

}
.account-page-title{
font-size: 18px;
font-weight: 700;
}

.account-page-sub-container{
display: flex;
}
.account-page-first-row{
width: 566px;
margin-right: 20px;
}

.account-page-second-row{
width: 566px;
}

#account-page-title-line{
width: 93px;
margin-top: 3px;
border: 0.5px solid var(--primary-color);
border-radius: 5px;
margin-bottom: 0px !important ;
}
.account-page-card{
border: 1px solid #DFDFDF;
border-radius: 5px;
padding: 20px 20px;
margin-top: 20px;
}
.account-page-card-title{
font-size: 16px;
font-weight: 600;
}
.account-page-personal-informations-title-bar{
display: flex;
align-items: center;
justify-content:space-between;
}
.account-page-rounded-button{
display: flex;
justify-content: center;
border: 0.5px solid var(--primary-color);
padding: 10px;
border-radius: 50px;
width: 40px;
}
.account-page-info-column{
display: flex;
}
.account-page-info-column .title{
margin-right: 9px;
font-size: 15px;
color: #666666;
}

.account-page-info-column .info{
font-size: 15px;
font-weight: 600;
}
.account-page-card-desc{
font-size: 13px;
color: #666666;
margin: 8px 0;
}
.apikey{
font-size: 17px;
font-weight: 600;
}
.account-page-card-container{
display: flex;
justify-content: space-between;
align-items: center;
}
.account-page-no-ontology{
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
padding: 37px;
}
.account-page-no-ontology p{
color: #bbbbbb;
font-size: 16px;
margin: 26px 0;
}
.account-page-upload-ontology-button{
width: 220px;
font-size: 16px;
font-weight: 500;
color: var(--primary-color);
background-color: white;
padding: 16px;
border: 1px solid var(--primary-color);
border-radius: 5px;
text-align: center;
}
.account-page-select-ontology-set-button{
display: flex;
justify-content: space-between;
align-items: center;
width: 200px;
border: 1px solid var(--primary-color);
padding: 16px;
border-radius: 5px;
font-size: 16px;
font-weight: 500;
color: var(--primary-color);
}
.account-page-select-ontology-set-button p{
margin-bottom: 0 !important;
}
.account-page-api-documentation-link{
display: flex;
margin-top: 10px;
}
.account-page-api-documentation-link a{
font-size: 15px;
font-weight: 500;
color: var(--primary-color);
text-decoration: none;
}
.account-page-api-documentation-link a svg{
margin-left: 10px;
margin-bottom: 5px;
}
svg path{
fill: var(--primary-color);
}

.account-page-subscribe-button{
border: 1px solid var(--primary-color);
text-decoration: none;
color: var(--primary-color);
border-radius: 5px;
padding: 12px 20px;
font-size: 14px;
font-weight: 500;
}

.account-page-subscription{
margin-top: 10px;
display: flex;
justify-content: space-between;
}
.account-page-subscription a{
font-size: 15px;
font-weight: 400;
color: var(--primary-color);
}
.account-page-subscription div{
display: flex;
}
.account-page-subscription div .notes{
margin-right: 23px;
color: #666666 !important;
font-weight: 400;
}
.account-page-subscription div .subscribe_to_notes{
color: #EB4335 !important;
font-weight: 400 !important;
border: unset !important;
background-color: unset !important;
vertical-align: top;
padding: unset !important;
box-shadow: unset !important;
}
.account-page-small-cards-container{
display: flex;
flex-wrap: wrap;
}
.account-page-submitted-ontology{
background-color: #F6F6F6;
padding: 10px;
border-radius: 5px;
margin-right: 10px;
margin-top: 10px;
}

.account-page-submitted-ontology a{
color: #777777 !important;
font-weight: 500;
font-size: 15px;
}
.no-margin{
margin: 0 !important;
}
.change-password{
margin-top: 14px;
display: flex;
justify-content: center;
}
@media only screen and (max-width: 1200px) {
.account-page-first-row{
width: 47vw;
margin-right: 20px;
}

.account-page-second-row{
width: 47vw;
}
}

@media only screen and (max-width: 950px) {
.account-page-first-row{
width: 80vw;
margin-right: 20px;
}

.account-page-second-row{
width: 80vw;
}
.account-page-sub-container{
display:block;
}
}
1 change: 1 addition & 0 deletions app/assets/stylesheets/application.css.scss.erb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
@import "feedback";
@import "login";
@import "components/index";
@import "account";

/* Bootstrap and Font Awesome */
@import "bootstrap";
Expand Down
3 changes: 3 additions & 0 deletions app/assets/stylesheets/bioportal.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
a{
text-decoration: none !important;
}
.alignright {
float:right;
}
Expand Down
33 changes: 21 additions & 12 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@ class UsersController < ApplicationController
before_action :authorize_admin, only: [:index,:subscribe, :un_subscribe]
layout :determine_layout

# GET /users
# GET /users.xml
def index
@users = LinkedData::Client::Models::User.all
respond_to do |format|
format.html
format.xml { render xml: @users.to_xml }
end
end

# GET /users/1
# GET /users/1.xml
Expand Down Expand Up @@ -142,7 +133,7 @@ def custom_ontologies
custom_ontologies = params[:ontology] ? params[:ontology][:ontologyId] : []
custom_ontologies.reject!(&:blank?)
@user.update_from_params(customOntology: custom_ontologies)
error_response = @user.update
error_response = !@user.update

if error_response
flash[:notice] = 'Error saving Custom Ontologies, please try again'
Expand Down Expand Up @@ -192,7 +183,7 @@ def user_params
end

def extract_id_from_url(url, pattern)
if url.include? (pattern)
if url && url.include?(pattern)
url.split('/').last
else
url
Expand Down Expand Up @@ -235,14 +226,32 @@ def validate(params)
errors << "Please fill in the proper text from the supplied image"
end
end
if ((!params[:orcidId].match(/^\d{4}+(-\d{4})+$/)) || (params[:orcidId].length != 19)) && !(params[:orcidId].nil? || params[:orcidId].length < 1)
errors << "Please enter a valide orcid id"
end

if params[:username].nil? || params[:username].length < 1 || !params[:username].match(/^[a-zA-Z0-9]([._-](?![._-])|[a-zA-Z0-9]){3,18}[a-zA-Z0-9]$/)
errors << "please enter a valid username"
end
return errors
end

def validate_update(params)
errors = []
if params[:email].nil? || params[:email].length < 1 || !params[:email].match(/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i)
errors << "Please enter an email address"
errors << "Please enter a valid email adresse"
end
if params[:firstName].nil? || params[:firstName].length < 1
errors << "First name field is required"
end
if params[:lastName].nil? || params[:lastName].length < 1
errors << "Last name field is required"
end
if params[:username].nil? || params[:username].length < 1
errors << "Last name field is required"
end
if ((!params[:orcidId].match(/^\d{4}+(-\d{4})+$/)) || (params[:orcidId].length != 19)) && !(params[:orcidId].nil? || params[:orcidId].length < 1)
errors << "Please enter a valide orcide id"
end
if !params[:password].eql?(params[:password_confirmation])
errors << "Your Password and Password Confirmation do not match"
Expand Down
7 changes: 6 additions & 1 deletion app/helpers/fair_score_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ def get_fairness_service_url(apikey = user_apikey)
"#{$FAIRNESS_URL}?portal=#{$HOSTNAME.split('.')[0]}#{apikey.nil? || apikey.empty? ? '' : "&apikey=#{apikey}"}"
end
def get_fairness_json(ontologies_acronyms, apikey = user_apikey)
MultiJson.load(Faraday.get(get_fairness_service_url(apikey) + "&ontologies=#{ontologies_acronyms}&combined").body.force_encoding('ISO-8859-1').encode('UTF-8'))
begin
MultiJson.load(Faraday.get(get_fairness_service_url(apikey) + "&ontologies=#{ontologies_acronyms}&combined").body.force_encoding('ISO-8859-1').encode('UTF-8'))
rescue
Rails.logger.warn "FAIRness service issue unreachable"
{}
end
end

def get_fair_score(ontologies_acronyms, apikey = user_apikey)
Expand Down
10 changes: 9 additions & 1 deletion app/views/admin/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

%div.row
%div.col

%ul.nav.nav-tabs{id: "admin-tabs", role: "tablist"}
%li.nav-item
=link_to("Site Administration", "#site-admin", id: "site-admin-tab", class: "nav-link active", role: "tab", data: { toggle: "tab" }, aria: { controls: "site-admin", selected: "true" })
Expand Down Expand Up @@ -54,6 +53,15 @@
%dive.site-admin-page-section
%div#appliance-id
%span

-# Clear caches
%div#site-admin-clear-caches.my-5
%div.site-admin-page-header
MONITORING LINKS
%dive.site-admin-page-section
= link_to("Newrelic", "https://login.newrelic.com/login", target: '_blank', id: "newrelic_link", class: "btn btn-outline-secondary btn-sm admin-action-item", role: "button")
= link_to("StatusCake", "https://app.statuscake.com/Login", target: '_blank', id: "statuscake_link", class: "btn btn-outline-secondary btn-sm admin-action-item", role: "button")


-# Ontology Administration tab
%div.tab-pane.fade{id: "ontology-admin", role: "tabpanel", aria: { labelledby: "ontology-admin-tab" }}
Expand Down
Loading

0 comments on commit 25959ff

Please sign in to comment.