Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Module and Namespace in nested module and type pages #314

Merged
merged 11 commits into from Jun 10, 2015
Merged

Add Module and Namespace in nested module and type pages #314

merged 11 commits into from Jun 10, 2015

Conversation

edhzsz
Copy link
Contributor

@edhzsz edhzsz commented May 22, 2015

Adds module and namespace information to the "TypeInfo" and "ModuleInfo" types.
This information is used to add namespace name and links to the parent module in type.cshtml and module.cshtml templates.
Adds test case to review that templates can be generated with correct information.
This will fix #53

@tpetricek
Copy link
Member

This looks like a very useful addition, thanks for doing this!

The only thing I would perhaps do a bit differently is to expose the additional information in a way that makes it a bit easier to use in the C# code in the template, so that you do not have to write things like:

if (FSharpOption<Module>.get_IsSome(@Model.ParentModule)) ...

Wouldn't the following work instead?

if (Model.ParentModule.IsSome) ...

I think this should actually work - if so, could you please simplify the template?

(if this doesn't work, then I'm not sure what would be better - I guess we could add HasParentModule or even return null - woohoo!)

@edhzsz
Copy link
Contributor Author

edhzsz commented May 22, 2015

Yep, while adding the link to the template it didn't feel right doing if (FSharpOption<Module>.get_IsSome(@Model.ParentModule)) ..., I will review if I can do something better than returning null.

@edhzsz
Copy link
Contributor Author

edhzsz commented Jun 2, 2015

Definitely if (Model.ParentModule.IsSome) ... is not possible.
I have added HasParentModule property to TypeInfo and ModuleInfo records, and I have added the Exists extension method to the Module option following @ldfallas http://langexplr.blogspot.co.at/2008/06/using-f-option-types-in-c.html

I prefer the Exists extension method. If you agree I would remove the HasParentModule property.

@tpetricek
Copy link
Member

Thanks, this is a nice trick :-).

tpetricek added a commit that referenced this pull request Jun 10, 2015
Add Module and Namespace in nested module and type pages
@tpetricek tpetricek merged commit 3793b1a into fsprojects:master Jun 10, 2015
@edhzsz edhzsz deleted the module_in_nested_type_pages branch June 12, 2015 14:35
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.

Render the namespace in detail pages
2 participants