Skip to content
This repository has been archived by the owner on Nov 2, 2018. It is now read-only.

Commit

Permalink
Merge branch 'release/0.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
brianjgeiger committed Jun 6, 2017
2 parents b9185b7 + 482e26c commit 5e71c92
Show file tree
Hide file tree
Showing 37 changed files with 893 additions and 1,251 deletions.
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,31 @@ ENV GIT_COMMIT ${GIT_COMMIT}

ARG APP_ENV=production
ENV APP_ENV ${APP_ENV}

ARG BACKEND=local
ENV BACKEND ${BACKEND}

ARG OSF_URL=
ENV OSF_URL ${OSF_URL}
ARG OSF_API_URL=
ENV OSF_API_URL ${OSF_API_URL}
ARG OSF_RENDER_URL=
ENV OSF_RENDER_URL ${OSF_RENDER_URL}
ARG OSF_FILE_URL=
ENV OSF_FILE_URL ${OSF_FILE_URL}
ARG OSF_HELP_URL=
ENV OSF_HELP_URL ${OSF_HELP_URL}
ARG OSF_COOKIE_LOGIN_URL=
ENV OSF_COOKIE_LOGIN_URL ${OSF_COOKIE_LOGIN_URL}
ARG OSF_OAUTH_URL=
ENV OSF_OAUTH_URL ${OSF_OAUTH_URL}
ARG SHARE_BASE_URL=
ENV SHARE_BASE_URL ${SHARE_BASE_URL}
ARG SHARE_API_URL=
ENV SHARE_API_URL ${SHARE_API_URL}
ARG SHARE_SEARCH_URL=
ENV SHARE_SEARCH_URL ${SHARE_SEARCH_URL}

RUN ./node_modules/ember-cli/bin/ember build --env ${APP_ENV}

CMD ["yarn", "test"]
16 changes: 0 additions & 16 deletions app/components/author-link/component.js

This file was deleted.

7 changes: 0 additions & 7 deletions app/components/author-link/template.hbs

This file was deleted.

97 changes: 97 additions & 0 deletions app/components/search-facet-provider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import Ember from 'ember';
import config from 'ember-get-config';

var getProvidersPayload = '{"from": 0,"query": {"bool": {"must": {"query_string": {"query": "*"}}, "filter": [{"term": {"types": "registration"}}]}},"aggregations": {"sources": {"terms": {"field": "sources","size": 200}}}}';

/**
* @module ember-osf-registries
* @submodule components
*/

/**
* Builds registry's provider facet for discover page - to be used with Ember-OSF's discover-page component and faceted-search component.
*
* Sample usage:
* ```handlebars
* {{search-facet-provider
* updateFilters=(action 'updateFilters')
* activeFilters=activeFilters
* options=facet
* filterReplace=filterReplace
* key=key
* }}
* ```
* @class search-facet-provider
*/
export default Ember.Component.extend({
store: Ember.inject.service(),
theme: Ember.inject.service(),
otherProviders: [],
searchUrl: config.OSF.shareSearchUrl,
osfProviders: [
'OSF',
// 'AEA Registry', //These need to be added to the language filter once on SHARE (OSF -> OSF Registries)
// 'ANZCTR',
// 'Clinicaltrials.gov',
// 'EGAP',
// 'EU Clinical Trials',
// 'ISRCTN',
// 'Research Registry',
// 'RIDIE'
],
whiteListedProviders: [
'OSF',
'ClinicalTrials.gov',
'Research Registry'
].map(item => item.toLowerCase()),

init() {
this._super(...arguments);

Ember.$.ajax({
type: 'POST',
url: this.get('searchUrl'),
data: getProvidersPayload,
contentType: 'application/json',
crossDomain: true,
}).then(results => {
const hits = results.aggregations.sources.buckets;
const whiteList = this.get('whiteListedProviders');
const providers = hits
.filter(hit => whiteList.includes(hit.key.toLowerCase()));

providers.push(
...this.get('osfProviders')
.filter(key => !providers
.find(hit => hit.key.toLowerCase() === key.toLowerCase())
)
.map(key => ({
key,
doc_count: 0
}))
);

providers
.sort((a, b) => a.key.toLowerCase() < b.key.toLowerCase() ? -1 : 1)
.unshift(
...providers.splice(
providers.findIndex(item => item.key === 'OSF'),
1
)
);

if (!this.get('theme.isProvider')) {
this.set('otherProviders', providers);
} else {
const filtered = providers.filter(
item => item.key.toLowerCase() === this.get('theme.id').toLowerCase()
);

this.set('otherProviders', filtered);
this.get('activeFilters.providers').pushObject(filtered[0].key);
}

this.notifyPropertyChange('otherProviders');
});
}
});
78 changes: 78 additions & 0 deletions app/components/search-facet-registration-type.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import Ember from 'ember';

/**
* @module ember-osf-registries
* @submodule components
*/

/**
* Builds registry's registration type facet for discover page - to be used with Ember-OSF's discover-page component and faceted-search component.
*
* Sample usage:
* ```handlebars
* {{search-facet-registration-type
* updateFilters=(action 'updateFilters')
* activeFilters=activeFilters
* options=facet
* filterReplace=filterReplace
* key=key
* }}
* ```
* @class search-facet-registration-type
*/
export default Ember.Component.extend({
registrationTypes: [
'AsPredicted Preregistration',
'Election Research Preacceptance Competition',
'Open-Ended Registration',
'OSF-Standard Pre-Data Collection Registration',
'Prereg Challenge',
'Pre-Registration in Social Psychology (van \'t Veer & Giner-Sorolla, 2016): Pre-Registration',
'Replication Recipe (Brandt et al., 2013): Post-Completion',
'Replication Recipe (Brandt et al., 2013): Pre-Registration',
],

init() {
this._super(...arguments);
Ember.run.schedule('afterRender', () => {
if (this.OSFIsSoleProvider()) {
return;
}
this.toggleTypeCSS(false);
});
},
registrationTypeCache: null,
setVisibilityOfOSFFilters: Ember.observer('activeFilters.providers', function() {
if (this.OSFIsSoleProvider()) {
if (this.get('registrationTypeCache')) {
this.set('activeFilters.types', Ember.$.extend(true, [], this.get('registrationTypeCache')));
this.set('registrationTypeCache', null);
}
this.toggleTypeCSS(true);
} else {
this.set('registrationTypeCache', Ember.$.extend(true, [], this.get('activeFilters.types')));
this.set('activeFilters.types', []);
this.toggleTypeCSS(false);
}
}),
// Disables search-facet-registration-type
toggleTypeCSS(show) {
if (show) {
Ember.$('.type-selector-warning').hide();
Ember.$('.type-checkbox').removeAttr('disabled');
Ember.$('.registration-type-selector').fadeTo('slow', 1);
} else {
Ember.$('.type-selector-warning').show();
Ember.$('.type-checkbox').attr('disabled', 'disabled');
Ember.$('.registration-type-selector').fadeTo('slow', 0.5);
}
},
OSFIsSoleProvider() {
let soleProvider = false;
const providers = this.get('activeFilters.providers');
if (providers.length === 1 && providers[0] === 'OSF') {
soleProvider = true;
}
return soleProvider;
}
});
2 changes: 1 addition & 1 deletion app/components/search-registries.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default Ember.Component.extend(Analytics, {
.trackEvent({
category: 'button',
action: 'click',
label: 'Registries - Index - Search',
label: 'Index - Search',
extra: query
});
}
Expand Down
60 changes: 0 additions & 60 deletions app/components/search-result.js

This file was deleted.

Loading

0 comments on commit 5e71c92

Please sign in to comment.