danielgtaylor / aglio

An API Blueprint renderer with theme support that outputs static HTML
4.75k stars 480 forks source link

Action section name overiding Resource section name #128

Closed wenxin-wang closed 9 years ago

wenxin-wang commented 9 years ago

Hi all, Thank you for making such a great tool!

I found a little issue, I don't know if it's a bug, and don't know if anyone else had found it. I'm new to the blueprint so maybe I'm doing it wrong.

In a Resource Group, if there's an Action section under the resource section, the name of the resource section will be override by the first Action section's name. If there's no Action section, then things are fine (but of little use).

Here's the blueprint:

# Group Resource1

## Resource1 [/resource1]

Oh my dear little Resource1

### Action1 on Resource1 [GET]

+ Response 200 (application/json)

        {"message": "you found it!"}

# Group Resource2

## Resource2 [/resource2]

Oh my dear little Resource2

And here's the screen shot: resource_section_name

Notice that the name of the Resource section gets overriden.

By the way, the Resource name didn't show up in the side bar either.

Thanks in advance! Have a nice day.

danielgtaylor commented 9 years ago

@stieizc this is a feature called condensed navigation. In Aglio 1.x you can use --no-condense-nav to disable it (in Aglio 2.0.0-beta it is --no-theme-condense-nav). The way that it works is that it will condense the navigation down to a single item if and only if the resource has only one action. If there are more actions, then no condensing happens.

You can see both in the example API Blueprint. The Note List resource has two actions and both are shown, while the Users resource has only a single action and will be condensed to a single item.

The idea is to make the navigation as small as possible so that you can see as many items as possible. I'm definitely open to suggestions on how to make this better!

wenxin-wang commented 9 years ago

I like your way of leaving an option for turning it off, and condensing the side bar is okay to me.

Personally, I would prefer that the Resource section title (in the red frame) be the original title, and leave the side bar in the condensed style. Currently, the Action section title appears twice in the main area, which is a little bit confusing for me (I spent some time checking the syntax). Maybe this could be done by hiding the Resource section title in the side bar, instead of changing it (which I assume is the current implementation).

Anyway, thank you for making aglio:)

wenxin-wang commented 9 years ago

I notice that with --no-theme-condense-nav (I'm using beta), the Resource section title still gets changed. Is that also a feature?

danielgtaylor commented 9 years ago

@stieizc good point. After looking into this a bit I think you are right and it should only happen in the navigation. I'll fix that for the next beta release today.

wenxin-wang commented 9 years ago

Wow so fast, thank you! Look forward to it.

danielgtaylor commented 9 years ago

This should be fixed with the latest beta. Please re-open if you are still having an issue!