Skip to content

Commit

Permalink
Merge pull request #663 from art-institute-of-chicago/feature/twill-u…
Browse files Browse the repository at this point in the history
…pdate-forms-formview

Update all forms to formview declarations [WEB-2984]
  • Loading branch information
nikhiltri committed Feb 13, 2025
2 parents 6632615 + 0e6e371 commit 7657ea4
Show file tree
Hide file tree
Showing 163 changed files with 7,794 additions and 7,811 deletions.
2 changes: 2 additions & 0 deletions app/Http/Controllers/Twill/FeeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

class FeeController extends \App\Http\Controllers\Twill\ModuleController
{
protected FeeRepository $fees;

public function __construct(FeeRepository $fees)
{
$this->fees = $fees;
Expand Down
267 changes: 128 additions & 139 deletions resources/views/twill/articles/form.blade.php
Original file line number Diff line number Diff line change
@@ -1,166 +1,155 @@
@extends('twill::layouts.form', [
// We define the fieldsets here for sticky subnav as the user scrolls down the form
'additionalFieldsets' => [
['fieldset' => 'content', 'label' => 'Content'],
['fieldset' => 'sponsors', 'label' => 'Sponsors'],
['fieldset' => 'attributes', 'label' => 'Attributes'],
['fieldset' => 'related', 'label' => 'Further Reading'],
['fieldset' => 'side_related', 'label' => 'Sidebar Related']
['fieldset' => 'side_related', 'label' => 'Sidebar Related'],
['fieldset' => 'metadata', 'label' => 'Metadata'],
]
])

@section('contentFields')
@formField('input', [
'name' => 'title_display',
'label' => 'Title formatting (optional)',
'note' => 'Use <i> tag to add italics. e.g. <i>Nighthawks</i>'
])

@formField('date_picker', [
'name' => 'date',
'label' => 'Display date',
'optional' => false,
'note' => 'Required',
])

@formField('select', [
'name' => 'layout_type',
'label' => 'Article layout',
'options' => $articleLayoutsList,
'default' => '0'
])

@formField('medias', [
'with_multiple' => false,
'no_crop' => false,
'label' => 'Hero image',
'name' => 'hero',
'note' => 'Minimum image width 3000px'
])

@formField('medias', [
'with_multiple' => false,
'no_crop' => false,
'label' => 'Mobile hero image',
'name' => 'mobile_hero',
'note' => 'Minimum image width 3000px'
])

@formField('wysiwyg', [
'type' => 'textarea',
'name' => 'hero_caption',
'label' => 'Hero image caption',
'note' => 'Usually used for copyright',
'maxlength' => 255,
'toolbarOptions' => [
'italic', 'link',
],
])

@formField('multi_select', [
'name' => 'categories',
'label' => 'Categories',
'options' => $categoriesList,
'placeholder' => 'Select some categories',
])

@formField('input', [
'name' => 'subtype',
'label' => 'Article Label'
])

@formField('wysiwyg', [
'name' => 'heading',
'label' => 'Header',
'maxlength' => 255,
'note' => 'Max 255 characters. Will be used on the article detail page.',
'toolbarOptions' => [
'italic'
],
])

@formField('wysiwyg', [
'name' => 'list_description',
'label' => 'List Description',
'maxlength' => 255,
'note' => 'Max 255 characters. Will be used on the article landing and listing pages, and social media.',
'toolbarOptions' => [
'italic'
],
])
<x-twill::input
name='title_display'
label='Title formatting (optional)'
note='Use <i> tag to add italics. e.g. <i>Nighthawks</i>'
/>

<x-twill::date-picker
name='date'
label='Display date'
optional='false'
note='Required'
/>

<x-twill::select
name='layout_type'
label='Article layout'
:options="$articleLayoutsList"
:default='0'
/>

<x-twill::medias
name='hero'
label='Hero image'
note='Minimum image width 3000px'
/>

<x-twill::medias
name='mobile_hero'
label='Mobile hero image'
note='Minimum image width 3000px'
/>

<x-twill::wysiwyg
name='hero_caption'
label='Hero image caption'
note='Usually used for copyright'
:maxlength='255'
:toolbar-options="[ 'italic', 'link' ]"
/>

<x-twill::multi-select
name='categories'
label='Categories'
placeholder='Select some categories'
:options='$categoriesList'
:unpack="true"
/>

<x-twill::input
name='subtype'
label='Article Label'
/>

<x-twill::wysiwyg
name='heading'
label='Header'
note='Max 255 characters. Will be used on the article detail page.'
:maxlength='255'
:toolbar-options="[ 'italic' ]"
/>

<x-twill::wysiwyg
name='list_description'
label='List Description'
note='Max 255 characters. Will be used on the article landing and listing pages, and social media.'
:maxlength='255'
:toolbar-options="[ 'italic' ]"
/>

@include('twill.partials.authors')

@formField('medias', [
'with_multiple' => false,
'no_crop' => false,
'label' => 'Author thumbnail',
'name' => 'author',
'note' => 'Minimum image width 600px'
])

@formField('checkbox', [
'name' => 'is_unlisted',
'label' => "Don't show this article in listings",
])

@formField('checkbox', [
'name' => 'is_in_magazine',
'label' => 'Assume this article is featured in a magazine issue',
])

@formField('wysiwyg', [
'name' => 'citations',
'label' => 'Citation',
'maxlength' => 255,
'note' => 'Max 255 characters',
'toolbarOptions' => [
'italic', 'link',
],
])

@formField('block_editor', [
'blocks' => BlockHelpers::getBlocksForEditor([
'paragraph', 'image', 'hr', 'artwork', 'split_block', 'gallery_new', 'link', 'video', 'quote', 'tour_stop', 'accordion', 'media_embed', 'list', 'grid', 'image_slider', 'button', 'audio_player', '360_embed', 'mirador_embed', '3d_embed', 'feature_2x', 'membership_banner', 'layered_image_viewer', '3d_tour', 'feature_4x', 'citation', 'citation', 'mirador_modal'
])
])

<x-twill::medias
label='Author thumbnail'
name='author'
note='Minimum image width 600px'
/>

<x-twill::checkbox
name='is_unlisted'
label="Don't show this article in listings"
/>

<x-twill::checkbox
name='is_in_magazine'
label='Assume this article is featured in a magazine issue'
/>

<x-twill::wysiwyg
name='citations'
label='Citation'
note='Max 255 characters'
:maxlength='255'
:toolbar-options="[ 'italic', 'link' ]"
/>

@php
$blocks = BlockHelpers::getBlocksForEditor([
'paragraph', 'image', 'hr', 'artwork', 'split_block', 'gallery_new', 'link', 'video', 'quote', 'tour_stop', 'accordion', 'media_embed', 'list', 'grid', 'image_slider', 'button', 'audio_player', '360_embed', 'vtour_embed', 'mirador_embed', '3d_embed', 'feature_2x', 'membership_banner', 'layered_image_viewer', '3d_tour', 'feature_4x', 'citation', 'citation', 'mirador_modal'
]);
@endphp

<x-twill::block-editor
:blocks="$blocks"
/>
@stop

@section('fieldsets')
<a17-fieldset id="sponsors" title="Sponsors">
@formField('browser', [
'routePrefix' => 'exhibitionsEvents',
'moduleName' => 'sponsors',
'name' => 'sponsors',
'label' => 'Sponsors',
'note' => 'Display content blocks from this sponsor',
'max' => 1
])
</a17-fieldset>

<a17-fieldset id="related" title="Further Reading">
<x-twill::formFieldset id="sponsors" title="Sponsors">
<x-twill::browser
name='sponsors'
label='Sponsors'
note='Display content blocks from this sponsor'
route-prefix='exhibitionsEvents'
module-name='sponsors'
:max='1'
/>
</x-twill::formFieldset>

<x-twill::formFieldset id="related" title="Further Reading">
<p>Use "Custom related items" to relate up to 4 articles to show on the article page. See special note on articles below.</p>

@formField('browser', [
'routePrefix' => 'collection.articlesPublications',
'moduleName' => 'articles',
'name' => 'further_reading_items',
'endpoints' => [
<x-twill::browser
name='further_reading_items'
label='Custom related items'
:max='4'
:modules="[
[
'label' => 'Article',
'value' => '/collection/articlesPublications/articles/browser'
'name' => 'collection.articlesPublications.articles'
],
[
'label' => 'Highlight',
'value' => moduleRoute('highlights', 'collection', 'browser')
'name' => 'collection.highlights'
],
[
'label' => 'Interactive feature',
'value' => moduleRoute('experiences', 'collection.interactiveFeatures', 'browser')
'name' => 'collection.interactiveFeatures.experiences'
]
],
'max' => 4,
'label' => 'Custom related items',
])
]"
/>

<p>We use Category data to determine which articles to relate. We automatically append any article related in this way to the "Related Content" section in reverse chronological order. The following articles would be shown on this article's page automatically:</p>

Expand All @@ -179,7 +168,7 @@
</ol>

<p style="margin-top: 1em">If this logic is satisfactory, there's no need to add exhibitions to the "Custom related items" field. However, if you'd like to control the order of exhibitions relative to other related content, feel free to add them using the field above.</p>
</a17-fieldset>
</x-twill::formFieldset>

@component('twill.partials.featured-related', ['form_fields' => $form_fields, 'autoRelated' => $autoRelated, 'item' => $item])
@slot('routePrefix', 'collection.articlesPublications')
Expand Down
Loading

0 comments on commit 7657ea4

Please sign in to comment.