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

Fix itemSet sorting priority in site view #1426

Merged
merged 3 commits into from
Jul 15, 2019

Conversation

pols12
Copy link
Contributor

@pols12 pols12 commented Jul 6, 2019

Rewrite of #1210. Asked on the forum.

New sorting priority order:

  1. sort_by (query parameter)
  2. position (configured by admins in site Resources administration)
  3. id of the item set

Previously, position was prioritized and fallback was 'created'. We are still able to replace id fallback by created fallback using the following code, but I’m not sure it’s really useful.

        //In site view, sorting by admin-defined position
        if(isset($this->siteItemSetsAlias)) {
            $qb->addOrderBy("$this->siteItemSetsAlias.position", 'ASC');
+           if(!is_string($query['sort_by'])) {
+               $query['sort_by'] = 'created';
+               parent::sortQuery($qb, $query);
+           }
        }

sort_by (URL param) > position (configured in admin side) > id
Previously, position was prioritized and fallback was 'created'
@zerocrates
Copy link
Member

Just to refresh my memory on this: the underlying issue or feature here is to allow users to manually re-sort the item sets on the public view, correct?

@zerocrates
Copy link
Member

This looks like a workable solution... if you can just make this small change flagged by the automated code-style checker, that should clear up the test failure.

@pols12
Copy link
Contributor Author

pols12 commented Jul 9, 2019

Just to refresh my memory on this: the underlying issue or feature here is to allow users to manually re-sort the item sets on the public view, correct?

I’ve forgotten to recall PR goal, sorry for that. You’ve well described the issue: indeed, visiting /item-set?sort_by=dcterms:title is intended to sort item sets by title; this PR let’s you sort by any property from public site view.

Coding-style issue has just been fixed, sorry for not having tested before committing.

@zerocrates zerocrates merged commit db563b5 into omeka:develop Jul 15, 2019
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