mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 10:54:50 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.Common.Settings.BodyPartSettings>" %>
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.Common.Settings.BodyPartSettings>" %>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<label for="<%:Html.FieldIdFor(m => m.FlavorDefault) %>"><%:T("Default flavor") %></label>
|
<label for="<%:Html.FieldIdFor(m => m.FlavorDefault) %>"><%:T("Default flavor") %></label>
|
||||||
<%:Html.EditorFor(m => m.FlavorDefault)%>
|
<%:Html.EditorFor(m => m.FlavorDefault)%>
|
||||||
<%:Html.ValidationMessageFor(m => m.FlavorDefault)%>
|
<%:Html.ValidationMessageFor(m => m.FlavorDefault)%>
|
||||||
</fieldset>
|
</fieldset>
|
@@ -1,6 +1,6 @@
|
|||||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.Common.Settings.BodyTypePartSettings>" %>
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.Common.Settings.BodyTypePartSettings>" %>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<label for="<%:Html.FieldIdFor(m => m.Flavor) %>"><%:T("Flavor") %></label>
|
<label for="<%:Html.FieldIdFor(m => m.Flavor) %>"><%:T("Flavor") %></label>
|
||||||
<%:Html.EditorFor(m => m.Flavor) %>
|
<%:Html.EditorFor(m => m.Flavor) %>
|
||||||
<%:Html.ValidationMessageFor(m => m.Flavor) %>
|
<%:Html.ValidationMessageFor(m => m.Flavor) %>
|
||||||
</fieldset>
|
</fieldset>
|
@@ -1,6 +1,5 @@
|
|||||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.Common.Fields.TextField>" %>
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.Common.Fields.TextField>" %>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<label for="<%:Html.FieldIdFor(m=>m.Value) %>"><%:Model.Name %></label>
|
<label for="<%:Html.FieldIdFor(m=>m.Value) %>"><%:Model.Name %></label>
|
||||||
<%: Html.EditorFor(m=>m.Value) %>
|
<%:Html.EditorFor(m=>m.Value) %><%:Html.ValidationMessageFor(m=>m.Value) %>
|
||||||
<%: Html.ValidationMessageFor(m=>m.Value) %>
|
</fieldset>
|
||||||
</fieldset>
|
|
@@ -238,6 +238,46 @@ namespace Orchard.ContentTypes.Controllers {
|
|||||||
return RedirectToAction("Edit", new {id});
|
return RedirectToAction("Edit", new {id});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActionResult RemovePartFrom(string id) {
|
||||||
|
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a content type.")))
|
||||||
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
|
var contentTypeDefinition = _contentDefinitionService.GetTypeDefinition(id);
|
||||||
|
|
||||||
|
var viewModel = new RemovePartViewModel();
|
||||||
|
if (contentTypeDefinition == null
|
||||||
|
|| !TryUpdateModel(viewModel)
|
||||||
|
|| !contentTypeDefinition.Parts.Any(p => p.PartDefinition.Name == viewModel.Name))
|
||||||
|
return new NotFoundResult();
|
||||||
|
|
||||||
|
viewModel.Type = new EditTypeViewModel { Name = contentTypeDefinition.Name, DisplayName = contentTypeDefinition.DisplayName };
|
||||||
|
return View(viewModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost, ActionName("RemovePartFrom")]
|
||||||
|
public ActionResult RemovePartFromPOST(string id) {
|
||||||
|
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a content type.")))
|
||||||
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
|
var contentTypeDefinition = _contentDefinitionService.GetTypeDefinition(id);
|
||||||
|
|
||||||
|
var viewModel = new RemovePartViewModel();
|
||||||
|
if (contentTypeDefinition == null
|
||||||
|
|| !TryUpdateModel(viewModel)
|
||||||
|
|| !contentTypeDefinition.Parts.Any(p => p.PartDefinition.Name == viewModel.Name))
|
||||||
|
return new NotFoundResult();
|
||||||
|
|
||||||
|
if (!ModelState.IsValid) {
|
||||||
|
viewModel.Type = new EditTypeViewModel { Name = contentTypeDefinition.Name, DisplayName = contentTypeDefinition.DisplayName };
|
||||||
|
return View(viewModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
_contentDefinitionManager.AlterTypeDefinition(id, typeBuilder => typeBuilder.RemovePart(viewModel.Name));
|
||||||
|
Services.Notifier.Information(T("The \"{0}\" part has been removed.", viewModel.Name));
|
||||||
|
|
||||||
|
return RedirectToAction("Edit", new {id});
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Parts
|
#region Parts
|
||||||
|
@@ -77,6 +77,7 @@
|
|||||||
<Compile Include="Services\ContentDefinitionService.cs" />
|
<Compile Include="Services\ContentDefinitionService.cs" />
|
||||||
<Compile Include="Services\IContentDefinitionService.cs" />
|
<Compile Include="Services\IContentDefinitionService.cs" />
|
||||||
<Compile Include="ViewModels\AddFieldViewModel.cs" />
|
<Compile Include="ViewModels\AddFieldViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\RemovePartViewModel.cs" />
|
||||||
<Compile Include="ViewModels\CreateTypeViewModel.cs" />
|
<Compile Include="ViewModels\CreateTypeViewModel.cs" />
|
||||||
<Compile Include="ViewModels\EditTypeViewModel.cs" />
|
<Compile Include="ViewModels\EditTypeViewModel.cs" />
|
||||||
<Compile Include="ViewModels\ListContentsViewModel.cs" />
|
<Compile Include="ViewModels\ListContentsViewModel.cs" />
|
||||||
@@ -87,6 +88,7 @@
|
|||||||
<Content Include="Styles\admin.css" />
|
<Content Include="Styles\admin.css" />
|
||||||
<Content Include="Views\Admin\AddFieldTo.ascx" />
|
<Content Include="Views\Admin\AddFieldTo.ascx" />
|
||||||
<Content Include="Views\Admin\AddPartsTo.ascx" />
|
<Content Include="Views\Admin\AddPartsTo.ascx" />
|
||||||
|
<Content Include="Views\Admin\RemovePartFrom.ascx" />
|
||||||
<Content Include="Views\Admin\Create.ascx" />
|
<Content Include="Views\Admin\Create.ascx" />
|
||||||
<Content Include="Views\Admin\EditPart.ascx" />
|
<Content Include="Views\Admin\EditPart.ascx" />
|
||||||
<Content Include="Views\Admin\Edit.ascx" />
|
<Content Include="Views\Admin\Edit.ascx" />
|
||||||
|
@@ -32,11 +32,11 @@ namespace Orchard.ContentTypes.ViewModels {
|
|||||||
|
|
||||||
return implicitTypePart == null
|
return implicitTypePart == null
|
||||||
? Enumerable.Empty<EditPartFieldViewModel>()
|
? Enumerable.Empty<EditPartFieldViewModel>()
|
||||||
: implicitTypePart.PartDefinition.Fields.Select(f => new EditPartFieldViewModel(f));
|
: implicitTypePart.PartDefinition.Fields.Select(f => new EditPartFieldViewModel(f) { Part = new EditPartViewModel(implicitTypePart.PartDefinition) });
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<EditTypePartViewModel> GetTypeParts(ContentTypeDefinition contentTypeDefinition) {
|
private IEnumerable<EditTypePartViewModel> GetTypeParts(ContentTypeDefinition contentTypeDefinition) {
|
||||||
return contentTypeDefinition.Parts.Where(p => p.PartDefinition.Name != Name).Select(p => new EditTypePartViewModel(p));
|
return contentTypeDefinition.Parts.Where(p => p.PartDefinition.Name != Name).Select(p => new EditTypePartViewModel(p) { Type = this });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,6 +49,7 @@ namespace Orchard.ContentTypes.ViewModels {
|
|||||||
Settings = part.Settings;
|
Settings = part.Settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EditTypeViewModel Type { get; set; }
|
||||||
public EditPartViewModel PartDefinition { get; set; }
|
public EditPartViewModel PartDefinition { get; set; }
|
||||||
public SettingsDictionary Settings { get; set; }
|
public SettingsDictionary Settings { get; set; }
|
||||||
public IEnumerable<TemplateViewModel> Templates { get; set; }
|
public IEnumerable<TemplateViewModel> Templates { get; set; }
|
||||||
@@ -61,7 +62,7 @@ namespace Orchard.ContentTypes.ViewModels {
|
|||||||
}
|
}
|
||||||
public EditPartViewModel(ContentPartDefinition contentPartDefinition) {
|
public EditPartViewModel(ContentPartDefinition contentPartDefinition) {
|
||||||
Name = contentPartDefinition.Name;
|
Name = contentPartDefinition.Name;
|
||||||
Fields = contentPartDefinition.Fields.Select(f => new EditPartFieldViewModel(f));
|
Fields = contentPartDefinition.Fields.Select(f => new EditPartFieldViewModel(f) { Part = this });
|
||||||
Settings = contentPartDefinition.Settings;
|
Settings = contentPartDefinition.Settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,6 +82,7 @@ namespace Orchard.ContentTypes.ViewModels {
|
|||||||
Settings = field.Settings;
|
Settings = field.Settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EditPartViewModel Part { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public IEnumerable<TemplateViewModel> Templates { get; set; }
|
public IEnumerable<TemplateViewModel> Templates { get; set; }
|
||||||
public EditFieldViewModel FieldDefinition { get; set; }
|
public EditFieldViewModel FieldDefinition { get; set; }
|
||||||
|
@@ -0,0 +1,8 @@
|
|||||||
|
using Orchard.Mvc.ViewModels;
|
||||||
|
|
||||||
|
namespace Orchard.ContentTypes.ViewModels {
|
||||||
|
public class RemovePartViewModel : BaseViewModel {
|
||||||
|
public string Name { get; set; }
|
||||||
|
public EditTypeViewModel Type { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@@ -1,25 +1,30 @@
|
|||||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.ContentTypes.ViewModels.EditTypeViewModel>" %>
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.ContentTypes.ViewModels.EditTypeViewModel>" %>
|
||||||
<% Html.RegisterStyle("admin.css"); %>
|
<% Html.RegisterStyle("admin.css");
|
||||||
<h1><%:Html.TitleForPage(T("Edit Content Type").ToString())%></h1>
|
%><h1><%:Html.TitleForPage(T("Edit Content Type").ToString())%></h1>
|
||||||
<p class="breadcrumb"><%:Html.ActionLink(T("Content Types").Text, "index") %><%:T(" > ") %><%:T("Edit Content Type") %></p><%
|
<p class="breadcrumb"><%:Html.ActionLink(T("Content Types").Text, "index") %><%:T(" > ") %><%:T("Edit Content Type") %></p><%
|
||||||
using (Html.BeginFormAntiForgeryPost()) { %>
|
using (Html.BeginFormAntiForgeryPost()) { %>
|
||||||
<%:Html.ValidationSummary() %>
|
<%--//todo: come up with real itemtype definitions and locations for said definitions--%>
|
||||||
|
<div itemscope itemid="<%:Model.Name %>" itemtype="http://orchardproject.net/data/ContentType"><%:Html.ValidationSummary() %>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<label for="DisplayName"><%:T("Display Name") %></label>
|
<label for="DisplayName"><%:T("Display Name") %></label>
|
||||||
<%:Html.TextBoxFor(m => m.DisplayName, new {@class = "textMedium"}) %>
|
<%:Html.TextBoxFor(m => m.DisplayName, new { @class = "textMedium" })%>
|
||||||
<%--// has unintended consequences (renamging the type) - changing the name creates a new type of that name--%>
|
<%--// todo: if we continue to go down the midrodata route, some helpers would be nice--%>
|
||||||
<label for="Name"><%:T("Name") %></label>
|
<meta itemprop="DisplayName" content="<%:Model.DisplayName %>" /><%--
|
||||||
<%:Html.TextBoxFor(m => m.Name, new {@class = "textMedium", disabled = "disabled"}) %>
|
// has unintended consequences (renamging the type) - changing the name creates a new type of that name--%>
|
||||||
|
<label for="Name" itemprop="name"><%:T("Name") %></label>
|
||||||
|
<%:Html.TextBoxFor(m => m.Name, new { @class = "textMedium", disabled = "disabled" })%>
|
||||||
|
<meta itemprop="Name" content="<%:Model.Name %>" />
|
||||||
<%:Html.HiddenFor(m => m.Name) %>
|
<%:Html.HiddenFor(m => m.Name) %>
|
||||||
</fieldset>
|
</fieldset><%
|
||||||
<% Html.RenderTemplates(Model.Templates); %>
|
Html.RenderTemplates(Model.Templates); %>
|
||||||
<h2><%:T("Parts") %></h2>
|
<h2><%:T("Parts") %></h2>
|
||||||
<div class="manage add-to-type"><%: Html.ActionLink(T("Add").Text, "AddPartsTo", new { area = "Orchard.ContentTypes", id = Model.Name }, new { @class = "button" })%></div>
|
<div class="manage add-to-type"><%: Html.ActionLink(T("Add").Text, "AddPartsTo", new { area = "Orchard.ContentTypes", id = Model.Name }, new { @class = "button" })%></div><%:
|
||||||
<%:Html.EditorFor(m => m.Parts, "Parts", "") %>
|
Html.EditorFor(m => m.Parts, "Parts", "") %>
|
||||||
<h2><%:T("Fields") %></h2>
|
<h2><%:T("Fields") %></h2>
|
||||||
<div class="manage add-to-type"><%: Html.ActionLink(T("Add").Text, "AddFieldTo", new { area = "Orchard.ContentTypes", id = Model.Name }, new { @class = "button" }) %></div>
|
<div class="manage add-to-type"><%: Html.ActionLink(T("Add").Text, "AddFieldTo", new { area = "Orchard.ContentTypes", id = Model.Name }, new { @class = "button" }) %></div><%:
|
||||||
<%:Html.EditorFor(m => m.Fields, "Fields", "") %>
|
Html.EditorFor(m => m.Fields, "Fields", "") %>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<button class="primaryAction" type="submit"><%:T("Save") %></button>
|
<button class="primaryAction" type="submit"><%:T("Save") %></button>
|
||||||
</fieldset><%
|
</fieldset>
|
||||||
|
</div><%
|
||||||
} %>
|
} %>
|
@@ -0,0 +1,11 @@
|
|||||||
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.ContentTypes.ViewModels.RemovePartViewModel>" %>
|
||||||
|
<%
|
||||||
|
Html.RegisterStyle("admin.css"); %>
|
||||||
|
<h1><%:Html.TitleForPage(T("Remove the \"{0}\" part from \"{1}\"", Model.Name, Model.Type.DisplayName).ToString())%></h1><%
|
||||||
|
using (Html.BeginFormAntiForgeryPost()) { %>
|
||||||
|
<p><%:T("Looks like you couldn't use the fancy way to remove the part. Try hitting the button below to force the issue.") %></p>
|
||||||
|
<fieldset>
|
||||||
|
<%=Html.HiddenFor(m => m.Name) %>
|
||||||
|
<button class="primaryAction" type="submit"><%:T("Remove") %></button>
|
||||||
|
</fieldset><%
|
||||||
|
} %>
|
@@ -1,8 +1,11 @@
|
|||||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<SettingsDictionary>" %>
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<SettingsDictionary>" %>
|
||||||
<%@ import Namespace="Orchard.ContentManagement.MetaData.Models" %>
|
<%@ import Namespace="Orchard.ContentManagement.MetaData.Models" %>
|
||||||
<dl><%
|
<%
|
||||||
foreach (var setting in Model) { %>
|
if (Model.Any()) { %>
|
||||||
<dt><%:setting.Key %></dt>
|
<dl><%
|
||||||
<dd><%:setting.Value %></dd><%
|
foreach (var setting in Model) { %>
|
||||||
} %>
|
<dt><%:setting.Key %></dt>
|
||||||
</dl>
|
<dd><%:setting.Value %></dd><%
|
||||||
|
} %>
|
||||||
|
</dl><%
|
||||||
|
} %>
|
@@ -2,15 +2,8 @@
|
|||||||
<fieldset class="manage-field">
|
<fieldset class="manage-field">
|
||||||
<h3><%:Model.Name %> <span>(<%:Model.FieldDefinition.Name %>)</span></h3>
|
<h3><%:Model.Name %> <span>(<%:Model.FieldDefinition.Name %>)</span></h3>
|
||||||
<div class="manage">
|
<div class="manage">
|
||||||
<%--// these inline forms can't be here. should probably have some JavaScript in here to build up the forms and add the "remove" link.
|
|
||||||
// get the antiforgery token from the edit type form and mark up the part in a semantic way so I can get some info from the DOM --%>
|
|
||||||
<%:Html.Link("[remove]", "#forshowonlyandnotintendedtowork!") %>
|
<%:Html.Link("[remove]", "#forshowonlyandnotintendedtowork!") %>
|
||||||
<%-- <% using (Html.BeginFormAntiForgeryPost(Url.Action("RemovePart", new { area = "Orchard.ContentTypes" }), FormMethod.Post, new {@class = "inline link"})) { %>
|
</div><%
|
||||||
<%:Html.Hidden("name", Model.PartDefinition.Name, new { id = "" }) %>
|
Html.RenderTemplates(Model.Templates); %>
|
||||||
<button type="submit" title="<%:T("Remove") %>"><%:T("Remove") %></button>
|
<%:Html.HiddenFor(m => m.Name) %><%:Html.HiddenFor(m => m.FieldDefinition.Name) %>
|
||||||
<% } %> --%>
|
|
||||||
</div>
|
|
||||||
<% Html.RenderTemplates(Model.Templates); %>
|
|
||||||
<%:Html.HiddenFor(m => m.Name) %>
|
|
||||||
<%:Html.HiddenFor(m => m.FieldDefinition.Name) %>
|
|
||||||
</fieldset>
|
</fieldset>
|
@@ -1,20 +1,13 @@
|
|||||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.ContentTypes.ViewModels.EditTypePartViewModel>" %>
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.ContentTypes.ViewModels.EditTypePartViewModel>" %>
|
||||||
<fieldset class="manage-part">
|
<fieldset class="manage-part" itemscope itemid="<%:Model.PartDefinition.Name %>" itemtype="http://orchardproject.net/data/ContentTypePart">
|
||||||
<h3><%:Model.PartDefinition.Name %></h3>
|
<h3 itemprop="Name"><%:Model.PartDefinition.Name %></h3>
|
||||||
<div class="manage">
|
<div class="manage">
|
||||||
<%--// these inline forms can't be here. should probably have some JavaScript in here to build up the forms and add the "remove" link.
|
<%:Html.ActionLink(T("Remove").Text, "RemovePartFrom", new { area = "Orchard.ContentTypes", id = Model.Type.Name, Model.PartDefinition.Name }, new { itemprop = "RemoveUrl UnsafeUrl" })%><%--// <- some experimentation--%>
|
||||||
// get the antiforgery token from the edit type form and mark up the part in a semantic way so I can get some info from the DOM --%>
|
</div><%
|
||||||
<%:Html.Link("[remove]", "#forshowonlyandnotintendedtowork") %>
|
Html.RenderTemplates(Model.Templates); %>
|
||||||
<%-- <% using (Html.BeginFormAntiForgeryPost(Url.Action("RemovePart", new { area = "Contents" }), FormMethod.Post, new {@class = "inline link"})) { %>
|
|
||||||
<%:Html.Hidden("name", Model.PartDefinition.Name, new { id = "" }) %>
|
|
||||||
<button type="submit" title="<%:T("Remove") %>"><%:T("Remove") %></button>
|
|
||||||
<% } %> --%>
|
|
||||||
</div>
|
|
||||||
<% Html.RenderTemplates(Model.Templates); %>
|
|
||||||
|
|
||||||
<h4><%:T("Global configuration") %></h4>
|
<h4><%:T("Global configuration") %></h4>
|
||||||
<div class="manage minor"><%:Html.ActionLink(T("Edit").Text, "EditPart", new { area = "Orchard.ContentTypes", id = Model.PartDefinition.Name }) %></div>
|
<div class="manage minor"><%:Html.ActionLink(T("Edit").Text, "EditPart", new { area = "Orchard.ContentTypes", id = Model.PartDefinition.Name }) %></div>
|
||||||
<%:Html.DisplayFor(m => m.PartDefinition.Settings, "Settings", "PartDefinition") %>
|
<%:Html.DisplayFor(m => m.PartDefinition.Settings, "Settings", "PartDefinition")
|
||||||
<%:Html.EditorFor(m => m.PartDefinition.Fields, "Fields", "PartDefinition") %>
|
%><%:Html.EditorFor(m => m.PartDefinition.Fields, "Fields", "PartDefinition")
|
||||||
<%:Html.Hidden("PartDefinition.Name", Model.PartDefinition.Name) %>
|
%><%:Html.Hidden("PartDefinition.Name", Model.PartDefinition.Name) %>
|
||||||
</fieldset>
|
</fieldset>
|
@@ -1,5 +1,6 @@
|
|||||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<SettingsDictionary>" %>
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<SettingsDictionary>" %>
|
||||||
<%@ import Namespace="Orchard.ContentManagement.MetaData.Models" %><%
|
<%@ import Namespace="Orchard.ContentManagement.MetaData.Models" %>
|
||||||
|
<%
|
||||||
if (Model.Any()) { %>
|
if (Model.Any()) { %>
|
||||||
<fieldset><%
|
<fieldset><%
|
||||||
var si = 0;
|
var si = 0;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Indexing.Settings.FieldIndexing>" %>
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Indexing.Settings.FieldIndexing>" %>
|
||||||
<%@ Import Namespace="Orchard.Mvc.Html" %>
|
<%@ Import Namespace="Orchard.Mvc.Html" %>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<%:Html.EditorFor(m=>m.Included) %>
|
<%:Html.EditorFor(m=>m.Included) %>
|
||||||
<label for="<%:Html.FieldIdFor(m => m.Included) %>" class="forcheckbox"><%:T("Include in the index") %></label>
|
<label for="<%:Html.FieldIdFor(m => m.Included) %>" class="forcheckbox"><%:T("Include in the index") %></label><%:
|
||||||
<%:Html.ValidationMessageFor(m => m.Included)%>
|
Html.ValidationMessageFor(m => m.Included)%>
|
||||||
</fieldset>
|
</fieldset>
|
@@ -1,7 +1,7 @@
|
|||||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Indexing.Settings.TypeIndexing>" %>
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Indexing.Settings.TypeIndexing>" %>
|
||||||
<%@ Import Namespace="Orchard.Mvc.Html" %>
|
<%@ Import Namespace="Orchard.Mvc.Html" %>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<%:Html.EditorFor(m=>m.Included) %>
|
<%:Html.EditorFor(m=>m.Included) %>
|
||||||
<label for="<%:Html.FieldIdFor(m => m.Included) %>" class="forcheckbox"><%:T("Index this content type for search") %></label>
|
<label for="<%:Html.FieldIdFor(m => m.Included) %>" class="forcheckbox"><%:T("Index this content type for search") %></label><%:
|
||||||
<%:Html.ValidationMessageFor(m=>m.Included) %>
|
Html.ValidationMessageFor(m=>m.Included) %>
|
||||||
</fieldset>
|
</fieldset>
|
@@ -15,7 +15,7 @@
|
|||||||
<p><%: module.Description %></p><%
|
<p><%: module.Description %></p><%
|
||||||
} %>
|
} %>
|
||||||
<ul class="pageStatus" style="color:#666; margin:.6em 0 0 0;">
|
<ul class="pageStatus" style="color:#666; margin:.6em 0 0 0;">
|
||||||
<li><%: T("Features: {0}", string.Join(", ", module.Features.Select(f => Html.Link(f.Name, string.Format("{0}#{1}", Url.Action("features", new { area = "Orchard.Modules" }), f.Name.AsFeatureId(n => T(n)))).ToString()).OrderBy(s => s).ToArray())) %></li>
|
<li><%:T("Features: {0}", MvcHtmlString.Create(string.Join(", ", module.Features.Select(f => Html.Link(f.Name, string.Format("{0}#{1}", Url.Action("features", new { area = "Orchard.Modules" }), f.Name.AsFeatureId(n => T(n)))).ToString()).OrderBy(s => s).ToArray()))) %></li>
|
||||||
<li> | <%: T("Author: {0}", !string.IsNullOrEmpty(module.Author) ? module.Author : (new []{"Bradley", "Bertrand", "Renaud", "Suha", "Sebastien", "Jon", "Nathan", "Erik"})[(module.DisplayName.Length + (new Random()).Next()) % 7]) %></li><%-- very efficient, I know --%>
|
<li> | <%: T("Author: {0}", !string.IsNullOrEmpty(module.Author) ? module.Author : (new []{"Bradley", "Bertrand", "Renaud", "Suha", "Sebastien", "Jon", "Nathan", "Erik"})[(module.DisplayName.Length + (new Random()).Next()) % 7]) %></li><%-- very efficient, I know --%>
|
||||||
<li> | <%: T("Website: {0}", !string.IsNullOrEmpty(module.HomePage) ? module.HomePage : T("<a href=\"http://orchardproject.net\">http://orchardproject.net</a>").ToString())%></li>
|
<li> | <%: T("Website: {0}", !string.IsNullOrEmpty(module.HomePage) ? module.HomePage : T("<a href=\"http://orchardproject.net\">http://orchardproject.net</a>").ToString())%></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@@ -1,69 +1,92 @@
|
|||||||
(function($){
|
(function ($) {
|
||||||
//todo: (heskew) make use of the autofocus attribute instead
|
//todo: (heskew) make use of the autofocus attribute instead
|
||||||
$.fn.extend({
|
$.fn.extend({
|
||||||
helpfullyFocus: function() {
|
helpfullyFocus: function () {
|
||||||
var _this = $(this);
|
var _this = $(this);
|
||||||
var firstError = _this.find(".input-validation-error").first();
|
var firstError = _this.find(".input-validation-error").first();
|
||||||
// try to focus the first error on the page
|
// try to focus the first error on the page
|
||||||
if (firstError.size() === 1) {
|
if (firstError.size() === 1) {
|
||||||
return firstError.focus();
|
return firstError.focus();
|
||||||
}
|
}
|
||||||
// or, give it up to the browser to autofocus
|
// or, give it up to the browser to autofocus
|
||||||
if ('autofocus' in document.createElement('input')) {
|
if ('autofocus' in document.createElement('input')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// otherwise, make the autofocus attribute work
|
// otherwise, make the autofocus attribute work
|
||||||
var autofocus = _this.find(":input[autofocus=autofocus]").first();
|
var autofocus = _this.find(":input[autofocus=autofocus]").first();
|
||||||
return autofocus.focus();
|
return autofocus.focus();
|
||||||
},
|
},
|
||||||
toggleWhatYouControl: function() {
|
toggleWhatYouControl: function () {
|
||||||
var _this = $(this);
|
var _this = $(this);
|
||||||
var _controllees = $("[data-controllerid=" + _this.attr("id") + "]");
|
var _controllees = $("[data-controllerid=" + _this.attr("id") + "]");
|
||||||
var _controlleesAreHidden = _controllees.is(":hidden");
|
var _controlleesAreHidden = _controllees.is(":hidden");
|
||||||
if (_this.is(":checked") && _controlleesAreHidden) {
|
if (_this.is(":checked") && _controlleesAreHidden) {
|
||||||
_controllees.hide(); // <- unhook this when the following comment applies
|
_controllees.hide(); // <- unhook this when the following comment applies
|
||||||
$(_controllees.show()[0]).find("input").focus(); // <- aaaand a slideDown there...eventually
|
$(_controllees.show()[0]).find("input").focus(); // <- aaaand a slideDown there...eventually
|
||||||
} else if (!(_this.is(":checked") && _controlleesAreHidden)) {
|
} else if (!(_this.is(":checked") && _controlleesAreHidden)) {
|
||||||
//_controllees.slideUp(200); <- hook this back up when chrome behaves, or when I care less
|
//_controllees.slideUp(200); <- hook this back up when chrome behaves, or when I care less
|
||||||
_controllees.hide()
|
_controllees.hide()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
// collapsable areas - anything with a data-controllerid attribute has its visibility controlled by the id-ed radio/checkbox
|
|
||||||
(function() {
|
|
||||||
$("[data-controllerid]").each(function() {
|
|
||||||
var controller = $("#" + $(this).attr("data-controllerid"));
|
|
||||||
if (controller.data("isControlling")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
controller.data("isControlling", 1);
|
|
||||||
if (!controller.is(":checked")) {
|
|
||||||
$("[data-controllerid=" + controller.attr("id") + "]").hide();
|
|
||||||
}
|
|
||||||
if (controller.is(":checkbox")) {
|
|
||||||
controller.click($(this).toggleWhatYouControl);
|
|
||||||
} else if (controller.is(":radio")) {
|
|
||||||
$("[name=" + controller.attr("name") + "]").click(function() { $("[name=" + $(this).attr("name") + "]").each($(this).toggleWhatYouControl); });
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})();
|
// collapsable areas - anything with a data-controllerid attribute has its visibility controlled by the id-ed radio/checkbox
|
||||||
// inline form link buttons (form.inline.link button) swapped out for a link that submits said form
|
(function () {
|
||||||
(function() {
|
$("[data-controllerid]").each(function () {
|
||||||
$("form.inline.link").each(function() {
|
var controller = $("#" + $(this).attr("data-controllerid"));
|
||||||
var _this = $(this);
|
if (controller.data("isControlling")) {
|
||||||
var link = $("<a class='wasFormInlineLink' href='.'/>");
|
return;
|
||||||
var button = _this.children("button").first();
|
}
|
||||||
link.text(button.text())
|
controller.data("isControlling", 1);
|
||||||
|
if (!controller.is(":checked")) {
|
||||||
|
$("[data-controllerid=" + controller.attr("id") + "]").hide();
|
||||||
|
}
|
||||||
|
if (controller.is(":checkbox")) {
|
||||||
|
controller.click($(this).toggleWhatYouControl);
|
||||||
|
} else if (controller.is(":radio")) {
|
||||||
|
$("[name=" + controller.attr("name") + "]").click(function () { $("[name=" + $(this).attr("name") + "]").each($(this).toggleWhatYouControl); });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
// inline form link buttons (form.inline.link button) swapped out for a link that submits said form
|
||||||
|
(function () {
|
||||||
|
$("form.inline.link").each(function () {
|
||||||
|
var _this = $(this);
|
||||||
|
var link = $("<a class='wasFormInlineLink' href='.'/>");
|
||||||
|
var button = _this.children("button").first();
|
||||||
|
link.text(button.text())
|
||||||
.addClass(button.attr("class"))
|
.addClass(button.attr("class"))
|
||||||
.click(function() { _this.submit(); return false; })
|
.click(function () { _this.submit(); return false; })
|
||||||
.unload(function() { _this = 0; });
|
.unload(function () { _this = 0; });
|
||||||
_this.replaceWith(link);
|
_this.replaceWith(link);
|
||||||
_this.css({ "position": "absolute", "left": "-9999em" });
|
_this.css({ "position": "absolute", "left": "-9999em" });
|
||||||
$("body").append(_this);
|
$("body").append(_this);
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
// a little better autofocus
|
||||||
|
$(function () {
|
||||||
|
$("body").helpfullyFocus();
|
||||||
|
});
|
||||||
|
// UnsafeUrl links -> form POST
|
||||||
|
//todo: need some real microdata support eventually (incl. revisiting usage of data-* attributes)
|
||||||
|
$(function () {
|
||||||
|
var magicToken = $("input[name=__RequestVerificationToken]");
|
||||||
|
if (!magicToken) { return; } // no sense in continuing if form POSTS will fail
|
||||||
|
$("a[itemprop~=UnsafeUrl]").each(function () {
|
||||||
|
var _this = $(this);
|
||||||
|
var hrefParts = _this.attr("href").split("?");
|
||||||
|
var form = $("<form action=\"" + hrefParts[0] + "\" method=\"POST\" />");
|
||||||
|
form.append(magicToken.clone());
|
||||||
|
if (hrefParts.length > 1) {
|
||||||
|
var queryParts = hrefParts[1].split("&");
|
||||||
|
for (var i = 0; i < queryParts.length; i++) {
|
||||||
|
var queryPartKVP = queryParts[i].split("=");
|
||||||
|
//trusting hrefs in the page here
|
||||||
|
form.append($("<input type=\"hidden\" name=\"" + queryPartKVP[0] + "\" value=\"" + queryPartKVP[1] + "\" />"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
form.css({ "position": "absolute", "left": "-9999em" });
|
||||||
|
$("body").append(form);
|
||||||
|
_this.click(function () { form.submit(); return false; });
|
||||||
|
});
|
||||||
});
|
});
|
||||||
})();
|
|
||||||
// a little better autofocus
|
|
||||||
$(function() {
|
|
||||||
$("body").helpfullyFocus();
|
|
||||||
});
|
|
||||||
})(jQuery);
|
})(jQuery);
|
Reference in New Issue
Block a user