mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-22 20:13:50 +08:00
Adding the page title separator to site settings
--HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4044450
This commit is contained in:
@@ -4,8 +4,12 @@ using Orchard.Settings;
|
||||
|
||||
namespace Orchard.Core.Settings.Models {
|
||||
public sealed class SiteSettings : ContentPart<SiteSettingsRecord>, ISite {
|
||||
public static readonly ContentType ContentType = new ContentType{Name="site", DisplayName="Site Settings"};
|
||||
public static readonly ContentType ContentType = new ContentType { Name = "site", DisplayName = "Site Settings" };
|
||||
|
||||
public string PageTitleSeparator {
|
||||
get { return Record.PageTitleSeparator; }
|
||||
set { Record.PageTitleSeparator = value; }
|
||||
}
|
||||
public string SiteName {
|
||||
get { return Record.SiteName; }
|
||||
set { Record.SiteName = value; }
|
||||
|
@@ -5,5 +5,6 @@ namespace Orchard.Core.Settings.Records {
|
||||
public virtual string SiteUrl { get; set; }
|
||||
public virtual string SiteName { get; set; }
|
||||
public virtual string SuperUser { get; set; }
|
||||
public virtual string PageTitleSeparator { get; set; }
|
||||
}
|
||||
}
|
@@ -27,7 +27,9 @@ namespace Orchard.Core.Settings.Services {
|
||||
SiteSettingsRecord record = _siteSettingsRepository.Fetch(x => x.SiteUrl == applicationName).FirstOrDefault();
|
||||
if (record == null) {
|
||||
ISite site = _contentManager.Create<SiteSettings>("site", item => {
|
||||
item.Record.SiteName = "My Orchard Project Application";
|
||||
item.Record.SiteUrl = applicationName;
|
||||
item.Record.PageTitleSeparator = " - ";
|
||||
});
|
||||
return site;
|
||||
}
|
||||
|
@@ -15,7 +15,14 @@ namespace Orchard.Core.Settings.ViewModels {
|
||||
get { return Site.ContentItem.Id; }
|
||||
}
|
||||
|
||||
public string SiteName {
|
||||
public string PageTitleSeparator
|
||||
{
|
||||
get { return Site.As<SiteSettings>().Record.PageTitleSeparator; }
|
||||
set { Site.As<SiteSettings>().Record.PageTitleSeparator = value; }
|
||||
}
|
||||
|
||||
public string SiteName
|
||||
{
|
||||
get { return Site.As<SiteSettings>().Record.SiteName; }
|
||||
set { Site.As<SiteSettings>().Record.SiteName = value; }
|
||||
}
|
||||
|
@@ -1,8 +1,6 @@
|
||||
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<Orchard.Core.Settings.ViewModels.SettingsIndexViewModel>" %>
|
||||
|
||||
<%@ Import Namespace="Orchard.Mvc.Html" %>
|
||||
<h2>
|
||||
Edit Settings</h2>
|
||||
<h2>Edit Settings</h2>
|
||||
<%using (Html.BeginForm()) { %>
|
||||
<%= Html.ValidationSummary() %>
|
||||
<fieldset>
|
||||
@@ -12,6 +10,11 @@
|
||||
<%=Html.EditorFor(x=>x.SiteName) %>
|
||||
<%=Html.ValidationMessage("SiteName", "*") %>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<%=Html.LabelFor(x => x.PageTitleSeparator) %>
|
||||
<%=Html.EditorFor(x => x.PageTitleSeparator)%>
|
||||
<%=Html.ValidationMessage("PageTitleSeparator", "*")%>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<%=Html.LabelFor(x => x.SuperUser) %>
|
||||
<%=Html.EditorFor(x=>x.SuperUser) %>
|
||||
@@ -19,8 +22,9 @@
|
||||
</fieldset>
|
||||
<%=Html.EditorFor(s=>s.Id) %>
|
||||
</fieldset>
|
||||
<% foreach (var e in Model.EditorModel.Editors) { %>
|
||||
<%=Html.EditorFor(m => e.Model, e.TemplateName, e.Prefix)%>
|
||||
<% foreach (var e in Model.EditorModel.Editors) {
|
||||
var editor = e;
|
||||
%><%=Html.EditorFor(m => editor.Model, editor.TemplateName, editor.Prefix)%>
|
||||
<% } %>
|
||||
<fieldset>
|
||||
<input class="button" type="submit" value="Save" />
|
||||
|
@@ -3,7 +3,8 @@ using Orchard.Settings;
|
||||
|
||||
namespace Orchard.Mvc.Html {
|
||||
public static class SiteServiceExtensions {
|
||||
public static string SiteName(this HtmlHelper html) {
|
||||
public static string SiteName(this HtmlHelper html)
|
||||
{
|
||||
return html.Resolve<ISiteService>().GetSiteSettings().SiteName;
|
||||
}
|
||||
}
|
||||
|
@@ -5,6 +5,7 @@ namespace Orchard.Settings {
|
||||
/// Interface provided by the "settings" model.
|
||||
/// </summary>
|
||||
public interface ISite : IContent {
|
||||
string PageTitleSeparator { get; }
|
||||
string SiteName { get; }
|
||||
string SuperUser { get; }
|
||||
}
|
||||
|
@@ -1,15 +1,18 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Orchard.Settings;
|
||||
|
||||
namespace Orchard.UI.PageTitle {
|
||||
public class PageTitleBuilder : IPageTitleBuilder {
|
||||
private readonly ISiteService _siteService;
|
||||
private readonly List<string> _titleParts;
|
||||
private readonly string _titleSeparator;
|
||||
|
||||
public PageTitleBuilder() {
|
||||
public PageTitleBuilder(ISiteService siteService) {
|
||||
_siteService = siteService;
|
||||
_titleParts = new List<string>(5);
|
||||
//TODO: (erikpo) Get this from a site setting
|
||||
_titleSeparator = " - ";
|
||||
_titleSeparator = _siteService.GetSiteSettings().PageTitleSeparator;
|
||||
}
|
||||
|
||||
public void AddTitleParts(params string[] titleParts) {
|
||||
|
Reference in New Issue
Block a user