This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var altmetricURL = 'https://api.altmetric.com/v1/doi/' + ArticleData.doi; | |
var dimensionsURL = 'https://metrics-api.dimensions.ai/doi/' + ArticleData.doi; | |
var counterURL = 'https://counter.plos.org/api/v1.0/stats/totals/doi/' + ArticleData.doi; | |
var URLs = [altmetricURL, dimensionsURL, counterURL]; | |
var isMetricsView = location.pathname.indexOf('metrics') > 0 | |
if (isMetricsView) { | |
var citedSection = new MetricsCitedSection(); | |
var discussedSection = new MetricsDiscussedSection(); | |
var savedSection = new MetricsSavedSection(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en" > | |
<head> | |
<meta charset="UTF-8"> | |
<title>PDF searcher</title> | |
</head> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'httparty' | |
require 'date' | |
# This currently just gets all of the alerts and fetches the resulting documents. A good way to test this would be to | |
# compare the returned count of documents. if its close that would be great. | |
# here are all the keys that exist in the query column of the alerts table. | |
# ["startPage", "filterSubjects", "unformattedQuery", "query", "eLocationId", "pageSize", "resultView", "volume", "sortValue", "sortKey", "filterKeyword", "filterArticleTypes", "filterSubjectsDisjunction", "filterAuthors", "filterJournals", "id", "sort", "filterArticleType", "filterStartDate", "filterEndDate", "resultsPerPage", "sortOrder", "page", "x", "y", "from", "q", "filterSections"] | |
ALLOWED_QUERY_KEYS = ["q", "filterSubjects", "volume", "filterKeyword", "filterArticleTypes", "filterSubjectsDisjunction", "filterAuthors", "filterJournals","filterArticleType", "filterSections", "query", "unformattedQuery"] | |
WOMBAT_SEARCH_URL = 'https://collections.plos.org/dynamicSearch' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let containerClass = 'related-articles-container'; | |
let listId = 'related-articles-list'; | |
let header = 'Similar PLOS Articles'; | |
let params = new URLSearchParams(window.location.search); | |
let relatedDoi = params.get('id'); | |
let allowedTypes = ['Research Article', 'Front Matter']; | |
// GTM doesn't support backtick notation, refactor | |
function relatedCallback (data) { | |
console.log(data) | |
let relatedDocs = data['moreLikeThis'][relatedDoi]['docs'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/controllers/events_controller.rb | |
class EventsController < ApplicationController | |
def create | |
Event.create(params.permit(:event_type, :doi, :event_data)) | |
render json: {}, status: :ok | |
end | |
end | |
# app/models/event.rb | |
class Event < ActiveRecord |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Jobs | |
class ::PlosSalesforceUserImporter < Jobs::Scheduled | |
every 2.hours # TODO: not sure if correct | |
CLIENT_KEYS = [:username, :password, :client_id, :client_secret, :host] | |
SETTING_PREFIX = 'plos_salesforce_user_importer_' | |
IMPORT_FIELDS = %w( | |
Id PersonEmail Salutation FirstName LastName Name | |
Affiliation__pc GUID_Acct__c ORCiD__c Iso_Country_Code__pc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "csv" | |
require File.expand_path(File.dirname(__FILE__) + "/base.rb") | |
# Edit the constants and initialize method for your import data. | |
# Requires that Custom User Fields be created before running scrit with names matching the keys in REQUIRED_USER_FIELD_NAME_MAP | |
# Call it like this: | |
# RAILS_ENV=production CSV_FILE=/path/to/file.csv bundle exec ruby script/import_scripts/moodle_csv.rb | |
class ImportScripts::MoodleCsv < ImportScripts::Base | |
CSV_FILE_PATH = ENV['CSV_FILE'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
require 'csv' | |
require 'pry' | |
class Transmogrifier | |
# this class takes a bunch of plos landing page json and | |
# renders bootstrap 4 html into a CSV that can be imported | |
# to wordpress. Makes ya wonder. | |
def initialize(page_object) |