Skip to content

Commit

Permalink
Merge branch 'release/6.19'
Browse files Browse the repository at this point in the history
  • Loading branch information
IllyaMoskvin committed Aug 13, 2020
2 parents 29ddca6 + 6382c21 commit 6b840a0
Show file tree
Hide file tree
Showing 41 changed files with 428 additions and 176 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.18
6.19
1 change: 1 addition & 0 deletions app/Http/Controllers/Admin/ExperienceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ protected function previewData($item)
{
$articles = Article::published()
->orderBy('date', 'desc')
->listed()
->paginate(4);

return [
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/DigitalPublicationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function index(Request $request)

public function show($id)
{
$page = $this->repository->forSlug($id);
$page = $this->repository->safeForSlug($id);
if (!$page) {
$page = $this->repository->find((Integer) $id) ?? abort(404);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/EducatorResourcesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function show($id)
{
$page = $this->repository->find((Integer) $id);
if (!$page) {
$page = $this->repository->forSlug($id);
$page = $this->repository->safeForSlug($id);

if (!$page) {
abort(404);
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/GenericPagesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function show($slug)
protected function getPage($slug)
{
$idSlug = collect(explode("/", $slug))->last();
$page = $this->genericPageRepository->forSlug($idSlug);
$page = $this->genericPageRepository->safeForSlug($idSlug);
if (empty($page)) {
$page = $this->genericPageRepository->getById((integer) $idSlug);
if (!$page) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ protected function show($slug)
);
}

$experience = $this->repository->forSlug($slug);
$experience = $this->repository->safeForSlug($slug);

if (!$experience || $experience->kiosk_only === true) {
abort(404);
Expand All @@ -116,6 +116,7 @@ protected function show($slug)
else {
$articles = Article::published()
->orderBy('date', 'desc')
->listed()
->paginate(4);
}

Expand All @@ -134,7 +135,7 @@ protected function show($slug)

protected function showKiosk($slug)
{
$experience = $this->repository->forSlug($slug);
$experience = $this->repository->safeForSlug($slug);
if (!$experience) {
abort(404);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/PrintedPublicationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function index(Request $request)

public function show($id)
{
$page = $this->repository->forSlug($id);
$page = $this->repository->safeForSlug($id);
if (!$page) {
$page = $this->repository->find((Integer) $id) ?? abort(404);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/ResearchGuidesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function show($id)
{
$page = $this->repository->find((Integer) $id);
if (!$page) {
$page = $this->repository->forSlug($id);
$page = $this->repository->safeForSlug($id);

if (!$page) {
abort(404);
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/VideoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function show($id, $slug = null)

// Temporary. Remove after redirects are in place!
if (empty($item)) {
$item = $this->repository->forSlug($id);
$item = $this->repository->safeForSlug($id);
}

if (!$item) {
Expand Down
3 changes: 2 additions & 1 deletion app/Http/Resources/Slide.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ protected function get3DTourAttributes()
'model_id' => $model3d->model_id,
'camera_position' => $model3d->camera_position,
'camera_target' => $model3d->camera_target,
'annotation_list' => json_decode($model3d->annotation_list)
'annotation_list' => json_decode($model3d->annotation_list),
'hide_annotation_title' => $model3d->hide_annotation_title
];
} else {
return [
Expand Down
3 changes: 2 additions & 1 deletion app/Models/Model3d.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class Model3d extends Model
'model_caption_title',
'model_caption',
'guided_tour',
'hide_annotation'
'hide_annotation',
'hide_annotation_title'
];
protected $casts = [
'camera_position' => 'array',
Expand Down
1 change: 0 additions & 1 deletion app/Repositories/AuthorRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use A17\Twill\Repositories\Behaviors\HandleSlugs;
use A17\Twill\Repositories\Behaviors\HandleMedias;
use A17\Twill\Repositories\Behaviors\HandleRevisions;
use A17\Twill\Repositories\ModuleRepository;
use App\Models\Author;

class AuthorRepository extends ModuleRepository
Expand Down
4 changes: 3 additions & 1 deletion app/Repositories/Behaviors/Handle3DModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ private function handle3DModel($object, $fields, $fieldName = 'aic_3d_model')
'annotation_list' => $fields["{$fieldName}[annotation_list]"],
'guided_tour' => $fields["{$fieldName}[guided_tour]"] ?? false,
'hide_annotation' => empty($fields["{$fieldName}[hide_annotation]"]) ? false : $fields["{$fieldName}[hide_annotation]"],
'hide_annotation_title' => empty($fields["{$fieldName}[hide_annotation_title]"]) ? false : $fields["{$fieldName}[hide_annotation_title]"],
]
);
$object->model3d()->associate($model);
Expand All @@ -45,7 +46,7 @@ private function getFormFieldsFor3DModel($object, $fields, $fieldName = 'aic_3d_
$model3d = $object->secondaryExperienceModal->first()->model3d)
{
$secondaryExperienceModal = $object->secondaryExperienceModal->first();
$aic3dFields = ['model_url', 'model_id', 'model_caption_title', 'model_caption', 'camera_position', 'guided_tour', 'camera_target', 'annotation_list', 'hide_annotation'];
$aic3dFields = ['model_url', 'model_id', 'model_caption_title', 'model_caption', 'camera_position', 'guided_tour', 'camera_target', 'annotation_list', 'hide_annotation', 'hide_annotation_title'];
foreach ($aic3dFields as $aic3dField) {
array_push($fields['repeaterFields']['secondary_experience_modal'], [
'name' => "blocks[secondaryExperienceModal-{$secondaryExperienceModal->id}][aic_split_3d_model][{$aic3dField}]",
Expand All @@ -64,6 +65,7 @@ private function getFormFieldsFor3DModel($object, $fields, $fieldName = 'aic_3d_
$fields["{$fieldName}[camera_target]"] = $model3d->getOriginal('camera_target');
$fields["{$fieldName}[annotation_list]"] = $model3d->getOriginal('annotation_list');
$fields["{$fieldName}[hide_annotation]"] = $model3d->getOriginal('hide_annotation');
$fields["{$fieldName}[hide_annotation_title]"] = $model3d->getOriginal('hide_annotation_title');
};

return $fields;
Expand Down
4 changes: 0 additions & 4 deletions app/Repositories/EmailSeriesRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@

namespace App\Repositories;


use A17\Twill\Repositories\ModuleRepository;
use App\Models\EmailSeries;

class EmailSeriesRepository extends ModuleRepository
{


public function __construct(EmailSeries $model)
{
$this->model = $model;
Expand Down
1 change: 0 additions & 1 deletion app/Repositories/ExperienceImageRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use A17\Twill\Repositories\Behaviors\HandleMedias;
use A17\Twill\Repositories\Behaviors\HandleRevisions;
use A17\Twill\Repositories\Behaviors\HandleSlugs;
use A17\Twill\Repositories\ModuleRepository;
use App\Models\Api\Artwork;
use App\Models\ExperienceImage;

Expand Down
3 changes: 1 addition & 2 deletions app/Repositories/ExperienceModalRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use A17\Twill\Repositories\Behaviors\HandleFiles;
use A17\Twill\Repositories\Behaviors\HandleMedias;
use A17\Twill\Repositories\Behaviors\HandleRevisions;
use A17\Twill\Repositories\ModuleRepository;
use App\Models\ExperienceModal;
use App\Repositories\Behaviors\HandleExperienceModule;
use App\Repositories\Behaviors\Handle3DModel;
Expand Down Expand Up @@ -42,7 +41,7 @@ public function prepareFieldsBeforeSave($object, $fields)
$fields['repeaters'] = $fields['blocks'];
unset($fields['blocks']);
};

return parent::prepareFieldsBeforeCreate($fields);
}
}
1 change: 0 additions & 1 deletion app/Repositories/ExperienceRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use A17\Twill\Repositories\Behaviors\HandleRevisions;
use A17\Twill\Repositories\Behaviors\HandleSlugs;
use A17\Twill\Repositories\Behaviors\HandleTranslations;
use A17\Twill\Repositories\ModuleRepository;
use App\Models\Experience;
use App\Repositories\Behaviors\HandleExperienceModule;
use App\Repositories\Behaviors\HandleMagazine;
Expand Down
1 change: 0 additions & 1 deletion app/Repositories/HomeArtistRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Repositories;

use A17\Twill\Repositories\Behaviors\HandleMedias;
use A17\Twill\Repositories\ModuleRepository;

use App\Models\HomeArtist;
use App\Repositories\Behaviors\HandleApiRelations;
Expand Down
3 changes: 1 addition & 2 deletions app/Repositories/InteractiveFeatureRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use A17\Twill\Repositories\Behaviors\HandleRepeaters;
use A17\Twill\Repositories\Behaviors\HandleRevisions;
use A17\Twill\Repositories\Behaviors\HandleSlugs;
use A17\Twill\Repositories\ModuleRepository;
use App\Models\InteractiveFeature;
use App\Models\Experience;
use Artisan;
Expand Down Expand Up @@ -36,5 +35,5 @@ public function search($search)
{
return Experience::where('title', 'ILIKE', "%{$search}%")->published();
}

}
1 change: 0 additions & 1 deletion app/Repositories/IssueArticleRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use A17\Twill\Repositories\Behaviors\HandleMedias;
use A17\Twill\Repositories\Behaviors\HandleRevisions;
use A17\Twill\Repositories\Behaviors\HandleBlocks;
use A17\Twill\Repositories\ModuleRepository;
use App\Models\IssueArticle;
use App\Models\Api\Search;

Expand Down
1 change: 0 additions & 1 deletion app/Repositories/IssueRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use A17\Twill\Repositories\Behaviors\HandleSlugs;
use A17\Twill\Repositories\Behaviors\HandleMedias;
use A17\Twill\Repositories\Behaviors\HandleRevisions;
use A17\Twill\Repositories\ModuleRepository;
use App\Models\Issue;
use App\Models\Api\Search;

Expand Down
1 change: 0 additions & 1 deletion app/Repositories/MagazineIssueRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use A17\Twill\Repositories\Behaviors\HandleBlocks;
use A17\Twill\Repositories\Behaviors\HandleMedias;
use A17\Twill\Repositories\Behaviors\HandleRevisions;
use A17\Twill\Repositories\ModuleRepository;
use App\Repositories\Behaviors\HandleApiBlocks;

class MagazineIssueRepository extends ModuleRepository
Expand Down
13 changes: 13 additions & 0 deletions app/Repositories/ModuleRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Repositories;

use BadMethodCallException;
use A17\Twill\Repositories\ModuleRepository as BaseModuleRepository;

class ModuleRepository extends BaseModuleRepository
Expand Down Expand Up @@ -29,4 +30,16 @@ public function prepareFieldsBeforeSave($object, $fields)
return parent::prepareFieldsBeforeSave($object, $fields);
}

/**
* Temporary work-around for https://github.com/area17/twill/issues/723
*/
public function safeForSlug($slug, $with = [], $withCount = [], $scopes = [])
{
try {
return $this->forSlug(...func_get_args());
} catch (BadMethodCallException $e) {
abort(404);
}
}

}
1 change: 0 additions & 1 deletion app/Repositories/SlideRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use A17\Twill\Repositories\Behaviors\HandleMedias;
use A17\Twill\Repositories\Behaviors\HandleRevisions;
use A17\Twill\Repositories\Behaviors\HandleSlugs;
use A17\Twill\Repositories\ModuleRepository;
use App\Models\Slide;
use App\Repositories\Behaviors\HandleExperienceModule;
use App\Repositories\Behaviors\Handle3DModel;
Expand Down
1 change: 0 additions & 1 deletion app/Repositories/VanityRedirectRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Repositories;

use A17\Twill\Repositories\Behaviors\HandleRevisions;
use A17\Twill\Repositories\ModuleRepository;
use App\Models\VanityRedirect;

class VanityRedirectRepository extends ModuleRepository
Expand Down
1 change: 0 additions & 1 deletion app/Repositories/WhatToExpectRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use A17\Twill\Repositories\Behaviors\HandleTranslations;
use A17\Twill\Repositories\Behaviors\HandleRevisions;
use A17\Twill\Repositories\ModuleRepository;
use App\Models\WhatToExpect;

class WhatToExpectRepository extends ModuleRepository
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddHideAnnotationTitleTo3dModels extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('3d_models', function (Blueprint $table) {
$table->boolean('hide_annotation_title')->default(false);
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('3d_models', function (Blueprint $table) {
$table->dropColumn('hide_annotation_title');
});
}
}
8 changes: 6 additions & 2 deletions frontend/js/behaviors/viewer3D.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const viewer3D = function(container) {
let btnExplore = wrapper.querySelector('.m-viewer-3d__overlay');
let btnCloseAnnotation = descriptionBlock.querySelector('.m-viewer-3d__annotation__close');
let hideAnnots = JSON.parse(wrapper.dataset.hideannot);
let hideAnnotTitles = JSON.parse(wrapper.dataset.hideannottitle);
let cc0 = JSON.parse(wrapper.dataset.cc);
let isGuided = JSON.parse(wrapper.dataset.guided);
let uid = wrapper.dataset.uid;
Expand Down Expand Up @@ -256,10 +257,13 @@ const viewer3D = function(container) {
var blockWindow = document.createElement("div");
blockWindow.classList.add('m-media--3d-tour__sep');
blockWindow.setAttribute('data-hotspot', i);
blockText.innerHTML = '<p class="m-media--3d-tour__p"><strong>' + annot.name + '</strong>' + annot.content.raw + '</p>';
if(hideAnnotTitles) {
blockText.innerHTML = '<p class="m-media--3d-tour__p">' + annot.content.raw + '</p>';
} else {
blockText.innerHTML = '<p class="m-media--3d-tour__p"><strong>' + annot.name + '</strong>' + annot.content.raw + '</p>';
}
containerText.appendChild(blockWindow);
containerText.appendChild(blockText);
containerText.classList.remove('is-not-loaded');
}

if(i == 0) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/scss/molecules/_m-listing.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1417,7 +1417,7 @@ $f-audio-subtitle: generate-font-obj(

// Quick aside for artwork detail's sound variant
.m-listing--inline.m-listing--sound {
.m-listing__meta {
.m-listing__meta--sound {
@include font-styles($f-module-title-1);
}

Expand Down
Loading

0 comments on commit 6b840a0

Please sign in to comment.