Code Monkey home page Code Monkey logo

apostrophe-workflow-prefix's Introduction

Apostrophe Workflow Prefix

This repository demonstrates how apostrophe-workflow's link-to-locale generates invalid URLs containing apos.prefix twice, when specifying a prefix in app.js.

When running without a prefix everything works as expected.

Setup

This project is based on apostrophe-boilerplate; apostrophe-workflow has been added and configured with two locales; a locale switcher has been implemented in views/layout.html.

Two locales have been defined to be able to demonstrate switching between locales: en-US and de-AT, both children of the default locale.

Apostrophe workflow has been configured with basic options, according the project's README.md.

Instructions to Reproduce the Error

First, test the app without a prefix set in app.js; everything should work as expexted. Then, set a prefix and test again; the links generated by the locale switcher will contain apos.prefix twice.

Without Prefix

To test without a prefix first, make sure to comment out prefix: '/pre' in app.js`. Then start the app.

  1. docker-compose up mongo to start Mongo
  2. npm i in another terminal to install packages
  3. node app apostrophe-groups:add admin admin to add group
  4. node app apostrophe-users:add admin admin to add user
  5. npm start to start the app

Login at localhost:3000/login, create the page _New Pagewith slug/new-pagein thedefaultlocale; export to theen-US locale (_New Page_//new-page) and the de-AT locale (_Neue Seite_//neue-seite`), commit all three versions of the page.

The language selector in the top-right corner implemented in views/layout.html should display options for United States and Austria. Clicking on Austria should redirect to /neue-seite, clicking on United States should redirect to /new-page.

With Prefix

Stop the app. Uncomment prefix: '/pre' in app.js. (Re)start the app as described above.

Login at localhost:3000/login, then go to /new-page to display New Page. Now click on Austria in the locale switcher in the to-right corner. The link generated is /pre/pre/neue-seite, which does not exist.

Analysis

The link-to-locale route defined in apostrophe-workflow/lib/routes.js returns a link containing apos.prefix twice.

I'm not yet sure why this happens and how to fix it.

apostrophe-workflow-prefix's People

Contributors

sepastian avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.