From b5c897a941f748723b0c242371e9c09f154a1dfd Mon Sep 17 00:00:00 2001 From: Imad Bourouche Date: Fri, 20 Dec 2024 11:14:01 +0100 Subject: [PATCH] display accessible private ontologies in user account settings --- app/controllers/users_controller.rb | 1 + app/views/users/show.html.haml | 14 ++++++++++++++ config/locales/en.yml | 2 ++ config/locales/fr.yml | 4 +++- 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 5b4eb817e5..f2de866642 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -40,6 +40,7 @@ def show @user_ontologies ||= [] @admin_ontologies = @ontologies.select {|o| o.administeredBy.include? @user.id } + @accessed_ontologies = @ontologies.select {|o| o.acl.include? @user.id } projects = LinkedData::Client::Models::Project.all; @user_projects = projects.select {|p| p.creator.include? @user.id } diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index cb69ab11a5..139d2f403d 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -119,6 +119,20 @@ .account-page-submitted-ontology{data: {controller: 'tooltip'}, title: ont.name} %a{href: "/ontologies/#{view.match(/\/([^\/]+)$/)[1]}"}= view.match(/\/([^\/]+)$/)[1] + .account-page-card + %h4.account-page-card-title= t('users.show.accessible_semantic_resources') + .account-page-small-cards-container + - if @accessed_ontologies.nil? || @accessed_ontologies.empty? + = t('users.show.no_accessible_resources') + - else + - @accessed_ontologies.each do |ont| + .account-page-submitted-ontology{data: {controller: 'tooltip'}, title: ont.name} + %a{href: "/ontologies/#{ont.acronym}"}= ont.acronym + - unless ont.views.nil? || ont.views.empty? + - ont.views.each do |view| + .account-page-submitted-ontology{data: {controller: 'tooltip'}, title: ont.name} + %a{href: "/ontologies/#{view.match(/\/([^\/]+)$/)[1]}"}= view.match(/\/([^\/]+)$/)[1] + .account-page-card %h4.account-page-card-title= t('users.show.projects_created') .account-page-small-cards-container diff --git a/config/locales/en.yml b/config/locales/en.yml index 188ee057d0..46f66c1d34 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -879,6 +879,7 @@ en: save_custom_semantic_resources: Save custom ontologies not_subscribed: Not subscribed to any ontology submitted_semantic_resources: Submitted Ontologies + accessible_semantic_resources: Accessible Ontologies upload_semantic_resources: Upload Ontologies projects_created: Projects Created no_project_created: No project created @@ -886,6 +887,7 @@ en: subscribe: Subscribe subscriptions: Subscriptions no_uploaded_resources: You didn't upload any ontology yet + no_accessible_resources: You do not have access to other ontologies. You can only access ontologies you own. notes: Notes search: no_search_class_provided: No search class provided diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 8f16f56b31..92b1548572 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -892,7 +892,8 @@ fr: note_feature_logged_in: "Note : cette fonctionnalité ne fonctionne que lorsque vous êtes connecté." save_custom_semantic_resources: Sauvegarder les ontologies personnalisées not_subscribed: Non abonné à aucune ontologie - submitted_semantic_resources: Ressources Ontologies + submitted_semantic_resources: Ontologies Soumises + accessible_semantic_resources: Ontologies Accessibles upload_semantic_resources: Télécharger ontologies projects_created: Projets Créés no_project_created: Aucun projet créé @@ -900,6 +901,7 @@ fr: subscribe: S'abonner subscriptions: Abonnements no_uploaded_resources: Vous n'avez encore téléchargé aucune ontologie + no_accessible_resources: Vous n'avez pas accès aux d'autres ontologies. Vous ne pouvez accéder qu'aux ontologies dont vous êtes propriétaire. notes: Notes search: