diff --git a/app/components/application-footer.js b/app/components/application-footer.js deleted file mode 100644 index bb93d73f..00000000 --- a/app/components/application-footer.js +++ /dev/null @@ -1,4 +0,0 @@ -import Component from '@ember/component'; - -export default Component.extend({ -}); diff --git a/app/components/application-header.js b/app/components/application-header.js index 0d8778e7..e54c1564 100644 --- a/app/components/application-header.js +++ b/app/components/application-header.js @@ -3,10 +3,12 @@ import { inject as service } from '@ember/service'; export default Component.extend({ globalSearch: service(), + allStatus: false, + showAdvanced: false, actions: { - search(query) { - this.get('globalSearch').doSearch(query); + search() { + this.get('globalSearch').doSearch(this.query); }, clear() { this.get('globalSearch').doSearch(null); diff --git a/app/components/application-subscribe.js b/app/components/application-subscribe.js deleted file mode 100644 index bb93d73f..00000000 --- a/app/components/application-subscribe.js +++ /dev/null @@ -1,4 +0,0 @@ -import Component from '@ember/component'; - -export default Component.extend({ -}); diff --git a/app/components/controllers/.gitkeep b/app/components/controllers/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/app/components/controllers/organizations/index.js b/app/components/controllers/organizations/index.js deleted file mode 100644 index ccaa3648..00000000 --- a/app/components/controllers/organizations/index.js +++ /dev/null @@ -1,25 +0,0 @@ -import Controller from '@ember/controller'; -export default Controller.extend({ - queryParams: ['sort', 'page', 'query'], - query: null, - sort: null, - page: 1, - - actions: { - doSearch(query) { - if (query) { - this.set('sort', 'relevance'); - } else if (this.sort === 'relevance') { - this.set('sort', null); - } - - this.set('query', query); - this.search(); - }, - clear() { - this.set('query', null); - this.set('sort', null); - this.search(); - } - } -}); \ No newline at end of file diff --git a/app/components/controllers/organizations/show.js b/app/components/controllers/organizations/show.js deleted file mode 100644 index 3ad17932..00000000 --- a/app/components/controllers/organizations/show.js +++ /dev/null @@ -1,4 +0,0 @@ -import Controller from '@ember/controller'; - -export default Controller.extend({ -}); \ No newline at end of file diff --git a/app/components/filter-sidebar.js b/app/components/filter-sidebar.js new file mode 100644 index 00000000..23d8e37f --- /dev/null +++ b/app/components/filter-sidebar.js @@ -0,0 +1,39 @@ +import Component from '@ember/component'; +import { inject as service } from '@ember/service'; + +export default Component.extend({ + router: service(), + activeStatus: true, + inactiveStatus: false, + withdrawnStatus: false, + filterValue: '', + + actions: { + applyFilter() { + this.filterValue = '' + if (this.activeStatus == true){ + this.filterValue += "status:active," + } + if (this.inactiveStatus == true){ + this.filterValue += "status:inactive," + } + if (this.withdrawnStatus == true){ + this.filterValue += "status:withdrawn," + } + this.filterValue = this.filterValue.slice(0, -1) + this.set('model.query.filter', this.filterValue) + //this.get('globalSearch').doSearch(this.query, this.allStatus) + this.get('router').transitionTo('organizations.index', { queryParams: { query: this.model.query.query, page: this.model.query.page, all_status: this.model.query.allStatus, filter: this.model.query.filter}}); + }, + clearFilter() { + this.filterValue = '' + this.set('activeStatus', true); + this.set('inactiveStatus', false); + this.set('withdrawnStatus', false); + this.filterValue = "status:active" + this.set('model.query.filter', this.filterValue) + this.get('router').transitionTo('organizations.index', { queryParams: { query: this.model.query.query, page: this.model.query.page, all_status: this.model.query.allStatus, filter: this.model.query.filter}}); + } + } + +}); diff --git a/app/helpers/.gitkeep b/app/helpers/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/app/index.html b/app/index.html index 01a140e8..fb4dfb21 100755 --- a/app/index.html +++ b/app/index.html @@ -16,8 +16,8 @@ - - + + diff --git a/app/routes/organizations/index.js b/app/routes/organizations/index.js index 4d5eaf4b..0410a314 100644 --- a/app/routes/organizations/index.js +++ b/app/routes/organizations/index.js @@ -5,8 +5,31 @@ export default Route.extend({ /*Escape Elasticsearch reserved chars https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#_reserved_characters*/ if(params.query){ + let ror_id = '' // eslint-disable-next-line - params.query = params.query.replace(/([\+\-\=\&\|\>\<\!\(\)\{\}\\\[\]\^\"\~\*\?\:\/])/g, "\\$1"); + let re1 = new RegExp("^0[a-hj-km-np-tv-z|0-9]{6}[0-9]{2}$"); + // eslint-disable-next-line + let re2 = new RegExp("^http(s)?:\/\/ror\.org\/0[a-hj-km-np-tv-z|0-9]{6}[0-9]{2}$"); + // eslint-disable-next-line + let re3 = new RegExp("^ror\.org\/0[a-hj-km-np-tv-z|0-9]{6}[0-9]{2}$") + if(re1.test(params.query)){ + ror_id = params.query + } + if(re2.test(params.query)){ + // eslint-disable-next-line + ror_id = params.query.replace(/http(s)?:\/\/ror\.org\//g, '') + } + if(re3.test(params.query)){ + // eslint-disable-next-line + ror_id = params.query.replace(/ror\.org\//g, '') + } + if(ror_id){ + this.transitionTo('/' + ror_id); + return; + } else { + // eslint-disable-next-line + params.query = params.query.replace(/([\+\-\=\&\|\>\<\!\(\)\{\}\\\[\]\^\~\*\?\:\/])/g, "\\$1"); + } } return this.store.query('organization', params).then(function(model) { return model; @@ -22,6 +45,12 @@ export default Route.extend({ }, page: { refreshModel: true + }, + all_status: { + refreshModel: true + }, + filter: { + refreshModel: true } } }); diff --git a/app/services/global-search.js b/app/services/global-search.js index 68360d76..3bb6395a 100644 --- a/app/services/global-search.js +++ b/app/services/global-search.js @@ -10,9 +10,12 @@ export default Service.extend({ }, doSearch(query) { + if (query.trim() === ''){ + query = undefined + } //let params = assign(this.model.get('query'), { query: this.query, sort: this.sort }); // this.router.transitionTo({ queryParams: params }); - this.get('router').transitionTo('organizations.index', { queryParams: { query: query, page: 1 } }); + this.get('router').transitionTo('organizations.index', { queryParams: { query: query, page: 1}}); } }); diff --git a/app/styles/app.scss b/app/styles/app.scss index e7e2b003..27b4e957 100644 --- a/app/styles/app.scss +++ b/app/styles/app.scss @@ -27,6 +27,18 @@ $desktop-width: 1024px; } } +.ror-search-home { + font-size: 1rem; +} + +.fa-question-circle { + font-size: 1.1rem; + &:hover{ + color: #53BAA1; + } + +} + .badge { padding: 8px 12px; font-size: .8em; @@ -48,3 +60,67 @@ $desktop-width: 1024px; display: none; } } + +.popover { + font-size: .8rem; +} + +.filters-list { + position: relative; + display: block; + padding-left: 1.25rem; +} + +.filters-list input[type=checkbox] { + box-sizing: border-box; + padding: 0; +} + +.filters-list-input { + position: absolute; + margin-top: 0.4rem; + margin-left: -1.25rem; +} + +.filters-list-label { + display: inline-block; + margin: 0; +} + +#filters{ + line-height: 1.5rem; + h2 { + font-size: 1.5rem; + margin: 0; + line-height: normal; + } + h3 { + font-size: 1rem; + margin: 0; + line-height: normal; + } + p { + margin-bottom: 0; + } + hr { + margin: .5rem 0; + } + .filter-group{ + margin-bottom: 1rem; + } + + a { + line-height: normal; + font-size: 1rem; + font-style: italic; + } + i { + margin-right: .3rem; + } + .btn-round { + padding: 6px 9px; + float: left; + margin-right: .3rem; + } + +} diff --git a/app/templates/components/application-header.hbs b/app/templates/components/application-header.hbs index a010edb6..1dc1a35e 100755 --- a/app/templates/components/application-header.hbs +++ b/app/templates/components/application-header.hbs @@ -49,4 +49,23 @@ onCollapse=(action (mut collapsed) true) onExpand=(action (mut collapsed) false) {{/navbar.nav}} {{/navbar.content}} -{{/bs-navbar}} \ No newline at end of file +{{/bs-navbar}} +{{#if showAdvanced}} +
Are we missing an organization you're looking for? Submit a request to add it
{{/if}} - - {{#each model as |organization|}} - {{organization-item model=organization}} - {{/each}} - - {{#if (gt model.meta.totalPages 1)}} - {{page-numbers model=model link="organizations.index"}} - {{/if}} +