diff --git a/ajax/editBookmark.php b/ajax/editBookmark.php
index 5b9d2ffe..fbfe4f81 100644
--- a/ajax/editBookmark.php
+++ b/ajax/editBookmark.php
@@ -34,10 +34,10 @@ if(isset($_POST['url'])) {
if(isset($_POST['record_id']) && is_numeric($_POST['record_id']) ) { //EDIT
$bm = $_POST['record_id'];
- OC_Bookmarks_Bookmarks::editBookmark($bm, $_POST['url'], $_POST['title'], $tags, $_POST['desc'], $pub);
+ OC_Bookmarks_Bookmarks::editBookmark($bm, $_POST['url'], $_POST['title'], $tags, $_POST['description'], $pub);
}
else {
- $bm = OC_Bookmarks_Bookmarks::addBookmark($_POST['url'], $_POST['title'], $tags, $_POST['desc'], $pub);
+ $bm = OC_Bookmarks_Bookmarks::addBookmark($_POST['url'], $_POST['title'], $tags, $_POST['description'], $pub);
}
OCP\JSON::success(array('id'=>$bm));
exit();
diff --git a/css/bookmarks.css b/css/bookmarks.css
index c5fe48cd..7fe274ae 100644
--- a/css/bookmarks.css
+++ b/css/bookmarks.css
@@ -316,6 +316,12 @@ li:hover em { display : none; }
width: 80%;
}
+.bookmark_single_form {
+ padding-top: 1em;
+ border-bottom: 1px solid #DDD;
+ padding-left: 2em;
+}
+
.bookmark_single_form .tagit{
width: 80%;
box-shadow: 0 1px 1px #FFFFFF, 0 1px 0 #BBBBBB inset;
diff --git a/js/bookmarks.js b/js/bookmarks.js
index 601ec2ec..c9212e0f 100644
--- a/js/bookmarks.js
+++ b/js/bookmarks.js
@@ -193,16 +193,17 @@ function createEditDialog(record){
function addBookmark(event) {
url = $('#add_url').val();
- createEditDialog({ url: url});
$('#add_url').val('');
-
+ bookmark = { url: url, description:'', title:''};
$.ajax({
- type: 'GET',
- url: OC.filePath('bookmarks', 'ajax', 'getInfos.php'),
- data: { type: 'url_info', url: url},
+ type: 'POST',
+ url: OC.filePath('bookmarks', 'ajax', 'editBookmark.php'),
+ data: bookmark,
success: function(data){
if (data.status == 'success') {
- $('.ui-dialog').data('bookmark_dialog').setTitle(data.title);
+ bookmark.id = data.id;
+ bookmark.added_date = new Date();
+ updateBookmarksList(bookmark, 'prepend');
}
}
});
@@ -213,7 +214,7 @@ function delBookmark(event) {
$.ajax({
type: 'POST',
url: OC.filePath('bookmarks', 'ajax', 'delBookmark.php'),
- data: 'id=' + record.data('id'),
+ data: { id: record.data('id') },
success: function(data){
if (data.status == 'success') {
record.remove();
@@ -228,14 +229,12 @@ function delBookmark(event) {
function editBookmark(event) {
var record = $(this).parent().parent();
bookmark = record.data('record');
- console.log(bookmark);
//createEditDialog(bookmark);
html = tmpl("item_form_tmpl", bookmark);
record.after(html);
record.hide();
rec_form = record.next().find('form');
- console.log(rec_form);
rec_form.find('.bookmark_form_tags ul').tagit({
allowSpaces: true,
availableTags: fullTags,
@@ -251,6 +250,7 @@ function cancelBookmark(event) {
rec_form.prev().show();
rec_form.remove();
}
+
function submitBookmark(event) {
event.preventDefault();
form_values = $(this).serialize();
@@ -268,8 +268,10 @@ function submitBookmark(event) {
}
});
}
-function updateBookmarksList(bookmark) {
- var tags = bookmark.tags;
+
+function updateBookmarksList(bookmark, position='append') {
+ bookmark = $.extend({title:'', description:'', added_date: new Date('now'), tags:[] }, bookmark);
+ tags = bookmark.tags;
var taglist = '';
for ( var i=0, len=tags.length; i ' +
- '' +
- '' +
- '' +
- '' +
- '' +
- ' ' +
- ' '+
- '' + encodeEntities(bookmark.title) + '' +
- ' ' + encodeEntities(bookmark.url) + ' ' + formatDate(bookmark.added_date) + ' '+ encodeEntities(bookmark.description) + '
- <%= encodeEntities(title) %> + <%= encodeEntities(title == '' ? url : title ) %>
<%= formatDate(added_date) %>
@@ -90,7 +90,7 @@+