diff --git a/README.md b/README.md index aa04f04..39c6df0 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,8 @@ This is an equivalent for the [shortcode as a page] in Omeka classic too. Display direct links to the current resource in the public user bar in order to simplify edition and management of resources (fix [#1283]). +The revert links are available too. They display the resource in the default +site, or in the first one (fix [#1259]). #### Random order of resources @@ -148,6 +150,7 @@ Copyright [shortcode as a page]: https://github.com/omeka/plugin-SimplePages/pull/24 [#1156]: https://github.com/omeka/omeka-s/issues/1156 [#1258]: https://github.com/omeka/omeka-s/issues/1258 +[#1259]: https://github.com/omeka/omeka-s/issues/1259 [#1274]: https://github.com/omeka/omeka-s/issues/1274 [#1276]: https://github.com/omeka/omeka-s/issues/1276 [#1281]: https://github.com/omeka/omeka-s/issues/1281 diff --git a/config/module.config.php b/config/module.config.php index d8e71f9..dfe5948 100644 --- a/config/module.config.php +++ b/config/module.config.php @@ -18,6 +18,7 @@ 'factories' => [ 'defaultSiteSlug' => Service\ViewHelper\DefaultSiteSlugFactory::class, 'logger' => Service\ViewHelper\LoggerFactory::class, + 'publicResourceUrl' => Service\ViewHelper\PublicResourceUrlFactory::class, ], ], 'block_layouts' => [ diff --git a/src/Service/ViewHelper/PublicResourceUrlFactory.php b/src/Service/ViewHelper/PublicResourceUrlFactory.php new file mode 100644 index 0000000..171fbbf --- /dev/null +++ b/src/Service/ViewHelper/PublicResourceUrlFactory.php @@ -0,0 +1,25 @@ +get('ViewHelperManager')->get('defaultSiteSlug'); + return new PublicResourceUrl($defaultSiteSlug()); + } +} diff --git a/src/View/Helper/PublicResourceUrl.php b/src/View/Helper/PublicResourceUrl.php new file mode 100644 index 0000000..d52f6d3 --- /dev/null +++ b/src/View/Helper/PublicResourceUrl.php @@ -0,0 +1,43 @@ +defaultSiteSlug = $defaultSiteSlug; + } + + /** + * Return the url to the public default site page or a resource. + * + * @uses AbstractResourceRepresentation::siteUrl() + * + * @param AbstractResourceRepresentation $resource + * @param bool $canonical Whether to return an absolute URL + * @return string + */ + public function __invoke(AbstractResourceRepresentation $resource, $canonical = false) + { + // Manage the case where there is no site. + return $this->defaultSiteSlug + ? $resource->siteUrl($this->defaultSiteSlug, $canonical) + : ''; + } +} diff --git a/view/omeka/admin/item-set/show.phtml b/view/omeka/admin/item-set/show.phtml new file mode 100644 index 0000000..e7f6f6b --- /dev/null +++ b/view/omeka/admin/item-set/show.phtml @@ -0,0 +1,86 @@ +plugin('translate'); +$escape = $this->plugin('escapeHtml'); +$this->htmlElement('body')->appendAttribute('class', 'item-sets show'); +$viewItemsLink = $this->url( + 'admin/default', + ['controller' => 'item', 'action' => 'browse'], + [ + 'query' => [ + 'item_set_id' => $itemSet->id() + ] + ] +); +if ($owner = $itemSet->owner()) { + $ownerText = $escape($itemSet->owner()->name()); +} else { + $ownerText = $translate('[no owner]'); +} + +$sectionNavs = [ + 'item-set-metadata' => $translate('Metadata'), + 'item-set-linked' => $translate('Linked resources'), +]; +?> + +pageTitle($itemSet->displayTitle(), 1, $translate('Item sets')); ?> + +