You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This continues the work from #2279, by allowing example badges to be specified using `namedParams`. Using an object makes it possible for us to display these in form fields down the line. (#701)
I've called this the "preferred" way, and labeled the other ways deprecated. I've also added some doc to the `examples` property in BaseService. Then I realized we had some doc in the tutorial, though I think it's fine to have a short version in the tutorial, and the gory detail in BaseService.
I've also added a `pattern` keyword, and made `urlPattern` an alias.
Closes#2050.
2. The examples property defines an array of examples. In this case the array will contain a single object, but in some cases it is helpful to provide multiple usage examples.
271
270
3. Our example object should contain the following properties:
272
271
*`title`: Descriptive text that will be shown next to the badge
273
-
*`urlPattern`: Describe the variable part of the route using `:param` syntax.
272
+
*`namedParams`: Provide a valid example of params we can substitute into
273
+
the pattern. In this case we need a valid ruby gem, so we've picked [formatador](https://rubygems.org/gems/formatador).
274
274
*`staticExample`: On the index page we want to show an example badge, but for performance reasons we want that example to be generated without making an API call. `staticExample` should be populated by calling our `render()` method with some valid data.
275
-
*`exampleUrl`: Provide a valid example of params we can call the badge with. In this case we need a valid ruby gem, so we've picked [formatador](https://rubygems.org/gems/formatador)
276
275
*`keywords`: If we want to provide additional keywords other than the title, we can add them here. This helps users to search for relevant badges.
277
276
278
277
Save, run `npm start`, and you can see it [locally](http://127.0.0.1:3000/).
0 commit comments