From d356fd365f8d249d36ef64d7dfac6e8abb387c94 Mon Sep 17 00:00:00 2001 From: ochan1 Date: Tue, 27 Apr 2021 03:31:55 -0700 Subject: [PATCH 1/2] New tab on project clickin Collection --- static/js/project.js | 42 ++++++++++++++++++++++++++++++---------- templates/collection.tmp | 3 ++- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/static/js/project.js b/static/js/project.js index 600a473..33432a5 100644 --- a/static/js/project.js +++ b/static/js/project.js @@ -20,17 +20,39 @@ function itemDiv (item, itemType, ownerUsernamePath, nameField, '">' } + + var project_href_url = + itemType + '?user=' + encodeURIComponent(eval('item.' + ownerUsernamePath)) + + '&' + itemType + '=' + encodeURIComponent(item[nameField]); + + var target = 'target="_self"'; + + if (options.linkTarget) { + if (options.linkTarget == "_blank") { + target = 'target="_blank" rel="noopener noreferrer"'; + } else { + target = 'target="' + options.linkTarget + '"'; + } + } + + var html_a_start_tag = + ''; + div.innerHTML += - '' +
-        (item.thumbnail ? escapeHtml(item[nameField]) : '') +
-        '' + escapeHtml(item[nameField]) + - ''; + html_a_start_tag + + '' +
+                (item.thumbnail ? escapeHtml(item[nameField]) : '') +
+                '' + + '' + + escapeHtml(item[nameField]) + + '' + + ''; if (extraFields) { Object.keys(extraFields).forEach(function (fieldName) { diff --git a/templates/collection.tmp b/templates/collection.tmp index 21aadaf..bb75167 100644 --- a/templates/collection.tmp +++ b/templates/collection.tmp @@ -90,7 +90,8 @@ isPublished: 'ispublished', author: 'username' }, - withCollectionControls: true + withCollectionControls: true, + linkTarget: '_blank' } ) ); From 1fdd0e3eed5e53e0a5228a6fc6b9f2b7e2933df9 Mon Sep 17 00:00:00 2001 From: ochan1 Date: Tue, 27 Apr 2021 03:58:11 -0700 Subject: [PATCH 2/2] Remove the linkTarget from collection.tmp --- templates/collection.tmp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/templates/collection.tmp b/templates/collection.tmp index bb75167..21aadaf 100644 --- a/templates/collection.tmp +++ b/templates/collection.tmp @@ -90,8 +90,7 @@ isPublished: 'ispublished', author: 'username' }, - withCollectionControls: true, - linkTarget: '_blank' + withCollectionControls: true } ) );