Skip to content

Commit

Permalink
Merge pull request #77 from repair-cafe/SRC-97-embed-links-blank
Browse files Browse the repository at this point in the history
SRC-97 Embed links target blank
  • Loading branch information
stefina authored Sep 19, 2017
2 parents 7cbf6c4 + 7293225 commit ccbe0ee
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
9 changes: 8 additions & 1 deletion plugins/liip/repaircafe/components/EventList.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class EventList extends ComponentBase
public $events_per_page_default;
public $events;
public $condensed;
public $is_embedded;
public $eventPaginator;
public $mapboxAccessToken;

Expand All @@ -39,13 +40,18 @@ public function defineProperties()
'description' => 'liip.repaircafe::lang.component.eventlist.properties.condensed.description',
'type' => 'checkbox',
],
'is_embedded' => [
'title' => 'liip.repaircafe::lang.component.eventlist.properties.is_embedded.title',
'description' => 'liip.repaircafe::lang.component.eventlist.properties.is_embedded.description',
'type' => 'checkbox',
],
'events_per_page' => [
'title' => 'liip.repaircafe::lang.component.eventlist.properties.events_per_page.title',
'description' => 'liip.repaircafe::lang.component.eventlist.properties.events_per_page.description',
'type' => 'string',
'validationPattern' => '^[0-9]+$',
'validationMessage' => 'liip.repaircafe::lang.component.eventlist.properties.events_per_page.validationMessage',
]
],
];
}

Expand Down Expand Up @@ -93,6 +99,7 @@ public function onRun()
setlocale(LC_TIME, $localeCode . '_' . strtoupper($localeCode) . '.UTF-8');

$this->condensed = boolval($this->property('condensed'));
$this->is_embedded = boolval($this->property('is_embedded'));
$this->events_per_page_default = Settings::get('events_per_page', 15);
if (!empty(Input::get('events_per_page'))) {
// if GET/POST parameter is set
Expand Down
4 changes: 4 additions & 0 deletions plugins/liip/repaircafe/lang/de/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@
'description' => 'Definiert wieviele Events pro Seite angezeigt werden sollen.',
'validationMessage' => 'Für die Anzahl Events pro Seite sind nur Zahlen erlaubt.',
],
'is_embedded' => [
'title' => 'Embed-Template',
'description' => 'Markieren falls die Komponente im Embed-Template verwendet wird. Target aller Links wird dadurch auf _blank gesetzt.',
],
],
],
'newslist' => [
Expand Down
1 change: 1 addition & 0 deletions themes/repair-cafe/pages/cafe-embed.htm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

[eventList]
cafe_slug = "{{ :slug }}"
is_embedded = 1
==
<div class="container-fluid cafe-embed">
{% partial 'components/eventlist' eventList=eventList %}
Expand Down
5 changes: 2 additions & 3 deletions themes/repair-cafe/partials/components/eventlist.htm
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ <h4 class="h5">{{ event.getTitle }}</h4>
<ul class="list-inline categories">
{% for category in event.categories %}
<li class="list-inline-item mb-2">
{# TODO find better solution for link creation #}
<a href="{{ 'events'|page ~ '?category=' ~ category.slug }}">
<a href="{{ 'events'|page ~ '?category=' ~ category.slug }}"{{ eventList.is_embedded ? ' target="_blank" rel="noopener"' }}>
<img src="{{ ('assets/images/categories/icon-' ~ category.slug ~ '.svg')|theme }}" onerror="this.onerror=null;this.src='{{ ('assets/images/categories/icon-' ~ category.slug ~ '@2x.png')|theme }}'" class="category-logo" title="{{ category.name ~ ': ' ~ category.description }}" alt="{{ category.name ~ ': ' ~ category.description }}" />
</a>
</li>
Expand All @@ -57,7 +56,7 @@ <h4 class="h5">{{ event.getTitle }}</h4>
</div>
{% if not eventList.condensed %}
<div class="mb-3">
<a class="btn btn-primary" href="{{ 'cafe'|page({ slug: event.cafe.slug }) }}" role="button">{{ 'eventlist.cafe_detail_button'|_ }}</a>
<a href="{{ 'cafe'|page({ slug: event.cafe.slug }) }}" class="btn btn-primary"{{ eventList.is_embedded ? ' target="_blank" rel="noopener"' }}>{{ 'eventlist.cafe_detail_button'|_ }}</a>
</div>
{% endif %}
{% partial 'components/event-share' event=event %}
Expand Down

0 comments on commit ccbe0ee

Please sign in to comment.