Skip to content

Commit

Permalink
Merge branch 'release/0.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
brianjgeiger committed Jun 27, 2017
2 parents b2dd355 + f6d676e commit d0a2dbd
Show file tree
Hide file tree
Showing 294 changed files with 7,474 additions and 3,113 deletions.
9 changes: 8 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
language: node_js

sudo: false
sudo: required
dist: trusty
addons:
chrome: stable

env:
global:
- SUPPRESS_NO_CONFIG_WARNING=true
- PERSONAL_ACCESS_TOKEN=TEST_TOKEN

cache:
yarn: true
directories:
- node_modules
- $HOME/.cache # includes bowers cache

before_install:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start

install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH=$HOME/.yarn/bin:$PATH
Expand Down
2 changes: 1 addition & 1 deletion addon/adapters/osf-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
*/
export default DS.JSONAPIAdapter.extend(HasManyQuery.RESTAdapterMixin, GenericDataAdapterMixin, {
headers: {
ACCEPT: 'application/vnd.api+json; version=2.3'
ACCEPT: 'application/vnd.api+json; version=2.4'
},
authorizer: config['ember-simple-auth'].authorizer,
host: config.OSF.apiUrl,
Expand Down
69 changes: 17 additions & 52 deletions addon/components/discover-page/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import { getUniqueList, getSplitParams, encodeParams } from '../../utils/elastic
* showActiveFilters=showActiveFilters
* sortOptions=sortOptions
* subject=subject
* themeProvider=themeProvider
* }}
* ```
* @class discover-page
Expand Down Expand Up @@ -107,11 +108,11 @@ export default Ember.Component.extend(Analytics, hostAppName, {
{ key: 'contributors', title: 'People', component: 'search-facet-typeahead', base: 'agents', type: 'person' }
]
*/
facets: Ember.computed('processedTypes', function() {
facets: Ember.computed(function() {
return [
{ key: 'sources', title: `${this.get('i18n').t('eosf.components.discoverPage.source')}`, component: 'search-facet-source' },
{ key: 'date', title: `${this.get('i18n').t('eosf.components.discoverPage.date')}`, component: 'search-facet-daterange' },
{ key: 'type', title: `${this.get('i18n').t('eosf.components.discoverPage.type')}`, component: 'search-facet-worktype', data: this.get('processedTypes') },
{ key: 'type', title: `${this.get('i18n').t('eosf.components.discoverPage.type')}`, component: 'search-facet-worktype', },
{ key: 'tags', title: `${this.get('i18n').t('eosf.components.discoverPage.tag')}`, component: 'search-facet-typeahead' },
{ key: 'publishers', title: `${this.get('i18n').t('eosf.components.discoverPage.publisher')}`, component: 'search-facet-typeahead', base: 'agents', type: 'publisher' },
{ key: 'funders', title: `${this.get('i18n').t('eosf.components.discoverPage.funder')}`, component: 'search-facet-typeahead', base: 'agents', type: 'funder' },
Expand Down Expand Up @@ -179,7 +180,6 @@ export default Ember.Component.extend(Analytics, hostAppName, {
* @default ''
*/
provider: '',
providerName: null, // For PREPRINTS and REGISTRIES. Provider name, if theme.isProvider, ex: psyarxiv
/**
* 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.
* @property {String} publishers
Expand Down Expand Up @@ -287,6 +287,12 @@ export default Ember.Component.extend(Analytics, hostAppName, {
* @default ''
*/
tags: '',
/**
* themeProvider
* @property {Object} Preprint provider loaded from theme service. Should be passed from consuming service so it is loaded before SHARE is queried.
* @default ''
*/
themeProvider: null,
took: 0,
/**
* 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.
Expand Down Expand Up @@ -348,11 +354,6 @@ export default Ember.Component.extend(Analytics, hostAppName, {
this.setActiveFiltersAndReload('activeFilters.providers', filter.split('OR'));
}
})),
processedTypes: Ember.computed('types', function() {
// Ember-SHARE property
const types = this.get('types') && this.get('types').CreativeWork ? this.get('types').CreativeWork.children : {};
return this.transformTypes(types);
}),
reloadSearch: Ember.observer('activeFilters.providers.@each', 'activeFilters.subjects.@each', 'activeFilters.types.@each', function() {
// For PREPRINTS and REGISTRIES. Reloads page if activeFilters change.
this.set('page', 1);
Expand Down Expand Up @@ -478,11 +479,15 @@ export default Ember.Component.extend(Analytics, hostAppName, {
});
});

// For PREPRINTS and REGISTRIES. If theme.isProvider, add this provider to the query body
if (this.get('theme.isProvider') && this.get('providerName') !== null) {
// For PREPRINTS and REGISTRIES. If theme.isProvider, add provider(s) to query body
if (this.get('theme.isProvider') && this.get('themeProvider.name') !== null) {
const themeProvider = this.get('themeProvider');
// Regular preprint providers will have their search results restricted to the one provider.
// If the provider has additionalProviders, all of these providers will be added to the "sources" SHARE query
const sources = (themeProvider.get('additionalProviders') || []).length ? themeProvider.get('additionalProviders') : [themeProvider.get('name')];
filters.push({
terms: {
sources: [this.get('providerName')]
sources: sources
}
});
}
Expand Down Expand Up @@ -518,28 +523,13 @@ export default Ember.Component.extend(Analytics, hostAppName, {
this.set('displayQueryBody', { query });
return this.set('queryBody', queryBody);
},
getTypes() {
// Ember-SHARE method
return Ember.$.ajax({
url: config.OSF.shareApiUrl + '/schema/creativework/hierarchy/',
crossDomain: true,
type: 'GET',
contentType: 'application/vnd.api+json',
}).then((json) => {
if (json.data) {
this.set('types', json.data);
}
});
},
init() {
//TODO Sort initial results on date_modified
// Runs on initial render.
this._super(...arguments);
this.set('firstLoad', true);
this.set('facetFilters', Ember.Object.create());
this.getTypes();
this.getCounts();
this.loadProvider();
this.loadPage();
},
loadPage() {
Expand All @@ -565,7 +555,7 @@ export default Ember.Component.extend(Analytics, hostAppName, {
hyperLinks: [// Links that are hyperlinks from hit._source.lists.links
{
type: 'share',
url: config.OSF.shareBaseUrl + `${hit._source.type}` + '/' + hit._id
url: config.OSF.shareBaseUrl + `${hit._source.type.replace(/ /g,'')}` + '/' + hit._id
}
],
infoLinks: [], // Links that are not hyperlinks hit._source.lists.links
Expand Down Expand Up @@ -634,16 +624,6 @@ export default Ember.Component.extend(Analytics, hostAppName, {
jqDeferred.fail((reason) => reject(reason));
});
},
loadProvider() {
// For PREPRINTS and REGISTRIES - Loads preprint provider if theme.isProvider
// Needed because theme's provider was not loading before SHARE was queried.
if (this.get('theme.isProvider')) {
this.get('theme.provider').then(provider => {
this.set('providerName', provider.get('name'));
this.loadPage();
});
}
},
scrollToResults() {
// Scrolls to top of search results
Ember.$('html, body').scrollTop(this.$('.results-top').position().top);
Expand Down Expand Up @@ -675,21 +655,6 @@ export default Ember.Component.extend(Analytics, hostAppName, {

});
},
transformTypes(obj) {
// Ember-SHARE method
if (typeof (obj) !== 'object') {
return obj;
}

for (let key in obj) {
let lowKey = key.replace(/([A-Z])/g, ' $1').trim().toLowerCase();
obj[lowKey] = this.transformTypes(obj[key]);
if (key !== lowKey) {
delete obj[key];
}
}
return obj;
},
actions: {
addFilter(type, filterValue) {
// Ember-SHARE action. Used to add filter from the search results.
Expand Down
44 changes: 28 additions & 16 deletions addon/components/discover-page/template.hbs
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
{{!Component builds DISCOVER PAGE - Blend of Ember-SHARE, Preprints, and Registries Discover pages}}
<div class="search-header">
<div class="container">
<div class="row m-v-md"> {{!BRANDING}}
{{!BRANDING}}
<div class="row m-v-md">
<div class="col-xs-12 text-center">
{{#if (or theme.isProvider providerLogo)}} {{!Provider Logo, if exists}}
{{!Provider Logo, if exists}}
{{#if (or theme.isProvider providerLogo)}}
<div class="col-xs-6 text-right">
<div class="provider-brand" id="provider-brand-background"></div>
</div>
{{/if}}
<div class={{if (or theme.isProvider providerLogo) 'col-xs-6 text-left'}}>
<div class="registries-brand m-t-lg"></div> {{!REGISTRIES ONLY}}
{{!REGISTRIES ONLY}}
<div class="registries-brand m-t-lg"></div>
{{!Discover Page Header text}}
{{#if discoverHeader}}
<h1> {{discoverHeader}} </h1> {{!Discover Page Header text}}
<h1> {{discoverHeader}} </h1>
{{/if}}
{{!POWERED BY SHARE}}
{{!POWERED BY SHARE}}
<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>
</div>
</div>
</div>

<div class="row m-t-md m-b-lg text-center"> {{!SEARCH}}
{{!SEARCH}}
<div class="row m-t-md m-b-lg text-center">
<div class="col-xs-12 col-sm-8 col-sm-offset-2">
<div class="input-group input-group-lg"> {{!SEARCH BAR}}
{{!SEARCH BAR}}
<div class="input-group input-group-lg">
{{input id="searchBox" value=q class="form-control" key-up='typing' placeholder=searchPlaceholder}}
<span class="input-group-btn">
{{!HELP BUTTON}}
Expand Down Expand Up @@ -87,7 +93,8 @@
<div class="search-main p-v-xl">
<div class="container">
<div class="row search-results-section">
<div class="col-sm-4 col-xs-12 search-sidebar"> {{!LEFT PANEL - SEARCH FACETS}}
{{!LEFT PANEL - SEARCH FACETS}}
<div class="col-sm-4 col-xs-12 search-sidebar">
{{! ACTIVE FILTERS - FOR PREPRINTS, REGISTRIES}}
{{#if showActiveFilters}}
<div id="activeFilters" class="well well-sm p-md">
Expand Down Expand Up @@ -141,35 +148,40 @@
}}

{{!ADD PREPRINT BUTTON - Preprints Only }}
{{#if (eq hostAppName 'Preprints')}}
{{#if (and (eq hostAppName 'Preprints') themeProvider.allowSubmissions)}}
{{add-preprint-box}}
{{/if}}

</div>

<div class="col-sm-8 col-xs-12"> {{!RIGHT PANEL - SEARCH RESULTS}}
{{#if loading}} {{!SEARCH LOADING}}
{{!RIGHT PANEL - SEARCH RESULTS}}
<div class="col-sm-8 col-xs-12">
{{!SEARCH LOADING}}
{{#if loading}}
<div class="text-center p-v-md" aria-label={{t 'eosf.components.discoverPage.searchLoading'}}>
{{fa-icon 'spinner' ariaHidden=false pulse=true size=3}}
</div>
{{else}}
{{#if numberOfResults}} {{!RESULTS FOUND}}
{{#if numberOfResults}}
{{!RESULTS FOUND}}
<div class="results-top">
{{#each results as |result|}}
{{search-result queryParams=queryParams detailRoute=detailRoute filterReplace=filterReplace addFilter='addFilter' updateFilters=(action 'updateFilters') result=result currentService=currentService}}
{{search-result themeProvider=themeProvider queryParams=queryParams detailRoute=detailRoute filterReplace=filterReplace addFilter='addFilter' updateFilters=(action 'updateFilters') result=result currentService=currentService}}
{{/each}}
</div>
<div class="pull-right text-right">
{{pagination-pager count=clampedPages current=page change=(action 'setLoadPage')}}
</div>
{{else if queryError}} {{!PROBLEM WITH SEARCH QUERY}}
{{else if queryError}}
{{!PROBLEM WITH SEARCH QUERY}}
{{query-syntax message=queryError}}
{{else if shareDown}} {{!SHARE IS DOWN}}
{{else if shareDown}}
<div class="text-muted text-center">
<p class="lead ">{{t 'eosf.components.discoverPage.shareUnavailable'}}</p>
<p> {{t 'eosf.components.discoverPage.shareUnavailableDescription'}}</p>
</div>
{{else}} {{!NO RESULTS FOUND}}
{{else}}
{{!NO RESULTS FOUND}}
<div class="text-muted text-center">
<p class="lead ">{{t "eosf.components.discoverPage.noResultsFound"}}</p>
<p>{{t 'eosf.components.discoverPage.broadenSearch'}}</p>
Expand Down
2 changes: 1 addition & 1 deletion addon/components/file-browser-item/template.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{{! TODO: configurable columns }}
{{file-browser-icon item=item}}
<a {{action 'open'}}>{{item.itemName}}</a>
<a {{action 'open'}} role="link">{{item.itemName}}</a>
17 changes: 10 additions & 7 deletions addon/components/file-browser/template.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ol class='breadcrumb'>
{{#each breadcrumbs as |item|}}
<li>
<a {{action 'navigateToItem' item}}>
<a {{action 'navigateToItem' item}} role="link">
{{file-browser-icon item=item}}
{{item.itemName}}
</a>
Expand All @@ -14,13 +14,16 @@
{{/if}}

<div class='file-browser-list'>
{{#ember-collection items=items
{{#ember-collection
items=items
cell-layout=(fixed-grid-layout itemWidth itemHeight)
as |item index|}}
{{file-browser-item item=item
navigateToItem=(action 'navigateToItem')
selectItem=(action 'selectItem')
openItem=(action 'openItem')
as |item|
}}
{{file-browser-item
item=item
navigateToItem=(action 'navigateToItem')
selectItem=(action 'selectItem')
openItem=(action 'openItem')
}}
{{/ember-collection}}
{{#unless itemsLoaded}}
Expand Down
7 changes: 4 additions & 3 deletions addon/components/file-widget/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
{{else}}
<label>Choose an OSF project:</label>
{{#power-select options=userNodes closeOnSelect=false searchField='title' selected=selectedNode onchange=(action (mut selectedNode)) as |node|}}
<img src="{{country.flagUrl}}" class="icon-flag"> <strong>{{node.title}}</strong>
<img src="{{country.flagUrl}}" class="icon-flag" alt="{{node.title}} flag"> <strong>{{node.title}}</strong>
{{/power-select}}
{{/if}}
</div>
{{else}}
<p> {{selectedNode.title}} <button class="btn btn-default" {{action 'deselectNode'}}>Back</button> </p>
{{file-browser rootNode=selectedNode
onClickFile=(action 'selectNodeFile')
{{file-browser
rootNode=selectedNode
onClickFile=(action 'selectNodeFile')
}}
{{/if}}
</div>
Expand Down
4 changes: 2 additions & 2 deletions addon/components/license-picker/template.hbs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<div class={{if showBorder "panel panel-default" ''}}>
<div class={{if showBorder "panel-body" ''}}>
{{#if allowDismiss}}
<span class='text-muted' style='cursor: pointer; float: right;' {{action 'dismiss'}}>{{fa-icon 'times'}}</span>
<span class='text-muted' style='cursor: pointer; float: right;' {{action 'dismiss'}} role="button">{{fa-icon 'times'}}</span>
{{/if}}
<div class="form-inline">
<div class="form-group">
<label> Choose a license: <span style="color: #f99; font-weight: 400"> (required)</span></label>
{{license-list licenses=licensesAvailable currentLicense=nodeLicense showCategories=showCategories select=(action 'selectLicense')}}
<small><a target='_blank' href='http://help.osf.io/m/60347/l/611430-licensing'>License FAQ</a></small>
<small><a target='_blank' rel="noopener" href='http://help.osf.io/m/60347/l/611430-licensing'>License FAQ</a></small>
</div>
<br>
</div>
Expand Down
2 changes: 1 addition & 1 deletion addon/components/navbar-auth-dropdown/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default Ember.Component.extend({
actions: {
logout() {
const redirectUrl = this.get('redirectUrl');
const query = redirectUrl ? '?' + Ember.$.param({ next_url: redirectUrl }) : '';
const query = redirectUrl ? '?' + Ember.$.param({ next: redirectUrl }) : '';
// TODO: May not work well if logging out from page that requires login- check?
this.get('session').invalidate()
.then(() => window.location.href = `${config.OSF.url}logout/${query}`);
Expand Down
9 changes: 5 additions & 4 deletions addon/components/navbar-auth-dropdown/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,21 @@
<a href="{{host}}settings/"><i class="fa fa-cog fa-lg p-r-xs"></i> Settings</a>
</li>
<li>
<a onclick={{action 'logout'}}><i class="fa fa-sign-out fa-lg p-r-xs"></i> Log out</a>
<a onclick={{action 'logout'}} role="button"><i class="fa fa-sign-out fa-lg p-r-xs"></i> Log out</a>
</li>
</ul>
{{else if allowLogin}}
{{#if institution}} {{! TODO: How does the page know whether this is an institution view? Implement in the future }}
{{#if institution}}
{{! TODO: How does the page know whether this is an institution view? Implement in the future }}
<div class="btn-group">
<a href="${domain}login/?campaign=institution&redirect_url=${redirect_url}" class="btn btn-info btn-top-login">
Sign in <span class="hidden-xs"><i class="fa fa-arrow-right"></i></span>
Sign In <span class="hidden-xs"><i class="fa fa-arrow-right"></i></span>
</a>
</div>
{{else}}
<div class="col-sm-12">
<a href="{{signupUrl}}" class="btn btn-success btn-top-signup m-r-xs">Sign Up</a>
<a {{action loginAction}} class="btn btn-info btn-top-login m-r-xs">Sign in</a>
<button {{action loginAction}} class="btn btn-info btn-top-login m-r-xs">Sign In</button>
</div>
{{/if}}
{{/if}}
Loading

0 comments on commit d0a2dbd

Please sign in to comment.