Added loading GIF when searching and fixed small display bug in modal

pull/57/head
Mokaddem 2016-07-08 12:09:33 +02:00
parent f475f18f06
commit 0174d46788
5 changed files with 13 additions and 4 deletions

View File

@ -161,7 +161,7 @@ def getmoredata():
requested_path = request.args.get('paste', '') requested_path = request.args.get('paste', '')
paste = Paste.Paste(requested_path) paste = Paste.Paste(requested_path)
p_content = paste.get_p_content().decode('utf-8', 'ignore') p_content = paste.get_p_content().decode('utf-8', 'ignore')
to_return = p_content[max_preview_modal:] to_return = p_content[max_preview_modal-1:]
return to_return return to_return

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

@ -70,6 +70,7 @@
<div id="mymodalcontent" class="modal-content"> <div id="mymodalcontent" class="modal-content">
<div id="mymodalbody" class="modal-body" max-width="850px"> <div id="mymodalbody" class="modal-body" max-width="850px">
<p>Loading paste information...</p> <p>Loading paste information...</p>
<img id="loading-gif-modal" src="{{url_for('static', filename='image/loading.gif') }}" height="26" width="26" style="margin: 4px;">
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a id="button_show_path" target="_blank" href=""><button type="button" class="btn btn-info">Show saved paste</button></a> <a id="button_show_path" target="_blank" href=""><button type="button" class="btn btn-info">Show saved paste</button></a>
@ -160,6 +161,7 @@
$("#button_show_path").attr('href', $(modal).attr('data-url')); $("#button_show_path").attr('href', $(modal).attr('data-url'));
$("#button_show_path").show('fast'); $("#button_show_path").show('fast');
$("#loading-gif-modal").css("visibility", "hidden"); // Hide the loading GIF
if ($("[data-initsize]").attr('data-initsize') < char_to_display) { // All the content is displayed if ($("[data-initsize]").attr('data-initsize') < char_to_display) { // All the content is displayed
nothing_to_display(); nothing_to_display();
} }
@ -180,6 +182,8 @@
// When the modal goes out, refresh it to normal content // When the modal goes out, refresh it to normal content
$("#mymodal").on('hidden.bs.modal', function () { $("#mymodal").on('hidden.bs.modal', function () {
$("#mymodalbody").html("<p>Loading paste information...</p>"); $("#mymodalbody").html("<p>Loading paste information...</p>");
var loading_gif = "<img id='loading-gif-modal' class='img-center' src=\"{{url_for('static', filename='image/loading.gif') }}\" height='26' width='26' style='margin: 4px;'>";
$("#mymodalbody").append(loading_gif); // Show the loading GIF
$("#button_show_path").attr('href', ''); $("#button_show_path").attr('href', '');
$("#button_show_path").hide(); $("#button_show_path").hide();
complete_paste = null; complete_paste = null;

View File

@ -1,11 +1,16 @@
<div class="input-group custom-search-form"> <div class="input-group custom-search-form">
<form action="/search" method=POST> <form action="/search" id="form-search" method=POST>
<input type="text" name="query" class="form-control" placeholder="Search Paste"> <input type="text" name="query" class="form-control" placeholder="Search Paste">
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-default" type="submit"> <button class="btn btn-default" type="submit">
<i class="fa fa-search"></i> <i class="fa fa-search"></i>
</button> </button>
<img id="loading-gif" src="{{url_for('static', filename='image/loading2.gif') }}" height="26" width="26" style="margin: 4px; visibility: hidden;">
</form> </form>
</span> </span>
</div> </div>
<script>
$("#form-search").submit(function( event ) {
$("#loading-gif").css("visibility", "visible");
});
</script>

View File

@ -43,7 +43,7 @@
</div> </div>
<div class="panel-body" id="panel-body"> <div class="panel-body" id="panel-body">
<h4> Content: </h4> <h4> Content: </h4>
<p data-initsize="{{ initsize }}"> <xmp id="paste-holder"> {{ content }} </xmp> </p> <p data-initsize="{{ initsize }}"> <xmp id="paste-holder">{{ content }}</xmp></p>
</div> </div>
</div> </div>