From 473cae2043e45e562c34fa5152fcbeab1fc41798 Mon Sep 17 00:00:00 2001 From: Dorian Merz <merz@ub.uni-leipzig.de> Date: Thu, 14 May 2020 10:10:56 +0200 Subject: [PATCH] refs #17355 [fid_bbi] improved tag handling * removes counting for tags * adds markings for "tagged by you" and "tagged by others" * clarifies tag usage by improved wording --- fid_bbi/config/vufind/config.ini | 4 +-- fid_bbi/languages/de.ini | 6 ++++ fid_bbi/languages/en.ini | 6 ++++ themes/fid_bbi/scss/compiled.scss | 10 ++++++ themes/fid_bbi/templates/record/taglist.phtml | 31 +++++++++++++++++++ 5 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 themes/fid_bbi/templates/record/taglist.phtml diff --git a/fid_bbi/config/vufind/config.ini b/fid_bbi/config/vufind/config.ini index e88ec512d43..328b50ae64c 100644 --- a/fid_bbi/config/vufind/config.ini +++ b/fid_bbi/config/vufind/config.ini @@ -120,8 +120,8 @@ sender_email = "noreply@hab.de" require_login = false user_email_in_from = true -;[Social] -;tags = enabled +[Social] +tags = enabled [RecordPermissions] WorldcatTab = enabled diff --git a/fid_bbi/languages/de.ini b/fid_bbi/languages/de.ini index b02e5c1d940..0e2e457cfdc 100644 --- a/fid_bbi/languages/de.ini +++ b/fid_bbi/languages/de.ini @@ -444,6 +444,12 @@ copied_link_to_clipboard = "Link in Zwischenablage kopiert" add_tag_note = "Trennen Sie Tags mit einem Leerzeichen oder mit [ENTER]. Max. Länge eines Tags: 25 Zeichen." Your Tags = Meine Tags +#17355 +tagged_by_you = "von Ihnen markiert" +tagged_by_others = "von anderen markiert" +delete_tag = "Ihre Markierung entfernen" +confirm_tag = "ebenfalls markieren" + #16903 Open Access = Kostenfrei Zugänglich diff --git a/fid_bbi/languages/en.ini b/fid_bbi/languages/en.ini index 64fc44ddf14..84ca71a74ff 100644 --- a/fid_bbi/languages/en.ini +++ b/fid_bbi/languages/en.ini @@ -437,6 +437,12 @@ copied_link_to_clipboard = "Copied Link to Clipboard" add_tag_note = "Use a whitespace character or press [ENTER] to separate tags. Maximum length of a tag is 25 characters." Your Tags = My Tags +#17355 +tagged_by_you = "tagged by you" +tagged_by_others = "tagged by other users" +delete_tag = "remove your tag" +confirm_tag = "add your tag" + #16903 Open Access = Free Access diff --git a/themes/fid_bbi/scss/compiled.scss b/themes/fid_bbi/scss/compiled.scss index 0a1c0559582..fed1f2b7125 100644 --- a/themes/fid_bbi/scss/compiled.scss +++ b/themes/fid_bbi/scss/compiled.scss @@ -629,3 +629,13 @@ button.search-filter-toggle { width: 100%; } +.tag .tag-icon { + &.tagged-by-me { + @extend .fa; + @extend .fa-user; + } + &.tagged-by-others { + @extend .fa; + @extend .fa-users; + } +} \ No newline at end of file diff --git a/themes/fid_bbi/templates/record/taglist.phtml b/themes/fid_bbi/templates/record/taglist.phtml new file mode 100644 index 00000000000..1a1084abe17 --- /dev/null +++ b/themes/fid_bbi/templates/record/taglist.phtml @@ -0,0 +1,31 @@ +<!-- fid_bbi: record - taglist --> +<?php /* this is mostly a copy of the bootstrap3 version */?> +<div class="tagList<?=$loggedin ? ' loggedin' : ''?>"> + <?php if (count($tagList) > 0): ?> + <?php foreach ($tagList as $tag): ?> + <?php $is_me = isset($tag['is_me']) && null !== $tag['is_me'] ? $tag['is_me'] : false; + $is_others = !$is_me || ($tag['cnt'] > 1); + ?> + <div class="tag"> + <?php if ($is_me): ?><i class="tag-icon tagged-by-me" title="<?=$this->translate('tagged_by_you')?>"></i><?php endif;?> + <?php if ($is_others): ?><i class="tag-icon tagged-by-others" title="<?=$this->translate('tagged_by_others')?>"></i><?php endif;?> + <a href="<?=$this->url('tag-home')?>?lookfor=<?=urlencode($tag['tag'])?>"><?=$this->escapeHtml($tag['tag'])?></a> + <?php if($loggedin): ?> + <form method="POST" action="<?=$this->recordLink()->getActionUrl($this->driver, $is_me ? 'DeleteTag' : 'AddTag') ?>" class="tag-form"> + <input type="hidden" name="tag" value="<?=$this->escapeHtmlAttr($tag['tag'])?>"/> + <button type="submit" class="badge" onClick="ajaxTagUpdate(this, '<?=$this->escapeHtmlAttr($tag['tag'])?>', <?=$is_me ? 'true' : 'false' ?>);return false;"> + <?php if($is_me): ?> + <i class="fa fa-close" title="<?=$this->transEsc('delete_tag') ?>"></i> + <?php else: ?> + <i class="fa fa-plus" title="<?=$this->transEsc('confirm_tag') ?>"></i> + <?php endif; ?> + </button> + </form> + <?php endif; ?> + </div> + <?php endforeach; ?> + <?php else: ?> + <?=$this->transEsc('No Tags')?>, <?=$this->transEsc('Be the first to tag this record')?>! + <?php endif; ?> +</div> +<!-- fid_bbi: record - taglist - END --> \ No newline at end of file -- GitLab