Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhiltri committed May 26, 2020
2 parents 383376a + cd3ef94 commit 006b1d2
Show file tree
Hide file tree
Showing 149 changed files with 3,154 additions and 950 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.12
6.13
2 changes: 1 addition & 1 deletion app/Console/Commands/GeneratePdfs.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function handle()

if (config('app.debug')) {
$prince->setVerbose(true);
$prince->setLog('/Users/ntrive/tmp/prince.log');
$prince->setLog(storage_path('logs/prince-' .date('Y-m-d') .'.log'));
}

set_time_limit(0);
Expand Down
8 changes: 4 additions & 4 deletions app/Helpers/DatesHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ function printYear($date)
return null;
}
if ($date < 0) {
return abs($date) ." BC";
return abs($date) ." BCE";
}
if ($date <= 1000) {
return $date ." AD";
return $date ." CE";
}
if ($date == Carbon::now()->year) {
return "Present";
Expand Down Expand Up @@ -63,9 +63,9 @@ function convertArtworkDates($date)
$formatdate = "";

if($date < 0) {
$formatdate = abs($date) . " BC";
$formatdate = abs($date) . " BCE";
} else if($date < 1000) {
$formatdate = $date . " AD";
$formatdate = $date . " CE";
} else {
$formatdate = $date;
}
Expand Down
10 changes: 10 additions & 0 deletions app/Helpers/UrlHelpers.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Route;

if (!function_exists('currentUrlWithQuery')) {
function currentUrlWithQuery($options = [])
Expand Down Expand Up @@ -30,3 +31,12 @@ function secureRoute($routeName)
return $route;
}
}

// derived from moduleRoute
if (!function_exists('moduleRouteExists')) {
function moduleRouteExists($moduleName, $prefix, $action)
{
$routeName = 'admin.' . ($prefix ? $prefix . '.' : '') . camel_case($moduleName) . '.' . $action;
return Route::has($routeName);
}
}
18 changes: 18 additions & 0 deletions app/Http/Controllers/API/CookieController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace App\Http\Controllers\API;

use Illuminate\Http\Request;

use Illuminate\Routing\Controller as BaseController;
use Illuminate\Support\Facades\Cookie;

class CookieController extends BaseController
{
public function notification($minutes = 1440)
{
return response()
->json(['has_seen_notification' => 'true'])
->cookie('has_seen_notification', 'true', $minutes);
}
}
12 changes: 11 additions & 1 deletion app/Http/Controllers/Admin/BaseApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,17 @@ protected function getRepository()
protected function getBrowserTableData($items)
{
// Ensure data is an array and not an object to avoid json_encode wrong conversion
return array_values(parent::getBrowserTableData($items));
$results = array_values(parent::getBrowserTableData($items));

// WEB-1187: Fix the edit link
$results = array_map(function($result) {
if (moduleRouteExists($this->moduleName, $this->routePrefix, 'augment')) {
$result['edit'] = moduleRoute($this->moduleName, $this->routePrefix, 'augment', $result['id']);
}
return $result;
}, $results);

return $results;
}

protected function getApiRepository()
Expand Down
45 changes: 0 additions & 45 deletions app/Http/Controllers/Admin/CollectionFeatureController.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@

use A17\Twill\Http\Controllers\Admin\ModuleController;
use App\Models\Experience;
use App\Models\InteractiveFeature;
use App\Models\Article;
use App\Repositories\InteractiveFeatureRepository;
use App\Repositories\ExperienceRepository;

class InteractiveFeatureExperienceController extends ModuleController
class ExperienceController extends ModuleController
{
protected $moduleName = 'interactiveFeatures.experiences';
protected $moduleName = 'experiences';
protected $modelName = 'Experience';
protected $previewView = 'site.experienceDetail';

protected function getParentModuleForeignKey()
{
return 'interactive_feature_id';
}
protected $indexOptions = [
'reorder' => true,
];

protected $indexColumns = [
'image' => [
Expand All @@ -27,63 +27,26 @@ protected function getParentModuleForeignKey()
'crop' => 'default',
],
],
'isWebPublished' => [
'title' => 'Is web published?',
'field' => 'isWebPublished',
'present' => true,
],
'title' => [
'title' => 'Title',
'field' => 'title',
'sort' => true,
],
'interactiveFeatureTitle' => [ // relation column
'title' => 'Grouping',
'relationship' => 'interactiveFeature',
'field' => 'title'
],
'experiences' => [
'title' => 'Slides',
'nested' => 'slides',
],
];

protected function indexData($request)
{
$interactiveFeature = app(InteractiveFeatureRepository::class)->getById(request('interactiveFeature'));
return [
'breadcrumb' => [
[
'label' => 'Groupings',
'url' => moduleRoute('interactiveFeatures', 'collection', 'index'),
],
[
'label' => $interactiveFeature->title,
'url' => moduleRoute('interactiveFeatures', 'collection', 'edit', $interactiveFeature->id),
],
[
'label' => 'Experiences',
],

],
];
}

protected function formData($request)
{
$experience = app(ExperienceRepository::class)->getById(request('experience'));
return [
'breadcrumb' => [
[
'label' => 'Groupings',
'url' => moduleRoute('interactiveFeatures', 'collection', 'index'),
],
[
'label' => $experience->interactiveFeature->title,
'url' => moduleRoute('interactiveFeatures', 'collection', 'edit', $experience->interactiveFeature->id),
],
[
'label' => 'Experiences',
'url' => moduleRoute('interactiveFeatures.experiences', 'collection', 'index', $request->route('interactiveFeature')),
],
[
'label' => $experience->title,
],

],
];
}

// Intend to override the lines:
// thumbnail
// $value .= moduleRoute("experiences.slides", $this->routePrefix, 'index', [$item->id]);
Expand Down Expand Up @@ -176,6 +139,14 @@ protected function previewData($item)
];
}

protected function formData($request)
{
return [
'groupingsList' => InteractiveFeature::all()->pluck('title', 'id')
];
}


protected function getBrowserTableData($items)
{
$withImage = $this->moduleHas('medias');
Expand Down
26 changes: 4 additions & 22 deletions app/Http/Controllers/Admin/ExperienceSlideController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,15 @@ protected function getParentModuleForeignKey()
protected function indexData($request)
{
$experience = app(ExperienceRepository::class)->getById(request('experience'));
$interactiveFeature = $experience->interactiveFeature;
return [
'breadcrumb' => [
[
'label' => 'Groupings',
'url' => moduleRoute('interactiveFeatures', 'collection', 'index'),
],
[
'label' => $interactiveFeature->title,
'url' => moduleRoute('interactiveFeatures', 'collection', 'edit', $interactiveFeature->id),
],
[
'label' => 'Experiences',
'url' => moduleRoute('interactiveFeatures.experiences', 'collection', 'index', $experience->interactiveFeature->id),
'url' => moduleRoute('experiences', 'collection', 'index'),
],
[
'label' => $experience->title,
'url' => moduleRoute('interactiveFeatures.experiences', 'collection', 'edit', [$interactiveFeature->id, $experience->id]),
'url' => moduleRoute('experiences', 'collection', 'edit', [$experience->id]),
],
[
'label' => 'Slides',
Expand All @@ -56,7 +47,6 @@ protected function indexData($request)
protected function formData($request)
{
$experience = app(ExperienceRepository::class)->getById(request('experience'));
$interactiveFeature = $experience->interactiveFeature;
$slide = app(SlideRepository::class)->getById(request('slide'));
$slides = $this->repository->get([], ['experience_id' => $experience->id], ['position' => 'asc']);
$currentSlideIndex = $slides->search($slide);
Expand All @@ -71,21 +61,13 @@ protected function formData($request)
];
}),
'breadcrumb' => [
[
'label' => 'Groupings',
'url' => moduleRoute('interactiveFeatures', 'collection', 'index'),
],
[
'label' => $interactiveFeature->title,
'url' => moduleRoute('interactiveFeatures', 'collection', 'edit', $interactiveFeature->id),
],
[
'label' => 'Experiences',
'url' => moduleRoute('interactiveFeatures.experiences', 'collection', 'index', $experience->interactiveFeature->id),
'url' => moduleRoute('experiences', 'collection', 'index'),
],
[
'label' => $experience->title,
'url' => moduleRoute('interactiveFeatures.experiences', 'collection', 'edit', [$interactiveFeature->id, $experience->id]),
'url' => moduleRoute('experiences', 'collection', 'edit', [$experience->id]),
],
[
'label' => 'Slides',
Expand Down
10 changes: 10 additions & 0 deletions app/Http/Controllers/Admin/HomeArtistController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace App\Http\Controllers\Admin;

use A17\Twill\Http\Controllers\Admin\ModuleController;

class HomeArtistController extends ModuleController
{
protected $moduleName = 'homeArtists';
}
4 changes: 0 additions & 4 deletions app/Http/Controllers/Admin/InteractiveFeatureController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ class InteractiveFeatureController extends ModuleController
'field' => 'updatedDate',
'present' => true,
],
'experiences' => [
'title' => 'Experiences',
'nested' => 'experiences',
]
];

protected $formWith = ['revisions'];
Expand Down
9 changes: 7 additions & 2 deletions app/Http/Controllers/Admin/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@ public function home(PageRepository $pages)
Session::put("pages_back_link", route('admin.homepage.landing'));

$additionalFieldsets = [
['fieldset' => 'exhibitions-and-events', 'label' => 'Exhibitions and Event'],
['fieldset' => 'membership', 'label' => 'Membership Module'],
['fieldset' => 'plan-your-visit', 'label' => 'Plan Your Visit'],
['fieldset' => 'video-carousel', 'label' => 'Video Carousel'],
['fieldset' => 'call-to-action', 'label' => 'Call to Action'],
['fieldset' => 'highlights', 'label' => 'Highlights'],
['fieldset' => 'artists', 'label' => 'Artists'],
['fieldset' => 'from-the-collection', 'label' => 'From the Collection'],
['fieldset' => 'from-the-shop', 'label' => 'From the Shop'],
['fieldset' => 'exhibitions-and-events', 'label' => 'Exhibitions and Events'],
// ['fieldset' => 'interactive-features', 'label' => 'Interactive Features'],
];
$fields = $this->form($page->id);
$fields['additionalFieldsets'] = $additionalFieldsets;
Expand Down
2 changes: 2 additions & 0 deletions app/Http/Controllers/Admin/SelectionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class SelectionController extends ModuleController

protected $indexOptions = [
'permalink' => true,
'reorder' => true,
];

protected $indexColumns = [
Expand Down Expand Up @@ -66,6 +67,7 @@ protected function formData($request)
return [
'baseUrl' => $baseUrl,
'siteTagsList' => app(SiteTagRepository::class)->listAll('name'),
'highlightTypeList' => $this->repository->getHighlightTypeList(),
];
}

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/ArticleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function index()

$featuredItems = $page->getRelatedWithApiModels("featured_items", [], [
'articles' => false,
'interactiveFeatures.experiences' => false
'experiences' => false
]);

$heroArticle = $featuredItems->first();
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/ArticlesPublicationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function index()

$articles = $page->getRelatedWithApiModels("featured_items", [], [
'articles' => false,
'interactiveFeatures.experiences' => false
'experiences' => false
]) ?? null;

$featureHero = $articles->shift();
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/CollectionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function index()
$featuredItems = $page->getRelatedWithApiModels(
'featured_items', [], [
'articles' => false,
'interactiveFeatures.experiences' => false
'experiences' => false
]);

$page = Page::forType('Art and Ideas')->with('apiElements')->first();
Expand Down
Loading

0 comments on commit 006b1d2

Please sign in to comment.