Skip to content

Commit

Permalink
Merge pull request #29 from repair-cafe/po-review-fixes
Browse files Browse the repository at this point in the history
PO review fixes
  • Loading branch information
stefina authored Aug 10, 2017
2 parents 0c6b9d2 + 66cad61 commit 7483428
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 13 deletions.
4 changes: 4 additions & 0 deletions plugins/liip/repaircafe/components/EventList.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ protected function queryEvents()
$query->where('event_date', '>=', DB::raw('now()'));
});

if (!empty($this->cafe_slug)) {
$query->where('cafe_slug', $this->cafe_slug);
}

$indexedResults = $query->distinct()->get(['event_id']);
$event_ids = array_map(function ($indexedResult) {
return $indexedResult->event_id;
Expand Down
3 changes: 2 additions & 1 deletion plugins/liip/repaircafe/components/eventlist/default.htm
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ <h3 class="h5"><a href="{{ 'cafe'|page({ slug: event.cafe.slug }) }}">{{ event.c
{% endif %}
<ul class="list-unstyled">
{% for category in event.categories %}
<li>{{ category.name }}</li>
{# find better solution for link creation #}
<li><a href="{{ 'cafes'|page ~ '?category=' ~ category.slug }}">{{ category.name }}</a></li>
{% endfor %}
</ul>
</div>
Expand Down
6 changes: 5 additions & 1 deletion plugins/liip/repaircafe/models/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ class Event extends Model
];

public $belongsToMany = [
'categories' => [Category::class, 'table' => 'liip_repaircafe_event_category']
'categories' => [
Category::class,
'table' => 'liip_repaircafe_event_category',
'order' => 'name asc',
],
];

public $belongsTo = [
Expand Down
23 changes: 12 additions & 11 deletions themes/repair-cafe/pages/cafe.htm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

<div class="row">
<div class="col-md-6 mb-3">
<h2 class="h5">{{ 'page.cafe.address'|_ }}</h2>
{% partial 'components/address' street=cafeDetail.cafe.street zip=cafeDetail.cafe.zip city=cafeDetail.cafe.city inline=false %}
</div>
<div class="col-md-6 mb-3">
Expand All @@ -49,18 +48,20 @@ <h2 class="h5">{{ 'page.cafe.external_links'|_ }}</h2>
{% endif %}
</div>
</div>
<div class="row">
<div class="col-12 mb-3">
<h2 class="h5">{{ 'page.cafe.contacts'|_ }}</h2>
<div class="row">
{% for contact in cafeDetail.cafe.contacts %}
<div class="col-lg-4 col-md-6">
{% partial 'components/contact' contact=contact %}
</div>
{% endfor %}
{% if cafeDetail.cafe.contacts|length > 0 %}
<div class="row">
<div class="col-12 mb-3">
<h2 class="h5">{{ 'page.cafe.contacts'|_ }}</h2>
<div class="row">
{% for contact in cafeDetail.cafe.contacts %}
<div class="col-lg-4 col-md-6">
{% partial 'components/contact' contact=contact %}
</div>
{% endfor %}
</div>
</div>
</div>
</div>
{% endif %}
</div>
</div>
{% component 'eventList' %}
Expand Down
1 change: 1 addition & 0 deletions themes/repair-cafe/partials/components/address.htm
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% if street or city %}
<h2 class="h5">{{ 'page.cafe.address'|_ }}</h2>
{% set address_string = (street ? street : '') %}
{% if city and street %}
{% if inline %}
Expand Down

0 comments on commit 7483428

Please sign in to comment.