mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-05-05 21:16:26 -05:00
Teambuilder validation eligibility tweaks
Disable Validate button until the user has at least one pokemon on their team
This commit is contained in:
parent
f74a3ea50d
commit
97c210e1c5
|
|
@ -980,10 +980,12 @@
|
|||
if (this.curSetList.length && !this.curSetList[this.curSetList.length - 1].species) {
|
||||
this.curSetList.splice(this.curSetList.length - 1, 1);
|
||||
}
|
||||
|
||||
if (exports.BattleFormats) {
|
||||
buf += '<li class="format-select">';
|
||||
buf += '<label class="label">Format:</label><button class="select formatselect teambuilderformatselect" name="format" value="' + this.curTeam.format + '">' + (Tools.escapeFormat(this.curTeam.format) || '<em>Select a format</em>') + '</button>';
|
||||
buf += ' <button name="validate" class="button"><i class="fa fa-check"></i> Validate</button></li>';
|
||||
var btnClass = 'button' + (!this.curSetList.length || !this.curTeam.format ? ' disabled' : '');
|
||||
buf += ' <button name="validate" class="' + btnClass + '"><i class="fa fa-check"></i> Validate</button></li>';
|
||||
}
|
||||
if (!this.curSetList.length) {
|
||||
buf += '<li><em>you have no pokemon lol</em></li>';
|
||||
|
|
@ -1144,10 +1146,20 @@
|
|||
},
|
||||
validate: function () {
|
||||
var format = this.curTeam.format;
|
||||
var prerequisiteErrors = [];
|
||||
if (!format) {
|
||||
app.addPopupMessage('You need to pick a format to validate your team.');
|
||||
prerequisiteErrors.push('- You need to pick a format to validate your team.');
|
||||
}
|
||||
|
||||
if (!this.curSetList.length) {
|
||||
prerequisiteErrors.push('- You must have at least one Pokémon on your team in order to validate.');
|
||||
}
|
||||
|
||||
if (prerequisiteErrors.length) {
|
||||
app.addPopupMessage(prerequisiteErrors.join('\n'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (window.BattleFormats && BattleFormats[this.curTeam.format] && BattleFormats[this.curTeam.format].hasBattleFormat) {
|
||||
format = BattleFormats[this.curTeam.format].battleFormat;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -311,6 +311,23 @@ button:disabled {
|
|||
.popupmenu button.button:active {
|
||||
background: linear-gradient(to bottom, #cfcfcf, #f2f2f2);
|
||||
}
|
||||
|
||||
.button.disabled,
|
||||
.button.disabled:hover,
|
||||
.button.disabled:active,
|
||||
.mainmenuwrapper .menugroup .button.disabled,
|
||||
.mainmenuwrapper .menugroup .button.disabled:hover,
|
||||
.mainmenuwrapper .menugroup .button.disabled:active {
|
||||
cursor: default;
|
||||
background: #EEEEEE;
|
||||
border-color: #CCCCCC;
|
||||
border-style: solid;
|
||||
border-size: 1px;
|
||||
color: #999999;
|
||||
text-shadow: none;
|
||||
box-shadow: 0 1px 2px rgba(0,0,0,.1);
|
||||
}
|
||||
|
||||
.button.notifying {
|
||||
border-color: #AA8866;
|
||||
background: #e3c3a3;
|
||||
|
|
@ -1011,20 +1028,6 @@ p.or:after {
|
|||
.button.mainmenu6:hover { background: linear-gradient(to bottom, hsl(270,40%,62%), hsl(270,40%,42%)); }
|
||||
.button.mainmenu6:active { background: linear-gradient(to bottom, hsl(270,40%,42%), hsl(300,40%,58%)); }
|
||||
|
||||
.mainmenuwrapper .menugroup .button.disabled,
|
||||
.mainmenuwrapper .menugroup .button.disabled:hover,
|
||||
.mainmenuwrapper .menugroup .button.disabled:active,
|
||||
.mainmenuwrapper .menugroup .button.disabled,
|
||||
.mainmenuwrapper .menugroup .button.disabled:hover,
|
||||
.mainmenuwrapper .menugroup .button.disabled:active {
|
||||
cursor: default;
|
||||
background: #EEEEEE;
|
||||
border: 1px solid #CCCCCC;
|
||||
color: #999999;
|
||||
text-shadow: none;
|
||||
box-shadow: 0 1px 2px rgba(0,0,0,.1);
|
||||
}
|
||||
|
||||
.rightmenu {
|
||||
width: 294px;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user