-
Notifications
You must be signed in to change notification settings - Fork 16
/
publisher.mydrafts.edge.js
84 lines (75 loc) · 3.74 KB
/
publisher.mydrafts.edge.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
$.extend(true, doaj, {
publisherApplicationsSearch : {
activeEdges : {},
editUpdateRequest : function (value, resultobj, renderer) {
if (resultobj['suggestion']) {
if (resultobj.admin && resultobj.admin.application_status) {
var status = resultobj.admin.application_status;
var result = "";
var view = '(<a href="' + doaj.publisherUpdatesSearchConfig.journalReadOnlyUrl + resultobj['id'] + '">view request</a>)';
if (status === "update_request" || status === "revisions_required") {
var actionUrl = doaj.publisherUpdatesSearchConfig.journalUpdateUrl + resultobj.admin.current_journal;
result = '<span><a class="edit_suggestion_link" href="' + actionUrl;
result += '"';
result += '>Edit this update request</a> | <a href="' + actionUrl + '" class="delete_suggestion_link">Delete this update request</a></span>';
} else if (status !== "rejected" && status !== "accepted") {
result = '<span>This update request is currently being reviewed by an Editor ' + view + '.</span>';
} else if (status === "rejected") {
result = '<span>This update request has been rejected ' + view + '.</span>';
} else if (status === "accepted") {
result = '<span>This update request has been accepted, and your journal in DOAJ updated ' + view + '.</span>';
}
return result;
}
}
return false;
},
init : function(params) {
if (!params) { params = {} }
var current_domain = document.location.host;
var current_scheme = window.location.protocol;
var selector = params.selector || "#publisher_applications";
var search_url = current_scheme + "//" + current_domain + doaj.publisherApplicationsSearchConfig.searchPath;
var countFormat = edges.numFormat({
thousandsSeparator: ","
});
var components = [
// results display
edges.newResultsDisplay({
id: "results",
category: "results",
renderer : doaj.renderers.newPublisherApplicationRenderer()
})
];
var e = edges.newEdge({
selector: selector,
template: doaj.templates.newPublisherApplications(),
search_url: search_url,
manageUrl: true,
baseQuery: es.newQuery({
must: [
es.newTermsFilter({
field: "admin.application_status.exact",
values: ["revisions_required", "pending", "in progress", "completed", "on hold", "ready", "draft"]
})
],
sort: [{"field" : "last_updated", "order" : "desc"}],
size: 50
}),
components: components,
callbacks : {
"edges:query-fail" : function() {
alert("There was an unexpected error. Please reload the page and try again. If the issue persists please contact us.");
},
"edges:post-init" : function() {
feather.replace();
}
}
});
doaj.publisherApplicationsSearch.activeEdges[selector] = e;
}
}
});
jQuery(document).ready(function($) {
doaj.publisherApplicationsSearch.init();
});