mockup/thet-structureupdater-docs: only apply, if titleSelector resp. descriptionSelector are d

Johannes Raggam <jenkins-z4DKO/[email protected]>
Newsgroups gmane.comp.web.zope.plone.cvs
Message-ID <[email protected]>
Repository: mockup
Branch: refs/heads/thet-structureupdater-docs
Date: 2017-07-11T13:19:19+02:00
Author: Johannes Raggam (thet) <[email protected]>
Commit: https://github.com/plone/mockup/commit/3887447eb170e58a956d93bb2a46bf7affe33492

only apply, if titleSelector resp. descriptionSelector are defined

Files changed:
M mockup/patterns/structure/pattern-structureupdater.js

diff --git a/mockup/patterns/structure/pattern-structureupdater.js b/mockup/patterns/structure/pattern-structureupdater.js
index 75eebfd3..abaaa214 100644
--- a/mockup/patterns/structure/pattern-structureupdater.js
+++ b/mockup/patterns/structure/pattern-structureupdater.js
@@ -27,8 +27,12 @@ define([
     init: function() {
 
       $('body').on('context-info-loaded', function (e, data) {
-        $(this.options.titleSelector, this.$el).html(data.object && data.object.Title || '&nbsp;');
-        $(this.options.descriptionSelector, this.$el).html(data.object && data.object.Description || '&nbsp;');
+        if (this.options.titleSelector) {
+            $(this.options.titleSelector, this.$el).html(data.object && data.object.Title || '&nbsp;');
+        }
+        if (this.options.descriptionSelector) {
+            $(this.options.descriptionSelector, this.$el).html(data.object && data.object.Description || '&nbsp;');
+        }
       }.bind(this));
 
     }



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.