mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Merge branch '1.9.x' into dev
Conflicts: src/Orchard.Web/Modules/Orchard.Autoroute/Drivers/AutoroutePartDriver.cs src/Orchard.Web/Modules/Orchard.Autoroute/Views/EditorTemplates/Parts.Autoroute.Edit.cshtml src/Orchard.Web/Modules/Orchard.DynamicForms/Scripts/LayoutEditor.js src/Orchard.Web/Modules/Orchard.DynamicForms/Scripts/LayoutEditor.min.js src/Orchard.Web/Modules/Orchard.Layouts/Drivers/LayoutPartDriver.cs src/Orchard.Web/Modules/Orchard.Layouts/Orchard.Layouts.csproj
This commit is contained in:
@@ -29,7 +29,7 @@ namespace Orchard.Autoroute.Drivers {
|
|||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
|
||||||
public AutoroutePartDriver(
|
public AutoroutePartDriver(
|
||||||
IAliasService aliasService,
|
IAliasService aliasService,
|
||||||
IContentManager contentManager,
|
IContentManager contentManager,
|
||||||
IAutorouteService autorouteService,
|
IAutorouteService autorouteService,
|
||||||
IAuthorizer authorizer,
|
IAuthorizer authorizer,
|
||||||
@@ -86,7 +86,7 @@ namespace Orchard.Autoroute.Drivers {
|
|||||||
foreach (DefaultPattern pattern in settings.DefaultPatterns.Where(x => String.IsNullOrWhiteSpace(x.Culture))) {
|
foreach (DefaultPattern pattern in settings.DefaultPatterns.Where(x => String.IsNullOrWhiteSpace(x.Culture))) {
|
||||||
pattern.Culture = _cultureManager.GetSiteCulture();
|
pattern.Culture = _cultureManager.GetSiteCulture();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the content type has no pattern for autoroute, then use a default one
|
// if the content type has no pattern for autoroute, then use a default one
|
||||||
if (!settings.Patterns.Any(x => String.Equals(x.Culture, itemCulture, StringComparison.OrdinalIgnoreCase))) {
|
if (!settings.Patterns.Any(x => String.Equals(x.Culture, itemCulture, StringComparison.OrdinalIgnoreCase))) {
|
||||||
settings.Patterns = new List<RoutePattern> { new RoutePattern { Name = "Title", Description = "my-title", Pattern = "{Content.Slug}", Culture = itemCulture } };
|
settings.Patterns = new List<RoutePattern> { new RoutePattern { Name = "Title", Description = "my-title", Pattern = "{Content.Slug}", Culture = itemCulture } };
|
||||||
@@ -117,9 +117,8 @@ namespace Orchard.Autoroute.Drivers {
|
|||||||
var homepage = _aliasService.Get(string.Empty);
|
var homepage = _aliasService.Get(string.Empty);
|
||||||
var displayRouteValues = _contentManager.GetItemMetadata(part).DisplayRouteValues;
|
var displayRouteValues = _contentManager.GetItemMetadata(part).DisplayRouteValues;
|
||||||
|
|
||||||
if (homepage.Match(displayRouteValues)) {
|
viewModel.IsHomePage = homepage.Match(displayRouteValues);
|
||||||
viewModel.PromoteToHomePage = true;
|
viewModel.PromoteToHomePage = viewModel.IsHomePage || part.DisplayAlias == "/";
|
||||||
}
|
|
||||||
|
|
||||||
if (settings.PerItemConfiguration) {
|
if (settings.PerItemConfiguration) {
|
||||||
// if enabled, the list of all available patterns is displayed, and the user can
|
// if enabled, the list of all available patterns is displayed, and the user can
|
||||||
@@ -130,7 +129,7 @@ namespace Orchard.Autoroute.Drivers {
|
|||||||
|
|
||||||
var previous = part.DisplayAlias;
|
var previous = part.DisplayAlias;
|
||||||
if (updater != null && updater.TryUpdateModel(viewModel, Prefix, null, null)) {
|
if (updater != null && updater.TryUpdateModel(viewModel, Prefix, null, null)) {
|
||||||
|
|
||||||
// remove any leading slash in the permalink
|
// remove any leading slash in the permalink
|
||||||
if (viewModel.CurrentUrl != null) {
|
if (viewModel.CurrentUrl != null) {
|
||||||
viewModel.CurrentUrl = viewModel.CurrentUrl.TrimStart('/');
|
viewModel.CurrentUrl = viewModel.CurrentUrl.TrimStart('/');
|
||||||
@@ -156,7 +155,7 @@ namespace Orchard.Autoroute.Drivers {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ContentShape("Parts_Autoroute_Edit",
|
return ContentShape("Parts_Autoroute_Edit",
|
||||||
() => shapeHelper.EditorTemplate(TemplateName: "Parts.Autoroute.Edit", Model: viewModel, Prefix: Prefix));
|
() => shapeHelper.EditorTemplate(TemplateName: "Parts.Autoroute.Edit", Model: viewModel, Prefix: Prefix));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace Orchard.Autoroute.ViewModels {
|
|||||||
|
|
||||||
public class AutoroutePartEditViewModel {
|
public class AutoroutePartEditViewModel {
|
||||||
public AutorouteSettings Settings { get; set; }
|
public AutorouteSettings Settings { get; set; }
|
||||||
|
public bool IsHomePage { get; set; }
|
||||||
public bool PromoteToHomePage { get; set; }
|
public bool PromoteToHomePage { get; set; }
|
||||||
public string CurrentUrl { get; set; }
|
public string CurrentUrl { get; set; }
|
||||||
public string CustomPattern { get; set; }
|
public string CustomPattern { get; set; }
|
||||||
|
|||||||
@@ -27,7 +27,8 @@
|
|||||||
<span>@Html.TextBoxFor(m => m.CurrentUrl, new { @class = "text is-url" })</span>
|
<span>@Html.TextBoxFor(m => m.CurrentUrl, new { @class = "text is-url" })</span>
|
||||||
</span>
|
</span>
|
||||||
<span class="hint">@T("Save the current item and leave the input empty to have it automatically generated using the pattern {0} e.g., {1}", pattern.ElementAtOrDefault(Convert.ToInt32(defaultPattern.PatternIndex)).Name, pattern.ElementAtOrDefault(Convert.ToInt32(defaultPattern.PatternIndex)).Description)</span>
|
<span class="hint">@T("Save the current item and leave the input empty to have it automatically generated using the pattern {0} e.g., {1}", pattern.ElementAtOrDefault(Convert.ToInt32(defaultPattern.PatternIndex)).Name, pattern.ElementAtOrDefault(Convert.ToInt32(defaultPattern.PatternIndex)).Description)</span>
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
var hintClass = string.Empty;
|
var hintClass = string.Empty;
|
||||||
if (!string.IsNullOrEmpty(Model.CurrentUrl)) {
|
if (!string.IsNullOrEmpty(Model.CurrentUrl)) {
|
||||||
hintClass = "hint";
|
hintClass = "hint";
|
||||||
@@ -58,6 +59,7 @@
|
|||||||
<span class="hint">@T("Check to promote this content as the home page")</span>
|
<span class="hint">@T("Check to promote this content as the home page")</span>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
<span>@T("This content is the current home page")</span>
|
<span>@T("This content is the current home page")</span>
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
|||||||
var LayoutEditor;!function(e,t){t.Fieldset=function(n,i,o,r,l,d,a,c,s,h,m){t.Element.call(this,"Fieldset",n,i,o,r,l),t.Container.call(this,["Grid","Content"],m);var u=this;this.isContainable=!0,this.dropTargetClass="layout-common-holder",this.contentType=a,this.contentTypeLabel=c,this.contentTypeClass=s,this.legend=d||"",this.hasEditor=h,this.toObject=function(){var e=this.elementToObject();return e.legend=this.legend,e.children=this.childrenToObject(),e};var p=this.getEditorObject;this.getEditorObject=function(){var t=p();return e.extend(t,{Legend:this.legend})},this.setChildren=function(e){this.children=e,_(this.children).each(function(e){e.parent=u})},this.applyElementEditorModel=function(e){this.legend=e.legend},this.setChildren(m)},t.Fieldset.from=function(e){return new t.Fieldset(e.data,e.htmlId,e.htmlClass,e.htmlStyle,e.isTemplated,e.legend,e.contentType,e.contentTypeLabel,e.contentTypeClass,e.hasEditor,t.childrenFrom(e.children))},t.registerFactory("Fieldset",function(e){return t.Fieldset.from(e)})}(jQuery,LayoutEditor||(LayoutEditor={}));var LayoutEditor;!function(e,t){t.Form=function(n,i,o,r,l,d,a,c,s,h,m,u,p){t.Element.call(this,"Form",n,i,o,r,l,u),t.Container.call(this,["Grid","Content"],p);var f=this;this.isContainable=!0,this.dropTargetClass="layout-common-holder",this.contentType=c,this.contentTypeLabel=s,this.contentTypeClass=h,this.name=d||"Untitled",this.formBindingContentType=a,this.hasEditor=m,this.toObject=function(){var e=this.elementToObject();return e.name=this.name,e.formBindingContentType=this.formBindingContentType,e.children=this.childrenToObject(),e};var y=this.getEditorObject;this.getEditorObject=function(){var t=y();return e.extend(t,{FormName:this.name,FormBindingContentType:this.formBindingContentType})},this.allowSealedFocus=function(){return 0===this.children.length},this.setChildren=function(e){this.children=e,_(this.children).each(function(e){e.setParent(f)})},this.onDescendantAdded=function(t){var n=t.getEditorObject;t.getEditorObject=function(){var t=n();return e.extend(t,{FormBindingContentType:f.formBindingContentType})}},this.applyElementEditorModel=function(e){this.name=e.name,this.formBindingContentType=e.formBindingContentType},this.setChildren(p)},t.Form.from=function(e){return new t.Form(e.data,e.htmlId,e.htmlClass,e.htmlStyle,e.isTemplated,e.name,e.formBindingContentType,e.contentType,e.contentTypeLabel,e.contentTypeClass,e.hasEditor,e.rule,t.childrenFrom(e.children))},t.registerFactory("Form",function(e){return t.Form.from(e)})}(jQuery,LayoutEditor||(LayoutEditor={})),angular.module("LayoutEditor").directive("orcLayoutFieldset",["$compile","scopeConfigurator","environment",function(e,t,n){return{restrict:"E",scope:{element:"="},controller:["$scope","$element",function(e,n){t.configureForElement(e,n),t.configureForContainer(e,n),e.sortableOptions.axis="y",e.edit=function(){e.$root.editElement(e.element).then(function(t){t.cancel||e.$apply(function(){e.element.data=decodeURIComponent(t.element.data),e.element.applyElementEditorModel(t.elementEditorModel)})})}}],templateUrl:n.templateUrl("Fieldset"),replace:!0}}]),angular.module("LayoutEditor").directive("orcLayoutForm",["$compile","scopeConfigurator","environment",function(e,t,n){return{restrict:"E",scope:{element:"="},controller:["$scope","$element",function(e,n){t.configureForElement(e,n),t.configureForContainer(e,n),e.sortableOptions.axis="y",e.edit=function(){e.$root.editElement(e.element).then(function(t){t.cancel||e.$apply(function(){e.element.data=decodeURIComponent(t.element.data),e.element.applyElementEditorModel(t.elementEditorModel)})})}}],templateUrl:n.templateUrl("Form"),replace:!0}}]);
|
var LayoutEditor;!function(e,t){t.Fieldset=function(n,i,o,r,l,d,a,c,s,h,m){t.Element.call(this,"Fieldset",n,i,o,r,l),t.Container.call(this,["Grid","Content"],m);var u=this;this.isContainable=!0,this.dropTargetClass="layout-common-holder",this.contentType=a,this.contentTypeLabel=c,this.contentTypeClass=s,this.legend=d||"",this.hasEditor=h,this.toObject=function(){var e=this.elementToObject();return e.legend=this.legend,e.children=this.childrenToObject(),e};var p=this.getEditorObject;this.getEditorObject=function(){var t=p();return e.extend(t,{Legend:this.legend})},this.setChildren=function(e){this.children=e,_(this.children).each(function(e){e.parent=u})},this.applyElementEditorModel=function(e){this.legend=e.legend},this.setChildren(m)},t.Fieldset.from=function(e){return new t.Fieldset(e.data,e.htmlId,e.htmlClass,e.htmlStyle,e.isTemplated,e.legend,e.contentType,e.contentTypeLabel,e.contentTypeClass,e.hasEditor,t.childrenFrom(e.children))},t.registerFactory("Fieldset",function(e){return t.Fieldset.from(e)})}(jQuery,LayoutEditor||(LayoutEditor={}));var LayoutEditor;!function(e,t){t.Form=function(n,i,o,r,l,d,a,c,s,h,m,u){t.Element.call(this,"Form",n,i,o,r,l),t.Container.call(this,["Grid","Content"],u);var p=this;this.isContainable=!0,this.dropTargetClass="layout-common-holder",this.contentType=c,this.contentTypeLabel=s,this.contentTypeClass=h,this.name=d||"Untitled",this.formBindingContentType=a,this.hasEditor=m,this.toObject=function(){var e=this.elementToObject();return e.name=this.name,e.formBindingContentType=this.formBindingContentType,e.children=this.childrenToObject(),e};var f=this.getEditorObject;this.getEditorObject=function(){var t=f();return e.extend(t,{FormName:this.name,FormBindingContentType:this.formBindingContentType})},this.setChildren=function(e){this.children=e,_(this.children).each(function(e){e.setParent(p)})},this.onDescendantAdded=function(t){var n=t.getEditorObject;t.getEditorObject=function(){var t=n();return e.extend(t,{FormBindingContentType:p.formBindingContentType})}},this.applyElementEditorModel=function(e){this.name=e.name,this.formBindingContentType=e.formBindingContentType},this.setChildren(u)},t.Form.from=function(e){return new t.Form(e.data,e.htmlId,e.htmlClass,e.htmlStyle,e.isTemplated,e.name,e.formBindingContentType,e.contentType,e.contentTypeLabel,e.contentTypeClass,e.hasEditor,t.childrenFrom(e.children))},t.registerFactory("Form",function(e){return t.Form.from(e)})}(jQuery,LayoutEditor||(LayoutEditor={})),angular.module("LayoutEditor").directive("orcLayoutFieldset",["$compile","scopeConfigurator","environment",function(e,t,n){return{restrict:"E",scope:{element:"="},controller:["$scope","$element",function(e,n){t.configureForElement(e,n),t.configureForContainer(e,n),e.sortableOptions.axis="y",e.edit=function(){e.$root.editElement(e.element).then(function(t){t.cancel||e.$apply(function(){e.element.data=decodeURIComponent(t.element.data),e.element.applyElementEditorModel(t.elementEditorModel)})})}}],templateUrl:n.templateUrl("Fieldset"),replace:!0}}]),angular.module("LayoutEditor").directive("orcLayoutForm",["$compile","scopeConfigurator","environment",function(e,t,n){return{restrict:"E",scope:{element:"="},controller:["$scope","$element",function(e,n){t.configureForElement(e,n),t.configureForContainer(e,n),e.sortableOptions.axis="y",e.edit=function(){e.$root.editElement(e.element).then(function(t){t.cancel||e.$apply(function(){e.element.data=decodeURIComponent(t.element.data),e.element.applyElementEditorModel(t.elementEditorModel)})})}}],templateUrl:n.templateUrl("Form"),replace:!0}}]);
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user