Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gregwiechec/d4a10f9412a7d13a97ba to your computer and use it in GitHub Desktop.
Save gregwiechec/d4a10f9412a7d13a97ba to your computer and use it in GitHub Desktop.
EPiServer - Extending “All properties” view
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";
}
}
}
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