1
0
mirror of https://github.com/moparisthebest/wallabag synced 2024-12-24 00:08:57 -05:00

saving link form now sends ajax request, article view is now justified

This commit is contained in:
Maryana Rozhankivska 2014-03-13 18:37:08 +02:00
parent 6775da70a8
commit 3ee27ee6ba
3 changed files with 34 additions and 6 deletions

View File

@ -1,9 +1,10 @@
<div id="bagit-form" class="messages info">
<form method="get" action="index.php" target="_blank">
<form method="get" action="index.php" target="_blank" id="bagit-form-form">
<h2><a href="javascript: void(null);" id="bagit-form-close">X</a>
{% trans "Save a link" %}</h2>
<input type="hidden" name="autoclose" value="1" />
<input required placeholder="example.com/article" class="addurl" id="plainurl" name="plainurl" type="url" />
<input type="submit" value="{% trans "save link!" %}" />
<div id="add-link-result"></div>
</form>
</div>

View File

@ -607,6 +607,11 @@ a#bagit-form-close:hover {
padding: 0 3px 2px 3px;
}
#add-link-result {
font-weight: bold;
margin-top: 10px;
}
/* ==========================================================================
3 = Pictos
========================================================================== */
@ -741,6 +746,7 @@ a#bagit-form-close:hover {
#article {
width: 70%;
margin-bottom: 3em;
text-align: justify;
}
#article .tags {

View File

@ -4,6 +4,7 @@ $.fn.ready(function() {
$listentries = $("#list-entries"),
$bagit = $('#bagit'),
$bagitForm = $('#bagit-form');
$bagitFormForm = $('#bagit-form-form');
/* ==========================================================================
Menu
@ -69,9 +70,30 @@ $.fn.ready(function() {
toggleSaveLinkForm();
});
$('#bagit-form form').submit(function(){
toggleSaveLinkForm();
return true;
//send "bag it link" form request via ajax
$bagitFormForm.submit( function(event) {
$bagitFormForm.css("cursor", "wait");
$("#add-link-result").empty();
$.ajax({
type: $bagitFormForm.attr('method'),
url: $bagitFormForm.attr('action'),
data: $bagitFormForm.serialize(),
success: function(data) {
$('#add-link-result').html("Done!");
$('#plainurl').val('');
$('#plainurl').blur('');
$bagitFormForm.css("cursor", "auto");
//setTimeout( function() { toggleSaveLinkForm(); }, 1000); //close form after 1000 delay
},
error: function(data) {
$('#add-link-result').html("Failed!");
$bagitFormForm.css("cursor", "auto");
}
});
event.preventDefault();
});
/* ==========================================================================
@ -94,9 +116,8 @@ $.fn.ready(function() {
});
$(".add-to-wallabag-link-after").click(function(event){
event.preventDefault();
toggleSaveLinkForm($(this).attr('href'));
return false;
event.preventDefault();
});