AntonLV 5 سال پیش
والد
کامیت
5062f30dbd

+ 1 - 0
modules/boonex/polls/classes/BxPollsConfig.php

@@ -182,6 +182,7 @@ class BxPollsConfig extends BxBaseModTextConfig
             'snippet_link_subentries' => $sHtmlPrefix . '-snippet-subentries-',
             'snippet_link_results' => $sHtmlPrefix . '-snippet-results-',
             'content' => $sHtmlPrefix . '-content-',
+            'embed' => $sHtmlPrefix . '-content-',
         );
     }
 

+ 1 - 0
modules/boonex/polls/classes/BxPollsModule.php

@@ -239,6 +239,7 @@ class BxPollsModule extends BxBaseModTextModule
         $aResult['title'] = $this->_oConfig->getTitle($aContentInfo);
         $aResult['text'] = '';
         $aResult['raw'] = ($bDynamic ? $sInclude : '') . $this->_oTemplate->parseHtmlByName('unit_embed.html', array(
+            'html_id' => $this->_oConfig->getHtmlIds('embed') . (int)$aContentInfo[$CNF['FIELD_ID']],
             'embed_url' => BX_DOL_URL_ROOT . bx_append_url_params($this->_oConfig->getBaseUri() . 'embed_entry/', array(
                 'id' => (int)$aContentInfo[$CNF['FIELD_ID']]
             ))

+ 3 - 1
modules/boonex/polls/classes/BxPollsTemplate.php

@@ -48,7 +48,9 @@ class BxPollsTemplate extends BxBaseModTextTemplate
         $oTemplate->addCssStyle($CNF['STYLES_POLLS_EMBED_CLASS'], $CNF['STYLES_POLLS_EMBED_CONTENT']);
         $oTemplate->setPageNameIndex(BX_PAGE_EMBED);
         $oTemplate->setPageHeader($this->getTitleAuto($aContentInfo));
-        $oTemplate->setPageContent('page_main_code', $this->getJsCode('entry') . $aBlock['content']);
+        $oTemplate->setPageContent('page_main_code', $this->getJsCode('entry', array(
+            'bEmbed' => true
+        )) . $aBlock['content']);
         $oTemplate->getPageCode();
         exit;
     }

+ 21 - 0
modules/boonex/polls/js/entry.js

@@ -12,13 +12,34 @@ function BxPollsEntry(oOptions) {
     this._sActionsUrl = oOptions.sActionUrl;
     this._sObjName = oOptions.sObjName == undefined ? 'oBxPollsEntry' : oOptions.sObjName;
 
+    this._bEmbed = oOptions.bEmbed == undefined ? false : oOptions.bEmbed;
+
     this._sAnimationEffect = oOptions.sAnimationEffect == undefined ? 'fade' : oOptions.sAnimationEffect;
     this._iAnimationSpeed = oOptions.iAnimationSpeed == undefined ? 'slow' : oOptions.iAnimationSpeed;
 
     this._aHtmlIds = oOptions.aHtmlIds == undefined ? {} : oOptions.aHtmlIds;
     this._oRequestParams = oOptions.oRequestParams == undefined ? {} : oOptions.oRequestParams;
+    
+    var $this = this;
+    if(this._bEmbed)
+        $(document).ready(function() {
+            $this.resizeEmbed();
+        });
 }
 
+BxPollsEntry.prototype.resizeEmbed = function() {
+    var oEntry = $('.bx-polls-content:last');
+    if(!oEntry || oEntry.length == 0)
+        return;
+
+    var iEntryId = parseInt(oEntry.attr('id').replace(this._aHtmlIds['content'], ''));
+    var iEntryHeight = oEntry.height();
+    if(!iEntryId || !iEntryHeight)
+        return;
+
+    window.parent.$('iframe#' + this._aHtmlIds['embed'] + iEntryId).height(iEntryHeight);
+};
+
 BxPollsEntry.prototype.changeBlockSnippet = function(oLink, sBlock, mixedContent) {
     var $this = this;
 

+ 0 - 1
modules/boonex/polls/template/css/entry.css

@@ -1,7 +1,6 @@
 /*--- Embed ---*/
 .bx-page-iframe .bx-polls-content {
     width: 100vw;
-    height: 100vh;
     overflow-x: hidden;
     overflow-y: auto;
 }

+ 1 - 1
modules/boonex/polls/template/unit_embed.html

@@ -1 +1 @@
-<iframe class="bx-polls-embed" src="__embed_url__" frameborder="0"></iframe>
+<iframe id="__html_id__" class="bx-polls-embed" src="__embed_url__" frameborder="0"></iframe>