mirror of
https://github.com/owncloud/bookmarks.git
synced 2025-01-22 18:52:10 +01:00
fix updating of bookmarks via bookmarklet
This commit is contained in:
parent
15c5c50a77
commit
74eb8a0848
@ -49,7 +49,7 @@ class WebViewController extends Controller {
|
|||||||
$bookmarkExists = Bookmarks::bookmarkExists($url, $this->userId, $this->db);
|
$bookmarkExists = Bookmarks::bookmarkExists($url, $this->userId, $this->db);
|
||||||
$description = "";
|
$description = "";
|
||||||
$tags = [];
|
$tags = [];
|
||||||
if ($bookmarkExists != false){
|
if ($bookmarkExists !== false){
|
||||||
$bookmark = Bookmarks::findUniqueBookmark($bookmarkExists, $this->userId, $this->db);
|
$bookmark = Bookmarks::findUniqueBookmark($bookmarkExists, $this->userId, $this->db);
|
||||||
$description = $bookmark['description'];
|
$description = $bookmark['description'];
|
||||||
$tags = $bookmark['tags'];
|
$tags = $bookmark['tags'];
|
||||||
|
@ -22,18 +22,28 @@ function updateLoadingAnimation() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(function () {
|
$(document).ready(function () {
|
||||||
$(".submit").click(function () {
|
$(".submit").click(function () {
|
||||||
increaseAjaxCallCount();
|
increaseAjaxCallCount();
|
||||||
var tags = '';
|
|
||||||
$('.tagit-choice .tagit-label').each(function() {
|
var endpoint = 'bookmark';
|
||||||
tags += '&item[tags][]='+$(this).text();
|
var method = 'POST';
|
||||||
});
|
var id = '';
|
||||||
var dataString = 'url=' + $("input#url").val() + '&description=' +
|
if($('#bookmarkID').length > 0) {
|
||||||
$("textarea#description").val() + '&title=' + $("input#title").val() + tags;
|
endpoint += '/'+ $('#bookmarkID').val();
|
||||||
|
method = 'PUT';
|
||||||
|
id = '&record_id=' + $('#bookmarkID').val();
|
||||||
|
}
|
||||||
|
|
||||||
|
var tags = '';
|
||||||
|
$('.tagit-choice .tagit-label').each(function() {
|
||||||
|
tags += '&item[tags][]='+$(this).text();
|
||||||
|
});
|
||||||
|
var dataString = 'url=' + $("input#url").val() + '&description=' +
|
||||||
|
$("textarea#description").val() + '&title=' + $("input#title").val() + tags + id;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: method,
|
||||||
url: "bookmark",
|
url: endpoint,
|
||||||
data: dataString,
|
data: dataString,
|
||||||
complete: function () {
|
complete: function () {
|
||||||
decreaseAjaxCallCount();
|
decreaseAjaxCallCount();
|
||||||
@ -52,15 +62,16 @@ $(function () {
|
|||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
$.get('tag', function(data) {
|
|
||||||
$('.tags').tagit({
|
$.get('tag', function (data) {
|
||||||
allowSpaces: true,
|
$('.tags').tagit({
|
||||||
availableTags : data,
|
allowSpaces: true,
|
||||||
placeholderText: t('bookmark', 'Tags')
|
availableTags: data,
|
||||||
});
|
placeholderText: t('bookmark', 'Tags')
|
||||||
});
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function closeWindow() {
|
function closeWindow() {
|
||||||
window.close();
|
window.close();
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ $bookmarkExists = $_['bookmarkExists'];
|
|||||||
<span style="display: inline; float: right"><div id="add_form_loading" style="margin: 3px;"><img src="<?php print_unescaped(OCP\image_path("bookmarks", "loading.gif")); ?>"> </div></span>
|
<span style="display: inline; float: right"><div id="add_form_loading" style="margin: 3px;"><img src="<?php print_unescaped(OCP\image_path("bookmarks", "loading.gif")); ?>"> </div></span>
|
||||||
|
|
||||||
<div style="color: red; clear: both; visibility: <?php
|
<div style="color: red; clear: both; visibility: <?php
|
||||||
if ($bookmarkExists == false) {
|
if ($bookmarkExists === false) {
|
||||||
print_unescaped('hidden');
|
print_unescaped('hidden');
|
||||||
}
|
}
|
||||||
?>">
|
?>">
|
||||||
@ -26,6 +26,9 @@ $bookmarkExists = $_['bookmarkExists'];
|
|||||||
<fieldset class="bm_desc">
|
<fieldset class="bm_desc">
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
|
<?php if($bookmarkExists !== false) { ?>
|
||||||
|
<input id="bookmarkID" type="hidden" class="hidden" value="<?php p($bookmarkExists); ?>" />
|
||||||
|
<?php } ?>
|
||||||
<input id="title" type="text" name="title" class="title" value="<?php p($_['title']); ?>"
|
<input id="title" type="text" name="title" class="title" value="<?php p($_['title']); ?>"
|
||||||
placeholder="<?php p($l->t('The title of the page')); ?>" />
|
placeholder="<?php p($l->t('The title of the page')); ?>" />
|
||||||
</li>
|
</li>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user