Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhiltri committed Nov 25, 2019
2 parents 166ab07 + be4dca3 commit a3f3014
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 18 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.0-beta52
6.0-beta53
4 changes: 2 additions & 2 deletions app/Models/Api/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ protected function basicQuery($field, $value, $boost = 0, $queryType = 'term')

protected function dateQuery($date_start, $date_end, $boost = 0)
{
if (!$date_start || !$date_end) {
if (!$date_start) {
return [];
}
$ret = [
Expand All @@ -965,7 +965,7 @@ protected function dateQuery($date_start, $date_end, $boost = 0)
[
"range" => [
"date_end" => [
"lte" => $date_end
"lte" => $date_end ?? date("Y")
]
]
]
Expand Down
28 changes: 27 additions & 1 deletion app/Models/Behaviors/HasApiModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ trait HasApiModel
*/
private $apiFields = [];

/**
* Helper to prevent duplicate API queries.
*/
private $apiDataCache;

/**
* Refresh the model with API values in case it's not done yet.
*
Expand All @@ -49,14 +54,35 @@ public function refreshApi()

public function getApiModelFilled()
{
return $this->apiModel::query()->find($this->datahub_id);
return $this->apiDataCache = $this->apiModel::query()->find($this->datahub_id);
}

public function getApiModelFilledCached()
{
return $this->apiDataCache ?? $this->getApiModelFilled();
}

public function getApiModel()
{
return $this->apiModel;
}

/**
* WEB-1315: When an item from the API gets augmented, the website
* takes all the data coming from the API, and uses it to fill out
* a new model instance. If there are any name collisions between
* API fields and model fields (e.g. title), API data will be saved
* to the model permanently. This causes API changes to appear not
* to propogate to the website. It seems like this is only the case
* with `title`, so here is a work-around for that bug.
*
* @return string
*/
public function getTitleAttribute()
{
return $this->getApiModelFilledCached()->title;
}

/**
* Augment the entity with the values coming from the API.
* TODO: Solve name collisions
Expand Down
19 changes: 8 additions & 11 deletions frontend/scss/molecules/_m-article-header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -925,27 +925,24 @@ $thumbTease: 4px;
}

.m-article-header--gallery .m-article-header__img-container {
display: block;
display: flex;
flex-flow: row nowrap;
align-items: center;

position: relative;
flex: 0 0 auto;
width: 100%;
max-width: 843px;
height: 100%;
max-width: 843px;
max-height: 843px;
margin: auto;
}

.m-article-header--gallery .m-article-header__img-container img {
display: block;
position: relative;
object-fit: contain;
height: 100%;
width: 100%;
z-index: 1;
left: 50%;
top: 50%;
width: auto;
max-width: 100%;
height: auto;
max-height: 100%;
transform: translate(-50%, -50%);
transition: opacity .25s;

&[data-gallery-fullscreen] {
Expand Down
4 changes: 2 additions & 2 deletions resources/views/components/atoms/_img.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ class="{{ $image['class'] ?? '' }} {{ $class ?? '' }} {{ $restrict ? 'restrict'
@else
src="{{ $src ?? '' }}"
@endif
@if ($restrict)
data-behavior="restrictDownload"
@if (isset($behavior) || $restrict)
data-behavior="{{ $behavior ?? '' }}{{ $restrict ? ' restrictDownload' : ''}}"
@endif
@if (isset($_GET['print']) or (isset($settings['lazyload']) and $settings['lazyload'] === false))
srcset="{{ $srcset ?? '' }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<ul class="m-link-list__sub-list">
@foreach ($link['links'] as $sublink)
<li class="m-link-list__item{{ (isset($sublink['active']) and $sublink['active']) ? ' s-active' : '' }}">
<a class="m-link-list__trigger {{ $sublinkFont ?? 'f-secondary' }}" href="{{ $sublink['href'] }}"><span class="m-link-list__label">{{ SmartyPants::defaultTransform($sublink['label']) }}</span>@if (isset($sublink['icon']) and $sublink['icon'])<svg aria-hidden="true" class="{{ $sublink['icon'] }}"><use xlink:href="#{{ $sublink['icon'] }}" /></svg>@endif</a>
<a class="m-link-list__trigger {{ $sublinkFont ?? 'f-secondary' }}" href="{{ $sublink['href'] }}"><span class="m-link-list__label">{!! SmartyPants::defaultTransform($sublink['label']) !!}</span>@if (isset($sublink['icon']) and $sublink['icon'])<svg aria-hidden="true" class="{{ $sublink['icon'] }}"><use xlink:href="#{{ $sublink['icon'] }}" /></svg>@endif</a>
</li>
@endforeach
</ul>
Expand Down

0 comments on commit a3f3014

Please sign in to comment.