Created
May 13, 2015 18:56
-
-
Save gregwiechec/d4a10f9412a7d13a97ba to your computer and use it in GitHub Desktop.
EPiServer - Extending “All properties” view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using EPiServer.Cms.Shell.UI.UIDescriptors.ViewConfigurations; | |
using EPiServer.ServiceLocation; | |
using EPiServer.Shell; | |
using EpiServerThumbnail.Models.Pages; | |
namespace EpiServerThumbnail.Business.EditorDescriptors | |
{ | |
[UIDescriptorRegistration] | |
public class ProdcutDetailsUiDescriptor : UIDescriptor<ProductPage> | |
{ | |
public ProdcutDetailsUiDescriptor() | |
: base(ContentTypeCssClassNames.Page) | |
{ | |
this.DefaultView = "extended-formedit"; | |
AddDisabledView(CmsViewNames.AllPropertiesView); | |
} | |
} | |
[ServiceConfiguration(typeof(ViewConfiguration))] | |
public class ProductFormEditing : FormEditing | |
{ | |
public ProductFormEditing() | |
{ | |
Key = "extended-formedit"; | |
ForType = typeof (ProductPage); | |
ViewType = "alloy.productFormEditing"; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define([ | |
"dojo/_base/declare", | |
"dojo/_base/lang", | |
"epi-cms/contentediting/FormEditing" | |
], | |
function( | |
declare, | |
lang, | |
FormEditing | |
) { | |
return declare("alloy.productFormEditing", [FormEditing], { | |
widgetsList: {}, | |
onSetupEditModeComplete: function() { | |
this.inherited(arguments); | |
this._initMaintenanceMessage(); | |
}, | |
_initMaintenanceMessage: function() { | |
// get widgets | |
var textWidget = this.widgetsList["maintenanceMessage"]; | |
var checkboxWidget = this.widgetsList["showMaintenanceMessage"]; | |
this.own(checkboxWidget.on("change", lang.hitch(this, function(value) { | |
if (checkboxWidget.checkbox.get("readOnly")) { | |
return; | |
} | |
textWidget.set("readOnly", !value); | |
}))); | |
if (checkboxWidget.checkbox.get("value") == false) { | |
textWidget.set("readOnly", true); | |
} | |
}, | |
onFieldCreated: function(fieldName, widget) { | |
this.inherited(arguments); | |
this.widgetsList[fieldName] = widget; | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment