Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Feature: Add feedback for empty attributes in concepts #231

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
4 changes: 3 additions & 1 deletion app/components/alert_message_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

class AlertMessageComponent < ViewComponent::Base
include Turbo::FramesHelper
def initialize(id: '', type: 'info')
def initialize(id: '', message: '', type: 'info', closeable: true)
@id = id
@message = message
@type = "alert-#{type}"
@closeable = closeable
end
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
.alert.alert-dismissible.fade.show{:role => "alert", class: "#{@type}"}
= content
%button.close{"aria-label": "Close", "data-dismiss": "alert", type: "button", style: "background: transparent"}
%span{"aria-hidden" => "true"} &times;
.alert.alert-dismissible.fade.show{:role => "alert", class: "#{@type}", style: "text-align: left"}
= @message

- if @closeable
%button.close{"aria-label": "Close", "data-dismiss": "alert", type: "button", style: "background: transparent"}
%span{"aria-hidden" => "true"} &times;


2 changes: 1 addition & 1 deletion app/components/concept_details_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def render_properties(properties_set, ontology_acronym, &block)
<td nowrap= "" style="width:30%" >
<span title=#{url} data-controller="tooltip">#{remove_owl_notation(key)}</span>
</td>
<td>#{"<p>#{ajax_links.join('</p><p>')}</p>".html_safe}</td>
<td>#{"<p>#{ ajax_links.join('</p><p>') }</p>".html_safe}</td>
</tr>
EOS
out += line
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def tree_link_to_concept(child:, ontology_acronym:, active_style:, node: nil)
data-active-collections-value='#{child.isInActiveCollection || []}'
data-skos-collection-colors-target='collection'
class='#{muted_style} #{active_style}'>
#{child.prefLabel ? child.prefLabel({ use_html: true }) : child.id}
#{child.prefLabel ? child.prefLabel({ use_html: true }) : child.id.split('/').last}
</a>
EOS

Expand Down
27 changes: 19 additions & 8 deletions app/views/concepts/_details.html.haml
Original file line number Diff line number Diff line change
@@ -1,57 +1,68 @@
= turbo_frame_tag 'concept_details' do
- schemes_keys = %w[hasTopConcept topConceptOf]
- label_xl_set = %w[skos-xl#prefLabel skos-xl#altLabel skos-xl#hiddenLabel]

- if @concept.prefLabel.nil?
%div.py-3.px-2
= render(AlertMessageComponent.new(message: t('ontology_details.concept.no_preferred_name_for_selected_language'), type: "warning", closeable: true))

= render ConceptDetailsComponent.new(id:'concept-details', acronym: @ontology.acronym,
properties: @concept.properties,
top_keys: %w[description comment],
bottom_keys: %w[disjoint subclass is_a has_part],
exclude_keys: schemes_keys + label_xl_set + ['inScheme']) do |c|

- c.header do
%tr
%td{nowrap: ""} ID
%td{nowrap: ""}= t('ontology_details.concept.id')
%td
%p= @concept.id
%tr
%td{nowrap: ""} Preferred Name
%td{nowrap: ""}= t('ontology_details.concept.preferred_name')
%td
%p= @concept.prefLabel({:use_html => true}).html_safe

- unless @concept.synonym.nil? || @concept.synonym.empty?
%tr
%td{nowrap: ""} Synonyms
%td{nowrap: ""}= t('ontology_details.concept.synonyms')
haddadzineddine marked this conversation as resolved.
Show resolved Hide resolved
%td
- for synonym in @concept.synonym
%p= synonym
%td
%div.synonym-change-request
= add_synonym_button
= remove_synonym_button


- unless @concept.definition.nil? || @concept.definition.empty?
%tr
%td{nowrap: ""} Definitions
%td{nowrap: ""}= t('ontology_details.concept.definitions')
%td
%p= @concept.definition.join(" ")


- if @concept.obsolete?
%tr
%td{nowrap: ""} Obsolete
%td{nowrap: ""}= t('ontology_details.concept.obsolete')
%td
%p true
- if skos?
- unless @concept.memberOf.nil? || @concept.memberOf.empty?
%tr
%td{nowrap: ""} Member of
%td{nowrap: ""}= t('ontology_details.concept.member_of')
%td
%div.my-1
- @concept.memberOf.each do |v|
= raw get_link_for_collection_ajax(v, @ontology.acronym, '_blank')
- unless @concept.inScheme.nil? || @concept.inScheme.empty?
%tr
%td{nowrap: ""} In Schemes
%td{nowrap: ""}= t('ontology_details.concept.in_schemes')
%td
%div.my-1
- @concept.inScheme.each do |v|
= raw get_link_for_scheme_ajax(v, @ontology.acronym, '_blank')
%tr
%td{nowrap: ""} Type
%td{nowrap: ""}= t('ontology_details.concept.type')
%td
%p= @concept.type

Expand Down
110 changes: 56 additions & 54 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -270,61 +270,63 @@ en:
sample_text: Melanoma is a malignant tumor of melanocytes found mainly in the skin but also in the intestine and the eye.

ontology_details:
header:
last_uploaded: "Last uploaded:"
sections:
summary: "Summary"
concepts: "Concepts"
classes: "Classes"
properties: "Properties"
notes: "Notes"
mappings: "Mappings"
schemes: "Schemes"
collections: "Collections"
widgets: "Widgets"
metadata:
details: "Details"
acronym: "Acronym"
visibility: "Visibility"
viewing_restriction: "Viewing Restriction"
view_of_ontology: "View of ontology"
description: "Description"
status: "Status"
format: "Format"
contact: "Contact"
categories: "Categories"
groups: "Groups"
pull_url: "Pull URL"
submissions: "Submissions"
links: "Links"
add_submission: "Add Submission"
views_of: "Views of"
create_new_view: "Create a new view"
no_views_of: "No views of %{name} available"
go_to_rest_api_json_entry: "Go to REST API JSON Entry"
get_my_metadata_back: "Get my metadata back"
n_triple: "N-Triple"
json_ld: "JSON-LD"
rdf_xml: "RDF/XML"
view_individual_metrics_definitions: "View individual metrics definitions"
metrics: "Metrics"
metrics_not_calculated_yet: "We have not yet calculated metrics for"
classes: "Classes"
individuals: "Individuals"
properties: "Properties"
max_depth: "Maximum depth"
max_children: "Maximum number of children"
avg_children: "Average number of children"
single_child_classes: "Classes with a single child"
many_children_classes: "Classes with more than 25 children"
no_definition_classes: "Classes without definition"
visits: "Visits"
download_as_csv: "Download as CSV"
projects_using: "Projects Using"
no_projects_using: "No projects are using"
create_new_project: "Create a new project"
additional_metadata: "Additional Metadata"
metadata:
details: "Details"
acronym: "Acronym"
visibility: "Visibility"
viewing_restriction: "Viewing Restriction"
view_of_ontology: "View of ontology"
description: "Description"
status: "Status"
format: "Format"
contact: "Contact"
categories: "Categories"
groups: "Groups"
pull_url: "Pull URL"
submissions: "Submissions"
links: "Links"
add_submission: "Add Submission"
views_of: "Views of"
create_new_view: "Create a new view"
no_views_of: "No views of %{name} available"
go_to_rest_api_json_entry: "Go to REST API JSON Entry"
get_my_metadata_back: "Get my metadata back"
n_triple: "N-Triple"
json_ld: "JSON-LD"
rdf_xml: "RDF/XML"
view_individual_metrics_definitions: "View individual metrics definitions"
metrics: "Metrics"
metrics_not_calculated_yet: "We have not yet calculated metrics for"
classes: "Classes"
individuals: "Individuals"
properties: "Properties"
max_depth: "Maximum depth"
max_children: "Maximum number of children"
avg_children: "Average number of children"
single_child_classes: "Classes with a single child"
many_children_classes: "Classes with more than 25 children"
no_definition_classes: "Classes without definition"
visits: "Visits"
download_as_csv: "Download as CSV"
projects_using: "Projects Using"
no_projects_using: "No projects are using"
create_new_project: "Create a new project"
additional_metadata: "Additional Metadata"

concept:
no_preferred_name_for_selected_language: "No preferred name for selected language."
no_synonym_name_for_selected_language: "No Synonym for selected language."
no_definitions_for_selected_language: "No Definitions for selected language."
preferred_name: "Preferred name"
id: "ID"
synonyms: "Synonyms"
definitions: "Definitions"
obsolete: "Obsolete"
member_of: "Member of"
in_schemes: "In Schemes"
type: "Type"
no_value_for_selected_language: "No value for selected language."

layout:
header:
browse: "Browse"
Expand Down
61 changes: 25 additions & 36 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
fr:

nbco_annotatosplus:
score_help: "Annotations de score suivant la mesure NCBO 2009 précédente (ancienne) ou Annotations de score suivant la mesure C-Value (cvalue) ou Annotations de score suivant la mesure C-Value avec expansion de la hiérarchie (cvalueh)"
start_typing_to_select: "Commencez à taper pour sélectionner %{type} ou laissez vide pour tout utiliser"
Expand Down Expand Up @@ -190,8 +191,7 @@ fr:
projects: "Projets"
users: "Utilisateurs"
no_recent_notes: "Aucune note récente n'a été soumise"
supported_by: "Avec le soutien de"
with_collaboration: "Avec la collaboration de"

index:
find_ontology_placeholder: Commencez à taper le nom de l'ontologie, puis choisissez dans
query_placeholder: Entrez une classe, par exemple Melanoma
Expand Down Expand Up @@ -281,22 +281,9 @@ fr:
sample_text: Le mélanome est une tumeur maligne des mélanocytes qui se trouvent principalement dans la peau mais aussi dans l'intestin et l'œil.

ontology_details:
header:
last_uploaded: "Dernière mise à jour:"
sections:
summary: "Résumé"
concepts: "Concepts"
classes: "Classes"
properties: "Propriétés"
notes: "Notes"
mappings: "Mappings"
schemes: "Schemes"
collections: "Collections"
widgets: "Widgets"

metadata:
details: "Détails"
acronym: "Acronyme"
acronym: "Acronym"
visibility: "Visibilité"
viewing_restriction: "Restriction de visualisation"
view_of_ontology: "Vue de l'ontologie"
Expand Down Expand Up @@ -337,6 +324,23 @@ fr:
create_new_project: "Créer un nouveau projet"
additional_metadata: "Métadonnées supplémentaires"

concept:
no_preferred_name_for_selected_language: "Pas de nom préféré pour la langue sélectionnée."
no_synonym_name_for_selected_language : "Aucun synonyme pour la langue sélectionnée."
no_definitions_for_selected_language : "Aucune définition pour la langue sélectionnée."
preferred_name: "Nom préféré"
id: "Identifiant"
synonyms: "Synonymes"
definitions: "Définitions"
obsolete: "Obsolète"
member_of: "Membre de"
in_schemes: "Dans les schémas"
type: "Type"
no_value_for_selected_language: "Pas de valeur pour la langue sélectionnée."




layout:
header:
browse: "Parcourir"
Expand All @@ -354,24 +358,7 @@ fr:
release_notes: "Notes de version"
publications: "Publications"
footer:
products: Produits
ontoportal: OntoPortal
release_notes: Notes de version
api: API
sparql: SPARQL
support: Support
contact_us: Nous contacter
wiki: Wiki
documentation: Documentation
agreements: Accords
terms: Conditions d'utilisation
privacy_policy: Politique de confidentialité
cite_us: Nous citer
acknowledgments: Remerciements
about: À propos
about_us: À propos de nous
projects: Projets
team: Équipe
products: "Produits"
copyright_html: Droit d'auteur &copie; 2005‑2022, Conseil d'administration de l'Université Leland Stanford Junior. Tous les droits sont réservés.
grant_html: >
<strong>%{site}</strong> est actuellement développé dans le cadre du <a href="http://www.d2kab.org">projet ANR D2KAB</a> (<a href="http:// www.agence-nationale-recherche.fr/Projet-ANR-18-CE23-0017">ANR-18-CE23-0017</a>). Il reçoit ou a également reçu le soutien du <a href="http://www.lirmm.fr/sifr">projet ANR SIFR</a> (<a href="https://anr.fr/Projet-ANR- 12-JS02-0010">ANR-12-JS02-0010</a>), Union Européenne <a href="http://www.lirmm.fr/sifr">Projet H2020-MSCA SIFRm</a> ( <a href="https://cordis.europa.eu/project/id/701771">N° 701771</a>), le <a href="https://www.lirmm.fr/numev/"> Labex NUMEV</a> (ANR-10-LABX-20), le <ahref="http://www.ibc-montpellier.fr/">projet IBC de Montpellier</a> (ANR-11-BINF0002) , l'<a href="https://www.agropolis-fondation.fr/The-LabEx-AGRO?lang=fr">Agro Labex</a> (ANR-10-LABX-0001) ainsi que de l'Université de Montpellier et du CNRS.
Expand Down Expand Up @@ -448,8 +435,8 @@ fr:
formats:
year_month_day_concise: "%Y-%m-%d" # 2017-03-01
month_day_year: "%b %-d, %Y" # Mar 1, 2017
monthfull_day_year: "%-d %B %Y" # March 1, 2017

monthfull_day_year: "%B %-d, %Y" # March 1, 2017
ontologies:
self: "Ontologies"
loading: Chargement des ontologies
Expand Down Expand Up @@ -571,3 +558,5 @@ fr:
paste_input_text: "Collez un paragraphe de texte ou des mots-clés à utiliser dans le calcul des recommandations d'ontologie"
get_recommendations: "Obtenir des recommandations"
select_ontologies_list: "Sélectionnez les ontologies"


10 changes: 10 additions & 0 deletions test/components/previews/alert_message_component_preview.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class AlertMessageComponentPreview < ViewComponent::Preview

# @param message text
# @param type select [error, info, success, warning]

def default(message: "Here we can type a success or failure message to the user", type: "info", closeable: true )
render(AlertMessageComponent.new(message: message, type: type, closeable: closeable))
end

end
2 changes: 1 addition & 1 deletion test/components/previews/card_message_component_preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ def default(message: "Here we can type a success or failure message to the user"
render(CardMessageComponent.new(message: message, button_text: button_text, type: type, button_link: button_link))
end

end
end
2 changes: 1 addition & 1 deletion test/components/previews/chips_component_preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ def default(name: "name", value: "value")
render(ChipsComponent.new(name: name, value: value))
end

end
end