apostrophecms / apostrophe-workflow

Provides approval-based workflow and localization capabilities for projects that need them. An optional component of the Apostrophe CMS.
MIT License
36 stars 20 forks source link

Language switcher should preserve query string #270

Closed ericwong3 closed 4 years ago

ericwong3 commented 5 years ago

As title mentions. If I am on say /artists?tags=french and click the link generated from {{ localization._url | build({ workflowLocale: localization.workflowLocale }) }}, the ?tags=french portion will be dropped. It should be preserved.

boutell commented 5 years ago

Try passing it data.url instead.

On Fri, Sep 27, 2019, 1:21 AM Eric Wong notifications@github.com wrote:

As title mentions. If I am on say /artists?tags=french and click the link generated from {{ localization._url | build({ workflowLocale: localization.workflowLocale }) }}, the ?tags=french portion will be dropped. It should be preserved.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/apostrophecms/apostrophe-workflow/issues/270?email_source=notifications&email_token=AAAH27KKQDAQZM3TRTIMYS3QLWJ7LA5CNFSM4I3B5VUKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HOBZOHQ, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAH27LCTE3LDHEN5AQ3QL3QLWJ7LANCNFSM4I3B5VUA .

boutell commented 5 years ago

People translate tags though so this might not work out like you're hoping. Joins are better than tags for i18n projects.

On Fri, Sep 27, 2019, 6:20 AM Tom Boutell tom@apostrophecms.com wrote:

Try passing it data.url instead.

On Fri, Sep 27, 2019, 1:21 AM Eric Wong notifications@github.com wrote:

As title mentions. If I am on say /artists?tags=french and click the link generated from {{ localization._url | build({ workflowLocale: localization.workflowLocale }) }}, the ?tags=french portion will be dropped. It should be preserved.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/apostrophecms/apostrophe-workflow/issues/270?email_source=notifications&email_token=AAAH27KKQDAQZM3TRTIMYS3QLWJ7LA5CNFSM4I3B5VUKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HOBZOHQ, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAH27LCTE3LDHEN5AQ3QL3QLWJ7LANCNFSM4I3B5VUA .

ericwong3 commented 5 years ago

You mean like this?

{% for localization in apos.workflow.localizations() %}
  <li><a href="{{ data.url|build({ workflowLocale: localization.workflowLocale }) }}">{{ localization.label }}</a></li>
{% endfor %}

Does not seem to work.. I can manually simulate by navigating to http://localhost:3000/en/?workflowLocale=zh-cn and I will get 302 back to http://localhost:3000/en/

For your suggestion, yeah I read it on the README suggesting the use of joins for translation. The tags is just an example (as it is a built-in attribute), for my case it is a boolean filter, like ?featured=1, so the focus is filter param got dropped.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.