Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Commit

Permalink
feat(checkbox actions): no longer show success modals, but spinning icon
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiSchwarz-cnic committed Oct 11, 2021
1 parent 6b4c2a5 commit 4a0b1d9
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,17 +207,15 @@ hr.xs {
.clickable .checkboxarea label {
cursor: pointer;
}
.fas.fa-spinner,
.fas.fa-check-square,
.far.fa-square {
position: absolute;
font-size: 21px;
}
.far.fa-square.avail {
color: #00a850;
}
.fas.fa-check-square {
position: absolute;
font-size: 21px;
}
.fas.fa-check-square.avail {
color: #00a850;
}
Expand Down
25 changes: 19 additions & 6 deletions modules/addons/ispapidomaincheck/lib/Client/assets/client.all.js
Original file line number Diff line number Diff line change
Expand Up @@ -670,9 +670,9 @@ ShoppingCart.prototype.load = async function () {
this.items = {};
}
if (Object.keys(this.items).length) {
$('.orderbutton').removeClass('hidden');
$('.orderbutton').css('visibility', 'visible');
} else {
$('.orderbutton').addClass('hidden').off('click');
$('.orderbutton').css('visibility', 'hidden').off('click');
}
};
ShoppingCart.prototype.getOrder = function (sr) {
Expand Down Expand Up @@ -743,7 +743,7 @@ ShoppingCart.prototype.addOrderDomain = function (sr, successmsg, errmsg) {
(async function () {
await cart.load();
sr.generate();
$.growl.notice(successmsg);
//$.growl.notice(successmsg);
})();
} else {
$.growl.error(errmsg);
Expand All @@ -756,7 +756,7 @@ ShoppingCart.prototype.addOrderDomain = function (sr, successmsg, errmsg) {
(async function () {
await cart.load();
sr.generate();
$.growl.notice(successmsg);
//$.growl.notice(successmsg);
})();
}
})
Expand Down Expand Up @@ -819,7 +819,7 @@ ShoppingCart.prototype.removeOrderDomain = function (sr, successmsg, errmsg) {
(async function () {
await cart.load();
sr.generate();
$.growl.notice(successmsg);
//$.growl.notice(successmsg);
})();
return;
}
Expand All @@ -842,9 +842,15 @@ ShoppingCart.prototype.orderClickHandler = function (e) {
return;
}
}

let eL = $(e.target).closest('div.clickable');
if (e.data.action === 'add') {
eL = eL.find('i.fa-square');
eL.removeClass('far fa-square').addClass('fas fa-spinner fa-spin');
this.addOrder(e.data.sr);
} else {
eL = eL.find('i.fa-check-square');
eL.removeClass('fas fa-check-square').addClass('fas fa-spinner fa-spin');
this.removeOrder(e.data.sr);
}
};
Expand Down Expand Up @@ -905,7 +911,7 @@ ShoppingCart.prototype.requestBackorderAction = function (
delete ds.backorders[sr.data.PC];
}
sr.generate();
$.growl.notice(successmsg);
//$.growl.notice(successmsg);
} else if (data.CODE === 531) {
$.growl.error({message: translations.login_required});
} else {
Expand Down Expand Up @@ -1214,6 +1220,13 @@ SearchResult.prototype.showAvailable = function () {
`<span>${translations.domain_added_to_cart}</span><br/><span class="registerprice added hxdata" data-registerprice="${regpriceraw}" data-term="${termcfg.initialTerm}">${regprice}</span>`,
);
}

row.element
.find('span.checkboxarea')
.find('i.fa-spin')
.removeClass('fas fa-spinner fa-spin')
.addClass(row.order ? 'fas fa-check-square' : 'far fa-square');

if (row.order) {
if (multiTerms) {
row.element
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions modules/addons/ispapidomaincheck/lib/Client/assets/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,15 @@ hr.xs {
.clickable .checkboxarea label {
cursor: pointer;
}
.fas.fa-spinner,
.fas.fa-check-square,
.far.fa-square {
position: absolute;
font-size: 21px;
}
.far.fa-square.avail {
color: #00a850;
}
.fas.fa-check-square {
position: absolute;
font-size: 21px;
}
.fas.fa-check-square.avail {
color: #00a850;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,13 @@ SearchResult.prototype.showAvailable = function () {
`<span>${translations.domain_added_to_cart}</span><br/><span class="registerprice added hxdata" data-registerprice="${regpriceraw}" data-term="${termcfg.initialTerm}">${regprice}</span>`,
);
}

row.element
.find('span.checkboxarea')
.find('i.fa-spin')
.removeClass('fas fa-spinner fa-spin')
.addClass(row.order ? 'fas fa-check-square' : 'far fa-square');

if (row.order) {
if (multiTerms) {
row.element
Expand Down
18 changes: 12 additions & 6 deletions modules/addons/ispapidomaincheck/lib/Client/assets/shoppingcart.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ ShoppingCart.prototype.load = async function () {
this.items = {};
}
if (Object.keys(this.items).length) {
$('.orderbutton').removeClass('hidden');
$('.orderbutton').css('visibility', 'visible');
} else {
$('.orderbutton').addClass('hidden').off('click');
$('.orderbutton').css('visibility', 'hidden').off('click');
}
};
ShoppingCart.prototype.getOrder = function (sr) {
Expand Down Expand Up @@ -88,7 +88,7 @@ ShoppingCart.prototype.addOrderDomain = function (sr, successmsg, errmsg) {
(async function () {
await cart.load();
sr.generate();
$.growl.notice(successmsg);
//$.growl.notice(successmsg);
})();
} else {
$.growl.error(errmsg);
Expand All @@ -101,7 +101,7 @@ ShoppingCart.prototype.addOrderDomain = function (sr, successmsg, errmsg) {
(async function () {
await cart.load();
sr.generate();
$.growl.notice(successmsg);
//$.growl.notice(successmsg);
})();
}
})
Expand Down Expand Up @@ -164,7 +164,7 @@ ShoppingCart.prototype.removeOrderDomain = function (sr, successmsg, errmsg) {
(async function () {
await cart.load();
sr.generate();
$.growl.notice(successmsg);
//$.growl.notice(successmsg);
})();
return;
}
Expand All @@ -187,9 +187,15 @@ ShoppingCart.prototype.orderClickHandler = function (e) {
return;
}
}

let eL = $(e.target).closest('div.clickable');
if (e.data.action === 'add') {
eL = eL.find('i.fa-square');
eL.removeClass('far fa-square').addClass('fas fa-spinner fa-spin');
this.addOrder(e.data.sr);
} else {
eL = eL.find('i.fa-check-square');
eL.removeClass('fas fa-check-square').addClass('fas fa-spinner fa-spin');
this.removeOrder(e.data.sr);
}
};
Expand Down Expand Up @@ -250,7 +256,7 @@ ShoppingCart.prototype.requestBackorderAction = function (
delete ds.backorders[sr.data.PC];
}
sr.generate();
$.growl.notice(successmsg);
//$.growl.notice(successmsg);
} else if (data.CODE === 531) {
$.growl.error({message: translations.login_required});
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
<hr>
</div>
</div>
<p align="center"><a class="btn btn-danger orderbutton hidden" href="{$WEB_ROOT}/cart.php?a=confdomains" role="button">{$_lang.checkoutbutton} &raquo;</a></p>
<p align="center"><a class="btn btn-danger orderbutton" style="visibility:hidden" href="{$WEB_ROOT}/cart.php?a=confdomains" role="button">{$_lang.checkoutbutton} &raquo;</a></p>
</div>
</form>
</div>
Expand All @@ -136,7 +136,7 @@
<div class="result-item" id="resultsarea" style="display:none;">
<form id="domainform" action="cart.php?a=add&domain=register" method="post">
<div class="row row1 search-results clear" id="searchresults"></div>
<p align="center"><button id="loadmorebutton" type="button" class="btn btn-secondary" style="display:none">{$_lang.loadmorebutton} &raquo;</button> <a class="btn btn-danger orderbutton hidden" href="{$WEB_ROOT}/cart.php?a=confdomains" role="button">{$_lang.checkoutbutton} &raquo;</a></p>
<p align="center"><button id="loadmorebutton" type="button" class="btn btn-secondary" style="display:none">{$_lang.loadmorebutton} &raquo;</button> <a class="btn btn-danger orderbutton" style="visibility:hidden" href="{$WEB_ROOT}/cart.php?a=confdomains" role="button">{$_lang.checkoutbutton} &raquo;</a></p>
<hr>
</form>
</div>
Expand Down

0 comments on commit 4a0b1d9

Please sign in to comment.