mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.Core.Common.Fields;
|
||||
using Orchard.Core.Common.ViewModels;
|
||||
|
||||
namespace Orchard.Core.Common.Drivers {
|
||||
[UsedImplicitly]
|
||||
public class TextContentFieldDriver : ContentFieldDriver<TextContentField> {
|
||||
public IOrchardServices Services { get; set; }
|
||||
private const string TemplateName = "Fields/Common.TextContentField";
|
||||
|
||||
public TextContentFieldDriver(IOrchardServices services) {
|
||||
Services = services;
|
||||
}
|
||||
|
||||
protected override string Prefix {
|
||||
get { return "TextContentField"; }
|
||||
}
|
||||
|
||||
protected override DriverResult Display(TextContentField field, string displayType) {
|
||||
var model = new TextContentFieldDisplayViewModel { Text = field };
|
||||
|
||||
return ContentFieldTemplate(model, TemplateName, Prefix);
|
||||
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(TextContentField field) {
|
||||
var model = BuildEditorViewModel(field);
|
||||
return ContentFieldTemplate(model, TemplateName, Prefix).Location("primary", "5");
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(TextContentField field, IUpdateModel updater) {
|
||||
var model = BuildEditorViewModel(field);
|
||||
updater.TryUpdateModel(model, Prefix, null, null);
|
||||
return ContentFieldTemplate(model, TemplateName, Prefix).Location("primary", "5");
|
||||
}
|
||||
|
||||
private static TextContentFieldEditorViewModel BuildEditorViewModel(TextContentField field) {
|
||||
return new TextContentFieldEditorViewModel {
|
||||
TextContentField = field
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
10
src/Orchard.Web/Core/Common/Fields/TextContentField.cs
Normal file
10
src/Orchard.Web/Core/Common/Fields/TextContentField.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using Orchard.ContentManagement;
|
||||
|
||||
namespace Orchard.Core.Common.Fields {
|
||||
public class TextContentField : ContentField {
|
||||
public string TextField {
|
||||
get { return Getter("text"); }
|
||||
set { Setter("text", value); }
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
|
||||
namespace Orchard.Core.Common.Handlers {
|
||||
public class TextContentFieldHandler : ContentFieldHandler {
|
||||
public TextContentFieldHandler(IEnumerable<IContentFieldDriver> contentFieldDrivers) : base(contentFieldDrivers) {}
|
||||
}
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
using Orchard.Core.Common.Fields;
|
||||
|
||||
namespace Orchard.Core.Common.ViewModels {
|
||||
public class TextContentFieldDisplayViewModel {
|
||||
public TextContentField Text { get; set; }
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Orchard.Core.Common.Fields;
|
||||
|
||||
namespace Orchard.Core.Common.ViewModels {
|
||||
public class TextContentFieldEditorViewModel {
|
||||
public TextContentField TextContentField { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Text {
|
||||
get { return TextContentField.TextField; }
|
||||
set { TextContentField.TextField = value; }
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<TextContentFieldDisplayViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Core.Common.ViewModels"%>
|
||||
<%=Model.Text %>
|
@@ -0,0 +1,7 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<TextContentFieldEditorViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Core.Common.ViewModels"%>
|
||||
<fieldset>
|
||||
<%: Html.LabelFor(m=>m.Text) %>
|
||||
<%: Html.EditorFor(m=>m.Text) %>
|
||||
<%: Html.ValidationMessageFor(m=>m.Text) %>
|
||||
</fieldset>
|
@@ -69,8 +69,13 @@
|
||||
<Compile Include="Common\Drivers\CommonDriver.cs" />
|
||||
<Compile Include="Common\Drivers\RoutableDriver.cs" />
|
||||
<Compile Include="Common\Controllers\RoutableController.cs" />
|
||||
<Compile Include="Common\Drivers\TextContentFieldDriver.cs" />
|
||||
<Compile Include="Common\Fields\TextContentField.cs" />
|
||||
<Compile Include="Common\Handlers\RoutableAspectHandler.cs" />
|
||||
<Compile Include="Common\Handlers\TextContentFieldHandler.cs" />
|
||||
<Compile Include="Common\ViewModels\ContainerEditorViewModel.cs" />
|
||||
<Compile Include="Common\ViewModels\TextContentFieldDisplayViewModel.cs" />
|
||||
<Compile Include="Common\ViewModels\TextContentFieldEditorViewModel.cs" />
|
||||
<Compile Include="Contents\Controllers\ItemController.cs" />
|
||||
<Compile Include="Contents\Handlers\ContentsModuleHandler.cs" />
|
||||
<Compile Include="Localization\Drivers\LocalizedDriver.cs" />
|
||||
@@ -207,7 +212,9 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Common\Module.txt" />
|
||||
<Content Include="Common\Views\DisplayTemplates\Fields\Common.TextContentField.ascx" />
|
||||
<Content Include="Common\Views\EditorTemplates\Parts\Common.Container.ascx" />
|
||||
<Content Include="Common\Views\EditorTemplates\Parts\Common.TextContentField.ascx" />
|
||||
<Content Include="Contents\Module.txt" />
|
||||
<Content Include="Contents\Views\Admin\Types.aspx" />
|
||||
<Content Include="Contents\Views\Admin\List.aspx" />
|
||||
|
@@ -1,9 +1,7 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ContentItemViewModel<Orchard.Pages.Models.Page>>" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.Html"%>
|
||||
<%@ Import Namespace="Orchard.ContentManagement"%>
|
||||
<%@ Import Namespace="Orchard.Core.Common.Models"%>
|
||||
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
|
||||
<h3><a href="<%=Url.Action(T("Item").ToString(), "Page", new { area = "Orchard.Pages", slug = Model.Item.Slug }) %>"><%: Model.Item.Title %></a></h3>
|
||||
<h3><a href="<%:Url.Action("Item", "Page", new { area = "Orchard.Pages", slug = Model.Item.Slug }) %>"><%: Model.Item.Title %></a></h3>
|
||||
<div class="content">
|
||||
<% Html.Zone("primary", ":manage :metadata"); %>
|
||||
</div>
|
@@ -1,16 +1,16 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Search.ViewModels.SearchIndexViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.Html" %><%
|
||||
Html.RegisterStyle("admin.css"); %>
|
||||
<h1><%=Html.TitleForPage(T("Search Index Management").ToString()) %></h1><%
|
||||
<h1><%:Html.TitleForPage(T("Search Index Management").ToString()) %></h1><%
|
||||
using (Html.BeginForm("update", "admin", FormMethod.Post, new {area = "Orchard.Search"})) { %>
|
||||
<fieldset>
|
||||
<p><%=T("The search index was last updated {0}. <button type=\"submit\" title=\"Update the search index.\" class=\"primaryAction\">Update</button>", Html.DateTimeRelative(Model.IndexUpdatedUtc, T))%></p>
|
||||
<%=Html.AntiForgeryTokenOrchard() %>
|
||||
<p><%:T("The search index was last updated {0}.", Html.DateTimeRelative(Model.IndexUpdatedUtc, T))%> <button type="submit" title="<%:T("Update the search index.") %>" class="primaryAction"><%:T("Update")%></button></p>
|
||||
<%:Html.AntiForgeryTokenOrchard() %>
|
||||
</fieldset><%
|
||||
}
|
||||
using (Html.BeginForm("rebuild", "admin", FormMethod.Post, new {area = "Orchard.Search"})) { %>
|
||||
<fieldset>
|
||||
<p><%=T("Rebuild the search index for a fresh start. <button type=\"submit\" title=\"Rebuild the search index.\">Rebuild</button>") %></p>
|
||||
<%=Html.AntiForgeryTokenOrchard() %>
|
||||
<p><%:T("Rebuild the search index for a fresh start.") %> <button type="submit" title="<%:T("Rebuild the search index.") %>"><%:T("Rebuild") %></button></p>
|
||||
<%:Html.AntiForgeryTokenOrchard() %>
|
||||
</fieldset><%
|
||||
} %>
|
@@ -1,14 +1,14 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Search.ViewModels.SearchViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.Html" %><%
|
||||
Html.RegisterStyle("search.css"); %>
|
||||
<h1><%=Html.TitleForPage(T("Search").Text)%></h1><%
|
||||
<h1><%:Html.TitleForPage(T("Search").Text)%></h1><%
|
||||
Html.Zone("search");
|
||||
if (!string.IsNullOrWhiteSpace(Model.Query)) {
|
||||
if (Model.PageOfResults.Count() == 0) { %>
|
||||
<p class="search-summary"><%=T("<em>zero</em> results") %></p><%
|
||||
<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("<em>{0} - {1}</em> of <em>{2}</em> results", Model.PageOfResults.StartPosition, Model.PageOfResults.EndPosition, Model.PageOfResults.TotalItemCount)%></p><%
|
||||
<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) { %>
|
||||
|
16
src/Orchard.Web/Modules/Orchard.Tags/AdminMenu.cs
Normal file
16
src/Orchard.Web/Modules/Orchard.Tags/AdminMenu.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Orchard.Localization;
|
||||
using Orchard.UI.Navigation;
|
||||
|
||||
namespace Orchard.Tags {
|
||||
public class AdminMenu : INavigationProvider {
|
||||
public Localizer T { get; set; }
|
||||
public string MenuName { get { return "admin"; } }
|
||||
|
||||
public void GetNavigation(NavigationBuilder builder) {
|
||||
builder.Add(T("Tags"), "3",
|
||||
menu => menu
|
||||
.Add(T("Manage Tags"), "1.0", item => item.Action("Index", "Admin", new { area = "Orchard.Tags" }).Permission(Permissions.ManageTags))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
@@ -65,6 +65,7 @@
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AdminMenu.cs" />
|
||||
<Compile Include="Controllers\AdminController.cs" />
|
||||
<Compile Include="Models\TagsContentItems.cs" />
|
||||
<Compile Include="Services\ITagService.cs" />
|
||||
|
@@ -15,11 +15,4 @@ namespace Orchard.ContentManagement {
|
||||
public Func<string, string> Getter { get; set; }
|
||||
public Action<string, string> Setter { get; set; }
|
||||
}
|
||||
|
||||
//public class AddressField : ContentField {
|
||||
// public string Zip {
|
||||
// get {return Getter("zip");}
|
||||
// set { Setter("zip", value); }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
@@ -54,15 +54,15 @@ namespace Orchard.ContentManagement.Drivers {
|
||||
protected virtual DriverResult Editor(TField field, IUpdateModel updater) { return null; }
|
||||
|
||||
|
||||
public ContentTemplateResult ContentPartTemplate(object model) {
|
||||
public ContentTemplateResult ContentFieldTemplate(object model) {
|
||||
return new ContentTemplateResult(model, null, Prefix).Location(Zone);
|
||||
}
|
||||
|
||||
public ContentTemplateResult ContentPartTemplate(object model, string template) {
|
||||
public ContentTemplateResult ContentFieldTemplate(object model, string template) {
|
||||
return new ContentTemplateResult(model, template, Prefix).Location(Zone);
|
||||
}
|
||||
|
||||
public ContentTemplateResult ContentPartTemplate(object model, string template, string prefix) {
|
||||
public ContentTemplateResult ContentFieldTemplate(object model, string template, string prefix) {
|
||||
return new ContentTemplateResult(model, template, prefix).Location(Zone);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user