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

Merge to master: Release 3.0.0 #753

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ gem 'flag-icons-rails', '~> 3.4'
gem 'iso-639', '~> 0.3.6'

# Custom API client
gem 'ontologies_api_client', git: 'https://github.com/ontoportal-lirmm/ontologies_api_ruby_client.git', branch: 'master'
gem 'ontologies_api_client', git: 'https://github.com/ontoportal-lirmm/ontologies_api_ruby_client.git', branch: 'development'

# Ruby 2.7.8 pinned gems (to remove when migrating to Ruby >= 3.0)
gem 'ffi', '~> 1.16.3'
Expand Down
16 changes: 10 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
GIT
remote: https://github.com/ontoportal-lirmm/ontologies_api_ruby_client.git
revision: 24fb2549f7b69841e052491439bc8375ed5acfd9
branch: master
revision: 670ce6adfe77aeda97974414ab0ed4b6c5dc9469
branch: development
specs:
ontologies_api_client (2.2.0)
activesupport
activesupport (~> 7.0.4)
excon
faraday
faraday-excon (~> 2.0.0)
faraday-multipart
lz4-ruby
multi_json
oj
parallel
request_store
spawnling (= 2.1.5)

GEM
Expand Down Expand Up @@ -300,7 +302,7 @@ GEM
time
net-http (0.3.2)
uri
net-imap (0.4.16)
net-imap (0.4.15)
date
net-protocol
net-pop (0.1.2)
Expand Down Expand Up @@ -420,6 +422,8 @@ GEM
regexp_parser (2.9.2)
reline (0.5.10)
io-console (~> 0.5)
request_store (1.7.0)
rack (>= 1.4)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0)
Expand Down Expand Up @@ -454,7 +458,7 @@ GEM
rubocop-ast (>= 1.32.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.32.3)
rubocop-ast (1.32.2)
parser (>= 3.3.1.0)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
Expand Down Expand Up @@ -485,7 +489,7 @@ GEM
simplecov-cobertura (2.1.0)
rexml
simplecov (~> 0.19)
simplecov-html (0.13.0)
simplecov-html (0.13.1)
simplecov_json_formatter (0.1.4)
snaky_hash (2.0.1)
hashie
Expand Down
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 @@ -58,6 +58,7 @@
@import "agent_tooltip";
@import "content_finder";
@import "tools";
@import "portal_configuration";
@import "taxonomy";

/* Bootstrap and Font Awesome */
Expand Down
1 change: 1 addition & 0 deletions app/assets/stylesheets/components/chip_button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
}
.chip-button-component-container {
display: inline-block;
text-wrap: nowrap !important;
}
.chip-button-component-container svg path{
fill: var(--primary-color);
Expand Down
68 changes: 68 additions & 0 deletions app/assets/stylesheets/portal_configuration.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@

.portal-configuration{
padding: 10px;
.portal-configuration-title{
h3{
font-size: 20px;
font-weight: 600;
margin-bottom: 0;
}
span{
font-size: 16px;
}
}

h4, .home-section-title .text{
font-size: 15px !important;
}

p {
font-size: 14px;
}
.home-support-items div {
font-size: 12px;
}
.home-support-items a img {
height: 48px;
width: 48px;
}
.home-logo-instances-small{
padding: 7px;
margin: 2px 5px !important;
border-radius: 50%;
display: inline-block;
width: 38px;
height: 38px;
display: flex;
justify-content: center;
align-items: center;
}
.portal-config-ontologies{
display: flex;
align-items: center;
margin-top: 2px;
}
.portal-config-ontologies svg{
width: 14px;
height: 14px;
margin-right: 4px;
}
.portal-config-ontologies svg path{
fill: var(--primary-color);
}
.portal-description{
font-size: 15px;
padding: 11px 0;
}
.portal-config-federated-with{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin-right: 15px;
}
.portal-config-title-text{
font-weight: 500;
font-size: 15px !important;
}
}
3 changes: 1 addition & 2 deletions app/components/display/header_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ class Display::HeaderComponent < ViewComponent::Base

include ComponentsHelper

renders_one :text

def initialize(text: nil, tooltip: nil)
super
Expand All @@ -14,7 +13,7 @@ def initialize(text: nil, tooltip: nil)

def call
content_tag(:div, class: 'header-component') do
out = content_tag(:p, text || @text)
out = content_tag(:p, content&.html_safe || @text)
if @info && !@info.empty?
out = out + info_tooltip(content_tag(:div, @info, style: 'max-width: 300px'))
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
.description
= render TextAreaFieldComponent.new(value: @taxonomy.description)
.ontologies-cards
- @taxonomy.ontologies.each do |ontology|
- @taxonomy.ontologies.each_with_index do |ontology, index|
- if index>10
= render ChipButtonComponent.new(url: "/ontologies?#{@taxonomy.id.split('/')[-2]}=#{@taxonomy.acronym}", text: "...", tooltip:"See all ontologies ...", type: "clickable")
- break
= render ChipButtonComponent.new(url: "/ontologies/#{ontology.split('/').last}", text: ontology.split('/').last, tooltip: @ontologies_names[ontology], type: "clickable")

- if @taxonomy.children
.taxonomy-children-reveal{'data-action': "click->reveal-component#toggle", 'data-id': reveal_id}
.text
Expand Down
5 changes: 4 additions & 1 deletion app/components/dropdown_container_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

class DropdownContainerComponent < ViewComponent::Base
renders_one :empty_state
def initialize(title:, id:, tooltip:nil, is_open: false)
renders_one :title

def initialize(title: nil, id:, tooltip:nil, is_open: false)
super
@title = title
@id = id
@tooltip = tooltip
@is_open = is_open
end

def open_class
@is_open ? "show" : ""
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
.dropdown-container
.dropdown-title-bar{"data-toggle" => "collapse", "data-target" => "##{@id}"}
= render Display::HeaderComponent.new(text: @title, tooltip: @tooltip)
- if title?
= title
- else
= render Display::HeaderComponent.new(text: @title, tooltip: @tooltip)
= image_tag("summary/arrow-down.svg", class: 'ml-2')

.collapse{id: @id, class: open_class}
Expand Down
30 changes: 28 additions & 2 deletions app/components/ontology_browse_card_component.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,40 @@
# frozen_string_literal: true

class OntologyBrowseCardComponent < ViewComponent::Base
include OntologiesHelper
include ApplicationHelper, OntologiesHelper, FederationHelper

def initialize(ontology: nil)
def initialize(ontology: nil, onto_link: nil, text_color: nil, bg_light_color: nil, portal_name: nil)
super
@ontology = ontology
@text_color = text_color
@bg_light_color = bg_light_color
@onto_link = onto_link || "/ontologies/#{@ontology[:acronym]}" if @ontology
@portal_name = portal_name
end

def ontology
@ontology
end

def external_ontology?
!internal_ontology?(@ontology[:id]) || (Array(@ontology[:sources]).size > 1)
end

def onto_link
@onto_link
end

def style_text
external_ontology? ? "color: #{@text_color} !important" : ''
end

def portal_color
@text_color
end
alias :color :portal_color

def style_bg
external_ontology? ? "#{style_text} ; background-color: #{@bg_light_color}" : ''
end

end
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
.d-flex
.browse-ontology-description
.browse-ontology-title-bar
%a.browse-ontology-title{:href => "/ontologies/#{ontology[:acronym]}", data: {'turbo': 'false'}}
%a.browse-ontology-title{:href => onto_link, data: {'turbo': 'false'} , style: style_text}
= ontology[:name]+" ("+ontology[:acronym]+")"
= private_ontology_icon(ontology[:private])
- if external_ontology?
= render Display::InfoTooltipComponent.new(text: "Federated ontology from #{ontology[:sources].map{|x| link_to(x,x)}.join(', ')}", icon: 'external-link.svg')
- if session[:user]&.admin?
- ontology_status = status_string(ontology)
= render Display::InfoTooltipComponent.new(text: ontology_status, icon: submission_status_icons(ontology_status))
Expand All @@ -21,27 +23,32 @@
%p.browse-fair-title
= t('components.fair_score')
.browse-progress-bar
.browse-faire-progress{:style => "width: #{ontology[:normalizedFairScore].to_s+"%"}"}
.browse-faire-progress{:style => "width: #{ontology[:normalizedFairScore].to_s+"%"}; #{color ? 'background-color:' + color : ''}"}
%p.browse-fair-score
= ontology[:fairScore]
%a.browse-fair-details{:href => "/ontologies/#{ontology[:acronym]}#fair-details", 'data-turbo': 'false'}= t('components.details_details')
%a.browse-fair-details{:href => "#{onto_link}#fair-details", 'data-turbo': 'false', style: style_text}= t('components.details_details')

.browse-ontology-cards
= render SquareBadgeComponent.new(label: t('components.classes'), count: ontology[:class_count_formatted], link: "/ontologies/#{ontology[:acronym]}?p=classes" )
.browse-ontology-cards{style: color ? "color: #{color} !important" : ''}
= render SquareBadgeComponent.new(label: t('components.classes'),
count: ontology[:class_count_formatted],
link: "#{onto_link}?p=classes",
color: color)

= render SquareBadgeComponent.new(label: ontology[:format] == 'SKOS' ? t('components.concepts') : t('components.instances'),
count: ontology[:individual_count_formatted],
link: "/ontologies/#{ontology[:acronym]}?p=#{ontology[:format] == 'SKOS' ? "classes" : "instances"}")
count: ontology[:individual_count_formatted], color: color,
link: "#{onto_link}?p=#{ontology[:format] == 'SKOS' ? "classes" : "instances"}")

= render SquareBadgeComponent.new(label: t('components.projects'), count: ontology[:project_count], link: "/ontologies/#{ontology[:acronym]}#projects_section" )
= render SquareBadgeComponent.new(label: t('components.projects'), count: ontology[:project_count], color: color,
link: "#{onto_link}#projects_section" )

= render SquareBadgeComponent.new(label: t('components.notes'), count: ontology[:note_count], link: "/ontologies/#{ontology[:acronym]}?p=notes" )
= render SquareBadgeComponent.new(label: t('components.notes'), count: ontology[:note_count], color: color,
link: "#{onto_link}?p=notes" )


.d-flex.align-items-baseline.mt-1
.d-flex.w-100.mt-1.flex-wrap
- if ontology[:creationDate]
%span.mr-1
= render ChipButtonComponent.new(type: "clickable") do
= render ChipButtonComponent.new(type: "clickable", style: style_bg) do
%span.mr-1= t('components.submitted')
%span.browse-uploaded-date{data:{controller: 'timeago', 'timeago-datetime-value': ontology[:creationDate], 'timeago-add-suffix-value': 'true'}}
- if ontology[:contact]
Expand All @@ -52,19 +59,32 @@
- if ontology[:released]
- date = render DateTimeFieldComponent.new(value: ontology[:released])
%span{data:{controller:'tooltip'}, title: t('components.creation_date', date: date)}
= render ChipButtonComponent.new(type: "clickable") do
= render ChipButtonComponent.new(type: "clickable", style: style_bg) do
= DateTime.parse(date).year rescue date

- if ontology[:format]
%span.mx-1
= render ChipButtonComponent.new(type: "clickable") do
= render ChipButtonComponent.new(type: "clickable", style: style_bg) do
= ontology[:format]
- if ontology_retired?(ontology)
%span.mx-1
= ontology_retired_badge(ontology)
- if ontology[:viewOfOnt]
%span.mx-1{data:{controller:'tooltip'}, title: t('components.view_of_the_ontology', ontology: ontology[:viewOfOnt].split('/').last )}
= render ChipButtonComponent.new(type: "clickable", text: t('components.view'))
= render ChipButtonComponent.new(type: "clickable", text: t('components.view'), style: style_bg)

- if external_ontology?
- ontology[:sources].each do |id|
- config = ontology_portal_config(id)&.last || internal_portal_config(id) || {}
- unless config.blank?
%div.mx-1{title: content_tag(:div, "Source #{config[:name]}"), data:{controller: 'tooltip', 'tooltip-interactive-value': 'true'}}
= render ChipButtonComponent.new(type: "clickable" , style: style_bg) do
= link_to ontoportal_ui_link(id), target: '_top' do
%span.d-inline
%span.mr-1
= inline_svg 'logo-white.svg', width: "20", height: "20"
%span
= config[:name]

- if session[:user]&.admin?
%div.mx-1{title: content_tag(:div, debug(ontology), style: 'height: 300px; overflow: scroll'), data:{controller: 'tooltip', 'tooltip-interactive-value': 'true'}}
Expand Down
6 changes: 4 additions & 2 deletions app/components/square_badge_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

class SquareBadgeComponent < ViewComponent::Base

def initialize(label: , count: ,link: nil)
def initialize(label: , count: ,link: nil, color: nil)
@label = label
@count = count
@link = link
@color = color
end

def call
return if @count.to_i.zero?

link_to(@link, class: 'browse-onology-card', 'data-turbo' => 'false') do
link_to(@link, class: 'browse-onology-card', 'data-turbo' => 'false', style: @color ? "color: #{@color} !important; border-color: #{@color}" : "") do
concat(content_tag(:p, @count, class: 'browse-card-number'))
concat(content_tag(:p, @label, class: 'browse-card-text'))
end
Expand Down
8 changes: 2 additions & 6 deletions app/components/tab_item_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,8 @@ def page_name
end

def call
if title && !title.empty?
link_to(title, @path, id: "#{item_id}_tab", class: "#{active_class} tab-link", 'data-json-link': @json_link)
else
link_to(@path, id: "#{item_id}_tab", class: "#{active_class} tab-link", 'data-json-link': @json_link) do
content
end
link_to(@path, id: "#{item_id}_tab", class: "#{active_class} tab-link", 'data-json-link': @json_link) do
(title && !title.empty?) ? title.html_safe : content
end
end

Expand Down
3 changes: 3 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ def bp_config_json
def rest_url
helpers.rest_url
end
def request_portals
helpers.request_portals
end

def parse_response_body(response)
return nil if response.nil?
Expand Down
Loading
Loading