Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Banlist hover #640

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion assets/banCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module.exports = function ($scope, io) {
banMessage: ($scope.query.banMessage || '') + messageAddition,
banlistEntry: $scope.query.banlistEntry || '',
tradeNote: $scope.query.tradeNote || '',
tradeNoteDescription: $scope.query.tradeNoteDescription || '',
duration: $scope.query.duration || '',
knownAlt: $scope.query.knownAlt || '',
additionalFCs: $scope.query.additionalFCs || ''
Expand All @@ -18,6 +19,7 @@ module.exports = function ($scope, io) {
$scope.banError = "";
$scope.indexOk = {};
$scope.indexSpin = {};
$scope.tradeNoteFull = "";

$scope.focus = {
gavegot: false
Expand All @@ -34,6 +36,12 @@ module.exports = function ($scope, io) {
return;
}

if ($scope.banInfo.tradeNote == "Some" && !$scope.banInfo.tradeNoteDescription) {
$scope.banError = "Please specify details for hover.";
$scope.indexSpin.ban = false;
return;
}

var names = ['username', 'knownAlt'];
for (let i = 0; i < names.length; i++) {

Expand Down Expand Up @@ -81,12 +89,20 @@ module.exports = function ($scope, io) {
}
FCs = $scope.banInfo.additionalFCs.match(/(\d{4}-){2}\d{4}/g);
}

if ($scope.banInfo.tradeNote == "Some" && $scope.banInfo.tradeNoteDescription) {
$scope.tradeNoteFull = "[" + $scope.banInfo.tradeNoteDescription + "](#b \"" + $scope.banInfo.tradeNote + " (hover)\")" ;
}
else {
$scope.tradeNoteFull = $scope.banInfo.tradeNote;
}

var post = {
"username": $scope.banInfo.username,
"banNote": $scope.banInfo.banNote,
"banMessage": $scope.banInfo.banMessage,
"banlistEntry": $scope.banInfo.banlistEntry,
"tradeNote": $scope.banInfo.tradeNote,
"tradeNote": $scope.tradeNoteFull,
"duration": parseInt($scope.banInfo.duration),
"knownAlt": $scope.banInfo.knownAlt,
"additionalFCs": FCs
Expand Down
22 changes: 21 additions & 1 deletion assets/views/home/banuser.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,29 @@

<ng-tooltip data-label="Retrading allowed?"
title="The entry under 'Retrading allowed?' on the public banlist">
<input type="text" class="form-control" ng-model="banInfo.tradeNote">
<label class="radio-inline">
<input type="radio" value="Yes" ng-model="banInfo.tradeNote">
Yes
</label>

<label class="radio-inline">
<input type="radio" value="No" ng-model="banInfo.tradeNote">
No
</label>

<label class="radio-inline">
<input type="radio" value="Some" ng-model="banInfo.tradeNote">
Some
</label>

</ng-tooltip>

<ng-tooltip ng-if="banInfo.tradeNote == 'Some'" data-label="Retrading - hover note"
title="Details visible after hovering 'Retrading allowed?' value. Leave blank for no hover.">
<input type="text" class="form-control" ng-model="banInfo.tradeNoteDescription">
</ng-tooltip>


<ng-tooltip data-label="Duration"
title="The number of days that the user will be banned for. Leave blank for a permanent ban.">
<input type="text" class="form-control" ng-model="banInfo.duration">
Expand Down