Skip to content

Commit

Permalink
Merge pull request #117 from ror-community/dev
Browse files Browse the repository at this point in the history
Merge staging to dev: Org status
  • Loading branch information
lizkrznarich authored Nov 28, 2022
2 parents 038a1d9 + ce35433 commit bfefee5
Show file tree
Hide file tree
Showing 17 changed files with 222 additions and 56 deletions.
4 changes: 0 additions & 4 deletions app/components/application-footer.js

This file was deleted.

6 changes: 4 additions & 2 deletions app/components/application-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 0 additions & 4 deletions app/components/application-subscribe.js

This file was deleted.

Empty file.
25 changes: 0 additions & 25 deletions app/components/controllers/organizations/index.js

This file was deleted.

4 changes: 0 additions & 4 deletions app/components/controllers/organizations/show.js

This file was deleted.

39 changes: 39 additions & 0 deletions app/components/filter-sidebar.js
Original file line number Diff line number Diff line change
@@ -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}});
}
}

});
Empty file removed app/helpers/.gitkeep
Empty file.
4 changes: 2 additions & 2 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@


<link rel="stylesheet" href="{{rootURL}}assets/vendor.css"type='text/css'>
<!--Change back to prod CSS URL after website refresh is deployed-->
<link rel="stylesheet" href="https://dev.ror.org/css/hugo-ror.css?v=4" type='text/css'>

<link rel="stylesheet" href="https://ror.org/css/hugo-ror.css?v=4" type='text/css'>
<link rel="stylesheet" href="{{rootURL}}assets/ror-app.css" type='text/css'>
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<link rel="icon" href="/favicon.ico" type="image/x-icon">
Expand Down
31 changes: 30 additions & 1 deletion app/routes/organizations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -22,6 +45,12 @@ export default Route.extend({
},
page: {
refreshModel: true
},
all_status: {
refreshModel: true
},
filter: {
refreshModel: true
}
}
});
5 changes: 4 additions & 1 deletion app/services/global-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}});
}
});
76 changes: 76 additions & 0 deletions app/styles/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

}
21 changes: 20 additions & 1 deletion app/templates/components/application-header.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,23 @@ onCollapse=(action (mut collapsed) true) onExpand=(action (mut collapsed) false)
{{/navbar.nav}}
{{/navbar.content}}
</div>
{{/bs-navbar}}
{{/bs-navbar}}
{{#if showAdvanced}}
<div class="row">
<div class="col-md-12">
<div class="callout small">
<h2>Show records with status:</h2>
<form {{action "applyFilter" query on="submit"}} class="form-inline mw-25" role="search">
{{input type="checkbox" id="active-status" name="activeStatus"}}
<label for="active-status">Active</label>
{{input type="checkbox" id="inactive-status" name="inactiveStatus"}}
<label for="inactive-status">Inactive</label>
{{input type="checkbox" id="withdrawn-status" name="withdrawnStatus"}}
<label for="withdrawn-status">Withdrawn</label>
{{input type="checkbox" id="all-status" name="allStatus" change=(action 'applyFilter')}}
<label for="all-status">All statuses</label>
</form>
</div>
</div>
</div>
{{/if}}
22 changes: 22 additions & 0 deletions app/templates/components/filter-sidebar.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<div id="filters" class="small">
<div class="filter-group">
<h3>Record status <i class="fa fa-question-circle" aria-hidden="true"><BsPopover @triggerEvents="hover" class="popover">Each ROR record has a status of active, inactive or withdrawn. <b>Inactive</b> indicates that an organization has split, merged or otherwise ceased to operate. <b>Withdrawn</b> indicates that an organization was added to ROR in error.</BsPopover></i></h3>
<hr>
<div class="filters-list">
{{input class="filters-list-input" type="checkbox" id="active-status" name="activeStatus" checked=activeStatus}}
<label class="filters-list-label" for="active-status">Active</label>
</div>
<div class="filters-list">
{{input class="filters-list-input" type="checkbox" id="inactive-status" name="inactiveStatus" checked=inactiveStatus}}
<label class="filters-list-label" for="inactive-status">Inactive</label>
</div>
<div class="filters-list">
{{input class="filters-list-input" type="checkbox" id="withdrawn-status" name="withdrawnStatus" checked=withdrawnStatus}}
<label class="filters-list-label" for="withdrawn-status">Withdrawn</label>
</div>
</div>
<div>
<button class="btn btn-sma btn-round btn-primary" type="submit" id="filter-button" {{action "applyFilter"}}><i class="fa fa-check-circle" aria-hidden="true"></i>Apply</button>
<button class="btn btn-sma btn-round btn-secondary" type="submit" id="clear-button" {{action "clearFilter"}}><i class="fa fa-times-circle" aria-hidden="true"></i>Clear</button>
</div>
</div>
4 changes: 2 additions & 2 deletions app/templates/components/organization-item.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="row">
<div class="col-lg-10 col-sm-12">
<div class="col-md-12">
<div class="card">
<div class="card-body">
{{#if notFound}}
Expand Down Expand Up @@ -49,7 +49,7 @@
{{/if}}
{{/if}}
{{/each-in}}
<br><a target="_blank" rel="noopener" class="card-link mt-1" href="#"><em>Learn more about {{model.status}} records</em></a>
<br><a target="_blank" rel="noopener" class="card-link mt-1" href="https://ror.readme.io/docs/ror-data-structure#status"><em>Learn more about {{model.status}} records</em></a>
</div>
{{/if}}
{{/if}}
Expand Down
29 changes: 19 additions & 10 deletions app/templates/organizations/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,28 @@
<h4 class="ml-3">{{format-number model.meta.total}} Organizations</h4>
<p class="small ml-3"><i>Are we missing an organization you're looking for? <a target="_blank" rel="noopener" href="http://curation-request.ror.org/">Submit a request to add it</a></i></p>
{{/if}}

{{#each model as |organization|}}
{{organization-item model=organization}}
{{/each}}

{{#if (gt model.meta.totalPages 1)}}
{{page-numbers model=model link="organizations.index"}}
{{/if}}
<div class="row">
<div class="col-md-2 col-sm-12">
{{filter-sidebar model=model}}
</div>
<div class="col-md-10 col-sm-12">
{{#each model as |organization|}}
{{organization-item model=organization}}
{{/each}}
</div>
{{#if (gt model.meta.totalPages 1)}}
{{page-numbers model=model link="organizations.index"}}
{{/if}}
</div>
{{else}}
<div class="row">
<div class="col-lg-8 col-sm-12">
<div class="col-md-2">
{{filter-sidebar model=model}}
</div>
<div class="col-md-10 col-sm-12">
{{#bs-alert dismissible=false type="warning"}}
No Organizations found.
No Organizations found. {{#link-to "organizations.index" (query-params
query=undefined page=undefined filter=undefined) }}Return to organizations list{{/link-to}}.
{{/bs-alert}}
</div>
</div>
Expand Down
4 changes: 4 additions & 0 deletions app/templates/organizations/show.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<div class="content">

<div class="container-fluid">
<div class="ml-4 ror-search-home">
{{#link-to "organizations.index"}}<i class="fa fa-caret-left" aria-hidden="true"></i> ROR search home page{{/link-to}}
</div>
{{organization-item model=model}}
</div>
</div>

0 comments on commit bfefee5

Please sign in to comment.