Merge pull request #959 from vishal-singh-webkul/gli-1739

Updated: Design for the our room block
This commit is contained in:
Rohit Jain
2024-09-05 18:38:43 +05:30
committed by GitHub
6 changed files with 143 additions and 30 deletions

View File

@@ -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}
</div>
</div>
<div class="form-group">

View File

@@ -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),
),

View File

@@ -17,18 +17,53 @@
* @license https://store.webkul.com/license.html
*/
.hotelRoomDescContainer{
position: absolute;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(255, 255, 255, 0.85);
margin-left: 15px;
margin-right: 15px;
padding: 20px;
z-index: 10;
.htlRoomTypeDescTextContainer {
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
}
.htlRoomTypeDescReadmore, .htlRoomTypeDescReadless{
cursor: pointer;
font-weight: 400;
display: none;
}
.htlRoomTypeDescExtras {
display: none;
}
@media (min-width: 530px) {
.hotelRoomDescContainer{
position: absolute;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(255, 255, 255, 0.8);
margin-left: 10px;
margin-right: 10px;
padding: 20px;
z-index: 10;
}
.htlRoomTypePriceText{
float :right;
}
}
@media (max-width: 530px) {
.hotelRoomDescContainer{
padding: 10px;
}
.wk_roomType_price_type{
font-size: 16px;
font-weight: 400;
}
.htlRoomTypeNameText {
width: 100%;
}
.room_type_old_price {
width: 100%;
display: block;
}
}
.htlRoomTypeNameText, .htlRoomTypePriceText {
font-size: 18px;
color: #222222;
@@ -37,17 +72,19 @@
}
.htlRoomTypeDescText{
font-size: 16px;
word-break: break-word;
color: #555555;
font-weight: 300;
line-height: 21px;
margin-bottom: 10px;
}
.htlRoomTypeBookNow {
font-size: 15px!important;
color: #333333!important;
font-weight: 400!important;
background: transparent!important;
border: 1px solid #333333!important;
padding: 10px 30px!important;
a.htlRoomTypeBookNow {
font-size: 15px;
color: #333333;
font-weight: 400;
background: transparent;
border: 1px solid #333333;
padding: 10px 30px;
text-transform: capitalize;
}
@@ -55,10 +92,6 @@
border: 1px solid #333333;
}
.htlRoomTypeDescText {
padding-bottom: 9px;
}
.room_type_old_price {
text-decoration: line-through;
color:#555555;

View File

@@ -0,0 +1,78 @@
/**
* Since 2010 Webkul.
*
* NOTICE OF LICENSE
*
* All right is reserved,
* Please go through this link for complete license : https://store.webkul.com/license.html
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information.
*
* @author Webkul IN <support@webkul.com>
* @copyright Since 2010 Webkul IN
* @license https://store.webkul.com/license.html
*/
$(document).ready(function() {
applyChangesToDescription();
$(window).on('resize', function() {
resetDescriptionChanges();
applyChangesToDescription();
});
$(document).on('click', '.htlRoomTypeDescReadmore', function(e) {
e.preventDefault();
var target = (e.target).closest(".htlRoomTypeDescText");
$(target).removeClass('htlRoomTypeDescTextContainer');
$(target).html($(e.target).closest(".hotelRoomDescContainer").find('.htlRoomTypeDescOriginal').html());
$(target).append($('.htlRoomTypeDescExtras').html());
$(target).find('.htlRoomTypeDescReadless').show().css('display', 'inline-block');
});
$(document).on('click', '.htlRoomTypeDescReadless', function(e) {
e.preventDefault();
var target = (e.target).closest(".htlRoomTypeDescText");
$(target).addClass('htlRoomTypeDescTextContainer');
initToggleOptions($(target));
});
});
function resetDescriptionChanges() {
$(document).find('.htlRoomTypeDescText').each(function() {
$(this).addClass('htlRoomTypeDescTextContainer');
$(this).html($(this).parent().find('.htlRoomTypeDescOriginal').html());
});
}
function applyChangesToDescription() {
$(document).find('.htlRoomTypeDescText').each(function() {
// checking if the display:overFlow has been applied to the description. using 14px since font size is 14px.
if ($(this).prop('scrollHeight') - $(this).prop('clientHeight') > 14) {
initToggleOptions($(this)[0]);
}
});
}
function initToggleOptions(target) {
truncatedText = truncateText(target);
$(target).text(truncatedText);
$(target).append($('.htlRoomTypeDescExtras').html());
$(target).find('.htlRoomTypeDescReadmore').first().show().css('display', 'inline-block');
}
function truncateText(target) {
var lineHeight = parseInt($(target).css('line-height'), 10);
var containerHeight = lineHeight * 3;
text = $(target).text();
while ($(target).prop('scrollHeight') > containerHeight) {
text = text.slice(0, -10);
$(target).text(text + ' ... ' + $('.htlRoomTypeDescReadmore').first().text());
}
return text;
}

View File

@@ -45,22 +45,24 @@
<div class="row margin-lr-0">
<p class="htlRoomTypeNameText pull-left">{$roomDisplay.name|escape:'htmlall':'UTF-8'}</p>
{if $roomDisplay.show_price && !isset($restricted_country_mode) && !$PS_CATALOG_MODE}
<p class="htlRoomTypePriceText pull-right">
<p class="htlRoomTypePriceText">
{if $roomDisplay.feature_price_diff >= 0}
<span class="wk_roomType_price {if $roomDisplay.feature_price_diff>0}room_type_old_price{/if}">{convertPrice price = $roomDisplay.price_without_reduction}</span>
{/if}
{if $roomDisplay.feature_price_diff}
<span class="wk_roomType_price">{convertPrice price = $roomDisplay.feature_price}</span>
{/if}
/&nbsp;{l s='Per Night' mod='wkhotelroom'}
<span class="wk_roomType_price_type">
/&nbsp;{l s='Per Night' mod='wkhotelroom'}
</span>
</p>
{/if}
</div>
<div class="row margin-lr-0 htlRoomTypeDescText">
{$roomDisplay.description}
</div>
<div class="row margin-lr-0 htlRoomTypeDescText htlRoomTypeDescTextContainer">{$roomDisplay.description|escape:'html':'UTF-8'}</div>
<div class="row htlRoomTypeDescOriginal" hidden>{$roomDisplay.description|escape:'html':'UTF-8'}</div>
<div class="htlRoomTypeDescExtras"><span class='htlRoomTypeDescReadmore'>...{l s='Read More.' mod='wkhotelroom'}</span><span class='htlRoomTypeDescReadless'>...{l s='Read Less.' mod='wkhotelroom'}</span></div>
<div class="row margin-lr-0">
<a class="btn btn-default button htlRoomTypeBookNow" href="{$link->getProductLink($roomDisplay.id_product)|escape:'html':'UTF-8'}"><span>{if !isset($restricted_country_mode) && !$PS_CATALOG_MODE}{l s='book now' mod='wkhotelroom'}{else}{l s='View' mod='wkhotelroom'}{/if}</span></a>
<a class="btn htlRoomTypeBookNow" href="{$link->getProductLink($roomDisplay.id_product)|escape:'html':'UTF-8'}"><span>{if !isset($restricted_country_mode) && !$PS_CATALOG_MODE}{l s='book now' mod='wkhotelroom'}{else}{l s='View' mod='wkhotelroom'}{/if}</span></a>
</div>
</div>
</div>

View File

@@ -115,6 +115,7 @@ class WkHotelRoom extends Module
)
);
$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');