Skip to content

Commit

Permalink
Merge pull request #485 from NetrunnerDB/nb/move-js-to-file
Browse files Browse the repository at this point in the history
Move (show history) onClick to js file
  • Loading branch information
plural authored Mar 14, 2021
2 parents 93fbdc0 + bdb8cdf commit 57e1e83
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/Resources/views/Search/display-zoom.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
{% for mwl_info in card.mwl_info %}
{% if mwl_info.active %}class="legality-{{ mwl_info.legality }}"{% endif %}
{% endfor %}> Standard Ban List<span>
<a id="mwl-history" href="" onClick="let entries = $.find('tr.card-mwl-inactive'); entries.forEach(x => x.style.display = (x.style.display == 'table-row' ? 'none' : 'table-row')); let l = $('#mwl-history'); l.html(l.text() == '(show history)' ? '(show only latest)' : '(show history)'); return false;">(show history)</a>
<a id="mwl-history" href="">(show history)</a>
</th>
</tr>
</thead>
Expand Down
10 changes: 10 additions & 0 deletions web/js/zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ $(function () {
$(window.document).on('click', '.review-button', write_review_open);
$(window.document).on('click', '.review-social-icon-like', like_review);
$(window.document).on('click', '.btn-write-comment', write_comment);
$(window.document).on('click', '#mwl-history', show_mwl_history);
$(window.document).on('submit', 'form.form-comment', form_comment_submit);
});

Expand Down Expand Up @@ -349,3 +350,12 @@ function write_review_open(event) {
}

}

function show_mwl_history(event) {
event.preventDefault();
let entries = $.find('tr.card-mwl-inactive');
entries.forEach(x => x.style.display = (x.style.display == 'table-row' ? 'none' : 'table-row'));
let l = event.currentTarget;
l.text = l.text == '(show history)' ? '(show only latest)' : '(show history)';
return false;
}

0 comments on commit 57e1e83

Please sign in to comment.