mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-12-02 19:44:02 +08:00
Giving the TextField display template some markup around the value.
--HG-- branch : dev
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Orchard.Core.Common.Fields.TextField>" %>
|
||||
<%: Model.Value %>
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.Common.Fields.TextField>" %>
|
||||
<%@ Import Namespace="Orchard.Utility.Extensions" %>
|
||||
<p class="text-field"><span class="name"><%:Model.Name.CamelFriendly() %>:</span> <%:Model.Value %></p>
|
||||
@@ -1,22 +1,5 @@
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Orchard.ContentTypes.Extensions {
|
||||
namespace Orchard.ContentTypes.Extensions {
|
||||
public static class StrinExtensions {
|
||||
private static readonly Regex humps = new Regex("[A-Z][^A-Z]*");
|
||||
public static string CamelFriendly(this string camel) {
|
||||
if (camel == null)
|
||||
return null;
|
||||
|
||||
var matches = humps.Matches(camel).OfType<Match>().Select(m => m.Value);
|
||||
if (matches.Any()) {
|
||||
return matches.Aggregate((a, b) => a + " " + b).TrimStart(' ');
|
||||
}
|
||||
else {
|
||||
return camel;
|
||||
}
|
||||
}
|
||||
|
||||
public static string TrimEnd(this string rough, string trim = "") {
|
||||
if (rough == null)
|
||||
return null;
|
||||
|
||||
@@ -5,6 +5,7 @@ using Orchard.ContentManagement.MetaData.Models;
|
||||
using Orchard.ContentManagement.ViewModels;
|
||||
using Orchard.ContentTypes.Extensions;
|
||||
using Orchard.Mvc.ViewModels;
|
||||
using Orchard.Utility.Extensions;
|
||||
|
||||
namespace Orchard.ContentTypes.ViewModels {
|
||||
public class EditTypeViewModel : BaseViewModel {
|
||||
|
||||
@@ -800,6 +800,13 @@ table .button {
|
||||
}
|
||||
|
||||
|
||||
/* Fields
|
||||
----------------------------------------------------------*/
|
||||
/* TextField */
|
||||
#main .summary .text-field {
|
||||
margin:.5em 0;
|
||||
}
|
||||
|
||||
/* ---------- Generic ---------- */
|
||||
#main .breadcrumb {
|
||||
margin-top:-1.5em;
|
||||
|
||||
@@ -1,8 +1,20 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using Orchard.Localization;
|
||||
|
||||
namespace Orchard.Utility.Extensions {
|
||||
public static class StringExtensions {
|
||||
private static readonly Regex humps = new Regex("[A-Z][^A-Z]*");
|
||||
public static string CamelFriendly(this string camel) {
|
||||
if (camel == null)
|
||||
return null;
|
||||
|
||||
var matches = humps.Matches(camel).OfType<Match>().Select(m => m.Value);
|
||||
return matches.Any()
|
||||
? matches.Aggregate((a, b) => a + " " + b).TrimStart(' ')
|
||||
: camel;
|
||||
}
|
||||
|
||||
public static string Ellipsize(this string text, int characterCount) {
|
||||
return text.Ellipsize(characterCount, " …");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user