diff --git a/app/assets/stylesheets/upload_ontology.scss b/app/assets/stylesheets/upload_ontology.scss index d5026556c..978d3997d 100644 --- a/app/assets/stylesheets/upload_ontology.scss +++ b/app/assets/stylesheets/upload_ontology.scss @@ -2,6 +2,9 @@ display: flex; justify-content: center; padding: 40px 0; + .show { + display: block; + } } .upload-ontology-card { @@ -50,9 +53,7 @@ display: none; } -.show { - display: block; -} + .upload-ontology-desc { font-size: 12px; diff --git a/app/components/input/language_selector_component.rb b/app/components/input/language_selector_component.rb index 443ee2cbb..3a7ec435c 100644 --- a/app/components/input/language_selector_component.rb +++ b/app/components/input/language_selector_component.rb @@ -2,11 +2,12 @@ class Input::LanguageSelectorComponent < ViewComponent::Base - def initialize(languages:, id: '', name: '' ) + def initialize(languages:, selected: nil, id: '', name: '' ) super @languages = languages @id = id @name = languages + @selected = selected end def languages_options @@ -20,6 +21,6 @@ def languages_options end def call - render SelectInputComponent.new(id: @id, name: @name, values: languages_options, placeholder: 'Select a language') + render SelectInputComponent.new(id: @id, name: @name, values: languages_options, selected: @selected, placeholder: 'Select a language') end end diff --git a/app/components/select_input_component.rb b/app/components/select_input_component.rb index 9392c6b8e..c006ec266 100644 --- a/app/components/select_input_component.rb +++ b/app/components/select_input_component.rb @@ -2,7 +2,7 @@ class SelectInputComponent < ViewComponent::Base - def initialize(id:, name:, values:, selected:, multiple: false, open_to_add_values: false, data: {}, placeholder: '') + def initialize(id:, name:, values:, selected: nil, multiple: false, open_to_add_values: false, data: {}, placeholder: '') super @id = id || '' @name = name diff --git a/config/environments/development.rb b/config/environments/development.rb index ede4e54c9..b595b87cd 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,7 +1,10 @@ +require "active_support/core_ext/integer/time" + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - # In the development environment your application's code is reloaded on - # every request. This slows down response time but is perfect for development + config.assets.debug = true + # In the development environment your application's code is reloaded any time + # it changes. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false @@ -11,15 +14,18 @@ # Show full error reports. config.consider_all_requests_local = true + # Enable server timing + config.server_timing = true + # Enable/disable caching. By default caching is disabled. # Run rails dev:cache to toggle caching. - if Rails.root.join('tmp', 'caching-dev.txt').exist? + if Rails.root.join("tmp/caching-dev.txt").exist? config.action_controller.perform_caching = true config.action_controller.enable_fragment_cache_logging = true config.cache_store = :memory_store config.public_file_server.headers = { - 'Cache-Control' => "public, max-age=#{2.days.to_i}" + "Cache-Control" => "public, max-age=#{2.days.to_i}" } else config.action_controller.perform_caching = false @@ -38,27 +44,30 @@ # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load # Highlight code that triggered database queries in logs. config.active_record.verbose_query_logs = true - # Debug mode disables concatenation and preprocessing of assets. - # This option may cause significant delays in view rendering with a large - # number of complex assets. - config.assets.debug = true # Suppress logger output for asset requests. config.assets.quiet = true # memcache setup - config.cache_store = ActiveSupport::Cache::MemCacheStore.new('cache', namespace: 'BioPortal') + config.cache_store = ActiveSupport::Cache::MemCacheStore.new('cache:11211', namespace: 'BioPortal') # Silence cache output config.cache_store.logger = Logger.new("/dev/null") if config.cache_store.respond_to?(:logger) # Add custom data attributes to sanitize allowed list config.action_view.sanitized_allowed_attributes = ['id', 'class', 'style', 'data-cls', 'data-ont'] + config.view_component.generate.sidecar = true config.file_watcher = ActiveSupport::FileUpdateChecker @@ -66,9 +75,11 @@ require Rails.root.join('config', "bioportal_config_#{Rails.env}.rb") # Raises error for missing translations. - # config.action_view.raise_on_missing_translations = true + # config.i18n.raise_on_missing_translations = true + + # Annotate rendered view with file names. + # config.action_view.annotate_rendered_view_with_filenames = true - # Use an evented file watcher to asynchronously detect changes in source code, - # routes, locales, etc. This feature depends on the listen gem. - config.file_watcher = ActiveSupport::EventedFileUpdateChecker + # Uncomment if you wish to allow Action Cable access from any origin. + # config.action_cable.disable_request_forgery_protection = true end \ No newline at end of file diff --git a/test/components/previews/input/select_component_preview.rb b/test/components/previews/input/select_component_preview.rb index e8f89cb73..851712b2d 100644 --- a/test/components/previews/input/select_component_preview.rb +++ b/test/components/previews/input/select_component_preview.rb @@ -18,8 +18,8 @@ def open_to_add(id: "", name: "", values: ["choices 1", "choices 2", "choices 3" def with_icon values = [ ['', ''], - ["\nFR", 'fr'], - ["\nEN", 'en'] + ["FR", 'fr'], + ["EN", 'en'] ] render SelectInputComponent.new(id: 'id', name: 'name', values: values, placeholder: 'Choose a language') end