Merge pull request #12398 from prssanna/rating-fix
This commit is contained in:
commit
4efe2291c1
2 changed files with 9 additions and 6 deletions
|
|
@ -52,7 +52,7 @@ frappe.ui.form.ControlRating = frappe.ui.form.ControlInt.extend({
|
|||
return cint(this.value, null);
|
||||
},
|
||||
set_formatted_input(value) {
|
||||
let el = $(this.input_area).find('i');
|
||||
let el = $(this.input_area).find('svg');
|
||||
el.children('svg').prevObject.each( function(e) {
|
||||
if (e < value) {
|
||||
$(this).addClass('star-click');
|
||||
|
|
|
|||
|
|
@ -61,11 +61,14 @@ frappe.form.formatters = {
|
|||
return frappe.form.formatters._right(flt(value, precision) + "%", options);
|
||||
},
|
||||
Rating: function(value) {
|
||||
return `<span class="rating">
|
||||
${Array.from(new Array(5)).map((_, i) =>
|
||||
`<i class="fa fa-fw fa-star ${i < (value || 0) ? "star-click": "" } star-icon" data-idx="${(i+1)}"></i>`
|
||||
).join('')}
|
||||
</span>`;
|
||||
const rating_html = `${[1, 2, 3, 4, 5].map(i =>
|
||||
`<svg class="icon icon-md ${i <= (value || 0) ? "star-click": "" }" data-idx="${i}">
|
||||
<use href="#icon-star"></use>
|
||||
</svg>`
|
||||
).join('')}`;
|
||||
return `<div class="rating">
|
||||
${rating_html}
|
||||
</div>`;
|
||||
},
|
||||
Currency: function (value, docfield, options, doc) {
|
||||
var currency = frappe.meta.get_field_currency(docfield, doc);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue