Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/fix/clean-update-lookbook' into …
Browse files Browse the repository at this point in the history
…stage
  • Loading branch information
syphax-bouazzouni committed Jan 27, 2025
2 parents 6c0f4a5 + 9bb35c0 commit 93b5986
Show file tree
Hide file tree
Showing 27 changed files with 109 additions and 178 deletions.
52 changes: 0 additions & 52 deletions .github/workflows/tests-real-data-testportal.yml

This file was deleted.

2 changes: 1 addition & 1 deletion app/assets/images/icons/delete.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/assets/stylesheets/components/pill_button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
display: flex;
align-items: center;
border: 1px solid var(--primary-color);
color: var(--primary-color) !important;
border-radius: 32px;
padding: 10px 20px;
cursor: pointer;
Expand Down
10 changes: 5 additions & 5 deletions app/components/concept_details_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ class ConceptDetailsComponent < ViewComponent::Base

attr_reader :concept_properties

def initialize(id:, acronym:, concept_id: nil , properties: nil, top_keys: [], bottom_keys: [], exclude_keys: [])
def initialize(id:, acronym:, concept_id: nil, properties: nil, top_keys: [], bottom_keys: [], exclude_keys: [])
@acronym = acronym
@properties = properties
@top_keys = top_keys
@bottom_keys = bottom_keys
@exclude_keys = exclude_keys
@id = id
@concept_id=concept_id
@concept_id = concept_id

@concept_properties = concept_properties2hash(@properties) if @properties
end
Expand Down Expand Up @@ -55,8 +55,8 @@ def row_hash_properties(properties_set, ontology_acronym, &block)
end

out << [
{ th: content_tag(:span, remove_owl_notation(key), title: url, 'data-controller': 'tooltip') },
{ td: content_tag(:span, ajax_links.join.html_safe) }
{ th: content_tag(:span, remove_owl_notation(key), title: url, 'data-controller': 'tooltip') },
{ td: list_items_component(max_items: 5) { |r| ajax_links.map { |val| r.container { val.html_safe } } } }
]
end
out
Expand All @@ -81,7 +81,7 @@ def filter_properties(top_keys, bottom_keys, exclude_keys, concept_properties)
private

def link_to_format_modal(format, icon)
link_to_modal(nil, "/ontologies/#{@acronym}/#{escape(@concept_id)}/serialize/#{format}",{ id: "resource_content_#{format}", data: {show_modal_title_value: @concept_id, show_modal_size_value: 'modal-xl'}}) do
link_to_modal(nil, "/ontologies/#{@acronym}/#{escape(@concept_id)}/serialize/#{format}", { id: "resource_content_#{format}", data: { show_modal_title_value: @concept_id, show_modal_size_value: 'modal-xl' } }) do
inline_svg("icons/#{icon}.svg", width: '50px', height: '50px')
end
end
Expand Down
16 changes: 16 additions & 0 deletions app/components/display/empty_state_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

class Display::EmptyStateComponent < ViewComponent::Base

def initialize(text: t('no_result_was_found'))
@text = text
end


def call
content_tag(:div, class:'browse-empty-illustration') do
inline_svg_tag('empty-box.svg') +
content_tag(:p, @text)
end.html_safe
end
end
10 changes: 10 additions & 0 deletions app/components/list_items_show_more_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true
class ListItemsShowMoreComponent < ViewComponent::Base
renders_many :containers

def initialize(max_items: 10)
super
@max_items = max_items - 1
end

end
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
%div{data: {controller: 'reveal-component'}}
- containers[..@max_items].each do |item|
= item

- if (@max_items + 1) < containers.size
- Array(containers[@max_items+1..]).each do |item|
%span{'data-reveal-component-target': "item", class: 'd-none'}
= item
%div{'data-reveal-component-target': "showButton", 'data-action': "click->reveal-component#show" }
%span.btn-link
See more
%div.d-none{'data-reveal-component-target': "hideButton", 'data-action': "click->reveal-component#hide" }
%span.btn-link
See less
7 changes: 2 additions & 5 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -405,11 +405,8 @@ def insert_sample_text_button(text)
end
end

def empty_state(text = t('no_result_was_found'))
content_tag(:div, class:'browse-empty-illustration') do
inline_svg_tag('empty-box.svg') +
content_tag(:p, text)
end
def empty_state(text: t('no_result_was_found'))
render Display::EmptyStateComponent.new(text: text)
end

def ontologies_selector(id:, label: nil, name: nil, selected: nil, placeholder: nil, multiple: true, ontologies: onts_for_select)
Expand Down
7 changes: 6 additions & 1 deletion app/helpers/components_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ def chips_component(id: , name: , label: , value: , checked: false , tooltip: ni
check_input(id: id, name: name, value: value, label: label, checked: checked, disabled: disabled, &block)
end
end
def list_items_component(max_items:, &block)
render ListItemsShowMoreComponent.new(max_items: max_items) do |r|
capture(r, &block)
end
end

def group_chip_component(id: nil, name: , object: , checked: , value: nil, title: nil, disabled: false, &block)
title ||= object["name"]
Expand Down Expand Up @@ -111,7 +116,7 @@ def resolvability_check_tag(url)
end

def rounded_button_component(link)
render RoundedButtonComponent.new(link: link, target: '_blank',size: 'small',title: t("components.go_to_api"))
render RoundedButtonComponent.new(link: link, target: '_blank', size: 'small', title: t("components.go_to_api"))
end

def copy_link_to_clipboard(url, show_content: false)
Expand Down
9 changes: 5 additions & 4 deletions app/helpers/multi_languages_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module MultiLanguagesHelper
include OntologiesHelper, ComponentsHelper
def portal_lang
session[:locale] || 'en'
end
Expand Down Expand Up @@ -172,15 +173,15 @@ def display_in_multiple_languages(label)
closable: true)
end



label = label.to_h.reject { |key, _| %i[links context].include?(key) } if label.is_a?(OpenStruct)

if label.is_a?(String)
content_tag(:p, label)
elsif label.is_a?(Array)
content_tag(:div) do
raw(label.map { |x| content_tag(:div, x) }.join)
list_items_component(max_items: show_max) do |r|
label.map do |x|
r.container { content_tag(:span, x, class: style_as_badge ? 'badge bg-secondary' : '').html_safe }
end
end
else
content_tag(:div) do
Expand Down
1 change: 0 additions & 1 deletion app/helpers/ontologies_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require 'iso-639'
module OntologiesHelper
include ApplicationHelper
REST_URI = $REST_URL
API_KEY = $API_KEY
LANGUAGE_FILTERABLE_SECTIONS = %w[classes schemes collections instances properties].freeze
Expand Down
3 changes: 1 addition & 2 deletions app/views/concepts/_details.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
- t.add_row({th: t('ontology_details.concept.synonyms')}) do |h|
- h.td do
%div.d-flex
%div.d-flex
= display_in_multiple_languages(@concept.synonym)
= display_in_multiple_languages(@concept.synonym, style_as_badge: true, show_max: 5)
%div.synonym-change-request
= add_synonym_button
= remove_synonym_button
Expand Down
2 changes: 1 addition & 1 deletion app/views/visits/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
%tbody
- count = 0
- @analytics.onts.each do |visits|
- ont = @ontologies_hash[visits[:ont].to_s]
- ont = @ontologies_hash[visits[:ont].to_s.split('/').last]
- next if ont.nil?
- count += 1
%tr
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class Buttons::IconWithTooltipComponentPreview < ViewComponent::Preview

# @param title text

def edit(icon: "edit.svg", title: "Edit")
render IconWithTooltipComponent.new(icon: icon, link: "#", title: title)
end

# @param title text

def delete(icon: "icons/delete.svg", title: "Delete")
render IconWithTooltipComponent.new(icon: icon, link: "#", title: title)
end


# @param title text

def preview(icon: "eye.svg", title: "Preview")
render IconWithTooltipComponent.new(icon: icon, link: "#", title: title)
end


end

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class Buttons::PillButtonComponentPreview < ViewComponent::Preview
# @param text text
def default(text: 'hello')
def default(text: 'Watch')
render PillButtonComponent.new(text: text)
end
end
33 changes: 0 additions & 33 deletions test/components/previews/concept_details_component_preview.rb

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class Display::EmptyStateComponentPreview < ViewComponent::Preview

def default()
render Display::EmptyStateComponent.new(text: 'No result was found')
end
end
10 changes: 0 additions & 10 deletions test/components/previews/display/header_component_preview.rb

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions test/components/previews/layout/card_component_preview.rb

This file was deleted.

19 changes: 0 additions & 19 deletions test/components/previews/layout/list_component_preview.rb

This file was deleted.

Loading

0 comments on commit 93b5986

Please sign in to comment.