mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 19:04:51 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
@@ -5,8 +5,6 @@ using Orchard.Search.Services;
|
||||
using Orchard.Search.ViewModels;
|
||||
using Orchard.Settings;
|
||||
using Orchard.Search.Models;
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Collections;
|
||||
using Orchard.Themes;
|
||||
|
@@ -0,0 +1,13 @@
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.Search.Models;
|
||||
using Orchard.Search.ViewModels;
|
||||
|
||||
namespace Orchard.Search.Drivers {
|
||||
public class SearchFormPartDriver : ContentPartDriver<SearchFormPart> {
|
||||
|
||||
protected override DriverResult Display(SearchFormPart part, string displayType, dynamic shapeHelper) {
|
||||
var model = new SearchViewModel();
|
||||
return ContentPartTemplate(model, "Parts/Search.SearchForm");
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,23 +0,0 @@
|
||||
using System.Web.Mvc;
|
||||
using Orchard.Mvc.Filters;
|
||||
|
||||
namespace Orchard.Search.Filters {
|
||||
public class SearchFilter : FilterProvider, IResultFilter {
|
||||
private readonly IWorkContextAccessor _workContextAccessor;
|
||||
|
||||
public SearchFilter(IWorkContextAccessor workContextAccessor) {
|
||||
_workContextAccessor = workContextAccessor;
|
||||
}
|
||||
|
||||
public void OnResultExecuting(ResultExecutingContext filterContext) {
|
||||
dynamic search = filterContext.Controller.ViewData.Model;
|
||||
var workContext = _workContextAccessor.GetContext(filterContext);
|
||||
|
||||
if (search != null)
|
||||
workContext.Layout.Search.Add(search);
|
||||
}
|
||||
|
||||
public void OnResultExecuted(ResultExecutedContext filterContext) {
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,4 +1,5 @@
|
||||
using Orchard.Data.Migration;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.Data.Migration;
|
||||
|
||||
namespace Orchard.Search {
|
||||
public class SearchDataMigration : DataMigrationImpl {
|
||||
@@ -13,5 +14,17 @@ namespace Orchard.Search {
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int UpdateFrom1() {
|
||||
ContentDefinitionManager.AlterTypeDefinition("SearchForm",
|
||||
cfg => cfg
|
||||
.WithPart("SearchFormPart")
|
||||
.WithPart("CommonPart")
|
||||
.WithPart("WidgetPart")
|
||||
.WithSetting("Stereotype", "Widget")
|
||||
);
|
||||
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
using Orchard.ContentManagement;
|
||||
|
||||
namespace Orchard.Search.Models {
|
||||
/// <summary>
|
||||
/// Cotnent part for the search form widget
|
||||
/// </summary>
|
||||
public class SearchFormPart : ContentPart {
|
||||
}
|
||||
}
|
@@ -67,11 +67,12 @@
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Drivers\SearchFormPartDriver.cs" />
|
||||
<Compile Include="Models\SearchFormPart.cs" />
|
||||
<Compile Include="ResourceManifest.cs" />
|
||||
<Compile Include="Controllers\SearchController.cs" />
|
||||
<Compile Include="Migrations.cs" />
|
||||
<Compile Include="Drivers\SearchSettingsPartDriver.cs" />
|
||||
<Compile Include="Filters\SearchFilter.cs" />
|
||||
<Compile Include="Models\SearchSettingsPart.cs" />
|
||||
<Compile Include="Models\SearchSettingsPartRecord.cs" />
|
||||
<Compile Include="Routes.cs" />
|
||||
@@ -100,9 +101,12 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\EditorTemplates\Parts\Search.SiteSettings.cshtml" />
|
||||
<Content Include="Views\SearchForm.cshtml" />
|
||||
<Content Include="Views\EditorTemplates\Parts\Search.SearchForm.cshtml" />
|
||||
<Content Include="Views\Search\Index.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\DisplayTemplates\Parts\Search.SearchForm.cshtml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
@@ -1,5 +1,4 @@
|
||||
@model Orchard.Search.ViewModels.SearchViewModel
|
||||
@using Orchard.Search.ViewModels;
|
||||
|
||||
@using(Html.BeginForm("index", "search", new { area = "Orchard.Search" }, FormMethod.Get, new { @class = "search" })) {
|
||||
<fieldset>
|
@@ -0,0 +1 @@
|
||||
|
@@ -2,15 +2,22 @@
|
||||
@{ Style.Require("Search"); }
|
||||
|
||||
<h1>@Html.TitleForPage(T("Search").Text)</h1>
|
||||
@Html.Zone("search")
|
||||
|
||||
@using(Html.BeginForm("index", "search", new { area = "Orchard.Search" }, FormMethod.Get, new { @class = "search" })) {
|
||||
<fieldset>
|
||||
@Html.TextBox("q", Model.Query)
|
||||
<button type="submit">@T("Search")</button>
|
||||
</fieldset>
|
||||
}
|
||||
|
||||
@if (!string.IsNullOrWhiteSpace(Model.Query)) {
|
||||
@if (Model.PageOfResults.Count() == 0) {
|
||||
if (Model.PageOfResults.Count() == 0) {
|
||||
<p class="search-summary">@T.Plural("the <em>one</em> result", "<em>zero</em> results", Model.PageOfResults.Count())</p>
|
||||
} else {
|
||||
<p class="search-summary">@T.Plural("the <em>one</em> result", "<em>{1} - {2}</em> of <em>{0}</em> results", Model.PageOfResults.TotalItemCount, Model.PageOfResults.StartPosition, Model.PageOfResults.EndPosition)</p>
|
||||
}
|
||||
}
|
||||
@if (Model.PageOfResults != null && Model.PageOfResults.Count() > 0) {
|
||||
@Html.UnorderedList(Model.PageOfResults.Where(hit => hit.Content != null), (r, i) => Html.DisplayForItem(r.Content), "search-results contentItems")
|
||||
@Html.Pager(Model.PageOfResults, Model.PageOfResults.PageNumber, Model.DefaultPageSize, new {q = Model.Query})
|
||||
@Html.UnorderedList(Model.PageOfResults.Where(hit => hit.Content != null), (r, i) => Display(r.Content), "search-results contentItems")
|
||||
@Html.Pager(Model.PageOfResults, Model.PageOfResults.PageNumber, Model.DefaultPageSize, new {q = Model.Query})
|
||||
}
|
@@ -142,14 +142,7 @@
|
||||
<Content Include="Themes\TheThemeMachine\Theme.txt" />
|
||||
<None Include="Themes\Classic\App_Data\Localization\fr-FR\orchard.theme.po" />
|
||||
<None Include="Themes\TheThemeMachine\Views\AsideThird.cshtml" />
|
||||
<None Include="Themes\TheThemeMachine\Views\Recent.cshtml">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Themes\TheThemeMachine\Views\Featured.cshtml">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Themes\TheThemeMachine\Views\_Document.cshtml" />
|
||||
<None Include="Themes\TheThemeMachine\Views\Content.cshtml" />
|
||||
<Content Include="Web.config">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
|
@@ -298,9 +298,7 @@ button:hover, .button:hover,
|
||||
button:active, .button:active,
|
||||
button:focus, .button:focus {
|
||||
text-decoration:none;
|
||||
background: #ffac40;
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(#ffac40), to(#f06015));
|
||||
background: -moz-linear-gradient(top, #ffac40, #f9760d);
|
||||
background: #ebebeb;
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(#e1e1e1), to(#ebebeb));
|
||||
background:-moz-linear-gradient(top , #e1e1e1, #ebebeb);
|
||||
}
|
||||
@@ -311,20 +309,35 @@ button:focus, .button:focus {
|
||||
|
||||
/* For testing purposes */
|
||||
#comments {
|
||||
font-size:1.6em;
|
||||
font-weight:600;
|
||||
margin:1.2em 0 1.2em 1.2em;
|
||||
margin:1.2em 0 1.8em 1.2em;
|
||||
}
|
||||
|
||||
ul.comments, form.comment {
|
||||
margin:1.2em 0 1.2em 1.2em;
|
||||
margin:1.2em 0 1.2em 1.8em;
|
||||
}
|
||||
|
||||
div.comment span {
|
||||
div.comment {
|
||||
font-size:1.3em;
|
||||
font-style:italic;
|
||||
color:#484848;
|
||||
}
|
||||
|
||||
div.comment a {
|
||||
color:#484848;
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
div.comment span.who {
|
||||
font-weight:600;
|
||||
font-style:normal;
|
||||
text-transform:capitalize;
|
||||
color:#333;
|
||||
}
|
||||
|
||||
ul.comments li div.text {
|
||||
margin:.6em 0;
|
||||
margin:.6em 0 2.4em 0;
|
||||
}
|
||||
|
||||
.user-display {
|
||||
|
Reference in New Issue
Block a user