Skip to content

Commit

Permalink
Merge pull request #86 from duhminick/favorite-trans
Browse files Browse the repository at this point in the history
Remove Transfer / Evolve if favorite
  • Loading branch information
vinnymac committed Aug 12, 2016
2 parents 45640c4 + beda1d9 commit 8582db5
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion js/screens/Table/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function prepDisplay (d) {
var pokeiv = poke['iv'] + '% (' + poke['attack'] + '/' + poke['defense'] + '/' + poke['stamina'] + ')'
var favoriteBool = poke['favorite'] ? 'true' : 'false'

if (poke.deployed) checkBox += ' disabled'
if (poke.deployed || poke.favorite) checkBox += ' disabled'
if (poke.favorite) favorite = 'glyphicon glyphicon-star favorite-yellow'

poke.td_checkbox = checkBox + '>'
Expand Down Expand Up @@ -361,6 +361,7 @@ const Table = React.createClass({

if (row.child.isShown()) {
// This row is already open - close it
$('#' + row.data().pokemon_id).DataTable().destroy()
row.child.hide()
tr.removeClass('shown')
} else {
Expand All @@ -384,6 +385,15 @@ const Table = React.createClass({
// Check all boxes
$('#' + d.pokemon_id + ' #checkall').click(function () {
$(':checkbox', table.rows().nodes()).prop('checked', this.checked)
$(':checkbox', table.rows().nodes()).filter(':disabled').attr('disabled', true)
})

$('#' + d.pokemon_id + ' td span.favorite').click(function () {
if ($(this).hasClass('favorite-yellow')) {
$(this).closest('tr').find(':checkbox').attr('disabled', false)
} else {
$(this).closest('tr').find(':checkbox').attr('disabled', true)
}
})

document.querySelectorAll('td a.nickname').forEach(el => {
Expand Down

0 comments on commit 8582db5

Please sign in to comment.