Skip to content

Commit

Permalink
chore: apply design feedback (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
arzola authored Feb 1, 2024
1 parent cdd142d commit 9f10e99
Show file tree
Hide file tree
Showing 14 changed files with 63 additions and 40 deletions.
2 changes: 0 additions & 2 deletions dist/assets/app-d5170c40.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/assets/app-d5170c40.js.map

This file was deleted.

2 changes: 2 additions & 0 deletions dist/assets/app-da8861a9.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/assets/app-da8861a9.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/assets/pressbooks-multi-institution-43e32fd4.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion dist/assets/pressbooks-multi-institution-8240075f.css

This file was deleted.

6 changes: 3 additions & 3 deletions dist/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
"src": "node_modules/@pressbooks/multiselect/pressbooks-multiselect.js"
},
"resources/assets/js/pressbooks-multi-institution.css": {
"file": "assets/pressbooks-multi-institution-8240075f.css",
"file": "assets/pressbooks-multi-institution-43e32fd4.css",
"src": "resources/assets/js/pressbooks-multi-institution.css"
},
"resources/assets/js/pressbooks-multi-institution.js": {
"css": [
"assets/pressbooks-multi-institution-8240075f.css"
"assets/pressbooks-multi-institution-43e32fd4.css"
],
"file": "assets/app-d5170c40.js",
"file": "assets/app-da8861a9.js",
"isEntry": true,
"src": "resources/assets/js/pressbooks-multi-institution.js"
}
Expand Down
12 changes: 11 additions & 1 deletion resources/assets/js/pressbooks-multi-institution.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
import "../styles/pressbooks-multi-institutions.css";

console.log('Pressbooks Multi-Institution JS loaded')
document.addEventListener('DOMContentLoaded', function() {
document.querySelector('#pressbooks-multi-institution-admin #doaction')
.addEventListener('click', function(e) {
e.preventDefault();
const action = document.querySelector('#pressbooks-multi-institution-admin #bulk-action-selector-top').value;
const items = document.querySelectorAll('.check-column input:checked');
if (action !== '-1' && items.length > 0 && confirm('Are you sure you want to delete these institutions?')) {
document.querySelector('#pressbooks-multi-institution-admin').submit();
}
});
});
37 changes: 32 additions & 5 deletions resources/assets/styles/pressbooks-multi-institutions.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,39 @@
table.institutions #the-list tr:not(.totals-row) {
background-color: #fff;
table.institutions #the-list tr:not(.totals-row):nth-child(odd) {
background-color: #FFFFFF;
}

.totals-row {
background: #F6F7F7;
table.institutions #the-list tr:not(.totals-row):nth-child(even) {
background-color: #F6F7F7;
}

.totals-row .text-right {
table.institutions #the-list tr td,th {
border-bottom: 1px solid #e5e5e5;
}

table.institutions #the-list tr td p {
margin: 0;
}

.striped .totals-row {
background-color: #E0E0E0 !important;
}

.striped .totals-row .text-right {
padding-left: 40px;
}

body.toplevel_page_pb_multi_institution .filtering {
display: flex;
gap: 10px;
margin-top: 10px;
}


body.toplevel_page_pb_multi_institution .filtering ul {
margin: 0;
padding-top: 5px;
}

body.toplevel_page_pb_multi_institution .filtering a {
height: 30px;
}
3 changes: 1 addition & 2 deletions resources/views/institutions/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
<div class="filtering">
<ul>
<li>{!! sprintf( __( '<strong>Showing results for:</strong> %s', 'pressbooks-multi-institution' ), $params['searchQuery'] ) !!}</li>
<li>{!! sprintf( __( '<strong>Ordering by:</strong> %s', 'pressbooks-multi-institution' ), $params['orderBy'] ) !!}</li>
</ul>
<a href="{{ $list_url }}">{{ __('Clear filters', 'pressbooks-multi-institution') }}</a>
<a href="{{ $list_url }}" class="button">{{ __('Clear filters', 'pressbooks-multi-institution') }}</a>
</div>
@endif

Expand Down
9 changes: 4 additions & 5 deletions resources/views/institutions/managers.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<p>
{{ $manager->display_name }}
</p>
<p>
<a href="mailto:{{ $manager->user_email }}">{{ $manager->user_email }}</a>
<p class="institutional_manager">
<span class="name">{{ $manager->display_name }}</span>
<br/>
<span class=email"><a href="mailto:{{ $manager->user_email }}">{{ $manager->user_email }}</a></span>
</p>
4 changes: 2 additions & 2 deletions resources/views/institutions/rows/totals.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<tr class="totals-row">
<td colspan="2" class="text-right">{{ $name }}</td>
<td class="text-center">({{ $email_domains }})</td>
<td class="text-center">({{ $institutional_managers }})</td>
<td class="text-center">{{ $email_domains }}</td>
<td class="text-center">{{ $institutional_managers }}</td>
<td class="text-center">{{ $book_total }}</td>
<td class="text-center">{{ $user_total }}</td>
</tr>
13 changes: 1 addition & 12 deletions src/Models/Institution.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,7 @@ class Institution extends Model

public function domains(): HasMany
{
// TODO: move this to the scopeSearchAndOrder method
// Probably we would want to improve the filtering sort with this kind of nested fields
$order = (isset($_REQUEST['order']) && $_REQUEST['order'] === 'asc') ? 'asc' : 'desc';
$relation = $this->hasMany(EmailDomain::class);
if(isset($_REQUEST['orderby']) && $_REQUEST['orderby'] === 'email_domains') {
$relation->orderBy('domain', $order);
}
return $relation;
return $this->hasMany(EmailDomain::class);
}

public function updateDomains(array $domains): self
Expand Down Expand Up @@ -105,10 +98,6 @@ public function scopeSearchAndOrder($query, $request)
return $builder;
}

if($request['orderby'] === 'email_domains') {
return $builder;
}

return $builder->orderBy($request['orderby'] ?? 'name', $request['order'] === 'asc' ? 'asc' : 'desc');
}

Expand Down
11 changes: 5 additions & 6 deletions src/Views/InstitutionsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function column_name(array $item): string
$delete_url,
/* translators: %s: post title */
esc_attr(sprintf(__('Move &#8220;%s&#8221; to the Trash'), $item['name'])),
_x('Trash', 'verb')
_x('Delete', 'verb')
);

return sprintf(
Expand Down Expand Up @@ -114,7 +114,6 @@ public function get_sortable_columns()
{
return [
'name' => ['name', false],
'email_domains' => ['email_domains', false],
'book_limit' => ['book_limit', false],
'user_limit' => ['user_limit', false],
];
Expand Down Expand Up @@ -220,8 +219,8 @@ public function prepare_items(): void
'unassigned' => true,
'ID' => 'unassigned_items',
'name' => __('Unassigned', 'pressbooks-multi-institution'),
'email_domains' => __('none', 'pressbooks-multi-institution'),
'institutional_managers' => __('none', 'pressbooks-multi-institution'),
'email_domains' => '',
'institutional_managers' => '',
'book_total' => $totalBooks - $assigned,
'user_total' => $totalUsers - $totalUsersAssigned,
];
Expand All @@ -230,8 +229,8 @@ public function prepare_items(): void
'totals' => true,
'ID' => 'total_items',
'name' => __('Total Items', 'pressbooks-multi-institution'),
'email_domains' => __('none', 'pressbooks-multi-institution'),
'institutional_managers' => __('none', 'pressbooks-multi-institution'),
'email_domains' => '',
'institutional_managers' => '',
'book_total' => $totalBooks,
'user_total' => $totalUsers,
];
Expand Down

0 comments on commit 9f10e99

Please sign in to comment.