The Golf Hole Editor package is an Umbraco data type for creating golf hole information. This data type could be used on a golf club website for displaying course information. An editor can configure each hole's tees and it's par, stroke index and distances. The data type can also accommodate for different numbers of tees, holes and pars.
If you'd like to contribute to the package, please visit https://github.com/agebase/umbraco-golf-hole-editor, fork the repository and send a pull request.
Installation
The Golf Hole Editor package can be installed via the package's page on our.umbraco.org or via NuGet. If installing via NuGet, use the following package manager command:
Install-Package AgeBase.GolfHoleEditor
Configuration
Setup a new data type and select the AgeBase.GolfHoleEditor within Umbraco's Developer section. After your selection, you will be presented with three options for your data type which are as follows:
- Tees: A comma separated list of tees available to edit. For example, White,Yellow,Red. The default tees value is set to White, Yellow and Red.
- Holes: A comma separated list of tees available for each hole. For example: 1,2,3,4,5,6,7,8,9. The default holes value is set to 1 to 18 holes.
- Pars: A comma separated list of pars available for each hole. For example: 3,4,5. The default value is set to pars 3, 4 and 5.
Once setup, you will be able to add the data type as a property to a document type. When an instance of that document type is created, the editor will be displayed a collection of editable tees.
Usage
When using a property value on a template, add the following code to return and use a list of golf tees.
var holes = Model.Content.GetPropertyValue<AgeBase.GolfHoleEditor.Models.GolfTees>("alias");
Once converted, you will be able to select or loop through each golf tee. For example:
@{
<ul>
@foreach (var hole in holes)
{
<li>
Tee: @hole.Name
<ul>
<li>Par: @hole.Par</li>
<li>Stroke Index: @hole.StrokeIndex</li>
<li>Distance: @hole.Distance yards</li>
</ul>
</li>
}
</ul>
}