Skip to content

Commit

Permalink
[FEATURE] Add support for extension bookmark_pages
Browse files Browse the repository at this point in the history
  • Loading branch information
buepro committed Apr 28, 2021
1 parent 670b26e commit 52e5ba9
Show file tree
Hide file tree
Showing 20 changed files with 210 additions and 15 deletions.
7 changes: 7 additions & 0 deletions Configuration/TCA/Overrides/101_sys_template.php
Expand Up @@ -92,6 +92,13 @@
'Pizpalue - felogin'
);
}
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('bookmark_pages')) {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
$_EXTKEY,
'Extensions/bookmark_pages/Configuration/TypoScript',
'Pizpalue - bookmark_pages'
);
}
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('indexed_search')) {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
$_EXTKEY,
Expand Down
1 change: 1 addition & 0 deletions Documentation/Administration/Index.rst
Expand Up @@ -44,6 +44,7 @@ news 8.5.0
eventnews 4.0.0
tt_address 5.2.0
timelog 1.6.0
bookmark_pages 2.0.0
================================ ================

Structure elements
Expand Down
1 change: 1 addition & 0 deletions Documentation/Introduction/Index.rst
Expand Up @@ -70,6 +70,7 @@ Extending extensions
- `eventnews <https://extensions.typo3.org/extension/eventnews>`__
- `tt_address <https://extensions.typo3.org/extension/tt_address>`__
- `timelog <https://extensions.typo3.org/extension/timelog>`__
- `bookmark_pages <https://github.com/buepro/typo3-bookmark_pages>`__

Various
-------
Expand Down
@@ -0,0 +1,4 @@
plugin.tx_bookmarkpages.settings {
# cat=plugin.tx_bookmarkpages/general; type=string; label=Additional class for dropdown (e.g. dropup)
dropdownClass =
}
@@ -0,0 +1,14 @@
plugin.tx_bookmarkpages {
view {
templateRootPaths.20 = EXT:pizpalue/Extensions/bookmark_pages/Resources/Private/Templates
partialRootPaths.20 = EXT:pizpalue/Extensions/bookmark_pages/Resources/Private/Partials
}
settings {
dropdownClass = {$plugin.tx_bookmarkpages.settings.dropdownClass}
}
}

page {
includeCSS.pizpalueBookmarkPages = EXT:pizpalue/Extensions/bookmark_pages/Resources/Public/Scss/general.scss
includeJSFooterlibs.bookmark_pages_jquery >
}
11 changes: 11 additions & 0 deletions Extensions/bookmark_pages/Resources/Private/.htaccess
@@ -0,0 +1,11 @@
# Apache < 2.3
<IfModule !mod_authz_core.c>
Order allow,deny
Deny from all
Satisfy All
</IfModule>

# Apache >= 2.3
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
10 changes: 10 additions & 0 deletions Extensions/bookmark_pages/Resources/Private/Partials/ListItem.html
@@ -0,0 +1,10 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://xsd.helmut-hummel.de/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:t="http://typo3.org/ns/Helhum/TyposcriptRendering/ViewHelpers" data-namespace-typo3-fluid="true">

<li class="dropdown-item">
<f:link.external class="bookmark-link" uri="{bookmark.url}" title="{bookmark.title}">{bookmark.title}</f:link.external>
<a class="action-button bookmark-ajax-submit ppicon ppicon-trash-alt" data-remove="{bookmark.id}" href="javascript:void(0);"></a>
</li>

</html>
@@ -0,0 +1,34 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://xsd.helmut-hummel.de/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:t="http://typo3.org/ns/Helhum/TyposcriptRendering/ViewHelpers" data-namespace-typo3-fluid="true">

<f:layout name="Default" />

<f:section name="main">
<f:if condition="{settings.listType} === 'alternative'">
<f:then>
<ul class="bookmarks-list ppc-complementary"></ul>
</f:then>
<f:else>
<div class="btn-group{f:if(condition: settings.dropdownClass, then: ' {settings.dropdownClass}')}">
<button type="button"
class="btn btn-primary dropdown-toggle dropdown-toggle-split"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Bookmarks
</button>
<button type="button" class="btn btn-default bookmark-ajax-submit bookmark-this-page" title="{f:translate(key: 'bookmarkThisPage', extensionName: 'bookmarkPages')}">
<i class="ppicon ppicon-star-regular"></i>
</button>
<button type="button" class="btn btn-default ppc-bookmarked">
<i class="ppicon ppicon-star-solid"></i>
</button>
<ul class="bookmarks-list dropdown-menu"></ul>
<template id="bookmark-template">
<f:render partial="ListItem" arguments="{bookmark: bookmark}" />
</template>
</div>
</f:else>
</f:if>
</f:section>

</html>
@@ -0,0 +1,34 @@
(function ($) {
$(function () {

if ( $( "#is-bookmarked" ).length ) {
// add a class to all bookmark links on the page because somewhere is a #is-bookmarked flag in html
$('.bookmark-this-page').addClass('is-bookmarked');
}

// doing it this way:
// $('.bookmark-ajax-submit').on('click', function (event) {
// would not work for initially hidden elements

$('.bookmark-pages').on('click', '.bookmark-ajax-submit', function (event) {
event.preventDefault();
var $submitButton = $(this);
var uri = $submitButton.data('ajaxuri');
$.ajax(
uri,
{
'type': 'post'
}
).done(function (result) {
$('#bookmarks-list').html(result.list);

if (result.isBookmarked) {
$('.bookmark-this-page').addClass('is-bookmarked');
} else {
$('.bookmark-this-page').removeClass('is-bookmarked');
}
});
});

});
})(jQuery);
47 changes: 47 additions & 0 deletions Extensions/bookmark_pages/Resources/Public/Scss/general.scss
@@ -0,0 +1,47 @@
.bookmark-pages {
li {
display: flex;
justify-content: space-between;
align-items: center;
}
.dropdown-item {
.bookmark-ajax-submit {
margin-left: 1.5em;
margin-bottom: 0.2em;
}
}
.btn {
&.dropdown-toggle-split:after {
margin-left: 0.5rem;
vertical-align: middle;
}
&.dropdown-toggle-split:before {
margin-right: 0.5rem;
vertical-align: middle;
}
&.bookmark-this-page {
display: block;
+.ppc-bookmarked {
display: none;
}
&.is-bookmarked {
display: none;
+.ppc-bookmarked {
display: block;
}
}
}
}
.ppicon {
text-decoration: none;
}
}
.bookmarks-list.ppc-complementary {
&, & li {
padding-left: 0;
padding-right: 0;
}
}
.footer-section {
overflow: visible;
}
54 changes: 41 additions & 13 deletions Resources/Public/Fonts/pizpalueicon.css
Expand Up @@ -3,10 +3,10 @@

@font-face {
font-family:"PizpalueIcon";
src:url("pizpalueicon.eot?9e7bd3c406c7f864dcdfa51c5dc697e0");
src:url("pizpalueicon.eot?9e7bd3c406c7f864dcdfa51c5dc697e0#iefix") format("embedded-opentype"),
url("pizpalueicon.woff?9e7bd3c406c7f864dcdfa51c5dc697e0") format("woff"),
url("pizpalueicon.ttf?9e7bd3c406c7f864dcdfa51c5dc697e0") format("truetype");
src:url("pizpalueicon.eot?441433a3f0f8a0025584de9a70b9ebae");
src:url("pizpalueicon.eot?441433a3f0f8a0025584de9a70b9ebae#iefix") format("embedded-opentype"),
url("pizpalueicon.woff?441433a3f0f8a0025584de9a70b9ebae") format("woff"),
url("pizpalueicon.ttf?441433a3f0f8a0025584de9a70b9ebae") format("truetype");
font-weight:normal;
font-style:normal;
}
Expand Down Expand Up @@ -210,64 +210,92 @@
}


.ppicon-star-regular:before,
.bootstrappackageicon-star-regular:before,
.glyphicon-star-regular:before {
content:"\f11b";
}


.ppicon-star-solid:before,
.bootstrappackageicon-star-solid:before,
.glyphicon-star-solid:before {
content:"\f11c";
}


.ppicon-tag:before,
.bootstrappackageicon-tag:before,
.glyphicon-tag:before {
content:"\f11b";
content:"\f11d";
}


.ppicon-tags:before,
.bootstrappackageicon-tags:before,
.glyphicon-tags:before {
content:"\f11c";
content:"\f11e";
}


.ppicon-times-circle:before,
.bootstrappackageicon-times-circle:before,
.glyphicon-times-circle:before {
content:"\f11f";
}


.ppicon-times:before,
.bootstrappackageicon-times:before,
.glyphicon-times:before {
content:"\f11d";
content:"\f120";
}


.ppicon-trash-alt:before,
.bootstrappackageicon-trash-alt:before,
.glyphicon-trash-alt:before {
content:"\f121";
}


.ppicon-twitter:before,
.bootstrappackageicon-twitter:before,
.glyphicon-twitter:before {
content:"\f11e";
content:"\f122";
}


.ppicon-user:before,
.bootstrappackageicon-user:before,
.glyphicon-user:before {
content:"\f11f";
content:"\f123";
}


.ppicon-vimeo:before,
.bootstrappackageicon-vimeo:before,
.glyphicon-vimeo:before {
content:"\f120";
content:"\f124";
}


.ppicon-vk:before,
.bootstrappackageicon-vk:before,
.glyphicon-vk:before {
content:"\f121";
content:"\f125";
}


.ppicon-xing:before,
.bootstrappackageicon-xing:before,
.glyphicon-xing:before {
content:"\f122";
content:"\f126";
}


.ppicon-youtube:before,
.bootstrappackageicon-youtube:before,
.glyphicon-youtube:before {
content:"\f123";
content:"\f127";
}
Binary file modified Resources/Public/Fonts/pizpalueicon.eot
Binary file not shown.
2 changes: 1 addition & 1 deletion Resources/Public/Fonts/pizpalueicon.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified Resources/Public/Fonts/pizpalueicon.ttf
Binary file not shown.
Binary file modified Resources/Public/Fonts/pizpalueicon.woff
Binary file not shown.
1 change: 1 addition & 0 deletions Resources/Public/Icons/PizpalueIcon/star-regular.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Resources/Public/Icons/PizpalueIcon/star-solid.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Resources/Public/Icons/PizpalueIcon/times-circle.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 52e5ba9

Please sign in to comment.