pierrepo / MalariaSmearSearch

Blood smears database for malaria diagnosis :microscope:
GNU General Public License v3.0
1 stars 0 forks source link

We should not be logged in to acces annotations info page #160

Closed pierrepo closed 7 years ago

pierrepo commented 7 years ago

When not logged in on the browse page:

image

If we click on

image

to access annotations, it does not work:

image

However, it works perfectly when the user is connected:

image

nanls commented 7 years ago

Spoil : I fixed the error but it do not understant how it is work.


Got it ! :tada:

In order to make the js flashed messages side by side whith the annotate button, we have define <div class="col-md-10 d-inline" id='flash-container'> inside of the following block :

{% if current_user.is_authenticated %}
    <section class="row">
        <div class="col-md-2 d-inline btn btn-primary" id="toggle-mode">
            <span id="icon-annotate" class="glyphicon glyphicon-plus" aria-hidden="true"></span>
            <span id="icon-view" class="glyphicon glyphicon-eye-open" aria-hidden="true" style="display: none;"></span>
            <span id="icon-text">Annotate</span>
        </div>
        <div class="col-md-10 d-inline" id='flash-container'>
        </div>
    </section>
    {% endif %}

Thus, the block those id is flash-container does not exist when the user is not logged in. that is why in the js console, there is this error : TypeError: $(...)[0] is undefined that is thrown by $('#flash-container')[0].innerHTML = "<div class='success message'>" + msg + "</div>"; in annotation.js l. 199.

Jquerrize the line 199 of annotation.js fixed the error but I do not know how it is work. However, js flashed messages are not printed.