Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use new format icons #171

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions app/Controllers/Partials/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public static function getFormat()
return false;
}

public static function getFormatSlug()
public static function getFormatIcon()
{
global $post;

Expand All @@ -139,11 +139,12 @@ public static function getFormatSlug()
switch ($format->slug) {
case 'academic-paper':
case 'thesis':
return 'academic-paper';
return 'academic';
break;
case 'article':
case 'document':
case 'blog-post':
return 'blog';
break;
case 'article':
case 'journal-article':
case 'magazine-article':
case 'newspaper-article':
Expand All @@ -162,10 +163,9 @@ public static function getFormatSlug()
return 'case-study';
break;
case 'curriculum':
return 'educational-curriculum';
return 'curriculum';
break;
case 'film':
case 'interview':
case 'video':
return 'video';
break;
Expand All @@ -180,11 +180,14 @@ public static function getFormatSlug()
break;
case 'software':
case 'toolkit':
case 'template':
return 'toolkit';
break;
case 'template':
return 'template';
break;
case 'document':
default:
return 'article';
return 'document';
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/partials/content-lc_resource.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<li @php post_class('card card--resource') @endphp>
<header>
<span class="card__format">@svg(Archive::getFormatSlug(), 'icon--' . Archive::getFormatSlug(), ['focusable' => 'false', 'aria-hidden' => 'true']) <span class="screen-reader-text">{{ __('resource format', 'coop-library') }}: </span>{{ Archive::getFormat() }}</span>
<span class="card__format">@svg(Archive::getFormatIcon(), 'icon--' . Archive::getFormatIcon(), ['focusable' => 'false', 'aria-hidden' => 'true']) <span class="screen-reader-text">{{ __('resource format', 'coop-library') }}: </span>{{ Archive::getFormat() }}</span>
@if($current_language !== Archive::getLanguage())
<span class="card__sep"> &middot; </span>
<span class="card__language">{{ $languages[Archive::getLanguage()] }}</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<article @php post_class() @endphp>
<div class="page-header resource__header">
<p class="resource__format">
@svg(Single::getFormatSlug(), 'icon--' . Single::getFormatSlug(), ['focusable' => 'false', 'aria-hidden' => 'true']) <span class="screen-reader-text">{{ __('resource format', 'coop-library') }}: </span>{{ Single::getFormat() }}
@svg(Single::getFormatIcon(), 'icon--' . Single::getFormatIcon(), ['focusable' => 'false', 'aria-hidden' => 'true']) <span class="screen-reader-text">{{ __('resource format', 'coop-library') }}: </span>{{ Single::getFormat() }}
</p>
<h1 class="resource__title">{!! get_the_title() !!}</h1>
@if(Single::getPublisher() || Single::getRegion())
Expand Down