1
0
mirror of https://github.com/moparisthebest/wallabag synced 2024-11-27 11:22:17 -05:00

Merge pull request #557 from mariroz/feature-add-link-inside-article-issue-505

saving link form now sends ajax request, article view is now justified (issue #554)
This commit is contained in:
Nicolas Lœuillet 2014-03-13 20:57:22 +01:00
commit 181d16fe22
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();
});