Skip to content

Commit

Permalink
Adding title option
Browse files Browse the repository at this point in the history
  • Loading branch information
ESnark committed Nov 8, 2018
1 parent b277eff commit 2265990
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 2 deletions.
18 changes: 17 additions & 1 deletion asset/css/carousel.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
.siema {
margin: 1rem 0;
background-color: #000;
position: relative;
}

.siema-img {
Expand Down Expand Up @@ -34,4 +35,19 @@
.caret#right {
right: 20px;
transform: rotate(180deg);
}
}

#carousel-title {color: #FFF;
font-size: 30px;
border: 3px solid;
padding: 20px;
margin: 0;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
}
1 change: 1 addition & 0 deletions config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'perPage' => 1,
'loop' => true,
'draggable' => true,
'title' => ''
]
]
];
2 changes: 1 addition & 1 deletion config/module.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ author_link = "https://github.com/ESnark"
module_link = "https://github.com/Neo-Inspiration/Omeka-S-SimpleCarousel"
support_link = "https://github.com/Neo-Inspiration/Omeka-S-SimpleCarousel/issues"
configurable = false
version = "1.0.1"
version = "1.1.0"
omeka_version_constraint = "^1.1.0"
8 changes: 8 additions & 0 deletions src/Form/CarouselBlockForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,13 @@ public function init()
'label' => 'Draggable',
]
]);

$this->add([
'name' => 'o:block[__blockIndex__][o:data][title]',
'type' => Element\Text::class,
'options' => [
'label' => 'Title (option)',
]
]);
}
}
1 change: 1 addition & 0 deletions src/Site/BlockLayout/Carousel.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public function render(PhpRenderer $view, SitePageBlockRepresentation $block)
'perPage' => $block->dataValue('perPage'),
'loop' => $block->dataValue('loop'),
'draggable' => $block->dataValue('draggable'),
'title' => $block->dataValue('title'),
'urls' => $urls,
]);
}
Expand Down
12 changes: 12 additions & 0 deletions view/common/block-layout/simple-carousel.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
<?php
$this->headLink()->appendStylesheet($this->assetUrl('css/carousel.css', 'SimpleCarousel'));
$this->headScript()->appendFile($this->assetUrl('js/siema.min.js', 'SimpleCarousel'));

if ($title !== false && $title !== "") {
$title = sprintf('<p id="carousel-title">%s</p>', $title);
} else {
$title = false;
}

$caret = sprintf('<img class="caret" id="left" src="%s">', $this->assetUrl('caret.png', 'SimpleCarousel'));
$caret_r = sprintf('<img class="caret" id="right" src="%s">', $this->assetUrl('caret.png', 'SimpleCarousel'));
?>
Expand Down Expand Up @@ -33,6 +40,11 @@

let caret = '<?php echo $caret;?>';
let caret_r = '<?php echo $caret_r;?>';

<?php if ($title !== false): ?>
$('.siema').append('<?php echo $title;?>');
<?php endif ?>

$('.siema').append(caret);
$('.siema').append(caret_r);

Expand Down

0 comments on commit 2265990

Please sign in to comment.