Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent notification messages from auto-disappearing and remove the cancel button from the login form #12

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 12 additions & 20 deletions web/static/js/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@ var apiDownload = function(downloadOptions){
success: function(data, textStatus, jqXHR)
{
$("#notifications").removeClass('is-danger').addClass('is-success');
$("#notifications").html(data.message)
$("#notifications").fadeIn("slow");
$("#notifications").fadeOut("slow");
$("#notifications-content").html(data.message)
$("#notifications").fadeIn("slow")
},
error: function(jqXHR, textStatus, errorThrown)
{
$("#notifications").removeClass('is-success').addClass('is-danger');
$("#notifications").html(jqXHR.responseJSON.error)
$("#notifications-content").html(jqXHR.responseJSON.error)
$("#notifications").fadeIn("slow")
$("#notifications").fadeOut("slow")
}
});
}
Expand All @@ -34,16 +32,14 @@ var apiStopDownload = function() {
success: function(data, textStatus, jqXHR)
{
$("#notifications").removeClass('is-danger').addClass('is-success')
$("#notifications").html(data.message)
$("#notifactions").fadeIn("slow");
$("#notifactions").fadeOut("slow");
$("#notifications-content").html(data.message)
$("#notifications").fadeIn("slow")
},
error: function(jqXHR, textStatus, errorThrown)
{
("#notifications").removeClass('is-success').addClass('is-danger')
$("#notifications").html(jqXHR.responseJSON.error)
$("#notifications-content").html(jqXHR.responseJSON.error)
$("#notifications").fadeIn("slow")
$("#notifications").fadeOut("slow")
}
});
}
Expand All @@ -58,16 +54,14 @@ var apiLogin = function(username, password) {
success: function(data, textStatus, jqXHR)
{
$("#notifications").removeClass('is-danger').addClass('is-success');
$("#notifications").html(data.message)
$("#notifications").fadeIn("slow");
$("#notifications").fadeOut("slow");
$("#notifications-content").html(data.message)
$("#notifications").fadeIn("slow")
},
error: function(jqXHR, textStatus, errorThrown)
{
$("#notifications").removeClass('is-success').addClass('is-danger');
$("#notifications").html(jqXHR.responseJSON.error)
$("#notifications-content").html(jqXHR.responseJSON.error)
$("#notifications").fadeIn("slow")
$("#notifications").fadeOut("slow")
}
});
}
Expand All @@ -82,16 +76,14 @@ var apiLogout = function() {
success: function(data, textStatus, jqXHR)
{
$("#notifications").removeClass('is-danger').addClass('is-success');
$("#notifications").html(data.message)
$("#notifications").fadeIn("slow");
$("#notifications").fadeOut("slow");
$("#notifications-content").html(data.message)
$("#notifications").fadeIn("slow")
},
error: function(jqXHR, textStatus, errorThrown)
{
$("#notifications").removeClass('is-success').addClass('is-danger');
$("#notifications").html(jqXHR.responseJSON.error)
$("#notifications-content").html(jqXHR.responseJSON.error)
$("#notifications").fadeIn("slow")
$("#notifications").fadeOut("slow")
}
});
}
4 changes: 4 additions & 0 deletions web/static/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ $( document ).ready(function() {
});


$("#close-notification-btn").on( "click", function() {
$("#notifications").fadeOut("slow")
});

$("#login-cancel,#modal-close-button").on( "click", function() {
$("#login-modal").removeClass('is-active').addClass('is-clipped')
});
Expand Down
3 changes: 1 addition & 2 deletions web/static/templates/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

<header class="modal-card-head">
<p class="modal-card-title">Insert your credentials once</p>
<button id="modal-close-button" class="delete" aria-label="close"></button>
<button type="button" id="modal-close-button" class="delete" aria-label="close"></button>
</header>
<section class="modal-card-body">

Expand All @@ -81,7 +81,6 @@
<footer class="modal-card-foot">
<button id="do-login" class="button is-success" type="submit">Save</button>
<a id="login-logout-button" class="button is-warning">Logout</a>
<a id="login-cancel" class="button is-pulled-right">Cancel</a>
</footer>
</form>
</div>
Expand Down
3 changes: 2 additions & 1 deletion web/static/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
<div id="errors" class="column is-narrow has-text-right is-2">Errors: N/A</div>
</div>
<div class="notification is-success" id="notifications" style="display: none">
<strong>Info:</strong> Download started.
<button type="button" class="delete" id="close-notification-btn" aria-label="close"></button>
<p id="notifications-content"></p>
</div>
</div>
</section>
Expand Down
2 changes: 1 addition & 1 deletion web/statik/statik.go

Large diffs are not rendered by default.