mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Fixing Content Picker when Search is the only tab
--HG-- branch : 1.x
This commit is contained in:
@@ -51,11 +51,22 @@ namespace Orchard.ContentPicker.Controllers {
|
||||
|
||||
if (contentPickerMenuItem.Items.All(x => x.Text.ToString() != T("Recent Content").Text)) {
|
||||
// the default tab should not be displayed, redirect to the next one
|
||||
var root = menuItems.FirstOrDefault();
|
||||
if (root == null) {
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
var routeData = new RouteValueDictionary(menuItems.First().RouteValues);
|
||||
var firstChild = root.Items.First();
|
||||
if (firstChild == null) {
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
var routeData = new RouteValueDictionary(firstChild.RouteValues);
|
||||
var queryString = Request.QueryString;
|
||||
foreach (var key in queryString.AllKeys) {
|
||||
routeData[key] = queryString[key];
|
||||
if (!String.IsNullOrEmpty(key)) {
|
||||
routeData[key] = queryString[key];
|
||||
}
|
||||
}
|
||||
|
||||
return RedirectToRoute(routeData);
|
||||
|
@@ -61,7 +61,7 @@ namespace Orchard.Search.Controllers {
|
||||
}
|
||||
|
||||
if (!_indexManager.HasIndexProvider()) {
|
||||
return HttpNotFound();
|
||||
return View("NoIndex");
|
||||
}
|
||||
|
||||
var builder = _indexManager.GetSearchIndexProvider().CreateSearchBuilder("Search");
|
||||
|
@@ -118,6 +118,9 @@
|
||||
<ItemGroup>
|
||||
<Content Include="Views\DefinitionTemplates\ContentPickerSearchFieldSettings.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\ContentPicker\NoIndex.cshtml" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
|
@@ -0,0 +1 @@
|
||||
@T("You need to enable a search index module.")
|
@@ -9,13 +9,13 @@
|
||||
<h1>@Html.TitleForPage(T("Search").Text)</h1>
|
||||
|
||||
@if (HasText(Model.Query)) {
|
||||
if (searchResults.Count() == 0) {
|
||||
if (!searchResults.Any()) {
|
||||
<p class="search-summary">@T.Plural("There is <em>one</em> result", "<em>zero</em> results", searchResults.Count())</p>
|
||||
} else {
|
||||
<p class="search-summary">@T.Plural("There is <em>one</em> result", "<em>{1} - {2}</em> of <em>{0}</em> results", Model.TotalItemCount, Model.StartPosition, Model.EndPosition)</p>
|
||||
}
|
||||
}
|
||||
@if (searchResults != null && searchResults.Count() > 0) {
|
||||
@if (searchResults != null && searchResults.Any()) {
|
||||
@Display(searchResults)
|
||||
@Display(Model.Pager)
|
||||
}
|
Reference in New Issue
Block a user