diff --git a/CHANGELOG.md b/CHANGELOG.md index 595ec50b1..a70297697 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +* **Build 305** (2015-10-17) + - The Inspector control has been dramatically improved. + * **Build 304** (2015-10-09) - Added new `where` and `whereComponent` methods for querying CMS template properties. diff --git a/modules/cms/classes/Controller.php b/modules/cms/classes/Controller.php index 58ff01eaa..fc4a94bb2 100644 --- a/modules/cms/classes/Controller.php +++ b/modules/cms/classes/Controller.php @@ -1304,6 +1304,10 @@ class Controller $routerParameters = $this->router->getParameters(); foreach ($properties as $propertyName => $propertyValue) { + if (is_array($propertyValue)) { + continue; + } + $matches = []; if (preg_match('/^\{\{([^\}]+)\}\}$/', $propertyValue, $matches)) { $paramName = trim($matches[1]); diff --git a/modules/system/assets/ui/js/inspector.js b/modules/system/assets/ui/js/inspector.js deleted file mode 100644 index 90f7718e9..000000000 --- a/modules/system/assets/ui/js/inspector.js +++ /dev/null @@ -1,1235 +0,0 @@ -/* -=require ../vendor/modernizr/modernizr.js -=require ../vendor/mustache/mustache.js -=require foundation.js -=require popover.js -=require tooltip.js -=require checkbox.js -=require select.js -*/ -/* - * Inspector control - * - * - Documentation: ../docs/inspector.md - */ -+function ($) { "use strict"; - var Base = $.oc.foundation.base, - BaseProto = Base.prototype - - if ($.oc === undefined) - $.oc = {} - - $.oc.inspector = { - editors: {}, - propertyCounter: 0 - } - - // INSPECTOR CLASS DEFINITION - // ============================ - - var Inspector = function(element, options) { - this.options = options - this.$el = $(element) - - this.title = false - this.description = false - - Base.call(this) - } - - Inspector.prototype = Object.create(BaseProto) - Inspector.prototype.constructor = Inspector - - Inspector.prototype.loadConfiguration = function(onSuccess) { - var configString = this.$el.data('inspector-config') - if (configString !== undefined) { - // If the data-inspector-config attribute is provided, - // load the configuration from it - this.parseConfiguration(configString) - - if (onSuccess !== undefined) - onSuccess(); - } else { - // If the data-inspector-config attribute is not provided, - // request the configuration from the server. - var $form = $(this.selector).closest('form'), - data = this.$el.data(), - self = this - - $.oc.stripeLoadIndicator.show() - - var request = $form.request('onGetInspectorConfiguration', { - data: data - }).done(function(data) { - self.parseConfiguration(data.configuration.properties) - - if (data.configuration.title !== undefined) - self.title = data.configuration.title - - if (data.configuration.description !== undefined) - self.description = data.configuration.description - - $.oc.stripeLoadIndicator.hide() - - if (onSuccess !== undefined) - onSuccess(); - }).always(function() { - $.oc.stripeLoadIndicator.hide() - }) - } - } - - Inspector.prototype.parseConfiguration = function(jsonString) { - if (jsonString === undefined) - throw new Error('The Inspector cannot be initialized because the Inspector configuration ' + - 'attribute is not defined on the inspectable element.'); - - if (!$.isArray(jsonString) && !$.isPlainObject(jsonString)) { - try { - this.config = $.parseJSON(jsonString) - } catch(err) { - throw new Error('Error parsing the Inspector field configuration. ' + err) - } - } else - this.config = jsonString - - this.propertyValuesField = $('input[data-inspector-values]', this.$el) - - // Inspector saves property values to data-property-xxx attributes if the input[data-inspector-values] - // doesn't exist, so the condition is not required. - // - // if (this.propertyValuesField.length === 0) - // throw new Error('Error initializing the Inspector: the inspectable element should contain ' + - // 'an hidden input element with the data-inspector-values property.') - } - - Inspector.prototype.getPopoverTemplate = function() { - return ' \ -
{{description}}
\ - {{/description}} \ - \ -