magfest / magwest

MagWest specific functionality for ubersystem
1 stars 5 forks source link

MAGWest's extra JS to hide amount_extra is breaking the admin form in some cases #27

Closed kitsuta closed 7 years ago

kitsuta commented 7 years ago

Sometimes when editing a badge in MAGWest, a JS error comes up: Uncaught TypeError: Cannot read property 'parents' of null About this block:

    <script type="text/javascript">
        $.field('amount_extra').parents('.form-group').hide();
    </script>

However, that block is behind a {% if c.PAGE_PATH != 'registration/form' %} -- it shouldn't even be rendering this script.

The JS error breaks other JS on the page; most notably, it prevents admins from deleting a badge (it simply says "This attendee has been saved" when you try).

RobRuana commented 7 years ago

I'm guessing that c.PAGE_PATH starts with a slash, so that should be:

{% if c.PAGE_PATH != '/registration/form' %}
kitsuta commented 7 years ago

True! Probably even better though would be to use our admin_area var.