diff options
author | Maryana Rozhankivska <mariroz@mr.lviv.ua> | 2014-03-13 18:37:08 +0200 |
---|---|---|
committer | Maryana Rozhankivska <mariroz@mr.lviv.ua> | 2014-03-13 18:37:08 +0200 |
commit | 3ee27ee6ba8d44182ddeac7b54d75cc54affeec7 (patch) | |
tree | adcf17eb6b9b3b64cb5948e137761096bf2882ae /themes | |
parent | 6775da70a845a7fa8364dd3bc1a8e7702e9789bf (diff) | |
download | wallabag-3ee27ee6ba8d44182ddeac7b54d75cc54affeec7.tar.gz wallabag-3ee27ee6ba8d44182ddeac7b54d75cc54affeec7.tar.zst wallabag-3ee27ee6ba8d44182ddeac7b54d75cc54affeec7.zip |
saving link form now sends ajax request, article view is now justified
Diffstat (limited to 'themes')
-rwxr-xr-x | themes/baggy/_pocheit-form.twig | 3 | ||||
-rwxr-xr-x | themes/baggy/css/main.css | 6 | ||||
-rwxr-xr-x | themes/baggy/js/init.js | 31 |
3 files changed, 34 insertions, 6 deletions
diff --git a/themes/baggy/_pocheit-form.twig b/themes/baggy/_pocheit-form.twig index ff911515..505ec368 100755 --- a/themes/baggy/_pocheit-form.twig +++ b/themes/baggy/_pocheit-form.twig | |||
@@ -1,9 +1,10 @@ | |||
1 | <div id="bagit-form" class="messages info"> | 1 | <div id="bagit-form" class="messages info"> |
2 | <form method="get" action="index.php" target="_blank"> | 2 | <form method="get" action="index.php" target="_blank" id="bagit-form-form"> |
3 | <h2><a href="javascript: void(null);" id="bagit-form-close">X</a> | 3 | <h2><a href="javascript: void(null);" id="bagit-form-close">X</a> |
4 | {% trans "Save a link" %}</h2> | 4 | {% trans "Save a link" %}</h2> |
5 | <input type="hidden" name="autoclose" value="1" /> | 5 | <input type="hidden" name="autoclose" value="1" /> |
6 | <input required placeholder="example.com/article" class="addurl" id="plainurl" name="plainurl" type="url" /> | 6 | <input required placeholder="example.com/article" class="addurl" id="plainurl" name="plainurl" type="url" /> |
7 | <input type="submit" value="{% trans "save link!" %}" /> | 7 | <input type="submit" value="{% trans "save link!" %}" /> |
8 | <div id="add-link-result"></div> | ||
8 | </form> | 9 | </form> |
9 | </div> | 10 | </div> |
diff --git a/themes/baggy/css/main.css b/themes/baggy/css/main.css index ba4b7c7f..61e0b47e 100755 --- a/themes/baggy/css/main.css +++ b/themes/baggy/css/main.css | |||
@@ -607,6 +607,11 @@ a#bagit-form-close:hover { | |||
607 | padding: 0 3px 2px 3px; | 607 | padding: 0 3px 2px 3px; |
608 | } | 608 | } |
609 | 609 | ||
610 | #add-link-result { | ||
611 | font-weight: bold; | ||
612 | margin-top: 10px; | ||
613 | } | ||
614 | |||
610 | /* ========================================================================== | 615 | /* ========================================================================== |
611 | 3 = Pictos | 616 | 3 = Pictos |
612 | ========================================================================== */ | 617 | ========================================================================== */ |
@@ -741,6 +746,7 @@ a#bagit-form-close:hover { | |||
741 | #article { | 746 | #article { |
742 | width: 70%; | 747 | width: 70%; |
743 | margin-bottom: 3em; | 748 | margin-bottom: 3em; |
749 | text-align: justify; | ||
744 | } | 750 | } |
745 | 751 | ||
746 | #article .tags { | 752 | #article .tags { |
diff --git a/themes/baggy/js/init.js b/themes/baggy/js/init.js index 4830bd25..da644fbe 100755 --- a/themes/baggy/js/init.js +++ b/themes/baggy/js/init.js | |||
@@ -4,6 +4,7 @@ $.fn.ready(function() { | |||
4 | $listentries = $("#list-entries"), | 4 | $listentries = $("#list-entries"), |
5 | $bagit = $('#bagit'), | 5 | $bagit = $('#bagit'), |
6 | $bagitForm = $('#bagit-form'); | 6 | $bagitForm = $('#bagit-form'); |
7 | $bagitFormForm = $('#bagit-form-form'); | ||
7 | 8 | ||
8 | /* ========================================================================== | 9 | /* ========================================================================== |
9 | Menu | 10 | Menu |
@@ -69,9 +70,30 @@ $.fn.ready(function() { | |||
69 | toggleSaveLinkForm(); | 70 | toggleSaveLinkForm(); |
70 | }); | 71 | }); |
71 | 72 | ||
72 | $('#bagit-form form').submit(function(){ | 73 | |
73 | toggleSaveLinkForm(); | 74 | //send "bag it link" form request via ajax |
74 | return true; | 75 | $bagitFormForm.submit( function(event) { |
76 | $bagitFormForm.css("cursor", "wait"); | ||
77 | $("#add-link-result").empty(); | ||
78 | |||
79 | $.ajax({ | ||
80 | type: $bagitFormForm.attr('method'), | ||
81 | url: $bagitFormForm.attr('action'), | ||
82 | data: $bagitFormForm.serialize(), | ||
83 | success: function(data) { | ||
84 | $('#add-link-result').html("Done!"); | ||
85 | $('#plainurl').val(''); | ||
86 | $('#plainurl').blur(''); | ||
87 | $bagitFormForm.css("cursor", "auto"); | ||
88 | //setTimeout( function() { toggleSaveLinkForm(); }, 1000); //close form after 1000 delay | ||
89 | }, | ||
90 | error: function(data) { | ||
91 | $('#add-link-result').html("Failed!"); | ||
92 | $bagitFormForm.css("cursor", "auto"); | ||
93 | } | ||
94 | }); | ||
95 | |||
96 | event.preventDefault(); | ||
75 | }); | 97 | }); |
76 | 98 | ||
77 | /* ========================================================================== | 99 | /* ========================================================================== |
@@ -94,9 +116,8 @@ $.fn.ready(function() { | |||
94 | }); | 116 | }); |
95 | 117 | ||
96 | $(".add-to-wallabag-link-after").click(function(event){ | 118 | $(".add-to-wallabag-link-after").click(function(event){ |
97 | event.preventDefault(); | ||
98 | toggleSaveLinkForm($(this).attr('href')); | 119 | toggleSaveLinkForm($(this).attr('href')); |
99 | return false; | 120 | event.preventDefault(); |
100 | }); | 121 | }); |
101 | 122 | ||
102 | 123 | ||