Titles for search results

refactor-intermediate-models
Thomas Hounsell 2014-12-11 12:24:42 +00:00
parent 18740b6336
commit b573550660
3 changed files with 7 additions and 1 deletions

View File

@ -41,6 +41,7 @@ namespace BuildFeed.Controllers
{
Url = Url.Route("Source Root", new { controller = "build", action = "source", source = s }),
Label = s.Replace(query, "<strong>" + query + "</strong>"),
Title = s,
Group = "Source"
};
@ -54,6 +55,7 @@ namespace BuildFeed.Controllers
{
Url = Url.Route("Version Root", new { controller = "build", action = "version", major = v.Major, minor = v.Minor }),
Label = string.Format("{0}.{1}", v.Major, v.Minor).Replace(query, "<strong>" + query + "</strong>"),
Title = "",
Group = "Version"
};
@ -67,6 +69,7 @@ namespace BuildFeed.Controllers
{
Url = Url.Route("Year Root", new { controller = "build", action = "year", year = y }),
Label = y.ToString().Replace(query, "<strong>" + query + "</strong>"),
Title = "",
Group = "Year"
};
@ -80,6 +83,7 @@ namespace BuildFeed.Controllers
{
Url = Url.Route("Lab Root", new { controller = "build", action = "lab", lab = l }),
Label = l.Replace(query, "<strong>" + query + "</strong>"),
Title = l,
Group = "Lab"
};
@ -94,6 +98,7 @@ namespace BuildFeed.Controllers
{
Url = Url.Route("Actions", new { controller = "build", action = "info", id = b.Id }),
Label = b.FullBuildString.Replace(query, "<strong>" + query + "</strong>"),
Title = b.FullBuildString,
Group = "Build"
};

View File

@ -9,6 +9,7 @@ namespace BuildFeed.Models.ApiModel
{
public string Url { get; set; }
public string Label { get; set; }
public string Title { get; set; }
public string Group { get; set; }
}
}

View File

@ -169,7 +169,7 @@
@Scripts.Render("~/bundles/jsrender")
<script type="text/javascript" src="~/Scripts/bfs.js"></script>
<script id="result-template" type="text/x-jsrender">
<a href="{{:Url}}" class="list-group-item">
<a href="{{:Url}}" class="list-group-item" title="{{:Title}}">
<h4 class="list-group-item-heading">{{:Label}}</h4>
<p class="list-group-item-text">{{:Group}}</p>
</a>