Skip to content

Commit

Permalink
Fix: submissions properties selector labels and include ontologies pr…
Browse files Browse the repository at this point in the history
…operties (#669)

* add ontologies properties to the submission properties selector

* show submission attributes label instead of the keys in the selector
  • Loading branch information
syphax-bouazzouni authored Jun 21, 2024
1 parent 5306a1a commit c5bd46a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
2 changes: 2 additions & 0 deletions app/helpers/submission_inputs_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ def help_text
end

def label
return attr_key unless @attr_metadata

@label || @attr_metadata['label'] || @attr_metadata['attribute'].humanize
end

Expand Down
17 changes: 13 additions & 4 deletions app/helpers/submissions_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,25 @@ def submission_properties

out
end
def ontology_properties
['acronym', 'name', [t('submission_inputs.visibility'), :viewingRestriction], 'viewOf', 'groups', 'categories',
[t('submission_inputs.administrators'), 'administeredBy']]
end

def submission_editable_properties
properties = submission_properties
properties.map do |x|
properties = submission_properties.map do |x|
if x.is_a? Array
[x[0].to_s.underscore.humanize, x[0]]
[attr_label(x[0], show_tooltip: false), x[0]]
else
[x.to_s.underscore.humanize, x]
[attr_label(x, show_tooltip: false), x]
end
end

properties += ontology_properties.map do |x|
x.is_a?(Array) ? x : [x.to_s.underscore.humanize, x]
end

properties
end

def attribute_infos(attr_label)
Expand Down
14 changes: 7 additions & 7 deletions lib/tasks/schema.rake
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# frozen_string_literal: true

require_relative '../../config/initializers/graphql_client'
# require_relative '../../config/initializers/graphql_client'

namespace :schema do
desc 'Update GitHub GraphQL schema'
task :update do
GraphQL::Client.dump_schema(GitHub::HTTPAdapter, 'data/schema.json')
end
end
# namespace :schema do
# desc 'Update GitHub GraphQL schema'
# task :update do
# GraphQL::Client.dump_schema(GitHub::HTTPAdapter, 'data/schema.json')
# end
# end

0 comments on commit c5bd46a

Please sign in to comment.