Skip to content
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

Merged

Conversation

SirineMhedhbi
Copy link

@SirineMhedhbi SirineMhedhbi commented May 24, 2023

Context

See agroportal/project-management#422

Changes

  • Add column number of ontologies in groups and categories table .
  • Add pop-up with list of ontologies in group and category admin table.
  • Change the column from nb to count in group and category admin table.
  • Redirect the click on the groups/categories ontologies count link to the browse page with the correct filter applied.
  • Add a select to update ontologies in edit pop-up in category/group table.
  • Restyle edit pop-up in category/group in admin table.
  • Resolve problem of delete all ontologies in category/group edit.
Capture d’écran 2023-06-09 à 10 32 12 Capture d’écran 2023-06-09 à 10 32 36

image

syphax-bouazzouni pushed a commit that referenced this pull request Jun 14, 2023
Copy link
Collaborator

@syphax-bouazzouni syphax-bouazzouni left a 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
Copy link
Collaborator

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] }
Copy link
Collaborator

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
Copy link
Collaborator

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)
Copy link
Collaborator

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"
Copy link
Collaborator

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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why hide it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we just need the select
image

Copy link
Collaborator

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

Copy link
Author

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)
Copy link
Collaborator

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 

@syphax-bouazzouni syphax-bouazzouni merged commit 98e6b02 into development Jun 27, 2023
syphax-bouazzouni added a commit that referenced this pull request Sep 5, 2023
…unt-to-group-and-category

Feature: add column ontologies count to categories and-groups admin page
syphax-bouazzouni added a commit that referenced this pull request Sep 6, 2023
… 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants