Skip to content

Commit

Permalink
tmp comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Bilelkihal committed Mar 21, 2023
1 parent 276021a commit 43e32cd
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 93 deletions.
26 changes: 9 additions & 17 deletions app/controllers/ontologies_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class OntologiesController < ApplicationController
helper :concepts
helper :fair_score

layout :determine_layout
layout 'ontology'

before_action :authorize_and_redirect, :only => [:edit, :update, :create, :new]
before_action :submission_metadata, only: [:show]
Expand Down Expand Up @@ -170,15 +170,14 @@ def index
filtered_ontologies = @ontologies

filtered_ontologies = search(filtered_ontologies, params[:search]) unless (params[:search].nil? || params[:search].empty?)

puts "params format ................."
puts params[:format]
filtered_ontologies = format_filter(filtered_ontologies, params[:format]) unless params[:format].nil?


filtered_ontologies = filter_ontologies_by(filtered_ontologies, :categories)
#filtered_ontologies, no_filter = filter_ontologies_by(filtered_ontologies, no_filter, :groups)
#filtered_ontologies, no_filter = filter_ontologies_by(filtered_ontologies, no_filter, :naturalLanguage)
#filtered_ontologies, no_filter = filter_ontologies_by(filtered_ontologies, no_filter, :hasFormalityLevel)
#filtered_ontologies, no_filter = filter_ontologies_by(filtered_ontologies, no_filter, :isOfType)
filtered_ontologies = filter_ontologies_by(filtered_ontologies, :groups)
filtered_ontologies = filter_ontologies_by(filtered_ontologies, :naturalLanguage)
filtered_ontologies = filter_ontologies_by(filtered_ontologies, :hasFormalityLevel)
filtered_ontologies = filter_ontologies_by(filtered_ontologies, :isOfType)

@ontologies = filtered_ontologies

Expand Down Expand Up @@ -513,14 +512,6 @@ def ontology_params
p.to_h
end

def determine_layout
case action_name
when 'index'
'angular'
else
super
end
end

def get_views(ontology)
views = ontology.explore.views || []
Expand All @@ -542,7 +533,8 @@ def search(ontologies_table, search_input)
def format_filter(ontologies_table, format)
filtered_table = []
ontologies_table.each do |ontology|
if ontology[:format] == format
#binding.pry
if ontology[:format]&.downcase == format.downcase
filtered_table << ontology
end
end
Expand Down
1 change: 1 addition & 0 deletions app/javascript/controllers/show_filter_count_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default class extends Controller {
updateCount(){
const checkInputs = this.element.querySelectorAll('input:checked')
const count = checkInputs.length
this.countSpanTarget.style.display = count === 0 ? "none" : "inline-block"
this.countSpanTarget.innerHTML = count === 0 ? "" : count
}
}
1 change: 1 addition & 0 deletions app/javascript/mixins/useHistory.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class HistoryService {
}

getUpdatedURL(currentUrl, newData) {

const url = new URL(currentUrl, document.location.origin)
const urlParams = url.searchParams
this.#updateURLFromState(urlParams, this.getState())
Expand Down
72 changes: 0 additions & 72 deletions app/views/layouts/angular.html.erb

This file was deleted.

7 changes: 3 additions & 4 deletions app/views/ontologies/browse.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
%svg{:fill => "none", :height => "14", :viewbox => "0 0 15 14", :width => "15", :xmlns => "http://www.w3.org/2000/svg"}
%path{:d => "M3.46242 4.17686L6.91776 0.23682C6.98312 0.162278 7.06302 0.102677 7.15225 0.0618794C7.24149 0.0210821 7.33808 0 7.43576 0C7.53344 0 7.63003 0.0210821 7.71927 0.0618794C7.80851 0.102677 7.8884 0.162278 7.95377 0.23682L11.4092 4.17686C11.533 4.31795 11.5971 4.50373 11.5874 4.69334C11.5777 4.88295 11.4951 5.06086 11.3577 5.18792C11.2204 5.31498 11.0395 5.38079 10.8548 5.37087C10.6702 5.36095 10.497 5.27612 10.3732 5.13503L8.13286 2.58055V10.4116C8.13286 10.6015 8.05942 10.7836 7.92869 10.9178C7.79796 11.0521 7.62065 11.1275 7.43576 11.1275C7.25088 11.1275 7.07357 11.0521 6.94284 10.9178C6.8121 10.7836 6.73866 10.6015 6.73866 10.4116V2.58058L4.49846 5.13512C4.43719 5.20498 4.36313 5.26177 4.28049 5.30223C4.19785 5.3427 4.10826 5.36605 4.01684 5.37096C3.92541 5.37587 3.83394 5.36223 3.74764 5.33084C3.66135 5.29944 3.58192 5.2509 3.51389 5.18798C3.44586 5.12506 3.39057 5.04899 3.35117 4.96413C3.31176 4.87926 3.28902 4.78726 3.28425 4.69337C3.27947 4.59948 3.29274 4.50554 3.32331 4.41692C3.35388 4.32829 3.40115 4.24672 3.46242 4.17686ZM14.1744 12.488H0.697103C0.51222 12.488 0.334909 12.5635 0.204177 12.6977C0.0734445 12.832 0 13.0141 0 13.2039C0 13.3938 0.0734445 13.5759 0.204177 13.7101C0.334909 13.8444 0.51222 13.9198 0.697103 13.9198H14.1744C14.3593 13.9198 14.5366 13.8444 14.6673 13.7101C14.7981 13.5759 14.8715 13.3938 14.8715 13.2039C14.8715 13.0141 14.7981 12.832 14.6673 12.6977C14.5366 12.5635 14.3593 12.488 14.1744 12.488Z", :fill => "#31B404"}
Submit new ontology
= form_tag "/ontologies", method: :get, data: { turbo_frame: "search-results", turbo: true, controller: 'turbo-frame' } do |f|
= form_tag "/ontologies", method: :get, data: { turbo_frame: "search-results", turbo: true, turbo_action: "advance"} do |f|

%input{:type => "submit", :value => "submit"}
.browse-search-bar
Expand Down Expand Up @@ -55,9 +55,8 @@
.browse-filter-title-bar{"data-target" => "#browse-#{key}-filter", "data-toggle" => "collapse"}
%p
#{key.to_s.underscore.humanize.capitalize}
- if values[2] && values[2].positive?
%span.badge.badge-secondary{"data-show-filter-count-target":"countSpan"}
= values[2]
%span.badge.badge-secondary{"data-show-filter-count-target":"countSpan", style: "#{values[2] && values[2].positive? ? '' : 'display: none;'}"}
= values[2]
%img{:src => "#{asset_path("arrow-down.svg")}"}/
.collapse{id: "browse-#{key}-filter", class: "#{values[2].positive? ? 'show': ''}"}
.browse-filter-checks-container
Expand Down

0 comments on commit 43e32cd

Please sign in to comment.