Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:DOAJ/doaj into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-jones committed Nov 13, 2023
2 parents 04b5d46 + 32c0b5b commit 2b90024
Show file tree
Hide file tree
Showing 7 changed files with 725 additions and 268 deletions.
4 changes: 2 additions & 2 deletions portality/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1069,11 +1069,11 @@
# ~~->Bitly:ExternalService~~

# bit,ly api shortening service
BITLY_SHORTENING_API_URL = "https://api-ssl.bitly.com/v4/shorten"
#BITLY_SHORTENING_API_URL = "https://api-ssl.bitly.com/v4/shorten"

# bitly oauth token
# ENTER YOUR OWN TOKEN IN APPROPRIATE .cfg FILE
BITLY_OAUTH_TOKEN = ""
#BITLY_OAUTH_TOKEN = ""

###############################################
# Date handling
Expand Down
14 changes: 7 additions & 7 deletions portality/static/js/doaj.fieldrender.edges.js
Original file line number Diff line number Diff line change
Expand Up @@ -1302,15 +1302,15 @@ $.extend(true, doaj, {

var comp = this.component;

var shareButtonFrag = "";
var shareButtonClass = edges.css_classes(this.namespace, "toggle-share", this);
var modalId = edges.css_id(this.namespace, "modal", this);
shareButtonFrag = '<button data-toggle="modal" data-target="#' + modalId + '" class="' + shareButtonClass + ' button button--tertiary" role="button">' + this.shareLinkText + '</button>';
let shareButtonFrag = '<button data-toggle="modal" data-target="#' + modalId + '" class="' + shareButtonClass + ' button button--tertiary" role="button">' + this.shareLinkText + '</button>';

var shorten = "";
let shorten = "";
if (this.component.urlShortener) {
var shortenClass = edges.css_classes(this.namespace, "shorten", this);
shorten = '<p>Share a link to this search</p>'
var shortenButtonClass = edges.css_classes(this.namespace, "shorten-url", this)
shorten = '<p><button class="' + shortenButtonClass + '">shorten url</button></p>';
}
var embed = "";
if (this.component.embedSnippet) {
Expand All @@ -1320,11 +1320,11 @@ $.extend(true, doaj, {
}
var shareBoxClass = edges.css_classes(this.namespace, "share", this);
var shareUrlClass = edges.css_classes(this.namespace, "share-url", this);
var shortenButtonClass = edges.css_classes(this.namespace, "shorten-url", this);

var shareFrag = '<div class="' + shareBoxClass + '">\
' + shorten + '\
<p>Share a link to this search</p>\
<textarea style="width: 100%; height: 150px" readonly class="' + shareUrlClass + '"></textarea>\
<p><button class="' + shortenButtonClass + '">shorten url</button></p>\
' + shorten + '\
' + embed + '\
</div>';

Expand Down
46 changes: 23 additions & 23 deletions portality/static/js/doaj.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,29 +69,29 @@ var doaj = {
doaj.bindMiniSearch();
},

bitlyShortener : function(query, success_callback, error_callback) {
// ~~-> Bitly:ExternalService ~~
function callbackWrapper(data) {
success_callback(data.url);
}

function errorHandler() {
alert("Sorry, we're unable to generate short urls at this time");
error_callback();
}

var page = window.location.protocol + '//' + window.location.host + window.location.pathname;

$.ajax({
type: "POST",
contentType: "application/json",
dataType: "jsonp",
url: "/service/shorten",
data : JSON.stringify({page: page, query: query}),
success: callbackWrapper,
error: errorHandler
});
},
// bitlyShortener : function(query, success_callback, error_callback) {
// // ~~-> Bitly:ExternalService ~~
// function callbackWrapper(data) {
// success_callback(data.url);
// }
//
// function errorHandler() {
// alert("Sorry, we're unable to generate short urls at this time");
// error_callback();
// }
//
// var page = window.location.protocol + '//' + window.location.host + window.location.pathname;
//
// $.ajax({
// type: "POST",
// contentType: "application/json",
// dataType: "jsonp",
// url: "/service/shorten",
// data : JSON.stringify({page: page, query: query}),
// success: callbackWrapper,
// error: errorHandler
// });
// },

journal_toc_id : function(journal) {
// if e-issn is available, use that
Expand Down
2 changes: 1 addition & 1 deletion portality/static/js/edges/public.article.edge.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ $.extend(true, doaj, {
edges.newFullSearchController({
id: "share_embed",
category: "controller",
urlShortener : doaj.bitlyShortener,
// urlShortener : doaj.bitlyShortener,
embedSnippet : doaj.publicSearch.embedSnippet,
renderer: doaj.renderers.newShareEmbedRenderer({
shareLinkText: '<span data-feather="share-2" aria-hidden="true"></span> Share or embed'
Expand Down
2 changes: 1 addition & 1 deletion portality/static/js/edges/public.journal.edge.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ $.extend(true, doaj, {
edges.newFullSearchController({
id: "share_embed",
category: "controller",
urlShortener : doaj.bitlyShortener,
// urlShortener : doaj.bitlyShortener,
embedSnippet : doaj.publicSearch.embedSnippet,
renderer: doaj.renderers.newShareEmbedRenderer({
shareLinkText: '<span data-feather="share-2" aria-hidden="true"></span> Share or embed'
Expand Down
Loading

0 comments on commit 2b90024

Please sign in to comment.