Skip to content

Commit

Permalink
Merge branch 'release/20.8.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
fabmiz committed Jul 29, 2020
2 parents 288630d + b76016d commit 55e2b30
Show file tree
Hide file tree
Showing 33 changed files with 608 additions and 281 deletions.
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [20.8.0] - 2020-07-29
### Added
- `contributor-list` read-only to draft metadata page
- `ember-template-lint` addon

### Changed
- analytics for collections
- styles for registries discover sort dropdown (bugfix)

### Removed
- `ember-cli-template-lint`

## [20.7.1] - 2020-07-22
### Changed
- keen public pageviews logging
Expand Down Expand Up @@ -1623,7 +1635,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added
- Quick Files

[Unreleased]: https://github.com/CenterForOpenScience/ember-osf-web/compare/20.7.1...develop
[Unreleased]: https://github.com/CenterForOpenScience/ember-osf-web/compare/20.8.0...develop
[20.8.0]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/20.8.0
[20.7.1]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/20.7.1
[20.7.0]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/20.7.0
[20.6.1]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/20.6.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<li>
{{#link-to
'provider.submit'
click=(action 'click' 'link' (concat 'Navbar - Add ' @objectType) target=this.analytics)
click=(action 'click' 'link' (concat 'Navbar - ' (t @addLinkKey) ' - ' this.theme.id) target=this.analytics)
}}
<span role='button'>{{t @addLinkKey}}</span>
{{/link-to}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<div
data-test-collection-search-result-node={{this.item.id}}
data-analytics-scope={{concat 'Collections search results - ' this.theme.id}}
class='row'
>
<div class='col-xs-12'>
{{!Title}}
<h4>
<a
<OsfLink
data-test-collection-search-result-node-title
href={{this.item.links.html}}
@href={{this.item.links.html}}
data-analytics-name='Result Title'
>
{{this.item.title}}
</a>
</OsfLink>
</h4>
</div>

Expand Down
5 changes: 2 additions & 3 deletions lib/collections/addon/components/discover-page/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,7 @@ export default class DiscoverPage extends Component {

@action
clearFilters() {
this.analytics.track('button', 'click', 'Discover - Clear Filters');

this.analytics.track('button', 'click', `Discover - Clear Filters - ${this.theme.id}`);
if (this.facetContexts) {
// Clear all of the activeFilters
this.facetContexts
Expand All @@ -366,7 +365,7 @@ export default class DiscoverPage extends Component {
@action
searchAction() {
// Only want to track search here when button clicked. Keypress search tracking is debounced in trackSearch
this.analytics.track('button', 'click', 'Discover - Search', this.q);
this.analytics.track('button', 'click', `Discover - Search - ${this.theme.id}`, this.q);
this.search();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import DS from 'ember-data';
import { layout } from 'ember-osf-web/decorators/component';
import Collection from 'ember-osf-web/models/collection';
import CollectionProvider from 'ember-osf-web/models/collection-provider';
import Analytics from 'ember-osf-web/services/analytics';

import Base from '../base/component';
import styles from './styles';
Expand All @@ -17,6 +18,7 @@ interface Item {

@layout(template, styles)
export default abstract class SearchFacetChecklist extends Base {
@service analytics!: Analytics;
@service store!: DS.Store;

allItems: Item[] = [];
Expand Down Expand Up @@ -72,7 +74,7 @@ export default abstract class SearchFacetChecklist extends Base {
didInsertElement(this: SearchFacetChecklist) {
super.didInsertElement();

const { context, filterChanged, filterProperty } = this;
const { analytics, context, filterChanged, filterProperty, theme } = this;

setProperties(context, {
updateFilters(item?: string) {
Expand All @@ -81,6 +83,12 @@ export default abstract class SearchFacetChecklist extends Base {
if (item) {
const method = activeFilter.includes(item) ? 'removeObject' : 'pushObject';
activeFilter[method](item);
const filterAction = method === 'removeObject' ? 'remove' : 'add';
analytics.track(
'filter',
filterAction,
`Discover - Filter ${context.title} ${item} - ${theme.id}`,
);
}

setProperties(context, {
Expand Down
1 change: 1 addition & 0 deletions lib/collections/addon/components/discover-page/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

.sortByOptionList {
background-color: #efefef;
left: auto;

li:hover {
background-color: #d9d9d9;
Expand Down
12 changes: 9 additions & 3 deletions lib/collections/addon/discover/route.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
import { action } from '@ember/object';
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import DS from 'ember-data';

import Analytics from 'ember-osf-web/services/analytics';

export default class Discover extends Route {
@service store!: DS.Store;
@service analytics!: Analytics;

queryParams = {
queryString: {
replace: true,
},
};

/**
* Stub
*/
model() {
return this.store.findAll('collection-provider', { reload: true });
}

@action
didTransition() {
this.analytics.trackPage();
}
}
8 changes: 8 additions & 0 deletions lib/collections/addon/provider/discover/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { action } from '@ember/object';
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import { DS } from 'ember-data';
import Analytics from 'ember-osf-web/services/analytics';
import Theme from 'ember-osf-web/services/theme';

export default class ProviderDiscover extends Route {
Expand All @@ -9,8 +11,14 @@ export default class ProviderDiscover extends Route {

@service store!: DS.Store;
@service theme!: Theme;
@service analytics!: Analytics;

model() {
return [];
}

@action
didTransition() {
this.analytics.trackPage();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { tagName } from '@ember-decorators/component';
import Component from '@ember/component';

import { layout } from 'ember-osf-web/decorators/component';
import { Permission } from 'ember-osf-web/models/osf-model';
import styles from './styles';
import template from './template';

@layout(template, styles)
@tagName('')
export default class ContributorsCardEditable extends Component {
permissionOptions = [...Object.values(Permission)];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.CardContainer {
composes: CardContainer from '../styles.scss';
}

.MainSection {
composes: MainSection from '../styles.scss';
}

.CardSection {
composes: CardSection from '../styles.scss';

:global(.ember-power-select-trigger) {
max-width: 150px;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<div data-test-contributor-card local-class='CardContainer'>
<div data-test-contributor-card-main local-class='MainSection'>
<span local-class='CardSection'>
<img
data-test-contributor-gravatar
class='m-r-xs'
src={{@contributor.users.links.profile_image}}
alt={{@contributor.users.fullName}}
height='30'
width='30'
>
<OsfLink
data-test-contributor-link={{@contributor.id}}
data-analytics-name='View user'
@route='guid-user'
@models={{array @contributor.users.id}}
>
{{@contributor.users.fullName}}
</OsfLink>
</span>
<span
data-test-contributor-permission={{@contributor.id}}
local-class='CardSection'
>
<PowerSelect
@selected={{@contributor.permission}}
@options={{this.permissionOptions}}
@onchange={{fn @manager.updateContributorPermission @contributor}}
as |option|
>
<span data-test-contributor-permission-choice={{option}}>
{{t (concat 'osf-components.contributors.permissions.' option)}}
</span>
</PowerSelect>
</span>
<span data-test-contributor-citation={{@contributor.id}} local-class='CardSection'>
<Input
@type='checkbox'
@checked={{readonly @contributor.bibliographic}}
data-test-contributor-citation-checkbox
data-analytics-name='Toogle isBibliographic'
{{on 'click' (fn @manager.toggleContributorIsBibliographic @contributor)}}
/>
</span>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,30 +1,11 @@
.CardContainer {
margin: 0;
height: 60px;

&:not(:first-of-type) {
margin-top: 10px;
}

&:not(:last-of-type) {
border-bottom: 1px solid $color-border-gray;
margin-bottom: 10px;
}
composes: CardContainer from '../styles.scss';
}

.MainSection {
display: flex;
height: inherit;
align-items: center;
padding-left: 20px;
composes: MainSection from '../styles.scss';
}

.CardSection {
flex: 1 0 auto;
max-width: 30%;

&:first-of-type {
flex: 2 0 auto;
max-width: 40%;
}
composes: CardSection from '../styles.scss';
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@
height='30'
width='30'
>
<OsfLink
data-test-contributor-link={{@contributor.id}}
data-analytics-name='View user'
@route='guid-user'
@models={{array @contributor.id}}
>
{{@contributor.users.fullName}}
</OsfLink>
{{#if @contributor.unregisteredContributor}}
{{@contributor.unregisteredContributor}}
{{else}}
<OsfLink
data-test-contributor-link={{@contributor.id}}
data-analytics-name='View user'
@route='guid-user'
@models={{array @contributor.users.id}}
>
{{@contributor.users.fullName}}
</OsfLink>
{{/if}}
</span>
<span
data-test-contributor-permission={{@contributor.id}}
Expand Down
25 changes: 25 additions & 0 deletions lib/osf-components/addon/components/contributors/card/styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.CardContainer {
margin: 0;
height: 60px;
border-bottom: 1px solid $color-border-gray;
}

.MainSection {
display: flex;
height: inherit;
align-items: center;
padding-left: 20px;
}

.CardSection {
flex: 1 0 auto;
max-width: 30%;

&:first-of-type {
flex: 2 0 auto;
max-width: 40%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
padding: 0;
margin: 0;
}

.InfinityLoader {
text-align: center;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,26 @@
{{#let (get
(hash
readonly=(component 'contributors/card/readonly')
editable=(component 'contributors/card/editable' manager=@contributorsManager)
)
@widgetMode
) as |Card|}}
{{#each @contributorsManager.contributors as |contributor|}}
<Card @contributor={{contributor}} />
<li>
<Card @contributor={{contributor}} />
</li>
{{/each}}
{{#if (and (not @contributorsManager.isLoading) @contributorsManager.hasMore)}}
<div local-class='InfinityLoader'
{{in-viewport
onEnter=(fn @contributorsManager.fetchContributors)
}}
>
{{t 'osf-components.contributors.loadMore'}}
</div>
{{/if}}
{{#if @contributorsManager.isLoading}}
<LoadingIndicator @dark={{true}} />
{{/if}}
{{/let}}
</ul>
Loading

0 comments on commit 55e2b30

Please sign in to comment.