-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: add column ontologies count to categories and-groups admin page #254
Feature: add column ontologies count to categories and-groups admin page #254
Conversation
…min table" This reverts commit c4b391a.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job, just some small details to change, and then we are good to go.
@name = "category[ontologies]" | ||
@values = @ontologies_category | ||
@selected = @category.ontologies | ||
@multiple = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need the @id
, @name
, @values
, @selected
nad @multiple
variable directly put the values in the view;
@@ -20,7 +20,13 @@ def new | |||
end | |||
|
|||
def edit | |||
@category = LinkedData::Client::Models::Category.find_by_acronym(params[:id]).first | |||
@category = LinkedData::Client::Models::Category.find_by_acronym(params[:id], include:'name,acronym,created,description,parentCategory,ontologies' ).first | |||
@ontologies_category = LinkedData::Client::Models::Ontology.all.map {|o|[o.acronym, o.id] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to
@ontologies_category = LinkedData::Client::Models::Ontology.all(include: 'acronym').map {|o|[o.acronym, o.id] }
to make the query more efficient.
@@ -49,10 +55,11 @@ def update | |||
response = { errors: '', success: ''} | |||
start = Time.now | |||
begin | |||
category = LinkedData::Client::Models::Category.find_by_acronym(params[:id]).first | |||
category = LinkedData::Client::Models::Category.find_by_acronym(params[:id], include:'name,acronym,created,description,parentCategory,ontologies' ).first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extract 'name,acronym,created,description,parentCategory,ontologies'
into a constant a re-use it in the line 106
@@ -105,4 +112,23 @@ def _categories | |||
end | |||
response | |||
end | |||
|
|||
def add_ontologies_to_category(ontologies,hasDomain) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same code as in groups, extract it into a concern and re-use it for groups
|
||
@acronyms = @group.ontologies.map { |url| url.match(/\/([^\/]+)$/)[1] } | ||
@ontologies_group = LinkedData::Client::Models::Ontology.all.map {|o|[o.acronym, o.id] } | ||
@id = "group_ontologies" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same remark as in categories
%th | ||
Ontologies | ||
%td.top | ||
= render SelectInputComponent.new(id: @id, name: @name, values: @values , selected: @selected , multiple: @multiple, hide: true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why hide it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, you need to make the variable name more clear, from hide
to 'open_to_add_values' or something like this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
def add_ontologies_to_group(ontologies,group) | ||
ontologies.each do |ont| | ||
unless group.ontologies.include?(ont) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of doing
unless condition
# your code
end
do this
next if condition
# your code
…unt-to-group-and-category Feature: add column ontologies count to categories and-groups admin page
… and Bug fixes (#335) * Merge pull request #281 from ontoportal-lirmm/fix-bug-in-slices-links fix bug in slices links * Merge pull request #212 from ontoportal-lirmm/fix/signup-fields-validation Fix: Signup page input fields validation * Merge pull request #214 from ontoportal-lirmm/feature/update-account-page-design Feature: Update submited ontologies and created projet sections design * Merge pull request #237 from ontoportal-lirmm/feature/ecoportal/groups-categories-administration Feature: Add categories and groups administration * Merge pull request #273 from ontoportal-lirmm/fix/bug-ANAEETHES-ontology Fix: Ontology description text display when it is a complex object not a string * Merge pull request #277 from ontoportal-lirmm/Fix-alphabetical-sorting Fix: Alphabetical sorting in the the collection members display * Fix: bug of display list submitted ontologies of account setting (#286) * fix display list of views of ontologies in Submitted ontologies #270 * fix bug of display text in alert when there is no collections (#285) fix the alert message text that is wrapping and overflowing out #266 * Merge pull request #287 from ontoportal-lirmm/fix-bug-reset-password Fix: bug of reset password * Fix bug of select list view of ontology (#289) * Add Chosen.js functionality to fix bug of select views of ontolgy * Add Chosen.js functionality for list views ontologies * fix bug of update ontology where there is no view * Refactor code * Delete ponse = @ontology.update * Merge pull request #295 from ontoportal-lirmm/Fix-display-the-list-of-concepts-in-a-collection-at-one-sight Fix: display the list of concepts in a collection at one sight * Merge pull request #291 from ontoportal-lirmm/Fix-remove-views-of-submitted-ontologies-in-account-setting Fix: Remove views ontologies in list of submitted ontologies * Merge pull request #280 from ontoportal-lirmm/Fix-Ontology-style-text-display-when-it-is-uri Fix: ontology style text display when it is uri * Merge pull request #254 from ontoportal-lirmm/feature/add-ontology-count-to-group-and-category Feature: add column ontologies count to categories and-groups admin page * Merge pull request #302 from ontoportal-lirmm/feature/migrate-fair-score-js-code Feature: Migrate fair score JS code to Stimulus controllers * fix generated bug after edit group and category (#334) --------- Co-authored-by: SirineMhedhbi <[email protected]>
Context
See agroportal/project-management#422
Changes