Skip to content

Commit

Permalink
Merge pull request #503 from adlius/og-image
Browse files Browse the repository at this point in the history
[EOSF-839] Make use of fingerprinted osf-assets for OSF Preprint logoSharing
  • Loading branch information
jamescdavis committed Jan 12, 2018
2 parents 6f9a6da + 8036ab6 commit c83a3f1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 34 deletions.
23 changes: 6 additions & 17 deletions app/services/theme.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Ember from 'ember';
import config from 'ember-get-config';
import pathJoin from '../utils/path-join';
import buildProviderAssetPath from '../utils/build-provider-asset-path';

/**
Expand Down Expand Up @@ -91,22 +90,12 @@ export default Ember.Service.extend({
// The logo object for social sharing
logoSharing: Ember.computed('id', 'isDomain', function() {
const id = this.get('id');
let logo = {};
if (id === 'osf') {
logo = config.PREPRINTS.providers
.find(provider => provider.id === id)
.logoSharing;

logo.path = pathJoin('/preprints', logo.path);
} else {
logo = {
path: buildProviderAssetPath(config, id, 'sharing.png', this.get('isDomain')),
type: 'image/png',
width: 1200,
height: 630
}
}
return logo;
return {
path: buildProviderAssetPath(config, id, 'sharing.png', this.get('isDomain')),
type: 'image/png',
width: 1200,
height: 630
};
}),

// The url to redirect users to sign up to
Expand Down
13 changes: 0 additions & 13 deletions config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,6 @@ module.exports = function(environment) {
},
PREPRINTS: {
defaultProvider: 'osf',
// Logos are needed for open graph sharing meta tags (Facebook, LinkedIn, etc) and must be at least 200x200
providers: [
// OSF must be the first provider
{
id: 'osf',
logoSharing: {
path: '/assets/img/provider_logos/osf-dark.png',
type: 'image/png',
width: 363,
height: 242
}
}
],
},
i18n: {
defaultLocale: 'en'
Expand Down
6 changes: 2 additions & 4 deletions tests/unit/services/theme-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ test('it exists', function(assert) {
});

test('themes have proper config', function(assert) {
let providers = config.PREPRINTS.providers;
for (var provider of providers) {
assert.ok(typeof provider.id !== 'undefined');
}
let defaultProvider = config.PREPRINTS.defaultProvider;
assert.equal(defaultProvider, 'osf');
});

0 comments on commit c83a3f1

Please sign in to comment.