Skip to content

Conversation

@alexlafroscia
Copy link
Contributor

@alexlafroscia alexlafroscia commented Mar 27, 2018

  • More generic matching (removes assumption that the file is within the pods directory)
  • Fixes some references to the original docs.api.class route and updates them to use docs.api.item

let params = getOwner(this).lookup('route:application').paramsFor('docs.api.class');
let klass = dasherize(params.class_id.replace(/-.+$/g, ''));
let path = `pods/${path}`;
if (path === 'docs/api/item') {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

docs/api/class was what the original documentation had, but no longer matches what the guide suggests.

import { computed } from '@ember/object';
import appFiles from 'ember-cli-addon-docs/app-files';
import { dasherize } from '@ember/string';
import addonFiles from 'ember-cli-addon-docs/addon-files';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Needed to add the logic to also expose the addon tree contents, otherwise you had to really guess a lot about what the current URL on Github would be. At least now we have a reference of the actual files to try and match against.


if (path === 'docs/api/class') {
let params = getOwner(this).lookup('route:application').paramsFor('docs.api.class');
let klass = dasherize(params.class_id.replace(/-.+$/g, ''));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

class_id is no longer what the catch-all param for the route is called.

if (path === 'docs/api/class') {
let params = getOwner(this).lookup('route:application').paramsFor('docs.api.class');
let klass = dasherize(params.class_id.replace(/-.+$/g, ''));
let path = `pods/${path}`;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As before, remove the assumption that the files are within pods

@alexlafroscia
Copy link
Contributor Author

Not sure if these changes will be compatible with every addon, but it's a step toward the right direction I think.

@samselikoff
Copy link
Contributor

Sweet. Will try in Storefront soon and see how it works.

We should beef up addon docs' test coverage soon

@samselikoff samselikoff merged commit a62d09d into ember-learn:master Mar 29, 2018
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