mockup/master: 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/master
Date: 2017-07-11T13:21:23+02:00
Author: Johannes Raggam (thet) <[email protected]>
Commit: https://github.com/plone/mockup/commit/2c2ee2b27cb64ccac05208154f07e0d7f1fb187a

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.