diff --git a/app/controllers/fair_score_controller.rb b/app/controllers/fair_score_controller.rb index 8f62995b33..8accbc891c 100644 --- a/app/controllers/fair_score_controller.rb +++ b/app/controllers/fair_score_controller.rb @@ -17,6 +17,7 @@ def details_json def get_fair ontology_not_found('') if params[:ontologies].nil? || params[:ontologies].empty? @ontologies = params[:ontologies] + @groups = LinkedData::Client::Models::Group.all begin if @ontologies.include? ',' @fair_scores_data = create_fair_scores_data(get_fair_combined_score(@ontologies), @ontologies.split(',').length) @@ -31,4 +32,4 @@ def get_fair #raise StandardError, 'Error: load failed' end end -end \ No newline at end of file +end diff --git a/app/views/fair_score/_details.html.haml b/app/views/fair_score/_details.html.haml index 914d66b70d..727fddc6b6 100644 --- a/app/views/fair_score/_details.html.haml +++ b/app/views/fair_score/_details.html.haml @@ -59,65 +59,63 @@ %div.card-body - @fair_scores_data[:criteria][:questions][index].each do |question| %div.card.m-3{id:get_name_with_out_dot(question[0])} + %div.card-body %div.card-title.d-flex.justify-content-between %h6.mr-2 #{question[0]} : #{question[1]["question"]} %div %div.btn.text-white{class:"#{( - if question[1]["score"] > 0 - 'bg-obtained_color' - elsif not_implemented?(question[1]) - 'bg-non-applicable_color' - else - 'bg-not-obtained_color' - end - )}"} + if question[1]["score"] > 0 + 'bg-obtained_color' + elsif not_implemented?(question[1]) + 'bg-non-applicable_color' + else + 'bg-not-obtained_color' + end + )}"} %span.badge.badge-pill.badge-light #{ print_score(question[1]["score"])} / #{print_score(question[1]["maxCredits"])} - %div.mb-3 - -if not_implemented?(question[1]) - %span.badge.badge-pill.badge-danger{style:"white-space:normal;font-size:14px"} - #{question[1]["explanation"]} - -elsif default_score?(question[1]) - %span.badge.badge-pill.badge-success{style:"white-space:normal;font-size:14px"} - #{question[1]["explanation"]} - %div - -if !not_implemented?(question[1]) && !default_score?(question[1]) - -if question[1]["points"] - %button.btn.btn-outline-primary{'data-toggle':"collapse" ,'data-target':"#collapse-credits-"+get_name_with_out_dot(question[0])} - = t("fair_score.see_possible_credits") + - if question[0].eql?('R1.3Q2') && @groups.blank? + = empty_state(t('taxonomy.no_taxonomy_created', type: 'groups')) + - else + %div.mb-3 + -if not_implemented?(question[1]) + %span.badge.badge-pill.badge-danger{style:"white-space:normal;font-size:14px"} + #{question[1]["explanation"]} + -elsif default_score?(question[1]) + %span.badge.badge-pill.badge-success{style:"white-space:normal;font-size:14px"} + #{question[1]["explanation"]} + %div + -if !not_implemented?(question[1]) && !default_score?(question[1]) + -if question[1]["points"] + %button.btn.btn-outline-primary{'data-toggle':"collapse" ,'data-target':"#collapse-credits-"+get_name_with_out_dot(question[0])} + = t("fair_score.see_possible_credits") + -if question[1]["properties"] + %button.btn.btn-outline-primary{'data-toggle':"collapse" ,'data-target':"#collapse-properties-"+get_name_with_out_dot(question[0])} + = t("fair_score.see_metadata_used_properties") + %div.mt-2 + %div.collapse{id:"collapse-credits-"+get_name_with_out_dot(question[0])} + %div.card.p-3 + - question[1]["points"].each do |point| + %ul.list-group.list-group-flush + %li.list-group-item.d-flex.justify-content-between.align-items-center + %div.mr-2 + = point["explanation"] + %span.badge.badge-pill.badge-primary + = point["score"] -if question[1]["properties"] - %button.btn.btn-outline-primary{'data-toggle':"collapse" ,'data-target':"#collapse-properties-"+get_name_with_out_dot(question[0])} - = t("fair_score.see_metadata_used_properties") - %div.mt-2 - %div.collapse{id:"collapse-credits-"+get_name_with_out_dot(question[0])} - %div.card.p-3 - - question[1]["points"].each do |point| - %ul.list-group.list-group-flush - %li.list-group-item.d-flex.justify-content-between.align-items-center - %div.mr-2 - = point["explanation"] - %span.badge.badge-pill.badge-primary - = point["score"] - -if question[1]["properties"] - %div.collapse{id:"collapse-properties-"+get_name_with_out_dot(question[0])} - %div.card.p-3{style:"font-size:18px"} - %div.d-flex.flex-wrap - - question[1]["properties"].each do |key, value| - %div.badge.my-2.mx-1{class:(['', 'null', '[]',nil].include?(value) ? "badge-danger" : "badge-success") ,style:"white-space:normal"} - %span - = key - %span.badge.badge-light{style:"white-space:normal"} - - if value == nil - = t("fair_score.not_found") - -elsif value == "" || value == "[]" - = t("fair_score.null") - - else - #{value} - - - - - - + %div.collapse{id:"collapse-properties-"+get_name_with_out_dot(question[0])} + %div.card.p-3{style:"font-size:18px"} + %div.d-flex.flex-wrap + - question[1]["properties"].each do |key, value| + %div.badge.my-2.mx-1{class:(['', 'null', '[]',nil].include?(value) ? "badge-danger" : "badge-success") ,style:"white-space:normal"} + %span + = key + %span.badge.badge-light{style:"white-space:normal"} + - if value == nil + = t("fair_score.not_found") + -elsif value == "" || value == "[]" + = t("fair_score.null") + - else + #{value}