Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
binoculars committed Aug 20, 2018
1 parent 9135e53 commit 3b8214e
Show file tree
Hide file tree
Showing 49 changed files with 730 additions and 162 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "public/assets/osf-assets"]
path = public/assets/osf-assets
url = https://github.com/CenterForOpenScience/osf-assets.git
1 change: 1 addition & 0 deletions app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const App = Application.extend({
'i18n',
'session',
'store',
'theme',
'router',
],
},
Expand Down
2 changes: 2 additions & 0 deletions app/application/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import Controller from '@ember/controller';
import { Registry as Services } from '@ember/service';
import config from 'ember-get-config';
import CurrentUser from 'ember-osf-web/services/current-user';
import Theme from 'ember-osf-web/services/theme';
import pathJoin from 'ember-osf-web/utils/path-join';
import $ from 'jquery';

export default class Application extends Controller {
@service currentUser!: CurrentUser;
@service router!: Services['router'];
@service theme!: Theme;

secondaryNavbarId = config.secondaryNavbarId;
signupUrl = `${pathJoin(config.OSF.url, 'register')}?${$.param({ next: window.location.href })}`;
Expand Down
6 changes: 5 additions & 1 deletion app/application/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
{{title (t 'general.OSF')}}
<div local-class="Application">
{{#unless disableHeaders}}
{{osf-navbar signupUrl=signupUrl loginAction=(action 'login')}}
{{#if theme.isProvider}}
{{branded-navbar}}
{{else}}
{{osf-navbar signupUrl=signupUrl loginAction=(action 'login')}}
{{/if}}
<div id="{{secondaryNavbarId}}"></div>
{{maintenance-banner}}
{{status-banner}}
Expand Down
5 changes: 5 additions & 0 deletions app/const/service-links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const serviceLinks = {
settings: `${osfUrl}settings/`,
reviewsHome: `${osfUrl}reviews/`,
institutionsLanding: `${osfUrl}institutions/`,
collectionsHome: `${osfUrl}collections/`,
};

const osfServices = [
Expand All @@ -46,6 +47,10 @@ const osfServices = [
url: serviceLinks.institutionsLanding,
flag: navigation.institutions,
},
{
name: 'COLLECTIONS',
url: serviceLinks.collectionsHome,
},
];

export {
Expand Down
16 changes: 16 additions & 0 deletions app/locales/en/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,19 @@ export default {
collections: {
index: {
title: 'Collections',
services_heading: 'Collection Services',
services_paragraph: 'Leading collection service providers use this open source infrastructure to support their communities.',
service_bottom: {
p1: 'Create your own branded collection service backed by the OSF.',
div: {
line1: 'Check out the',
linkText1: 'open source code',
line2: 'and the',
linkText2: 'requirements and road map',
line3: '. Input welcome!',
},
contact: 'Contact us',
},
},
provider: {
title: 'Provider',
Expand All @@ -572,6 +585,7 @@ export default {
title: 'Discover',
search_heading: 'Collections Search',
search_placeholder: 'Search collections',
other_repositories: 'Other collections',
},
submit: {
title: 'Submit',
Expand Down Expand Up @@ -770,6 +784,8 @@ export default {
main: {
providers: 'Providers',
subject: 'Subject',
status: 'Status',
type: 'Type',
},
relevance: 'Relevance',
sort_oldest_newest: 'Modified Date (oldest to newest)',
Expand Down
45 changes: 4 additions & 41 deletions app/models/collection-provider.ts
Original file line number Diff line number Diff line change
@@ -1,48 +1,11 @@
import { attr, hasMany } from '@ember-decorators/data';
import { alias } from '@ember-decorators/object/computed';
import { belongsTo, hasMany } from '@ember-decorators/data';
import DS from 'ember-data';
import Collection from './collection';
import License from './license';
import OsfModel from './osf-model';
import Taxonomy from './taxonomy';
import Provider from './provider';

export default class CollectionProvider extends OsfModel {
@attr('fixstring') name!: string; // eslint-disable-line no-restricted-globals
@attr('fixstring') description!: string;
@attr('string') domain!: string;
@attr('boolean') domainRedirectEnabled!: boolean;
@attr('fixstring') example!: string;
@attr('string') advisoryBoard!: string;
@attr('fixstring') emailSupport!: string;
// @attr('array') subjectsAcceptable!: string[];
@attr('string') footerLinks!: string;
@attr('boolean') allowSubmissions!: boolean;
@attr('boolean') allowCommenting!: boolean;
@attr('string') facebookAppId!: string;
// @attr('array') additionalProviders!: string[];
// @attr('string') shareSource!: string;
// @attr('string') preprintWord!: string;

// // Reviews settings
// @attr('array') permissions!: string[];
// @attr('string') reviewsWorkflow!: string | null;
// @attr('boolean', { allowNull: true }) reviewsCommentsPrivate!: boolean | null;
// @attr('boolean', { allowNull: true }) reviewsCommentsAnonymous!: boolean | null;

// Relationships
@hasMany('taxonomy') taxonomies!: DS.PromiseManyArray<Taxonomy>;
@hasMany('taxonomy') highlightedTaxonomies!: DS.PromiseManyArray<Taxonomy>;
export default class CollectionProvider extends Provider {
@belongsTo('collection') primaryCollection!: DS.PromiseObject<Collection> & Collection;
@hasMany('collection', { inverse: 'provider' }) collections!: DS.PromiseManyArray<Collection>;
@hasMany('license', { inverse: null }) licensesAcceptable!: DS.PromiseManyArray<License>;

// @alias('links.relationships.preprints.links.related.meta')
// reviewableStatusCounts!: any;

// @alias('links.relationships.highlighted_taxonomies.links.related.meta.has_highlighted_subjects')
// hasHighlightedSubjects!: boolean;

@alias('relationships.primary_collection.data.id')
primaryCollection!: string;
}

declare module 'ember-data' {
Expand Down
4 changes: 1 addition & 3 deletions app/models/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import Node from 'ember-osf-web/models/node';
import Registration from 'ember-osf-web/models/registration';
import OsfModel from './osf-model';

type statusChoice = 'good';

/**
* @module ember-osf-web
* @submodule models
Expand All @@ -25,7 +23,7 @@ export default class Collection extends OsfModel {
@attr('boolean') isPromoted!: boolean;
@attr('boolean') isPublic!: boolean;
@attr('array') collectedTypeChoices!: Array<'node' | 'preprint' | 'collection' | 'registration'>;
@attr('array') statusChoices!: statusChoice[];
@attr('array') statusChoices!: string[];

@belongsTo('collection-provider', { inverse: 'collections' })
provider!: DS.PromiseObject<CollectionProvider> & CollectionProvider;
Expand Down
19 changes: 3 additions & 16 deletions app/models/preprint-provider.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
import { attr, hasMany } from '@ember-decorators/data';
import { alias } from '@ember-decorators/object/computed';
import DS from 'ember-data';
import License from './license';
import OsfModel from './osf-model';
// import License from './license';
import Preprint from './preprint';
import Taxonomy from './taxonomy';
import Provider from './provider';

export default class PreprintProvider extends OsfModel {
@attr('fixstring') name!: string; // eslint-disable-line no-restricted-globals
@attr('fixstring') description!: string;
@attr('string') domain!: string;
@attr('boolean') domainRedirectEnabled!: boolean;
@attr('fixstring') example!: string;
@attr('string') advisoryBoard!: string;
@attr('fixstring') emailSupport!: string;
export default class PreprintProvider extends Provider {
@attr('array') subjectsAcceptable!: string[];
@attr('string') footerLinks!: string;
@attr('boolean') allowSubmissions!: boolean;
@attr('array') additionalProviders!: string[];
@attr('string') shareSource!: string;
@attr('string') preprintWord!: string;
Expand All @@ -28,10 +18,7 @@ export default class PreprintProvider extends OsfModel {
@attr('boolean', { allowNull: true }) reviewsCommentsAnonymous!: boolean | null;

// Relationships
@hasMany('taxonomy') taxonomies!: DS.PromiseManyArray<Taxonomy>;
@hasMany('taxonomy') highlightedTaxonomies!: DS.PromiseManyArray<Taxonomy>;
@hasMany('preprint', { inverse: 'provider' }) preprints!: DS.PromiseManyArray<Preprint>;
@hasMany('license', { inverse: null }) licensesAcceptable!: DS.PromiseManyArray<License>;

@alias('links.relationships.preprints.links.related.meta')
reviewableStatusCounts!: any;
Expand Down
40 changes: 40 additions & 0 deletions app/models/provider.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { attr, hasMany } from '@ember-decorators/data';
import DS from 'ember-data';
import License from './license';
import OsfModel from './osf-model';
import Taxonomy from './taxonomy';

/* eslint-disable camelcase */

interface Assets {
favicon: string;
powered_by_share: string;
sharing: string;
square_color_no_transparent: string;
square_color_transparent: string;
style: string;
wide_black: string;
wide_color: string;
wide_white: string;
}

/* eslint-enable camelcase */

export default abstract class Provider extends OsfModel {
@attr('fixstring') name!: string; // eslint-disable-line no-restricted-globals
@attr('fixstring') description!: string;
@attr('string') advisoryBoard!: string;
@attr('fixstring') example!: string;
@attr('string') domain!: string;
@attr('boolean') domainRedirectEnabled!: boolean;
@attr('fixstring') footerLinks!: string;
@attr('fixstring') emailSupport!: string;
@attr('string') facebookAppId!: string;
@attr('boolean') allowSubmissions!: boolean;
@attr('boolean') allowCommenting!: boolean;
@attr() assets!: Assets; // TODO: camelize in transform

@hasMany('taxonomy') taxonomies!: DS.PromiseManyArray<Taxonomy>;
@hasMany('taxonomy') highlightedTaxonomies!: DS.PromiseManyArray<Taxonomy>;
@hasMany('license', { inverse: null }) licensesAcceptable!: DS.PromiseManyArray<License>;
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { computed } from '@ember-decorators/object';
import { service } from '@ember-decorators/service';
import Service from '@ember/service';
import config from 'collections/config/environment';
// import config from 'ember-default-config';
import DS from 'ember-data';
import PreprintProvider from 'ember-osf-web/models/preprint-provider';
import Provider from 'ember-osf-web/models/provider';
import defaultTo from 'ember-osf-web/utils/default-to';

const { defaultProvider } = config;
// const { defaultProvider } = config;
const defaultProvider = 'osf';

export default class Theme extends Service {
@service store!: DS.Store;
Expand All @@ -23,8 +24,8 @@ export default class Theme extends Service {
}

@computed('id', 'isProvider')
get provider(): PreprintProvider | null {
const provider = this.store.peekRecord('preprint-provider', this.id);
get provider(): Provider | null {
const provider = this.store.peekRecord('collection-provider', this.id);

if (!provider) {
return null;
Expand Down
1 change: 1 addition & 0 deletions lib/app-components/addon/styles/headers.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// @import '../../../app/styles/variables';
17 changes: 17 additions & 0 deletions lib/app-components/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* eslint-env node */

module.exports = {
name: 'app-components',

isDevelopingAddon() {
return true;
},

options: {
cssModules: {
headerModules: [
'app-components/styles/headers',
],
},
},
};
22 changes: 22 additions & 0 deletions lib/app-components/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "app-components",
"keywords": [
"ember-addon"
],
"dependencies": {
"ember-bootstrap": "*",
"ember-bootstrap-datepicker": "*",
"ember-cli-babel": "*",
"ember-cli-htmlbars": "*",
"ember-cli-htmlbars-inline-precompile": "*",
"ember-cli-sass": "*",
"ember-cli-template-lint": "*",
"ember-cli-typescript": "*",
"ember-component-attributes": "*",
"ember-cp-validations": "*",
"ember-css-modules": "*",
"ember-css-modules-sass": "*",
"ember-i18n": "*",
"ember-i18n-inject": "*"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import { action } from '@ember-decorators/object';
import { service } from '@ember-decorators/service';
import Component from '@ember/component';
import { assert } from '@ember/debug';
import Theme from 'collections/services/theme';

import { get } from '@ember/object';
import Theme from 'ember-osf-web/services/theme';
import { FacetContexts } from '../component';

export default class ActiveFilters extends Component {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</span>
</div>
</div>
{{#each facetContexts.provider.activeFilter as |item|}}
{{#each facetContexts.collection-provider.activeFilter as |item|}}
<span local-class="preprint-filter provider-filter">
{{filter-replace item filterReplace}}
{{#unless theme.isProvider}}
Expand All @@ -21,7 +21,7 @@
<button
class="fa fa-times-circle"
local-class="removeActiveFilter"
{{action 'removeFilterItem' 'provider' item}}
{{action 'removeFilterItem' 'collection-provider' item}}
></button>
</span>
{{/unless}}
Expand All @@ -40,6 +40,33 @@
</span>
</span>
{{/each}}
{{#each facetContexts.collected-type.activeFilter as |item|}}
{{!ACTIVE SUBJECT FILTERS}}
<span local-class='preprint-filter subject-filter'>
{{item}}
<span aria-label={{t 'eosf.components.discoverPage.removeSubject'}}>
<button
class="fa fa-times-circle"
local-class="removeActiveFilter"
{{action 'removeFilterItem' 'collected-type' item}}
></button>
</span>
</span>
{{/each}}

{{#each facetContexts.status.activeFilter as |item|}}
{{!ACTIVE SUBJECT FILTERS}}
<span local-class='preprint-filter subject-filter'>
{{item}}
<span aria-label={{t 'eosf.components.discoverPage.removeSubject'}}>
<button
class="fa fa-times-circle"
local-class="removeActiveFilter"
{{action 'removeFilterItem' 'status' item}}
></button>
</span>
</span>
{{/each}}
{{!ACTIVE TYPE FILTERS}}
{{!--
{{#each activeFilters.types as |filter|}}
Expand Down
Loading

0 comments on commit 3b8214e

Please sign in to comment.