From 678073e2a71b6fa9fc4b7fa83f18b67296f5e708 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Sun, 21 Oct 2012 11:37:30 +0000 Subject: [PATCH] Put some js html constructions in a template file for bookmarks --- js/bookmarks.js | 35 +++-------------- templates/js_tpl.php | 89 ++++++++++++++++++++++++++++++++++++++++++++ templates/list.php | 57 +--------------------------- 3 files changed, 95 insertions(+), 86 deletions(-) create mode 100644 templates/js_tpl.php diff --git a/js/bookmarks.js b/js/bookmarks.js index 5400488d..94b98fca 100644 --- a/js/bookmarks.js +++ b/js/bookmarks.js @@ -91,18 +91,8 @@ function addFilterTag(event) { } function updateTagsList(tag) { - $('.tag_list').append('
  • '+tag['tag']+''+ - '

    '+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - '

    '+ - ''+tag['nbr']+''+ - '
  • '); - + html = tmpl("tag_tmpl", tag); + $('.tag_list').append(html); } function filterTagsChanged() @@ -290,24 +280,9 @@ function updateBookmarksList(bookmark, position) { if(bookmark_view == 'image') { //View in images service_url = formatString(shot_provider, {url: encodeEntities(bookmark.url), title: bookmark.title, width: 200}); - $('.bookmarks_list').append( - '
    ' + - '

    '+ - '

    ' + - '' + - '' + - '' + - '' + - '' + - ' ' + - '

    ' + - '

    '+ - '' + encodeEntities(bookmark.title) + '' + - '

    ' + - '

    '+ encodeEntities(bookmark.description) + '

    ' + - '

    ' + encodeEntities(bookmark.url) + '

    ' + - '
    ' - ); + bookmark['service_url'] = service_url; + html = tmpl("img_item_tmpl", bookmark); + $('.bookmarks_list').append(html); $('div[data-id="'+ bookmark.id +'"]').data('record', bookmark); if(taglist != '') { $('div[data-id="'+ bookmark.id +'"]').append('

    ' + taglist + '

    '); diff --git a/templates/js_tpl.php b/templates/js_tpl.php new file mode 100644 index 00000000..732f3d33 --- /dev/null +++ b/templates/js_tpl.php @@ -0,0 +1,89 @@ + + + + + \ No newline at end of file diff --git a/templates/list.php b/templates/list.php index 1d5bd3d7..c3946c9d 100644 --- a/templates/list.php +++ b/templates/list.php @@ -54,59 +54,4 @@ - - - - - + \ No newline at end of file