Skip to content

Commit

Permalink
fix language display to be aligned in the center
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Nov 3, 2023
1 parent a9cee07 commit cdbffd1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 5 additions & 1 deletion app/components/language_field_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ class LanguageFieldComponent < ViewComponent::Base
def initialize(value:, label: nil)
super
@value = value
@lang_code = ISO_639.find(value.split('/').last)&.alpha2 || nil
@lang_code = value&.is_a?(String) ? ISO_639.find(value.split('/').last)&.alpha2 : nil
@label = label
end

def lang_code
@lang_code = 'gb' if @lang_code.eql?('en')
@lang_code
end

def value
@value&.is_a?(String) ? @value.to_s.split('/').last : 'NO-LANG'
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
%div.ml-1
= @label
- else
= render ChipButtonComponent.new(text: @value ? @value.split('/').last : 'NO-LANG')
= render ChipButtonComponent.new(text: value)
2 changes: 0 additions & 2 deletions app/helpers/schemes_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

module SchemesHelper
def get_schemes(ontology)
ontology.explore.schemes(language: request_lang)
Expand Down

0 comments on commit cdbffd1

Please sign in to comment.