Skip to content

Commit d0a2dbd

Browse files
committed
Merge branch 'release/0.6.0'
2 parents b2dd355 + f6d676e commit d0a2dbd

File tree

294 files changed

+7474
-3113
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

294 files changed

+7474
-3113
lines changed

.travis.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
language: node_js
22

3-
sudo: false
3+
sudo: required
44
dist: trusty
5+
addons:
6+
chrome: stable
57

68
env:
79
global:
810
- SUPPRESS_NO_CONFIG_WARNING=true
11+
- PERSONAL_ACCESS_TOKEN=TEST_TOKEN
912

1013
cache:
1114
yarn: true
1215
directories:
1316
- node_modules
1417
- $HOME/.cache # includes bowers cache
1518

19+
before_install:
20+
- export DISPLAY=:99.0
21+
- sh -e /etc/init.d/xvfb start
22+
1623
install:
1724
- curl -o- -L https://yarnpkg.com/install.sh | bash
1825
- export PATH=$HOME/.yarn/bin:$PATH

addon/adapters/osf-adapter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
*/
2525
export default DS.JSONAPIAdapter.extend(HasManyQuery.RESTAdapterMixin, GenericDataAdapterMixin, {
2626
headers: {
27-
ACCEPT: 'application/vnd.api+json; version=2.3'
27+
ACCEPT: 'application/vnd.api+json; version=2.4'
2828
},
2929
authorizer: config['ember-simple-auth'].authorizer,
3030
host: config.OSF.apiUrl,

addon/components/discover-page/component.js

Lines changed: 17 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import { getUniqueList, getSplitParams, encodeParams } from '../../utils/elastic
4848
* showActiveFilters=showActiveFilters
4949
* sortOptions=sortOptions
5050
* subject=subject
51+
* themeProvider=themeProvider
5152
* }}
5253
* ```
5354
* @class discover-page
@@ -107,11 +108,11 @@ export default Ember.Component.extend(Analytics, hostAppName, {
107108
{ key: 'contributors', title: 'People', component: 'search-facet-typeahead', base: 'agents', type: 'person' }
108109
]
109110
*/
110-
facets: Ember.computed('processedTypes', function() {
111+
facets: Ember.computed(function() {
111112
return [
112113
{ key: 'sources', title: `${this.get('i18n').t('eosf.components.discoverPage.source')}`, component: 'search-facet-source' },
113114
{ key: 'date', title: `${this.get('i18n').t('eosf.components.discoverPage.date')}`, component: 'search-facet-daterange' },
114-
{ key: 'type', title: `${this.get('i18n').t('eosf.components.discoverPage.type')}`, component: 'search-facet-worktype', data: this.get('processedTypes') },
115+
{ key: 'type', title: `${this.get('i18n').t('eosf.components.discoverPage.type')}`, component: 'search-facet-worktype', },
115116
{ key: 'tags', title: `${this.get('i18n').t('eosf.components.discoverPage.tag')}`, component: 'search-facet-typeahead' },
116117
{ key: 'publishers', title: `${this.get('i18n').t('eosf.components.discoverPage.publisher')}`, component: 'search-facet-typeahead', base: 'agents', type: 'publisher' },
117118
{ key: 'funders', title: `${this.get('i18n').t('eosf.components.discoverPage.funder')}`, component: 'search-facet-typeahead', base: 'agents', type: 'funder' },
@@ -179,7 +180,6 @@ export default Ember.Component.extend(Analytics, hostAppName, {
179180
* @default ''
180181
*/
181182
provider: '',
182-
providerName: null, // For PREPRINTS and REGISTRIES. Provider name, if theme.isProvider, ex: psyarxiv
183183
/**
184184
* Publishers query parameter. If "publishers" is one of your query params, it must be passed to the component so it can be reflected in the URL.
185185
* @property {String} publishers
@@ -287,6 +287,12 @@ export default Ember.Component.extend(Analytics, hostAppName, {
287287
* @default ''
288288
*/
289289
tags: '',
290+
/**
291+
* themeProvider
292+
* @property {Object} Preprint provider loaded from theme service. Should be passed from consuming service so it is loaded before SHARE is queried.
293+
* @default ''
294+
*/
295+
themeProvider: null,
290296
took: 0,
291297
/**
292298
* type query parameter. If "type" is one of your query params, it must be passed to the component so it can be reflected in the URL.
@@ -348,11 +354,6 @@ export default Ember.Component.extend(Analytics, hostAppName, {
348354
this.setActiveFiltersAndReload('activeFilters.providers', filter.split('OR'));
349355
}
350356
})),
351-
processedTypes: Ember.computed('types', function() {
352-
// Ember-SHARE property
353-
const types = this.get('types') && this.get('types').CreativeWork ? this.get('types').CreativeWork.children : {};
354-
return this.transformTypes(types);
355-
}),
356357
reloadSearch: Ember.observer('activeFilters.providers.@each', 'activeFilters.subjects.@each', 'activeFilters.types.@each', function() {
357358
// For PREPRINTS and REGISTRIES. Reloads page if activeFilters change.
358359
this.set('page', 1);
@@ -478,11 +479,15 @@ export default Ember.Component.extend(Analytics, hostAppName, {
478479
});
479480
});
480481

481-
// For PREPRINTS and REGISTRIES. If theme.isProvider, add this provider to the query body
482-
if (this.get('theme.isProvider') && this.get('providerName') !== null) {
482+
// For PREPRINTS and REGISTRIES. If theme.isProvider, add provider(s) to query body
483+
if (this.get('theme.isProvider') && this.get('themeProvider.name') !== null) {
484+
const themeProvider = this.get('themeProvider');
485+
// Regular preprint providers will have their search results restricted to the one provider.
486+
// If the provider has additionalProviders, all of these providers will be added to the "sources" SHARE query
487+
const sources = (themeProvider.get('additionalProviders') || []).length ? themeProvider.get('additionalProviders') : [themeProvider.get('name')];
483488
filters.push({
484489
terms: {
485-
sources: [this.get('providerName')]
490+
sources: sources
486491
}
487492
});
488493
}
@@ -518,28 +523,13 @@ export default Ember.Component.extend(Analytics, hostAppName, {
518523
this.set('displayQueryBody', { query });
519524
return this.set('queryBody', queryBody);
520525
},
521-
getTypes() {
522-
// Ember-SHARE method
523-
return Ember.$.ajax({
524-
url: config.OSF.shareApiUrl + '/schema/creativework/hierarchy/',
525-
crossDomain: true,
526-
type: 'GET',
527-
contentType: 'application/vnd.api+json',
528-
}).then((json) => {
529-
if (json.data) {
530-
this.set('types', json.data);
531-
}
532-
});
533-
},
534526
init() {
535527
//TODO Sort initial results on date_modified
536528
// Runs on initial render.
537529
this._super(...arguments);
538530
this.set('firstLoad', true);
539531
this.set('facetFilters', Ember.Object.create());
540-
this.getTypes();
541532
this.getCounts();
542-
this.loadProvider();
543533
this.loadPage();
544534
},
545535
loadPage() {
@@ -565,7 +555,7 @@ export default Ember.Component.extend(Analytics, hostAppName, {
565555
hyperLinks: [// Links that are hyperlinks from hit._source.lists.links
566556
{
567557
type: 'share',
568-
url: config.OSF.shareBaseUrl + `${hit._source.type}` + '/' + hit._id
558+
url: config.OSF.shareBaseUrl + `${hit._source.type.replace(/ /g,'')}` + '/' + hit._id
569559
}
570560
],
571561
infoLinks: [], // Links that are not hyperlinks hit._source.lists.links
@@ -634,16 +624,6 @@ export default Ember.Component.extend(Analytics, hostAppName, {
634624
jqDeferred.fail((reason) => reject(reason));
635625
});
636626
},
637-
loadProvider() {
638-
// For PREPRINTS and REGISTRIES - Loads preprint provider if theme.isProvider
639-
// Needed because theme's provider was not loading before SHARE was queried.
640-
if (this.get('theme.isProvider')) {
641-
this.get('theme.provider').then(provider => {
642-
this.set('providerName', provider.get('name'));
643-
this.loadPage();
644-
});
645-
}
646-
},
647627
scrollToResults() {
648628
// Scrolls to top of search results
649629
Ember.$('html, body').scrollTop(this.$('.results-top').position().top);
@@ -675,21 +655,6 @@ export default Ember.Component.extend(Analytics, hostAppName, {
675655

676656
});
677657
},
678-
transformTypes(obj) {
679-
// Ember-SHARE method
680-
if (typeof (obj) !== 'object') {
681-
return obj;
682-
}
683-
684-
for (let key in obj) {
685-
let lowKey = key.replace(/([A-Z])/g, ' $1').trim().toLowerCase();
686-
obj[lowKey] = this.transformTypes(obj[key]);
687-
if (key !== lowKey) {
688-
delete obj[key];
689-
}
690-
}
691-
return obj;
692-
},
693658
actions: {
694659
addFilter(type, filterValue) {
695660
// Ember-SHARE action. Used to add filter from the search results.

addon/components/discover-page/template.hbs

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,33 @@
11
{{!Component builds DISCOVER PAGE - Blend of Ember-SHARE, Preprints, and Registries Discover pages}}
22
<div class="search-header">
33
<div class="container">
4-
<div class="row m-v-md"> {{!BRANDING}}
4+
{{!BRANDING}}
5+
<div class="row m-v-md">
56
<div class="col-xs-12 text-center">
6-
{{#if (or theme.isProvider providerLogo)}} {{!Provider Logo, if exists}}
7+
{{!Provider Logo, if exists}}
8+
{{#if (or theme.isProvider providerLogo)}}
79
<div class="col-xs-6 text-right">
810
<div class="provider-brand" id="provider-brand-background"></div>
911
</div>
1012
{{/if}}
1113
<div class={{if (or theme.isProvider providerLogo) 'col-xs-6 text-left'}}>
12-
<div class="registries-brand m-t-lg"></div> {{!REGISTRIES ONLY}}
14+
{{!REGISTRIES ONLY}}
15+
<div class="registries-brand m-t-lg"></div>
16+
{{!Discover Page Header text}}
1317
{{#if discoverHeader}}
14-
<h1> {{discoverHeader}} </h1> {{!Discover Page Header text}}
18+
<h1> {{discoverHeader}} </h1>
1519
{{/if}}
16-
{{!POWERED BY SHARE}}
20+
{{!POWERED BY SHARE}}
1721
<p class="lead">{{t 'eosf.components.discoverPage.poweredBy'}} <a href="https://share.osf.io/" id='share-logo' class="share-logo" title="SHARE" onclick={{action "click" "link" "Discover - SHARE Logo"}}></a></p>
1822
</div>
1923
</div>
2024
</div>
2125

22-
<div class="row m-t-md m-b-lg text-center"> {{!SEARCH}}
26+
{{!SEARCH}}
27+
<div class="row m-t-md m-b-lg text-center">
2328
<div class="col-xs-12 col-sm-8 col-sm-offset-2">
24-
<div class="input-group input-group-lg"> {{!SEARCH BAR}}
29+
{{!SEARCH BAR}}
30+
<div class="input-group input-group-lg">
2531
{{input id="searchBox" value=q class="form-control" key-up='typing' placeholder=searchPlaceholder}}
2632
<span class="input-group-btn">
2733
{{!HELP BUTTON}}
@@ -87,7 +93,8 @@
8793
<div class="search-main p-v-xl">
8894
<div class="container">
8995
<div class="row search-results-section">
90-
<div class="col-sm-4 col-xs-12 search-sidebar"> {{!LEFT PANEL - SEARCH FACETS}}
96+
{{!LEFT PANEL - SEARCH FACETS}}
97+
<div class="col-sm-4 col-xs-12 search-sidebar">
9198
{{! ACTIVE FILTERS - FOR PREPRINTS, REGISTRIES}}
9299
{{#if showActiveFilters}}
93100
<div id="activeFilters" class="well well-sm p-md">
@@ -141,35 +148,40 @@
141148
}}
142149

143150
{{!ADD PREPRINT BUTTON - Preprints Only }}
144-
{{#if (eq hostAppName 'Preprints')}}
151+
{{#if (and (eq hostAppName 'Preprints') themeProvider.allowSubmissions)}}
145152
{{add-preprint-box}}
146153
{{/if}}
147154

148155
</div>
149156

150-
<div class="col-sm-8 col-xs-12"> {{!RIGHT PANEL - SEARCH RESULTS}}
151-
{{#if loading}} {{!SEARCH LOADING}}
157+
{{!RIGHT PANEL - SEARCH RESULTS}}
158+
<div class="col-sm-8 col-xs-12">
159+
{{!SEARCH LOADING}}
160+
{{#if loading}}
152161
<div class="text-center p-v-md" aria-label={{t 'eosf.components.discoverPage.searchLoading'}}>
153162
{{fa-icon 'spinner' ariaHidden=false pulse=true size=3}}
154163
</div>
155164
{{else}}
156-
{{#if numberOfResults}} {{!RESULTS FOUND}}
165+
{{#if numberOfResults}}
166+
{{!RESULTS FOUND}}
157167
<div class="results-top">
158168
{{#each results as |result|}}
159-
{{search-result queryParams=queryParams detailRoute=detailRoute filterReplace=filterReplace addFilter='addFilter' updateFilters=(action 'updateFilters') result=result currentService=currentService}}
169+
{{search-result themeProvider=themeProvider queryParams=queryParams detailRoute=detailRoute filterReplace=filterReplace addFilter='addFilter' updateFilters=(action 'updateFilters') result=result currentService=currentService}}
160170
{{/each}}
161171
</div>
162172
<div class="pull-right text-right">
163173
{{pagination-pager count=clampedPages current=page change=(action 'setLoadPage')}}
164174
</div>
165-
{{else if queryError}} {{!PROBLEM WITH SEARCH QUERY}}
175+
{{else if queryError}}
176+
{{!PROBLEM WITH SEARCH QUERY}}
166177
{{query-syntax message=queryError}}
167-
{{else if shareDown}} {{!SHARE IS DOWN}}
178+
{{else if shareDown}}
168179
<div class="text-muted text-center">
169180
<p class="lead ">{{t 'eosf.components.discoverPage.shareUnavailable'}}</p>
170181
<p> {{t 'eosf.components.discoverPage.shareUnavailableDescription'}}</p>
171182
</div>
172-
{{else}} {{!NO RESULTS FOUND}}
183+
{{else}}
184+
{{!NO RESULTS FOUND}}
173185
<div class="text-muted text-center">
174186
<p class="lead ">{{t "eosf.components.discoverPage.noResultsFound"}}</p>
175187
<p>{{t 'eosf.components.discoverPage.broadenSearch'}}</p>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{{! TODO: configurable columns }}
22
{{file-browser-icon item=item}}
3-
<a {{action 'open'}}>{{item.itemName}}</a>
3+
<a {{action 'open'}} role="link">{{item.itemName}}</a>

addon/components/file-browser/template.hbs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<ol class='breadcrumb'>
22
{{#each breadcrumbs as |item|}}
33
<li>
4-
<a {{action 'navigateToItem' item}}>
4+
<a {{action 'navigateToItem' item}} role="link">
55
{{file-browser-icon item=item}}
66
{{item.itemName}}
77
</a>
@@ -14,13 +14,16 @@
1414
{{/if}}
1515

1616
<div class='file-browser-list'>
17-
{{#ember-collection items=items
17+
{{#ember-collection
18+
items=items
1819
cell-layout=(fixed-grid-layout itemWidth itemHeight)
19-
as |item index|}}
20-
{{file-browser-item item=item
21-
navigateToItem=(action 'navigateToItem')
22-
selectItem=(action 'selectItem')
23-
openItem=(action 'openItem')
20+
as |item|
21+
}}
22+
{{file-browser-item
23+
item=item
24+
navigateToItem=(action 'navigateToItem')
25+
selectItem=(action 'selectItem')
26+
openItem=(action 'openItem')
2427
}}
2528
{{/ember-collection}}
2629
{{#unless itemsLoaded}}

addon/components/file-widget/template.hbs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@
1616
{{else}}
1717
<label>Choose an OSF project:</label>
1818
{{#power-select options=userNodes closeOnSelect=false searchField='title' selected=selectedNode onchange=(action (mut selectedNode)) as |node|}}
19-
<img src="{{country.flagUrl}}" class="icon-flag"> <strong>{{node.title}}</strong>
19+
<img src="{{country.flagUrl}}" class="icon-flag" alt="{{node.title}} flag"> <strong>{{node.title}}</strong>
2020
{{/power-select}}
2121
{{/if}}
2222
</div>
2323
{{else}}
2424
<p> {{selectedNode.title}} <button class="btn btn-default" {{action 'deselectNode'}}>Back</button> </p>
25-
{{file-browser rootNode=selectedNode
26-
onClickFile=(action 'selectNodeFile')
25+
{{file-browser
26+
rootNode=selectedNode
27+
onClickFile=(action 'selectNodeFile')
2728
}}
2829
{{/if}}
2930
</div>

addon/components/license-picker/template.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<div class={{if showBorder "panel panel-default" ''}}>
22
<div class={{if showBorder "panel-body" ''}}>
33
{{#if allowDismiss}}
4-
<span class='text-muted' style='cursor: pointer; float: right;' {{action 'dismiss'}}>{{fa-icon 'times'}}</span>
4+
<span class='text-muted' style='cursor: pointer; float: right;' {{action 'dismiss'}} role="button">{{fa-icon 'times'}}</span>
55
{{/if}}
66
<div class="form-inline">
77
<div class="form-group">
88
<label> Choose a license: <span style="color: #f99; font-weight: 400"> (required)</span></label>
99
{{license-list licenses=licensesAvailable currentLicense=nodeLicense showCategories=showCategories select=(action 'selectLicense')}}
10-
<small><a target='_blank' href='http://help.osf.io/m/60347/l/611430-licensing'>License FAQ</a></small>
10+
<small><a target='_blank' rel="noopener" href='http://help.osf.io/m/60347/l/611430-licensing'>License FAQ</a></small>
1111
</div>
1212
<br>
1313
</div>

addon/components/navbar-auth-dropdown/component.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export default Ember.Component.extend({
6363
actions: {
6464
logout() {
6565
const redirectUrl = this.get('redirectUrl');
66-
const query = redirectUrl ? '?' + Ember.$.param({ next_url: redirectUrl }) : '';
66+
const query = redirectUrl ? '?' + Ember.$.param({ next: redirectUrl }) : '';
6767
// TODO: May not work well if logging out from page that requires login- check?
6868
this.get('session').invalidate()
6969
.then(() => window.location.href = `${config.OSF.url}logout/${query}`);

addon/components/navbar-auth-dropdown/template.hbs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,21 @@
2121
<a href="{{host}}settings/"><i class="fa fa-cog fa-lg p-r-xs"></i> Settings</a>
2222
</li>
2323
<li>
24-
<a onclick={{action 'logout'}}><i class="fa fa-sign-out fa-lg p-r-xs"></i> Log out</a>
24+
<a onclick={{action 'logout'}} role="button"><i class="fa fa-sign-out fa-lg p-r-xs"></i> Log out</a>
2525
</li>
2626
</ul>
2727
{{else if allowLogin}}
28-
{{#if institution}} {{! TODO: How does the page know whether this is an institution view? Implement in the future }}
28+
{{#if institution}}
29+
{{! TODO: How does the page know whether this is an institution view? Implement in the future }}
2930
<div class="btn-group">
3031
<a href="${domain}login/?campaign=institution&redirect_url=${redirect_url}" class="btn btn-info btn-top-login">
31-
Sign in <span class="hidden-xs"><i class="fa fa-arrow-right"></i></span>
32+
Sign In <span class="hidden-xs"><i class="fa fa-arrow-right"></i></span>
3233
</a>
3334
</div>
3435
{{else}}
3536
<div class="col-sm-12">
3637
<a href="{{signupUrl}}" class="btn btn-success btn-top-signup m-r-xs">Sign Up</a>
37-
<a {{action loginAction}} class="btn btn-info btn-top-login m-r-xs">Sign in</a>
38+
<button {{action loginAction}} class="btn btn-info btn-top-login m-r-xs">Sign In</button>
3839
</div>
3940
{{/if}}
4041
{{/if}}

0 commit comments

Comments
 (0)