diff --git a/client/dist/styles/bundle.css b/client/dist/styles/bundle.css index b56d823..3f63f02 100644 --- a/client/dist/styles/bundle.css +++ b/client/dist/styles/bundle.css @@ -1 +1 @@ -.baselistcomponent .items>article.item{margin-bottom:2rem}.baselistcomponent .items>article.item>div.image{position:relative;margin-bottom:1rem}.baselistcomponent .items>article.item>div.image a{display:block}.baselistcomponent .items>article.item>div.image div.image-overlay{top:0;left:0;right:0;bottom:0;width:100%;height:100%;opacity:0;position:absolute;transition:.5s ease;background-color:rgba(33,37,41,.5)}.baselistcomponent .items>article.item>div.image div.image-overlay>i{top:50%;left:50%;color:#fff;position:absolute;font-size:32px;transform:translate(-50%,-50%)}.baselistcomponent .items>article.item>div.image:hover div.image-overlay,.baselistcomponent .items>article.item>div.image a:focus div.image-overlay{opacity:1}.baselistcomponent .items>article.item>section.content header a{color:inherit}.baselistcomponent .items>article.item>section.content div.details{color:#868e96}.baselistcomponent .items>article.item>section.content div.details>span{margin-right:.5rem}.baselistcomponent .items>article.item>section.content div.details a{color:inherit}.baselistcomponent .items>article.item>section.content footer{margin-top:1rem}.baselistcomponent .items>article.item>section.content>div{margin-bottom:.5rem}.featurecomponent article.feature>a.feature{display:block;text-decoration:none;transition:background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}.featurecomponent article.feature>a.feature:focus,.featurecomponent article.feature>a.feature:hover{text-decoration:none}.featurecomponent article.feature div.icon{margin-bottom:.5rem}.featurecomponent article.feature div.summary>p:last-child{margin-bottom:0}.featurecomponent article.feature footer{margin-top:1rem}.imagecomponent figure{width:100%;margin-bottom:0}.imagecomponent figure>figcaption>p:last-child{margin-bottom:0}.imagecomponent a.image{display:block}@media (min-width:768px){.listcomponent .items>article.item{display:block}.listcomponent .items.image-align-left>article.item,.listcomponent .items.image-align-right>article.item,.listcomponent .items.image-align-stagger>article.item{display:flex}.listcomponent .items.image-align-left>article.item>div.image,.listcomponent .items.image-align-right>article.item>div.image,.listcomponent .items.image-align-stagger>article.item>div.image{margin-bottom:0}.listcomponent .items.image-align-left>article.item.has-image>div.image,.listcomponent .items.image-align-stagger>article.item.has-image:nth-child(odd)>div.image{order:1}.listcomponent .items.image-align-left>article.item.has-image>section.content,.listcomponent .items.image-align-stagger>article.item.has-image:nth-child(odd)>section.content{flex:1;order:2;margin-left:1rem}.listcomponent .items.image-align-right>article.item.has-image>div.image,.listcomponent .items.image-align-stagger>article.item.has-image:nth-child(2n)>div.image,.listcomponent .items>div.image{order:2}.listcomponent .items.image-align-right>article.item.has-image>section.content,.listcomponent .items.image-align-stagger>article.item.has-image:nth-child(2n)>section.content,.listcomponent .items>section.content{flex:1;order:1;margin-right:1rem}}.mediacomponent figure{width:100%;margin-bottom:0}.mediacomponent figure>figcaption>p:last-child{margin-bottom:0}.mediacomponent a.text{display:block}.mediacomponent a.text:hover{text-decoration:none}.mediacomponent a.text:hover span{text-decoration:underline}.mediacomponent a.text>i.fa{color:#868e96}.mediacomponent a.image{display:block}.mediacomponent a.image+a.text{margin-top:.5rem}.mediacomponent .rich>iframe{margin:0!important}.mediacomponent .video{width:100%;height:0;display:block;position:relative}.mediacomponent .video.four-three{padding-bottom:75%}.mediacomponent .video.sixteen-nine{padding-bottom:56.25%}.mediacomponent .video>iframe{top:0;left:0;border:0;width:100%;height:100%;position:absolute}.pagecomponent.page-title-hidden .content-container>article>header{display:none}.pagecomponent .content-container>article>div{margin-bottom:1rem}.scrolltotopbutton{opacity:0;outline:0;right:1rem;bottom:1rem;width:4rem;height:4rem;z-index:1000;position:fixed;display:block;overflow:hidden;visibility:hidden;white-space:nowrap;text-align:center;font-size:16px;line-height:4rem;box-shadow:0 0 20px rgba(0,0,0,.2);transition:opacity .3s 0s,visibility 0s .3s,color .15s ease-in-out 0s,background-color .15s ease-in-out 0s}.scrolltotopbutton.is-visible{opacity:1;visibility:visible}.scrolltotopbutton.fade-out{opacity:.5}.scrolltotopbutton:hover{opacity:1}@media (min-width:768px){.scrolltotopbutton{width:5rem;height:5rem;right:2rem;bottom:2rem;line-height:5rem}}@media (min-width:992px){.scrolltotopbutton{width:6rem;height:6rem;font-size:20px;line-height:6rem}}.tilecomponent .items{display:flex;flex-flow:row wrap;align-items:stretch}.tilecomponent .items>article.item{display:flex;flex-direction:column;flex:1 100%;padding:2%}.tilecomponent .items>article.item>section.content{margin-top:auto}.tilecomponent .items>article.item>section.content header>*{font-size:1rem;line-height:1.2}.tilecomponent .items>article.item>section.content div.details>span{display:block;margin-right:0;margin-bottom:.5rem}@media (min-width:576px){.tilecomponent .items>article.item{flex:1 50%}}@media (min-width:768px){.tilecomponent .items>article.item{flex:1 33.3%}}@media (min-width:992px){.tilecomponent .items>article.item{flex:1 25%}}.detail-fields>dl dt{font-weight:500}.detail-fields>dl dd{font-size:.9rem;margin-bottom:1rem}.component.link{text-decoration:none}.component.link,.component.link>i.fa{display:inline-block}.component.link:active,.component.link:focus,.component.link:hover{text-decoration:none}.show-icons.hide-text .component.link{overflow:hidden;text-align:center;transition:color .15s ease-in-out 0s,background-color .15s ease-in-out 0s}.show-icons.hide-text .component.link>i.fa{display:block}.show-icons.hide-text .component.link.size-16{width:16px;height:16px;font-size:8px;line-height:16px}.show-icons.hide-text .component.link.size-16>i.fa{height:16px;line-height:16px}.show-icons.hide-text .component.link.size-24{width:24px;height:24px;font-size:12px;line-height:24px}.show-icons.hide-text .component.link.size-24>i.fa{height:24px;line-height:24px}.show-icons.hide-text .component.link.size-32{width:32px;height:32px;font-size:16px;line-height:32px}.show-icons.hide-text .component.link.size-32>i.fa{height:32px;line-height:32px}.show-icons.hide-text .component.link.size-48{width:48px;height:48px;font-size:24px;line-height:48px}.show-icons.hide-text .component.link.size-48>i.fa{height:48px;line-height:48px}.show-icons.hide-text .component.link.size-64{width:64px;height:64px;font-size:32px;line-height:64px}.show-icons.hide-text .component.link.size-64>i.fa{height:64px;line-height:64px}.show-icons.hide-text .component.link.size-96{width:96px;height:96px;font-size:48px;line-height:96px}.show-icons.hide-text .component.link.size-96>i.fa{height:96px;line-height:96px}.show-icons.hide-text .component.link.size-128{width:128px;height:128px;font-size:64px;line-height:128px}.show-icons.hide-text .component.link.size-128>i.fa{height:128px;line-height:128px}.hide-icons .component.link>i.fa,.hide-text .component.link>span.text{display:none} \ No newline at end of file +.baselistcomponent .items>article.item{margin-bottom:2rem}.baselistcomponent .items>article.item>div.image{position:relative;margin-bottom:1rem}.baselistcomponent .items>article.item>div.image a{display:block}.baselistcomponent .items>article.item>div.image div.image-overlay{top:0;left:0;right:0;bottom:0;width:100%;height:100%;opacity:0;position:absolute;transition:.5s ease;background-color:rgba(33,37,41,.5)}.baselistcomponent .items>article.item>div.image div.image-overlay>i{top:50%;left:50%;color:#fff;position:absolute;font-size:32px;transform:translate(-50%,-50%)}.baselistcomponent .items>article.item>div.image:hover div.image-overlay,.baselistcomponent .items>article.item>div.image a:focus div.image-overlay{opacity:1}.baselistcomponent .items>article.item>section.content header{margin-bottom:.5rem}.baselistcomponent .items>article.item>section.content header>*{margin-bottom:0}.baselistcomponent .items>article.item>section.content header a{color:inherit}.baselistcomponent .items>article.item>section.content div.details{color:#868e96}.baselistcomponent .items>article.item>section.content div.details>span{margin-right:.5rem}.baselistcomponent .items>article.item>section.content div.details a{color:inherit}.baselistcomponent .items>article.item>section.content footer{margin-top:1rem}.baselistcomponent .items>article.item>section.content>div{margin-bottom:.5rem}.featurecomponent article.feature>a.feature{display:block;text-decoration:none;transition:background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}.featurecomponent article.feature>a.feature:focus,.featurecomponent article.feature>a.feature:hover{text-decoration:none}.featurecomponent article.feature div.icon{margin-bottom:.5rem}.featurecomponent article.feature div.summary>p:last-child{margin-bottom:0}.featurecomponent article.feature footer{margin-top:1rem}.imagecomponent figure{width:100%;margin-bottom:0}.imagecomponent figure>figcaption>p:last-child{margin-bottom:0}.imagecomponent a.image{display:block}@media (min-width:768px){.listcomponent .items>article.item{display:block}.listcomponent .items.image-align-left>article.item,.listcomponent .items.image-align-right>article.item,.listcomponent .items.image-align-stagger>article.item{display:flex}.listcomponent .items.image-align-left>article.item>div.image,.listcomponent .items.image-align-right>article.item>div.image,.listcomponent .items.image-align-stagger>article.item>div.image{margin-bottom:0}.listcomponent .items.image-align-left>article.item.has-image>div.image,.listcomponent .items.image-align-stagger>article.item.has-image:nth-child(odd)>div.image{order:1}.listcomponent .items.image-align-left>article.item.has-image>section.content,.listcomponent .items.image-align-stagger>article.item.has-image:nth-child(odd)>section.content{flex:1;order:2;margin-left:1rem}.listcomponent .items.image-align-right>article.item.has-image>div.image,.listcomponent .items.image-align-stagger>article.item.has-image:nth-child(2n)>div.image,.listcomponent .items>div.image{order:2}.listcomponent .items.image-align-right>article.item.has-image>section.content,.listcomponent .items.image-align-stagger>article.item.has-image:nth-child(2n)>section.content,.listcomponent .items>section.content{flex:1;order:1;margin-right:1rem}}.mediacomponent figure{width:100%;margin-bottom:0}.mediacomponent figure>figcaption>p:last-child{margin-bottom:0}.mediacomponent a.text{display:block}.mediacomponent a.text:hover{text-decoration:none}.mediacomponent a.text:hover span{text-decoration:underline}.mediacomponent a.text>i.fa{color:#868e96}.mediacomponent a.image{display:block}.mediacomponent a.image+a.text{margin-top:.5rem}.mediacomponent .rich>iframe{margin:0!important}.mediacomponent .video{width:100%;height:0;display:block;position:relative}.mediacomponent .video.four-three{padding-bottom:75%}.mediacomponent .video.sixteen-nine{padding-bottom:56.25%}.mediacomponent .video>iframe{top:0;left:0;border:0;width:100%;height:100%;position:absolute}.pagecomponent.page-title-hidden .content-container>article>header{display:none}.pagecomponent .content-container>article>div{margin-bottom:1rem}.scrolltotopbutton{opacity:0;outline:0;right:1rem;bottom:1rem;width:4rem;height:4rem;z-index:1000;position:fixed;display:block;overflow:hidden;visibility:hidden;white-space:nowrap;text-align:center;font-size:16px;line-height:4rem;box-shadow:0 0 20px rgba(0,0,0,.2);transition:opacity .3s 0s,visibility 0s .3s,color .15s ease-in-out 0s,background-color .15s ease-in-out 0s}.scrolltotopbutton.is-visible{opacity:1;visibility:visible}.scrolltotopbutton.fade-out{opacity:.5}.scrolltotopbutton:hover{opacity:1}@media (min-width:768px){.scrolltotopbutton{width:5rem;height:5rem;right:2rem;bottom:2rem;line-height:5rem}}@media (min-width:992px){.scrolltotopbutton{width:6rem;height:6rem;font-size:20px;line-height:6rem}}.tilecomponent .items{display:flex;flex-flow:row wrap;align-items:stretch}.tilecomponent .items>article.item{display:flex;flex-direction:column;flex:1 100%;padding:2%}.tilecomponent .items>article.item>section.content{margin-top:auto}.tilecomponent .items>article.item>section.content div.details>span{display:block;margin-right:0;margin-bottom:.25rem}@media (min-width:576px){.tilecomponent .items>article.item{flex:1 50%}}@media (min-width:768px){.tilecomponent .items>article.item{flex:1 33.3%}}@media (min-width:992px){.tilecomponent .items>article.item{flex:1 25%}}.detail-fields>dl dt{font-weight:500}.detail-fields>dl dd{font-size:.9rem;margin-bottom:1rem}.component.link{text-decoration:none}.component.link,.component.link>i.fa{display:inline-block}.component.link:active,.component.link:focus,.component.link:hover{text-decoration:none}.show-icons.hide-text .component.link{overflow:hidden;text-align:center;transition:color .15s ease-in-out 0s,background-color .15s ease-in-out 0s}.show-icons.hide-text .component.link>i.fa{display:block}.show-icons.hide-text .component.link.size-16{width:16px;height:16px;font-size:8px;line-height:16px}.show-icons.hide-text .component.link.size-16>i.fa{height:16px;line-height:16px}.show-icons.hide-text .component.link.size-24{width:24px;height:24px;font-size:12px;line-height:24px}.show-icons.hide-text .component.link.size-24>i.fa{height:24px;line-height:24px}.show-icons.hide-text .component.link.size-32{width:32px;height:32px;font-size:16px;line-height:32px}.show-icons.hide-text .component.link.size-32>i.fa{height:32px;line-height:32px}.show-icons.hide-text .component.link.size-48{width:48px;height:48px;font-size:24px;line-height:48px}.show-icons.hide-text .component.link.size-48>i.fa{height:48px;line-height:48px}.show-icons.hide-text .component.link.size-64{width:64px;height:64px;font-size:32px;line-height:64px}.show-icons.hide-text .component.link.size-64>i.fa{height:64px;line-height:64px}.show-icons.hide-text .component.link.size-96{width:96px;height:96px;font-size:48px;line-height:96px}.show-icons.hide-text .component.link.size-96>i.fa{height:96px;line-height:96px}.show-icons.hide-text .component.link.size-128{width:128px;height:128px;font-size:64px;line-height:128px}.show-icons.hide-text .component.link.size-128>i.fa{height:128px;line-height:128px}.hide-icons .component.link>i.fa,.hide-text .component.link>span.text{display:none} \ No newline at end of file diff --git a/client/src/styles/components/BaseListComponent.scss b/client/src/styles/components/BaseListComponent.scss index 4bc48c6..d34f0b9 100644 --- a/client/src/styles/components/BaseListComponent.scss +++ b/client/src/styles/components/BaseListComponent.scss @@ -55,8 +55,18 @@ > section.content { - header a { - color: inherit; + header { + + margin-bottom: $spacer-half; + + > * { + margin-bottom: 0; + } + + a { + color: inherit; + } + } div.details { diff --git a/client/src/styles/components/TileComponent.scss b/client/src/styles/components/TileComponent.scss index 2bb0c43..b8a061e 100644 --- a/client/src/styles/components/TileComponent.scss +++ b/client/src/styles/components/TileComponent.scss @@ -21,15 +21,10 @@ margin-top: auto; - header > * { - font-size: 1rem; - line-height: 1.2; - } - div.details > span { display: block; margin-right: 0; - margin-bottom: $spacer-half; + margin-bottom: $spacer-quarter; } } diff --git a/src/Extensions/Lists/ListViewExtension.php b/src/Extensions/Lists/ListViewExtension.php index 46a5640..a5821f6 100644 --- a/src/Extensions/Lists/ListViewExtension.php +++ b/src/Extensions/Lists/ListViewExtension.php @@ -33,6 +33,7 @@ use SilverWare\Forms\FieldSection; use SilverWare\Forms\ViewportsField; use SilverWare\ORM\FieldType\DBViewports; +use SilverWare\Tools\ClassTools; use SilverWare\Tools\ImageTools; use SilverWare\Tools\ViewTools; @@ -59,6 +60,7 @@ class ListViewExtension extends DataExtension * @config */ private static $db = [ + 'ListClass' => 'Varchar(255)', 'ListConfig' => 'Text' ]; @@ -173,6 +175,11 @@ public function updateCMSFields(FieldList $fields) 'ListViewOptions', $this->owner->fieldLabel('ListView'), [ + DropdownField::create( + 'ListClass', + $this->owner->fieldLabel('ListClass'), + $this->owner->getListClassOptions() + )->setEmptyString(' ')->setAttribute('data-placeholder', $placeholder), TextField::create( $this->nestName('Title'), $this->owner->fieldLabel('ListTitle') @@ -319,6 +326,7 @@ public function updateFieldLabels(&$labels) $labels['NumberOfItems'] = _t(__CLASS__ . '.NUMBEROFITEMS', 'Number of items'); $labels['ReverseItems'] = _t(__CLASS__ . '.REVERSEITEMS', 'Reverse items'); $labels['ImageItems'] = _t(__CLASS__ . '.IMAGEITEMS', 'Show only items with images'); + $labels['ListClass'] = _t(__CLASS__ . '.LISTCLASS', 'List class'); } /** @@ -494,6 +502,24 @@ public function getListSource() */ public function getListComponentClass() { + if ($class = $this->owner->ListClass) { + return $class; + } + + return $this->owner->getDefaultListComponentClass(); + } + + /** + * Answers the default class to use for the list component. + * + * @return string + */ + public function getDefaultListComponentClass() + { + if ($class = $this->owner->config()->list_component_class) { + return $class; + } + return Config::inst()->get(self::class, 'default_list_component_class'); } @@ -553,6 +579,22 @@ public function hasListComponent() return ($this->owner->ListComponent instanceof BaseListComponent); } + /** + * Answers an array of options for the list class field. + * + * @return array + */ + public function getListClassOptions() + { + $classes = ClassTools::singleton()->getVisibleSubClasses(BaseListComponent::class); + + foreach ($classes as $key => $value) { + $classes[$key] = Injector::inst()->get($key)->i18n_singular_name(); + } + + return $classes; + } + /** * Answers true if the given value is considered to be an 'empty' value. * diff --git a/src/Tools/ClassTools.php b/src/Tools/ClassTools.php index 9fa822f..05d3ef3 100644 --- a/src/Tools/ClassTools.php +++ b/src/Tools/ClassTools.php @@ -97,11 +97,11 @@ public function getVisibleSubClasses($name) $instance = Injector::inst()->get($class); if ($ancestor = $instance->stat('hide_ancestor')) { - $remove[$ancestor] = $ancestor; + $remove[strtolower($ancestor)] = $ancestor; } if ($instance instanceof HiddenClass) { - $remove[$class] = $class; + $remove[strtolower($class)] = $class; } }