Merge pull request #185 from shreesh-webkul/gli-476
Changed star rating plugin to jQuery Raty | Added success msg on comment update and delete
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
/*
|
||||
### jQuery Star Rating Plugin v2.0 - 2008-03-12 ###
|
||||
By Diego A, http://www.fyneworks.com, diego@fyneworks.com
|
||||
- v2 by Keith Wood, kbwood@virginbroadband.com.au
|
||||
|
||||
Project: http://plugins.jquery.com/project/MultipleFriendlyStarRating
|
||||
Website: http://www.fyneworks.com/jquery/star-rating/
|
||||
|
||||
This is a modified version of the star rating plugin from:
|
||||
http://www.phpletter.com/Demo/Jquery-Star-Rating-Plugin/
|
||||
*/
|
||||
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';4(w)(3($){$.Y.T=3(c){c=$.15({m:\'X U\',E:\'\',B:z,8:z},c||{});o d={};o e={t:3(n,a,b){2.6(n);$(a).D(\'.j\').A().l(b||\'x\')},6:3(n){$(d[n].7).O(\'.j\').u(\'9\').u(\'x\')},h:3(n){4(!$(d[n].5).Z(\'.m\')){$(d[n].5).D(\'.j\').A().l(\'9\')}},g:3(n,a){d[n].5=a;o b=$(a).L(\'a\').K();$(d[n].7).J(b);e.6(n);e.h(n);4(c.I)c.I.W(d[n].7,[b,a])}};2.V(3(i){o n=2.G;4(!d[n])d[n]={r:0};i=d[n].r;d[n].r++;4(i==0){c.8=$(2).S(\'p\')||c.8;d[n].7=$(\'<R Q="P" G="\'+n+\'" q=""\'+(c.8?\' p="p"\':\'\')+\'>\');$(2).C(d[n].7);4(c.8||c.B){}F{$(2).C($(\'<k y="m"><a s="\'+c.m+\'">\'+c.E+\'</a></k>\').H(3(){e.6(n);$(2).l(\'9\')}).v(3(){e.h(n);$(2).u(\'9\')}).g(3(){e.g(n,2)}))}};f=$(\'<k y="j"><a s="\'+(2.s||2.q)+\'">\'+2.q+\'</a></k>\');$(2).N(f);4(c.8){$(f).l(\'M\')}F{$(f).H(3(){e.6(n);e.t(n,2)}).v(3(){e.6(n);e.h(n)}).g(3(){e.g(n,2)})};4(2.14)d[n].5=f;$(2).13();4(i+1==2.12)e.h(n)});11(n 10 d)4(d[n].5){e.t(n,d[n].5,\'9\');$(d[n].7).J($(d[n].5).L(\'a\').K())}16 2}})(w);',62,69,'||this|function|if|currentElem|drain|valueElem|readOnly|star_on||||||eStar|click|reset||star|div|addClass|cancel||var|disabled|value|count|title|fill|removeClass|mouseout|jQuery|star_hover|class|false|andSelf|required|before|prevAll|cancelValue|else|name|mouseover|callback|val|text|children|star_readonly|after|siblings|hidden|type|input|attr|rating|Rating|each|apply|Cancel|fn|is|in|for|length|remove|checked|extend|return'.split('|'),0,{}));
|
||||
@@ -23,9 +23,17 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
$(document).ready(function(){
|
||||
$('input.star').rating();
|
||||
$('.auto-submit-star').rating();
|
||||
|
||||
$('.raty_star').raty({
|
||||
starType : 'i',
|
||||
starOff: 'icon-star-o',
|
||||
starOn: 'icon-star',
|
||||
halfShow: false,
|
||||
score: 3,
|
||||
hints: null,
|
||||
readOnly: function() {
|
||||
return $(this).hasClass('readonly');
|
||||
}
|
||||
});
|
||||
$('#new_comment_tab_btn').on('click', function(e){
|
||||
e.preventDefault();
|
||||
$('.new_comment_form_outer').show();
|
||||
|
||||
29
modules/productcomments/lib/index.php
Normal file
29
modules/productcomments/lib/index.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* 2010-2021 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 2010-2021 Webkul IN
|
||||
* @license https://store.webkul.com/license.html
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../');
|
||||
exit;
|
||||
770
modules/productcomments/lib/jquery.raty.js
Normal file
770
modules/productcomments/lib/jquery.raty.js
Normal file
@@ -0,0 +1,770 @@
|
||||
/*!
|
||||
* Raty - A Star Rating Plugin
|
||||
*
|
||||
* The MIT License
|
||||
*
|
||||
* author: Washington Botelho
|
||||
* github: wbotelhos/raty
|
||||
* version: 3.0.0
|
||||
*
|
||||
*/
|
||||
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(['jquery'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
module.exports = factory(require('jquery'));
|
||||
} else {
|
||||
factory(root.jQuery);
|
||||
}
|
||||
}(this, function($) {
|
||||
'use strict';
|
||||
|
||||
$.raty = {
|
||||
cancelButton: false,
|
||||
cancelClass: 'raty-cancel',
|
||||
cancelHint: 'Cancel this rating!',
|
||||
cancelOff: 'cancel-off.png',
|
||||
cancelOn: 'cancel-on.png',
|
||||
cancelPlace: 'left',
|
||||
click: undefined,
|
||||
half: false,
|
||||
halfShow: true,
|
||||
hints: ['bad', 'poor', 'regular', 'good', 'gorgeous'],
|
||||
iconRange: undefined,
|
||||
mouseout: undefined,
|
||||
mouseover: undefined,
|
||||
noRatedMsg: 'Not rated yet!',
|
||||
number: 5,
|
||||
numberMax: 20,
|
||||
path: undefined,
|
||||
precision: false,
|
||||
readOnly: false,
|
||||
round: { down: 0.25, full: 0.6, up: 0.76 },
|
||||
score: undefined,
|
||||
scoreName: 'score',
|
||||
single: false,
|
||||
space: true,
|
||||
starHalf: 'star-half.png',
|
||||
starOff: 'star-off.png',
|
||||
starOn: 'star-on.png',
|
||||
starType: 'img',
|
||||
target: undefined,
|
||||
targetFormat: '{score}',
|
||||
targetKeep: false,
|
||||
targetScore: undefined,
|
||||
targetText: '',
|
||||
targetType: 'hint'
|
||||
};
|
||||
|
||||
$.fn.raty = function(options) {
|
||||
return this.each(function() {
|
||||
var instance = new $.raty.Raty(this, options);
|
||||
|
||||
return instance._create();
|
||||
});
|
||||
};
|
||||
|
||||
$.raty.Raty = (function() {
|
||||
var Raty = function(element, options) {
|
||||
this.element = element;
|
||||
this.self = $(element);
|
||||
this.opt = $.extend(true, {}, $.raty, options, this.self.data());
|
||||
};
|
||||
|
||||
Raty.prototype = {
|
||||
_create: function() {
|
||||
this._executeCallbacks();
|
||||
this._adjustNumber();
|
||||
this._adjustHints();
|
||||
|
||||
this.opt.score = this._adjustedScore(this.opt.score);
|
||||
|
||||
if (this.opt.starType !== 'img') {
|
||||
this._adjustStarName();
|
||||
}
|
||||
|
||||
this._setPath();
|
||||
this._createStars();
|
||||
|
||||
if (this.opt.cancelButton) {
|
||||
this._createCancel();
|
||||
}
|
||||
|
||||
if (this.opt.precision) {
|
||||
this._adjustPrecision();
|
||||
}
|
||||
|
||||
this._createScore();
|
||||
|
||||
this._apply(this.opt.score);
|
||||
this._setTitle(this.opt.score);
|
||||
this._target(this.opt.score);
|
||||
|
||||
if (this.opt.readOnly) {
|
||||
this._lock();
|
||||
} else {
|
||||
this.element.style.cursor = 'pointer';
|
||||
|
||||
this._binds();
|
||||
}
|
||||
|
||||
this.self.data('raty', this);
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
_adjustedScore: function(score) {
|
||||
if (score || score === 0) {
|
||||
return this._between(score, 0, this.opt.number);
|
||||
}
|
||||
},
|
||||
|
||||
_adjustHints: function() {
|
||||
if (!this.opt.hints) {
|
||||
this.opt.hints = [];
|
||||
}
|
||||
|
||||
if (!this.opt.halfShow && !this.opt.half) {
|
||||
return;
|
||||
}
|
||||
|
||||
var steps = this.opt.precision ? 10 : 2;
|
||||
|
||||
for (var i = 0; i < this.opt.number; i++) {
|
||||
var group = this.opt.hints[i];
|
||||
|
||||
if (Object.prototype.toString.call(group) !== '[object Array]') {
|
||||
group = [group];
|
||||
}
|
||||
|
||||
this.opt.hints[i] = [];
|
||||
|
||||
for (var j = 0; j < steps; j++) {
|
||||
var hint = group[j];
|
||||
var last = group[group.length - 1];
|
||||
|
||||
if (last === undefined) {
|
||||
last = null;
|
||||
}
|
||||
|
||||
this.opt.hints[i][j] = hint === undefined ? last : hint;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_adjustNumber: function() {
|
||||
this.opt.number = this._between(this.opt.number, 1, this.opt.numberMax);
|
||||
},
|
||||
|
||||
_adjustPrecision: function() {
|
||||
this.opt.half = true;
|
||||
},
|
||||
|
||||
_adjustStarName: function() {
|
||||
var replaces = ['cancelOff', 'cancelOn', 'starHalf', 'starOff', 'starOn'];
|
||||
|
||||
this.opt.path = '';
|
||||
|
||||
for (var i = 0; i < replaces.length; i++) {
|
||||
this.opt[replaces[i]] = this.opt[replaces[i]].replace('.', '-');
|
||||
}
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
_apply: function(score) {
|
||||
this._fill(score);
|
||||
|
||||
if (score) {
|
||||
if (score > 0) {
|
||||
this.scoreField.val(score);
|
||||
}
|
||||
|
||||
this._roundStars(score);
|
||||
}
|
||||
},
|
||||
|
||||
_attributesForIndex: function(i) {
|
||||
var name = this._nameForIndex(i);
|
||||
var attributes = { alt: i, src: this.opt.path + this.opt[name] };
|
||||
|
||||
if (this.opt.starType !== 'img') {
|
||||
attributes = { 'data-alt': i, 'class': this.opt[name] };
|
||||
}
|
||||
|
||||
attributes.title = this._getHint(i);
|
||||
|
||||
return attributes;
|
||||
},
|
||||
|
||||
_between: function(value, min, max) {
|
||||
return Math.min(Math.max(parseFloat(value), min), max);
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
_binds: function() {
|
||||
if (this.cancelButton) {
|
||||
this._bindOverCancel();
|
||||
this._bindClickCancel();
|
||||
this._bindOutCancel();
|
||||
}
|
||||
|
||||
this._bindOver();
|
||||
this._bindClick();
|
||||
this._bindOut();
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
_bindClick: function() {
|
||||
var that = this;
|
||||
|
||||
this.stars.on('click.raty', function(evt) {
|
||||
if (that.self.data('readonly')) {
|
||||
return;
|
||||
}
|
||||
|
||||
var execute = true;
|
||||
var score = (that.opt.half || that.opt.precision) ? that.self.data('score') : (this.alt || $(this).data('alt'));
|
||||
|
||||
if (that.opt.half && !that.opt.precision) {
|
||||
score = that._roundHalfScore(score);
|
||||
}
|
||||
|
||||
if (that.opt.click) {
|
||||
execute = that.opt.click.call(that.element, +score, evt);
|
||||
}
|
||||
|
||||
if (execute || execute === undefined) {
|
||||
that._apply(+score);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
_bindClickCancel: function() {
|
||||
this.cancelButton.on('click.raty', function(evt) {
|
||||
this.scoreField.removeAttr('value');
|
||||
|
||||
if (this.opt.click) {
|
||||
this.opt.click.call(this.element, null, evt);
|
||||
}
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
_bindOut: function() {
|
||||
this.self.on('mouseleave.raty', function(evt) {
|
||||
var score = +this.scoreField.val() || undefined;
|
||||
|
||||
this._apply(score);
|
||||
this._target(score, evt);
|
||||
this._resetTitle();
|
||||
|
||||
if (this.opt.mouseout) {
|
||||
this.opt.mouseout.call(this.element, score, evt);
|
||||
}
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
_bindOutCancel: function() {
|
||||
var that = this;
|
||||
|
||||
this.cancelButton.on('mouseleave.raty', function(evt) {
|
||||
var icon = that.opt.cancelOff;
|
||||
|
||||
if (that.opt.starType !== 'img') {
|
||||
icon = that.opt.cancelClass + ' ' + icon;
|
||||
}
|
||||
|
||||
that._setIcon(this, icon);
|
||||
|
||||
if (that.opt.mouseout) {
|
||||
var score = +that.scoreField.val() || undefined;
|
||||
|
||||
that.opt.mouseout.call(that.element, score, evt);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
_bindOver: function() {
|
||||
var that = this;
|
||||
var action = that.opt.half ? 'mousemove.raty' : 'mouseover.raty';
|
||||
|
||||
this.stars.on(action, function(evt) {
|
||||
var score = that._getScoreByPosition(evt, this);
|
||||
|
||||
that._fill(score);
|
||||
|
||||
if (that.opt.half) {
|
||||
that._roundStars(score, evt);
|
||||
that._setTitle(score, evt);
|
||||
|
||||
that.self.data('score', score);
|
||||
}
|
||||
|
||||
that._target(score, evt);
|
||||
|
||||
if (that.opt.mouseover) {
|
||||
that.opt.mouseover.call(that.element, score, evt);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
_bindOverCancel: function() {
|
||||
var that = this;
|
||||
|
||||
this.cancelButton.on('mouseover.raty', function(evt) {
|
||||
if (that.self.data('readonly')) {
|
||||
return;
|
||||
}
|
||||
|
||||
var starOff = that.opt.path + that.opt.starOff;
|
||||
var icon = that.opt.cancelOn;
|
||||
|
||||
if (that.opt.starType === 'img') {
|
||||
that.stars.attr('src', starOff);
|
||||
} else {
|
||||
icon = that.opt.cancelClass + ' ' + icon;
|
||||
|
||||
that.stars.attr('class', starOff);
|
||||
}
|
||||
|
||||
that._setIcon(this, icon);
|
||||
that._target(null, evt);
|
||||
|
||||
if (that.opt.mouseover) {
|
||||
that.opt.mouseover.call(that.element, null);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
_buildScoreField: function() {
|
||||
return $('<input />', { name: this.opt.scoreName, type: 'hidden' }).appendTo(this.self);
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
_createCancel: function() {
|
||||
var icon = this.opt.path + this.opt.cancelOff;
|
||||
var button = $('<' + this.opt.starType + ' />', { title: this.opt.cancelHint, 'class': this.opt.cancelClass });
|
||||
|
||||
if (this.opt.starType === 'img') {
|
||||
button.attr({ src: icon, alt: 'x' });
|
||||
} else {
|
||||
// TODO: use $.data
|
||||
button.attr('data-alt', 'x').addClass(icon);
|
||||
}
|
||||
|
||||
if (this.opt.cancelPlace === 'left') {
|
||||
this.self.prepend(' ').prepend(button);
|
||||
} else {
|
||||
this.self.append(' ').append(button);
|
||||
}
|
||||
|
||||
this.cancelButton = button;
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
_createScore: function() {
|
||||
var score = $(this.opt.targetScore);
|
||||
|
||||
this.scoreField = score.length ? score : this._buildScoreField();
|
||||
},
|
||||
|
||||
_createStars: function() {
|
||||
for (var i = 1; i <= this.opt.number; i++) {
|
||||
var attributes = this._attributesForIndex(i);
|
||||
|
||||
$('<' + this.opt.starType + ' />', attributes).appendTo(this.element);
|
||||
|
||||
if (this.opt.space && i < this.opt.number) {
|
||||
this.self.append(' ');
|
||||
}
|
||||
}
|
||||
|
||||
this.stars = this.self.children(this.opt.starType);
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
_error: function(message) {
|
||||
$(this).text(message);
|
||||
|
||||
$.error(message);
|
||||
},
|
||||
|
||||
_executeCallbacks: function() {
|
||||
var options = ['number', 'readOnly', 'score', 'scoreName', 'target', 'path'];
|
||||
|
||||
for (var i = 0; i < options.length; i++) {
|
||||
if (typeof this.opt[options[i]] === 'function') {
|
||||
var value = this.opt[options[i]].call(this.element);
|
||||
|
||||
if (value) {
|
||||
this.opt[options[i]] = value;
|
||||
} else {
|
||||
delete this.opt[options[i]];
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
_fill: function(score) {
|
||||
var hash = 0;
|
||||
|
||||
for (var i = 1; i <= this.stars.length; i++) {
|
||||
var icon;
|
||||
var star = this.stars[i - 1];
|
||||
var turnOn = this._turnOn(i, score);
|
||||
|
||||
if (this.opt.iconRange && this.opt.iconRange.length > hash) {
|
||||
var irange = this.opt.iconRange[hash];
|
||||
|
||||
icon = this._getRangeIcon(irange, turnOn);
|
||||
|
||||
if (i <= irange.range) {
|
||||
this._setIcon(star, icon);
|
||||
}
|
||||
|
||||
if (i === irange.range) {
|
||||
hash++;
|
||||
}
|
||||
} else {
|
||||
icon = this.opt[turnOn ? 'starOn' : 'starOff'];
|
||||
|
||||
this._setIcon(star, icon);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_getDecimal: function(number, fractions) {
|
||||
var decimal = number.toString().split('.')[1];
|
||||
var result = 0;
|
||||
|
||||
if (decimal) {
|
||||
result = parseInt(decimal.slice(0, fractions), 10);
|
||||
|
||||
if (decimal.slice(1, 5) === '9999') {
|
||||
result++;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
_getRangeIcon: function(irange, turnOn) {
|
||||
return turnOn ? irange.on || this.opt.starOn : irange.off || this.opt.starOff;
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
_getScoreByPosition: function(evt, icon) {
|
||||
var score = parseInt(icon.alt || icon.getAttribute('data-alt'), 10);
|
||||
|
||||
if (this.opt.half) {
|
||||
var size = this._getWidth();
|
||||
var percent = parseFloat((evt.pageX - $(icon).offset().left) / size);
|
||||
|
||||
score = score - 1 + percent;
|
||||
}
|
||||
|
||||
return score;
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
_getHint: function(score, evt) {
|
||||
if (score !== 0 && !score) {
|
||||
return this.opt.noRatedMsg;
|
||||
}
|
||||
|
||||
var decimal = this._getDecimal(score, 1);
|
||||
var integer = Math.ceil(score);
|
||||
var group = this.opt.hints[(integer || 1) - 1];
|
||||
var hint = group;
|
||||
var set = !evt || this.isMove;
|
||||
|
||||
if (this.opt.precision) {
|
||||
if (set) {
|
||||
decimal = decimal === 0 ? 9 : decimal - 1;
|
||||
}
|
||||
|
||||
hint = group[decimal];
|
||||
} else if (this.opt.halfShow || this.opt.half) {
|
||||
decimal = set && decimal === 0 ? 1 : decimal > 5 ? 1 : 0;
|
||||
|
||||
hint = group[decimal];
|
||||
}
|
||||
|
||||
return hint === '' ? '' : hint || score;
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
_getWidth: function() {
|
||||
var width = this.stars[0].width || parseFloat(this.stars.eq(0).css('font-size'));
|
||||
|
||||
if (!width) {
|
||||
this._error('Could not get the icon width!');
|
||||
}
|
||||
|
||||
return width;
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
_lock: function() {
|
||||
var hint = this._getHint(this.scoreField.val());
|
||||
|
||||
this.element.style.cursor = '';
|
||||
this.element.title = hint;
|
||||
|
||||
this.scoreField.prop('readonly', true);
|
||||
this.stars.prop('title', hint);
|
||||
|
||||
if (this.cancelButton) {
|
||||
this.cancelButton.hide();
|
||||
}
|
||||
|
||||
this.self.data('readonly', true);
|
||||
},
|
||||
|
||||
_nameForIndex: function(i) {
|
||||
return this.opt.score && this.opt.score >= i ? 'starOn' : 'starOff';
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
_resetTitle: function() {
|
||||
for (var i = 0; i < this.opt.number; i++) {
|
||||
this.stars[i].title = this._getHint(i + 1);
|
||||
}
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
_roundHalfScore: function(score) {
|
||||
var integer = parseInt(score, 10);
|
||||
var decimal = this._getDecimal(score, 1);
|
||||
|
||||
if (decimal !== 0) {
|
||||
decimal = decimal > 5 ? 1 : 0.5;
|
||||
}
|
||||
|
||||
return integer + decimal;
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
_roundStars: function(score, evt) {
|
||||
var name = this._starName(score, evt);
|
||||
|
||||
if (name) {
|
||||
var icon = this.opt[name];
|
||||
var star = this.stars[Math.ceil(score) - 1];
|
||||
|
||||
this._setIcon(star, icon);
|
||||
} // Full down: [x.00 .. x.25]
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
_setIcon: function(star, icon) {
|
||||
star[this.opt.starType === 'img' ? 'src' : 'className'] = this.opt.path + icon;
|
||||
},
|
||||
|
||||
_setPath: function() {
|
||||
this.opt.path = this.opt.path || '';
|
||||
|
||||
if (this.opt.path && this.opt.path.slice(-1)[0] !== '/') {
|
||||
this.opt.path += '/';
|
||||
}
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
_setTarget: function(target, score) {
|
||||
if (score) {
|
||||
score = this.opt.targetFormat.toString().replace('{score}', score);
|
||||
}
|
||||
|
||||
if (target.is(':input')) {
|
||||
target.val(score);
|
||||
} else {
|
||||
target.html(score);
|
||||
}
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
_setTitle: function(score, evt) {
|
||||
if (score) {
|
||||
var integer = parseInt(Math.ceil(score), 10);
|
||||
var star = this.stars[integer - 1];
|
||||
|
||||
star.title = this._getHint(score, evt);
|
||||
}
|
||||
},
|
||||
|
||||
_starName: function(score, evt) {
|
||||
var decimal = +(score % 1).toFixed(2);
|
||||
|
||||
if (evt || this.isMove) {
|
||||
return decimal > 0.5 ? 'starOn' : 'starHalf';
|
||||
}
|
||||
|
||||
if (decimal <= this.opt.round.down) { // Down: [x.00 ... x.25]
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.opt.halfShow && decimal < this.opt.round.up) { // Half: [x.26 ... x.75]
|
||||
return 'starHalf';
|
||||
}
|
||||
|
||||
if (decimal < this.opt.round.full) { // Off: [x.26 .. x.6]
|
||||
return 'starOff';
|
||||
}
|
||||
|
||||
return 'starOn'; // Up: [x.26 ...] || [x.6 ...]
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
_target: function(score, evt) {
|
||||
if (this.opt.target) {
|
||||
var target = $(this.opt.target);
|
||||
|
||||
if (!target.length) {
|
||||
this._error('Target selector invalid or missing!');
|
||||
}
|
||||
|
||||
var mouseover = evt && evt.type === 'mouseover';
|
||||
|
||||
if (score === undefined) {
|
||||
score = this.opt.targetText;
|
||||
} else if (score === null) {
|
||||
score = mouseover ? this.opt.cancelHint : this.opt.targetText;
|
||||
} else {
|
||||
if (this.opt.targetType === 'hint') {
|
||||
score = this._getHint(score, evt);
|
||||
} else if (this.opt.precision) {
|
||||
score = parseFloat(score).toFixed(1);
|
||||
}
|
||||
|
||||
var mousemove = evt && evt.type === 'mousemove';
|
||||
|
||||
if (!mouseover && !mousemove && !this.opt.targetKeep) {
|
||||
score = this.opt.targetText;
|
||||
}
|
||||
}
|
||||
|
||||
this._setTarget(target, score);
|
||||
}
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
_turnOn: function(i, score) {
|
||||
return this.opt.single ? (i === score) : (i <= score);
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
_unlock: function() {
|
||||
this.element.style.cursor = 'pointer';
|
||||
this.element.removeAttribute('title');
|
||||
|
||||
this.scoreField.removeAttr('readonly');
|
||||
|
||||
this.self.data('readonly', false);
|
||||
|
||||
this._resetTitle();
|
||||
|
||||
if (this.cancelButton) {
|
||||
this.cancelButton.css('display', '');
|
||||
}
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
cancel: function(click) {
|
||||
if (this.self.data('readonly') !== true) {
|
||||
this[click ? 'click' : 'score'].call(this, null);
|
||||
|
||||
this.scoreField.removeAttr('value');
|
||||
}
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
click: function(score) {
|
||||
if (this.self.data('readonly') !== true) {
|
||||
score = this._adjustedScore(score);
|
||||
|
||||
this._apply(score);
|
||||
|
||||
if (this.opt.click) {
|
||||
this.opt.click.call(this.element, score, $.Event('click'));
|
||||
}
|
||||
|
||||
this._target(score);
|
||||
}
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
getScore: function() {
|
||||
var score = [];
|
||||
var value ;
|
||||
|
||||
value = this.scoreField.val();
|
||||
|
||||
score.push(value ? +value : undefined);
|
||||
|
||||
return (score.length > 1) ? score : score[0];
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
move: function(score) {
|
||||
var integer = parseInt(score, 10);
|
||||
var decimal = this._getDecimal(score, 1);
|
||||
|
||||
if (integer >= this.opt.number) {
|
||||
integer = this.opt.number - 1;
|
||||
decimal = 10;
|
||||
}
|
||||
|
||||
var width = this._getWidth();
|
||||
var steps = width / 10;
|
||||
var star = $(this.stars[integer]);
|
||||
var percent = star.offset().left + steps * decimal;
|
||||
var evt = $.Event('mousemove', { pageX: percent });
|
||||
|
||||
this.isMove = true;
|
||||
|
||||
star.trigger(evt);
|
||||
|
||||
this.isMove = false;
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
readOnly: function(readonly) {
|
||||
if (this.self.data('readonly') !== readonly) {
|
||||
if (readonly) {
|
||||
this.self.off('.raty').children(this.opt.starType).off('.raty');
|
||||
|
||||
this._lock();
|
||||
} else {
|
||||
this._binds();
|
||||
this._unlock();
|
||||
}
|
||||
|
||||
this.self.data('readonly', readonly);
|
||||
}
|
||||
},
|
||||
|
||||
// TODO: model spec
|
||||
score: function() {
|
||||
return arguments.length ? this.setScore.apply(this, arguments) : this.getScore();
|
||||
},
|
||||
|
||||
setScore: function(score) {
|
||||
if (this.self.data('readonly') !== true) {
|
||||
score = this._adjustedScore(score);
|
||||
|
||||
this._apply(score);
|
||||
this._target(score);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return Raty;
|
||||
})();
|
||||
}));
|
||||
@@ -7,22 +7,15 @@
|
||||
margin: 39px 0 22px; }
|
||||
#product_comments_block_extra .comments_note {
|
||||
margin-bottom: 5px; }
|
||||
#product_comments_block_extra .comments_note span,
|
||||
#product_comments_block_extra .star_content {
|
||||
#product_comments_block_extra .comments_note span{
|
||||
float: left;
|
||||
color: #333; }
|
||||
#product_comments_block_extra .star_content {
|
||||
margin-top: 1px; }
|
||||
#product_comments_block_extra div.star:after {
|
||||
content: "\f006";
|
||||
font-family: "FontAwesome";
|
||||
display: inline-block;
|
||||
color: #777676; }
|
||||
#product_comments_block_extra div.star_on:after {
|
||||
content: "\f005";
|
||||
font-family: "FontAwesome";
|
||||
display: inline-block;
|
||||
color: #e9ce18; }
|
||||
.raty_star i[class^="icon-"] {
|
||||
font-size: 22px;
|
||||
color: #e9ce18;
|
||||
} .raty_star i.icon-star-o {
|
||||
color: #777777;
|
||||
}
|
||||
#product_comments_block_extra .comments_advices {
|
||||
clear: both; }
|
||||
|
||||
|
||||
@@ -156,6 +156,7 @@ class ProductComments extends Module
|
||||
$id_product_comment = (int)Tools::getValue('id_product_comment');
|
||||
$comment = new ProductComment($id_product_comment);
|
||||
$comment->delete();
|
||||
$this->_html .= '<div class="conf confirm alert alert-success">'.$this->l('Comment deleted').'</div>';
|
||||
}
|
||||
elseif (Tools::isSubmit('submitEditCriterion'))
|
||||
{
|
||||
@@ -214,7 +215,8 @@ class ProductComments extends Module
|
||||
elseif ($id_product_comment = (int)Tools::getValue('approveComment'))
|
||||
{
|
||||
$comment = new ProductComment($id_product_comment);
|
||||
$comment->validate();
|
||||
if($comment->validate())
|
||||
$this->_html .= '<div class="conf confirm alert alert-success">'.$this->l('Comment approved').'</div>';
|
||||
}
|
||||
elseif ($id_product_comment = (int)Tools::getValue('noabuseComment'))
|
||||
{
|
||||
@@ -827,7 +829,6 @@ class ProductComments extends Module
|
||||
|
||||
public function hookProductTabContent($params)
|
||||
{
|
||||
$this->context->controller->addJS($this->_path.'js/jquery.rating.pack.js');
|
||||
$this->context->controller->addJS($this->_path.'js/jquery.textareaCounter.plugin.js');
|
||||
$this->context->controller->addJS($this->_path.'js/productcomments.js');
|
||||
|
||||
@@ -879,7 +880,7 @@ class ProductComments extends Module
|
||||
$this->page_name = Dispatcher::getInstance()->getController();
|
||||
if (in_array($this->page_name, array('product', 'productscomparison')))
|
||||
{
|
||||
$this->context->controller->addJS($this->_path.'js/jquery.rating.pack.js');
|
||||
$this->context->controller->addJS($this->_path.'lib/jquery.raty.js');
|
||||
if (in_array($this->page_name, array('productscomparison')))
|
||||
{
|
||||
$this->context->controller->addjqueryPlugin('cluetip');
|
||||
|
||||
@@ -24,90 +24,87 @@
|
||||
*}
|
||||
<div id="idTab5" class="tab-pane card">
|
||||
<div id="product_comments_block_tab">
|
||||
{if $comments}
|
||||
{if (!$too_early AND ($is_logged OR $allow_guests))}
|
||||
<p class="align_center open-comment-block">
|
||||
<a id="new_comment_tab_btn" class="btn button button-medium" href="#new_comment_form">
|
||||
<span>{l s='Make a review' mod='productcomments'}</span>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<div class="new_comment_form_outer" style="display: none;">
|
||||
<div id="new_comment_form">
|
||||
<form id="id_new_comment_form" action="#">
|
||||
<!-- <h2 class="page-subheading">
|
||||
{l s='Write a review' mod='productcomments'}
|
||||
</h2> -->
|
||||
<div class="row">
|
||||
<!-- {if isset($product) && $product}
|
||||
<div class="product clearfix col-xs-12 col-sm-6">
|
||||
<img src="{$productcomment_cover_image}" height="{$mediumSize.height}" width="{$mediumSize.width}" alt="{$product->name|escape:'html':'UTF-8'}" />
|
||||
<div class="product_desc">
|
||||
<p class="product_name">
|
||||
<strong>{$product->name}</strong>
|
||||
</p>
|
||||
{$product->description_short}
|
||||
</div>
|
||||
</div>
|
||||
{/if} -->
|
||||
<div class="new_comment_form_content col-xs-12 col-sm-12">
|
||||
<div id="new_comment_form_error" class="error" style="display: none;background-color: #cd5d5d;color: #ffffff;font-size: 13px;padding-left: 10px;font-weight:400;">
|
||||
<ul></ul>
|
||||
</div>
|
||||
<label for="comment_title">
|
||||
{l s='Title:' mod='productcomments'} <sup class="required">*</sup>
|
||||
</label>
|
||||
<input id="comment_title" name="title" type="text" value=""/>
|
||||
{if $criterions|@count > 0}
|
||||
<ul id="criterions_list">
|
||||
{foreach from=$criterions item='criterion'}
|
||||
<li>
|
||||
<label>{$criterion.name|escape:'html':'UTF-8'}:</label>
|
||||
<div class="star_content">
|
||||
<input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="1" />
|
||||
<input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="2" />
|
||||
<input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="3" />
|
||||
<input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="4" checked="checked" />
|
||||
<input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="5" />
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
<label for="content">
|
||||
{l s='Description:' mod='productcomments'} <sup class="required">*</sup>
|
||||
</label>
|
||||
<textarea id="content" name="content"></textarea>
|
||||
{if $allow_guests == true && !$is_logged}
|
||||
<label>
|
||||
{l s='Your name:' mod='productcomments'} <sup class="required">*</sup>
|
||||
</label>
|
||||
<input id="commentCustomerName" name="customer_name" type="text" value=""/>
|
||||
{/if}
|
||||
<div id="new_comment_form_footer">
|
||||
<input id="id_product_comment_send" name="id_product" type="hidden" value='{$id_product_comment_form}' />
|
||||
<!-- <p class="fl required"><sup>*</sup> {l s='Required fields' mod='productcomments'}</p> -->
|
||||
<p class="fr review_submit_div">
|
||||
<button id="submitNewMessage" name="submitMessage" type="submit" class="btn button button-medium">
|
||||
<span>{l s='Make Review' mod='productcomments'}</span>
|
||||
</button>
|
||||
<!-- {l s='or' mod='productcomments'} -->
|
||||
<button id="cancelreview" name="cancelreview" type="submit" class="btn button button-medium">
|
||||
<span>{l s='Cancel' mod='productcomments'}</span>
|
||||
</button>
|
||||
{if (!$too_early AND ($is_logged OR $allow_guests))}
|
||||
<p class="open-comment-block">
|
||||
<a id="new_comment_tab_btn" class="btn button button-medium" href="#new_comment_form">
|
||||
<span>
|
||||
{if $comments}
|
||||
{l s='Make a review' mod='productcomments'}
|
||||
{else}
|
||||
{l s='Be the first to write your review' mod='productcomments'}
|
||||
{/if}
|
||||
</span>
|
||||
</a>
|
||||
</p>
|
||||
<div class="new_comment_form_outer" style="display: none;">
|
||||
<div id="new_comment_form">
|
||||
<form id="id_new_comment_form" action="#">
|
||||
<!-- <h2 class="page-subheading">
|
||||
{l s='Write a review' mod='productcomments'}
|
||||
</h2> -->
|
||||
<div class="row">
|
||||
<!-- {if isset($product) && $product}
|
||||
<div class="product clearfix col-xs-12 col-sm-6">
|
||||
<img src="{$productcomment_cover_image}" height="{$mediumSize.height}" width="{$mediumSize.width}" alt="{$product->name|escape:'html':'UTF-8'}" />
|
||||
<div class="product_desc">
|
||||
<p class="product_name">
|
||||
<strong>{$product->name}</strong>
|
||||
</p>
|
||||
<div class="clearfix"></div>
|
||||
</div> <!-- #new_comment_form_footer -->
|
||||
{$product->description_short}
|
||||
</div>
|
||||
</div>
|
||||
{/if} -->
|
||||
<div class="new_comment_form_content col-xs-12 col-sm-12">
|
||||
<div id="new_comment_form_error" class="error" style="display: none;background-color: #cd5d5d;color: #ffffff;font-size: 13px;padding-left: 10px;font-weight:400;">
|
||||
<ul></ul>
|
||||
</div>
|
||||
<label for="comment_title">
|
||||
{l s='Title:' mod='productcomments'} <sup class="required">*</sup>
|
||||
</label>
|
||||
<input id="comment_title" name="title" type="text" value=""/>
|
||||
{if $criterions|@count > 0}
|
||||
<ul id="criterions_list">
|
||||
{foreach from=$criterions item='criterion'}
|
||||
<li>
|
||||
<label>{$criterion.name|escape:'html':'UTF-8'}:</label>
|
||||
<div class="raty_star" data-score-name="criterion[{$criterion.id_product_comment_criterion|round}]"></div>
|
||||
<div class="clearfix"></div>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
<label for="content">
|
||||
{l s='Description:' mod='productcomments'} <sup class="required">*</sup>
|
||||
</label>
|
||||
<textarea id="content" name="content"></textarea>
|
||||
{if $allow_guests == true && !$is_logged}
|
||||
<label>
|
||||
{l s='Your name:' mod='productcomments'} <sup class="required">*</sup>
|
||||
</label>
|
||||
<input id="commentCustomerName" name="customer_name" type="text" value=""/>
|
||||
{/if}
|
||||
<div id="new_comment_form_footer">
|
||||
<input id="id_product_comment_send" name="id_product" type="hidden" value='{$id_product_comment_form}' />
|
||||
<!-- <p class="fl required"><sup>*</sup> {l s='Required fields' mod='productcomments'}</p> -->
|
||||
<p class="fr review_submit_div">
|
||||
<button id="submitNewMessage" name="submitMessage" type="submit" class="btn button button-medium">
|
||||
<span>{l s='Make Review' mod='productcomments'}</span>
|
||||
</button>
|
||||
<!-- {l s='or' mod='productcomments'} -->
|
||||
<button id="cancelreview" name="cancelreview" type="submit" class="btn button button-medium">
|
||||
<span>{l s='Cancel' mod='productcomments'}</span>
|
||||
</button>
|
||||
</p>
|
||||
<div class="clearfix"></div>
|
||||
</div> <!-- #new_comment_form_footer -->
|
||||
</div>
|
||||
</form><!-- /end new_comment_form_content -->
|
||||
</div>
|
||||
</div>
|
||||
</form><!-- /end new_comment_form_content -->
|
||||
</div>
|
||||
|
||||
|
||||
{/if}
|
||||
</div>
|
||||
<hr>
|
||||
{/if}
|
||||
{if $comments}
|
||||
{foreach from=$comments item=comment}
|
||||
{if $comment.content}
|
||||
<div class="reviews_blogs">
|
||||
@@ -120,13 +117,7 @@
|
||||
<p>{$comment.title}</p>
|
||||
</div>
|
||||
<div class="star_content clearfix" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
|
||||
{section name="i" start=0 loop=5 step=1}
|
||||
{if $comment.grade le $smarty.section.i.index}
|
||||
<div class="star"></div>
|
||||
{else}
|
||||
<div class="star star_on"></div>
|
||||
{/if}
|
||||
{/section}
|
||||
<div class="raty_star readonly" data-score="{$comment.grade}"></div>
|
||||
<meta itemprop="worstRating" content = "0" />
|
||||
<meta itemprop="ratingValue" content = "{$comment.grade|escape:'html':'UTF-8'}" />
|
||||
<meta itemprop="bestRating" content = "5" />
|
||||
@@ -167,87 +158,7 @@
|
||||
{/if}
|
||||
{/foreach}
|
||||
{else}
|
||||
{if (!$too_early AND ($is_logged OR $allow_guests))}
|
||||
<p class="align_center">
|
||||
<a id="new_comment_tab_btn" class="btn button button-medium" href="#new_comment_form">
|
||||
<span>{l s='Be the first to write your review' mod='productcomments'}</span>
|
||||
</a>
|
||||
</p>
|
||||
<div class="new_comment_form_outer" style="display: none;">
|
||||
<div id="new_comment_form">
|
||||
<form id="id_new_comment_form" action="#">
|
||||
<!-- <h2 class="page-subheading">
|
||||
{l s='Write a review' mod='productcomments'}
|
||||
</h2> -->
|
||||
<div class="row">
|
||||
<!-- {if isset($product) && $product}
|
||||
<div class="product clearfix col-xs-12 col-sm-6">
|
||||
<img src="{$productcomment_cover_image}" height="{$mediumSize.height}" width="{$mediumSize.width}" alt="{$product->name|escape:'html':'UTF-8'}" />
|
||||
<div class="product_desc">
|
||||
<p class="product_name">
|
||||
<strong>{$product->name}</strong>
|
||||
</p>
|
||||
{$product->description_short}
|
||||
</div>
|
||||
</div>
|
||||
{/if} -->
|
||||
<div class="new_comment_form_content col-xs-12 col-sm-12">
|
||||
<div id="new_comment_form_error" class="error" style="display: none;background-color: #cd5d5d;color: #ffffff;font-size: 13px;padding-left: 10px;font-weight:400;">
|
||||
<ul></ul>
|
||||
</div>
|
||||
<label for="comment_title">
|
||||
{l s='Title:' mod='productcomments'} <sup class="required">*</sup>
|
||||
</label>
|
||||
<input id="comment_title" name="title" type="text" value=""/>
|
||||
{if $criterions|@count > 0}
|
||||
<ul id="criterions_list">
|
||||
{foreach from=$criterions item='criterion'}
|
||||
<li>
|
||||
<label>{$criterion.name|escape:'html':'UTF-8'}:</label>
|
||||
<div class="star_content">
|
||||
<input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="1" />
|
||||
<input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="2" />
|
||||
<input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="3" />
|
||||
<input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="4" checked="checked" />
|
||||
<input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="5" />
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
<label for="content">
|
||||
{l s='Description:' mod='productcomments'} <sup class="required">*</sup>
|
||||
</label>
|
||||
<textarea id="content" name="content"></textarea>
|
||||
{if $allow_guests == true && !$is_logged}
|
||||
<label>
|
||||
{l s='Your name:' mod='productcomments'} <sup class="required">*</sup>
|
||||
</label>
|
||||
<input id="commentCustomerName" name="customer_name" type="text" value=""/>
|
||||
{/if}
|
||||
<div id="new_comment_form_footer">
|
||||
<input id="id_product_comment_send" name="id_product" type="hidden" value='{$id_product_comment_form}' />
|
||||
<!-- <p class="fl required"><sup>*</sup> {l s='Required fields' mod='productcomments'}</p> -->
|
||||
<p class="fr review_submit_div">
|
||||
<button id="submitNewMessage" name="submitMessage" type="submit" class="btn button button-medium">
|
||||
<span>{l s='Make Review' mod='productcomments'}</span>
|
||||
</button>
|
||||
<!-- {l s='or' mod='productcomments'} -->
|
||||
<button id="cancelreview" name="cancelreview" type="submit" class="btn button button-medium">
|
||||
<span>{l s='Cancel' mod='productcomments'}</span>
|
||||
</button>
|
||||
</p>
|
||||
<div class="clearfix"></div>
|
||||
</div> <!-- #new_comment_form_footer -->
|
||||
</div>
|
||||
</div>
|
||||
</form><!-- /end new_comment_form_content -->
|
||||
</div>
|
||||
</div>
|
||||
{else}
|
||||
<p class="align_center no_reviews_cond_block">{l s='No customer reviews for the moment.' mod='productcomments'}</p>
|
||||
{/if}
|
||||
{/if}
|
||||
</div> <!-- #product_comments_block_tab -->
|
||||
</div>
|
||||
|
||||
@@ -7,22 +7,15 @@
|
||||
margin: 39px 0 22px; }
|
||||
#product_comments_block_extra .comments_note {
|
||||
margin-bottom: 5px; }
|
||||
#product_comments_block_extra .comments_note span,
|
||||
#product_comments_block_extra .star_content {
|
||||
#product_comments_block_extra .comments_note span{
|
||||
float: left;
|
||||
color: #333; }
|
||||
#product_comments_block_extra .star_content {
|
||||
margin-top: 1px; }
|
||||
#product_comments_block_extra div.star:after {
|
||||
content: "\f006";
|
||||
font-family: "FontAwesome";
|
||||
display: inline-block;
|
||||
color: #777676; }
|
||||
#product_comments_block_extra div.star_on:after {
|
||||
content: "\f005";
|
||||
font-family: "FontAwesome";
|
||||
display: inline-block;
|
||||
color: #e9ce18; }
|
||||
.raty_star i[class^="icon-"] {
|
||||
font-size: 22px;
|
||||
color: #e9ce18;
|
||||
} .raty_star i.icon-star-o {
|
||||
color: #777777;
|
||||
}
|
||||
#product_comments_block_extra .comments_advices {
|
||||
clear: both; }
|
||||
|
||||
|
||||
@@ -23,9 +23,17 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
$(document).ready(function(){
|
||||
$('input.star').rating();
|
||||
$('.auto-submit-star').rating();
|
||||
|
||||
$('.raty_star').raty({
|
||||
starType : 'i',
|
||||
starOff: 'icon-star-o',
|
||||
starOn: 'icon-star',
|
||||
halfShow: false,
|
||||
score: 3,
|
||||
hints: null,
|
||||
readOnly: function() {
|
||||
return $(this).hasClass('readonly');
|
||||
}
|
||||
});
|
||||
$('#new_comment_tab_btn').on('click', function(e){
|
||||
e.preventDefault();
|
||||
$('.new_comment_form_outer').show();
|
||||
|
||||
@@ -24,90 +24,87 @@
|
||||
*}
|
||||
<div id="idTab5" class="tab-pane card">
|
||||
<div id="product_comments_block_tab">
|
||||
{if $comments}
|
||||
{if (!$too_early AND ($is_logged OR $allow_guests))}
|
||||
<p class="align_center open-comment-block">
|
||||
<a id="new_comment_tab_btn" class="btn button button-medium" href="#new_comment_form">
|
||||
<span>{l s='Make a review' mod='productcomments'}</span>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<div class="new_comment_form_outer" style="display: none;">
|
||||
<div id="new_comment_form">
|
||||
<form id="id_new_comment_form" action="#">
|
||||
<!-- <h2 class="page-subheading">
|
||||
{l s='Write a review' mod='productcomments'}
|
||||
</h2> -->
|
||||
<div class="row">
|
||||
<!-- {if isset($product) && $product}
|
||||
<div class="product clearfix col-xs-12 col-sm-6">
|
||||
<img src="{$productcomment_cover_image}" height="{$mediumSize.height}" width="{$mediumSize.width}" alt="{$product->name|escape:'html':'UTF-8'}" />
|
||||
<div class="product_desc">
|
||||
<p class="product_name">
|
||||
<strong>{$product->name}</strong>
|
||||
</p>
|
||||
{$product->description_short}
|
||||
</div>
|
||||
</div>
|
||||
{/if} -->
|
||||
<div class="new_comment_form_content col-xs-12 col-sm-12">
|
||||
<div id="new_comment_form_error" class="error" style="display: none;background-color: #cd5d5d;color: #ffffff;font-size: 13px;padding-left: 10px;font-weight:400;">
|
||||
<ul></ul>
|
||||
</div>
|
||||
<label for="comment_title">
|
||||
{l s='Title:' mod='productcomments'} <sup class="required">*</sup>
|
||||
</label>
|
||||
<input id="comment_title" name="title" type="text" value=""/>
|
||||
{if $criterions|@count > 0}
|
||||
<ul id="criterions_list">
|
||||
{foreach from=$criterions item='criterion'}
|
||||
<li>
|
||||
<label>{$criterion.name|escape:'html':'UTF-8'}:</label>
|
||||
<div class="star_content">
|
||||
<input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="1" />
|
||||
<input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="2" />
|
||||
<input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="3" />
|
||||
<input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="4" checked="checked" />
|
||||
<input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="5" />
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
<label for="content">
|
||||
{l s='Description:' mod='productcomments'} <sup class="required">*</sup>
|
||||
</label>
|
||||
<textarea id="content" name="content"></textarea>
|
||||
{if $allow_guests == true && !$is_logged}
|
||||
<label>
|
||||
{l s='Your name:' mod='productcomments'} <sup class="required">*</sup>
|
||||
</label>
|
||||
<input id="commentCustomerName" name="customer_name" type="text" value=""/>
|
||||
{/if}
|
||||
<div id="new_comment_form_footer">
|
||||
<input id="id_product_comment_send" name="id_product" type="hidden" value='{$id_product_comment_form}' />
|
||||
<!-- <p class="fl required"><sup>*</sup> {l s='Required fields' mod='productcomments'}</p> -->
|
||||
<p class="fr review_submit_div">
|
||||
<button id="submitNewMessage" name="submitMessage" type="submit" class="btn button button-medium">
|
||||
<span>{l s='Make Review' mod='productcomments'}</span>
|
||||
</button>
|
||||
<!-- {l s='or' mod='productcomments'} -->
|
||||
<button id="cancelreview" name="cancelreview" type="submit" class="btn button button-medium">
|
||||
<span>{l s='Cancel' mod='productcomments'}</span>
|
||||
</button>
|
||||
{if (!$too_early AND ($is_logged OR $allow_guests))}
|
||||
<p class="open-comment-block">
|
||||
<a id="new_comment_tab_btn" class="btn button button-medium" href="#new_comment_form">
|
||||
<span>
|
||||
{if $comments}
|
||||
{l s='Make a review' mod='productcomments'}
|
||||
{else}
|
||||
{l s='Be the first to write your review' mod='productcomments'}
|
||||
{/if}
|
||||
</span>
|
||||
</a>
|
||||
</p>
|
||||
<div class="new_comment_form_outer" style="display: none;">
|
||||
<div id="new_comment_form">
|
||||
<form id="id_new_comment_form" action="#">
|
||||
<!-- <h2 class="page-subheading">
|
||||
{l s='Write a review' mod='productcomments'}
|
||||
</h2> -->
|
||||
<div class="row">
|
||||
<!-- {if isset($product) && $product}
|
||||
<div class="product clearfix col-xs-12 col-sm-6">
|
||||
<img src="{$productcomment_cover_image}" height="{$mediumSize.height}" width="{$mediumSize.width}" alt="{$product->name|escape:'html':'UTF-8'}" />
|
||||
<div class="product_desc">
|
||||
<p class="product_name">
|
||||
<strong>{$product->name}</strong>
|
||||
</p>
|
||||
<div class="clearfix"></div>
|
||||
</div> <!-- #new_comment_form_footer -->
|
||||
{$product->description_short}
|
||||
</div>
|
||||
</div>
|
||||
{/if} -->
|
||||
<div class="new_comment_form_content col-xs-12 col-sm-12">
|
||||
<div id="new_comment_form_error" class="error" style="display: none;background-color: #cd5d5d;color: #ffffff;font-size: 13px;padding-left: 10px;font-weight:400;">
|
||||
<ul></ul>
|
||||
</div>
|
||||
<label for="comment_title">
|
||||
{l s='Title:' mod='productcomments'} <sup class="required">*</sup>
|
||||
</label>
|
||||
<input id="comment_title" name="title" type="text" value=""/>
|
||||
{if $criterions|@count > 0}
|
||||
<ul id="criterions_list">
|
||||
{foreach from=$criterions item='criterion'}
|
||||
<li>
|
||||
<label>{$criterion.name|escape:'html':'UTF-8'}:</label>
|
||||
<div class="raty_star" data-score-name="criterion[{$criterion.id_product_comment_criterion|round}]"></div>
|
||||
<div class="clearfix"></div>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
<label for="content">
|
||||
{l s='Description:' mod='productcomments'} <sup class="required">*</sup>
|
||||
</label>
|
||||
<textarea id="content" name="content"></textarea>
|
||||
{if $allow_guests == true && !$is_logged}
|
||||
<label>
|
||||
{l s='Your name:' mod='productcomments'} <sup class="required">*</sup>
|
||||
</label>
|
||||
<input id="commentCustomerName" name="customer_name" type="text" value=""/>
|
||||
{/if}
|
||||
<div id="new_comment_form_footer">
|
||||
<input id="id_product_comment_send" name="id_product" type="hidden" value='{$id_product_comment_form}' />
|
||||
<!-- <p class="fl required"><sup>*</sup> {l s='Required fields' mod='productcomments'}</p> -->
|
||||
<p class="fr review_submit_div">
|
||||
<button id="submitNewMessage" name="submitMessage" type="submit" class="btn button button-medium">
|
||||
<span>{l s='Make Review' mod='productcomments'}</span>
|
||||
</button>
|
||||
<!-- {l s='or' mod='productcomments'} -->
|
||||
<button id="cancelreview" name="cancelreview" type="submit" class="btn button button-medium">
|
||||
<span>{l s='Cancel' mod='productcomments'}</span>
|
||||
</button>
|
||||
</p>
|
||||
<div class="clearfix"></div>
|
||||
</div> <!-- #new_comment_form_footer -->
|
||||
</div>
|
||||
</form><!-- /end new_comment_form_content -->
|
||||
</div>
|
||||
</div>
|
||||
</form><!-- /end new_comment_form_content -->
|
||||
</div>
|
||||
|
||||
|
||||
{/if}
|
||||
</div>
|
||||
<hr>
|
||||
{/if}
|
||||
{if $comments}
|
||||
{foreach from=$comments item=comment}
|
||||
{if $comment.content}
|
||||
<div class="reviews_blogs">
|
||||
@@ -120,13 +117,7 @@
|
||||
<p>{$comment.title}</p>
|
||||
</div>
|
||||
<div class="star_content clearfix" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
|
||||
{section name="i" start=0 loop=5 step=1}
|
||||
{if $comment.grade le $smarty.section.i.index}
|
||||
<div class="star"></div>
|
||||
{else}
|
||||
<div class="star star_on"></div>
|
||||
{/if}
|
||||
{/section}
|
||||
<div class="raty_star readonly" data-score="{$comment.grade}"></div>
|
||||
<meta itemprop="worstRating" content = "0" />
|
||||
<meta itemprop="ratingValue" content = "{$comment.grade|escape:'html':'UTF-8'}" />
|
||||
<meta itemprop="bestRating" content = "5" />
|
||||
@@ -167,87 +158,7 @@
|
||||
{/if}
|
||||
{/foreach}
|
||||
{else}
|
||||
{if (!$too_early AND ($is_logged OR $allow_guests))}
|
||||
<p class="align_center">
|
||||
<a id="new_comment_tab_btn" class="btn button button-medium" href="#new_comment_form">
|
||||
<span>{l s='Be the first to write your review' mod='productcomments'}</span>
|
||||
</a>
|
||||
</p>
|
||||
<div class="new_comment_form_outer" style="display: none;">
|
||||
<div id="new_comment_form">
|
||||
<form id="id_new_comment_form" action="#">
|
||||
<!-- <h2 class="page-subheading">
|
||||
{l s='Write a review' mod='productcomments'}
|
||||
</h2> -->
|
||||
<div class="row">
|
||||
<!-- {if isset($product) && $product}
|
||||
<div class="product clearfix col-xs-12 col-sm-6">
|
||||
<img src="{$productcomment_cover_image}" height="{$mediumSize.height}" width="{$mediumSize.width}" alt="{$product->name|escape:'html':'UTF-8'}" />
|
||||
<div class="product_desc">
|
||||
<p class="product_name">
|
||||
<strong>{$product->name}</strong>
|
||||
</p>
|
||||
{$product->description_short}
|
||||
</div>
|
||||
</div>
|
||||
{/if} -->
|
||||
<div class="new_comment_form_content col-xs-12 col-sm-12">
|
||||
<div id="new_comment_form_error" class="error" style="display: none;background-color: #cd5d5d;color: #ffffff;font-size: 13px;padding-left: 10px;font-weight:400;">
|
||||
<ul></ul>
|
||||
</div>
|
||||
<label for="comment_title">
|
||||
{l s='Title:' mod='productcomments'} <sup class="required">*</sup>
|
||||
</label>
|
||||
<input id="comment_title" name="title" type="text" value=""/>
|
||||
{if $criterions|@count > 0}
|
||||
<ul id="criterions_list">
|
||||
{foreach from=$criterions item='criterion'}
|
||||
<li>
|
||||
<label>{$criterion.name|escape:'html':'UTF-8'}:</label>
|
||||
<div class="star_content">
|
||||
<input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="1" />
|
||||
<input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="2" />
|
||||
<input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="3" />
|
||||
<input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="4" checked="checked" />
|
||||
<input class="star" type="radio" name="criterion[{$criterion.id_product_comment_criterion|round}]" value="5" />
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
<label for="content">
|
||||
{l s='Description:' mod='productcomments'} <sup class="required">*</sup>
|
||||
</label>
|
||||
<textarea id="content" name="content"></textarea>
|
||||
{if $allow_guests == true && !$is_logged}
|
||||
<label>
|
||||
{l s='Your name:' mod='productcomments'} <sup class="required">*</sup>
|
||||
</label>
|
||||
<input id="commentCustomerName" name="customer_name" type="text" value=""/>
|
||||
{/if}
|
||||
<div id="new_comment_form_footer">
|
||||
<input id="id_product_comment_send" name="id_product" type="hidden" value='{$id_product_comment_form}' />
|
||||
<!-- <p class="fl required"><sup>*</sup> {l s='Required fields' mod='productcomments'}</p> -->
|
||||
<p class="fr review_submit_div">
|
||||
<button id="submitNewMessage" name="submitMessage" type="submit" class="btn button button-medium">
|
||||
<span>{l s='Make Review' mod='productcomments'}</span>
|
||||
</button>
|
||||
<!-- {l s='or' mod='productcomments'} -->
|
||||
<button id="cancelreview" name="cancelreview" type="submit" class="btn button button-medium">
|
||||
<span>{l s='Cancel' mod='productcomments'}</span>
|
||||
</button>
|
||||
</p>
|
||||
<div class="clearfix"></div>
|
||||
</div> <!-- #new_comment_form_footer -->
|
||||
</div>
|
||||
</div>
|
||||
</form><!-- /end new_comment_form_content -->
|
||||
</div>
|
||||
</div>
|
||||
{else}
|
||||
<p class="align_center no_reviews_cond_block">{l s='No customer reviews for the moment.' mod='productcomments'}</p>
|
||||
{/if}
|
||||
{/if}
|
||||
</div> <!-- #product_comments_block_tab -->
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user