diff --git a/admin/themes/default/template/controllers/products/informations.tpl b/admin/themes/default/template/controllers/products/informations.tpl
index 68a6d2d18..201cbc41d 100644
--- a/admin/themes/default/template/controllers/products/informations.tpl
+++ b/admin/themes/default/template/controllers/products/informations.tpl
@@ -356,9 +356,8 @@
file="controllers/products/textarea_lang.tpl"
languages=$languages
input_name='description_short'
- class="autoload_rte"
input_value=$product->description_short
- max=$PS_PRODUCT_SHORT_DESC_LIMIT}
+ maxlength=$PS_PRODUCT_SHORT_DESC_LIMIT}
diff --git a/classes/Product.php b/classes/Product.php
index c47bb1f04..9569df37a 100644
--- a/classes/Product.php
+++ b/classes/Product.php
@@ -357,7 +357,7 @@ class ProductCore extends ObjectModel
),
'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCatalogName', 'required' => true, 'size' => 128),
'description' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'),
- 'description_short' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'),
+ 'description_short' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCleanHtml'),
'available_now' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
'available_later' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'IsGenericName', 'size' => 255),
),
diff --git a/modules/wkhotelroom/views/css/WkHotelRoomBlockFront.css b/modules/wkhotelroom/views/css/WkHotelRoomBlockFront.css
index 4319dbb72..4e8590cfa 100644
--- a/modules/wkhotelroom/views/css/WkHotelRoomBlockFront.css
+++ b/modules/wkhotelroom/views/css/WkHotelRoomBlockFront.css
@@ -25,9 +25,6 @@
cursor: pointer;
font-weight: 400;
}
-.htlRoomTypeDescTextContainer p{
- margin: 0px;
-}
@media (min-width: 530px) {
.hotelRoomDescContainer{
position: absolute;
@@ -72,7 +69,7 @@
color: #555555;
font-weight: 300;
line-height: 21px;
- margin-bottom: 9px;
+ margin-bottom: 10px;
}
a.htlRoomTypeBookNow {
font-size: 15px;
diff --git a/modules/wkhotelroom/views/js/WkHotelRoomBlockFront.js b/modules/wkhotelroom/views/js/WkHotelRoomBlockFront.js
index 4aba4b360..afd2304b4 100644
--- a/modules/wkhotelroom/views/js/WkHotelRoomBlockFront.js
+++ b/modules/wkhotelroom/views/js/WkHotelRoomBlockFront.js
@@ -18,10 +18,12 @@
*/
$(document).ready(function() {
- toggleRoomDescriptionExtras();
- $(window).on('resize', function() {
- removePreviousChanges();
- toggleRoomDescriptionExtras();
+ $(document).find('.htlRoomTypeDescText').each(function() {
+ // checking if the display:overFlow has been applied to the description.
+ if ($(this).prop('scrollHeight') - $(this).prop('clientHeight') > 15) {
+ // Only show read more and read less text if the text is wrapped.
+ initToogleOtions($(this)[0]);
+ }
});
$(document).on('click', '.read-extra-text', function(e) {
@@ -36,44 +38,22 @@ $(document).ready(function() {
});
});
-// Function is called to revert the changes made to the description on the window size change.
-function removePreviousChanges()
-{
- $(document).find('.htlRoomTypeDescText').each(function() {
- //Reverting the changes so we can reapply them according the new screen size.
- $(this).html($(this).parent().find('.htlRoomTypeDescTextOriginal').html());
- if (!$(this).hasClass('htlRoomTypeDescTextContainer')){
- $(this).addClass('htlRoomTypeDescTextContainer');
- }
- });
-}
-function addExtraTextToDescription(target)
+function initToogleOtions(target)
{
// Getting the number of displayed characters
var show_char = getChars(target);
var ellipses = "... ";
var content = $(target).html();
if (content.trim().length > show_char) {
- var a = content.trim().substr(0, show_char).replace('
' , ''); // getting the text that we want to show to the user, removed the first
tag.
- if (content.trim().substr(content.trim().length - 4, content.trim().length) == '
') {
- content = content.trim().substr(0, content.trim().length - 4);// removed the last closing tag.
- }
- var b = content.trim().substr(show_char - content.trim().length) // getting the text that will be toggled
+ // Dividing the text into two parts so that we are able to diffrentiate the displayed text from hidden text.
+ var a = content.trim().substr(0, show_char);
+ var b = content.trim().substr(show_char - content.trim().length);
// Adding the read more and read less text with the ellipses to the original text.
var html = a + "
" + ellipses + "" + b + "";
- $(target).html('
' + html+ '
');
+ $(target).html(html);
}
}
-function toggleRoomDescriptionExtras()
-{
- $(document).find('.htlRoomTypeDescText').each(function() {
- // checking if the display:overFlow has been applied to the description.
- if ($(this).prop('scrollHeight') - $(this).prop('clientHeight') > 15) {
- // Only show read more and read less text if the text is wrapped.
- addExtraTextToDescription($(this)[0]);
- }
- });
-}
+
// Getting the number of characters displayed to the user.
function getChars(target) {
var style = window.getComputedStyle(target, null);
@@ -90,4 +70,4 @@ function getChars(target) {
var displayedCharacters = $(target).text().split('').slice(0, lines * (width / parseInt(font_size))).join('').length;
return displayedCharacters + 20;
-}
+}
\ No newline at end of file
diff --git a/modules/wkhotelroom/views/templates/hook/hotelRoomDisplayBlock.tpl b/modules/wkhotelroom/views/templates/hook/hotelRoomDisplayBlock.tpl
index 2ad22920a..38cdd5f63 100644
--- a/modules/wkhotelroom/views/templates/hook/hotelRoomDisplayBlock.tpl
+++ b/modules/wkhotelroom/views/templates/hook/hotelRoomDisplayBlock.tpl
@@ -59,13 +59,10 @@
{/if}
- {$roomDisplay.description}
-
-
- {$roomDisplay.description}
+ {$roomDisplay.description|escape:'html':'UTF-8'}
diff --git a/modules/wkhotelroom/wkhotelroom.php b/modules/wkhotelroom/wkhotelroom.php
index 2fc1d0ab8..0ae240929 100644
--- a/modules/wkhotelroom/wkhotelroom.php
+++ b/modules/wkhotelroom/wkhotelroom.php
@@ -104,8 +104,8 @@ class WkHotelRoom extends Module
)
);
- $this->context->controller->addCSS($this->_path.'/views/css/WkHotelRoomBlockFront.css');
$this->context->controller->addJs($this->_path.'/views/js/WkHotelRoomBlockFront.js');
+ $this->context->controller->addCSS($this->_path.'/views/css/WkHotelRoomBlockFront.css');
return $this->display(__FILE__, 'hotelRoomDisplayBlock.tpl');
}