Skip to content

Commit

Permalink
Adjusted to use same styles, removed extra parts of code
Browse files Browse the repository at this point in the history
  • Loading branch information
LuomaJuha committed Oct 15, 2024
1 parent 81f48f3 commit d5889d2
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 102 deletions.
39 changes: 0 additions & 39 deletions themes/finna2/js/finna-mylist.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,45 +298,6 @@ finna.myList = (function finnaMyList() {
$(".list-visibility input[type='radio']").off('change').on("change", function onChangeVisibility() {
updateList({}, refreshLists, 'visibility');
});

// delete list
var active = $('.mylist-bar').find('a.active');
active.find('.remove').off('click').on('click', function onClickRemove(e) {
var target = $(this);
var form = $('.delete-list');
var prompt = form.find('.dropdown-menu');

function repositionPrompt(ev, data) {
var pos = target.offset();
var left = data.w / 2 - prompt.width() / 2;

prompt.css({
'left': left,
'top': pos.top + 30
});
}

function initRepositionListener() {
$(window).on('throttled-resize.finna', repositionPrompt);
}

prompt.find('.confirm').off('click').on('click', function onClickConfirm(ev) {
form.submit();
ev.preventDefault();
});
prompt.find('.cancel').off('click').on('click', function onClickCancel(ev) {
$(window).off('throttled-resize.finna', repositionPrompt);
prompt.hide();
$('.remove-favorite-list').trigger("focus");
ev.preventDefault();
});

repositionPrompt({}, {w: $(window).width(), h: $(window).height()});
initRepositionListener();
prompt.show();
prompt.find('.confirm a').focus();
e.preventDefault();
});
}

$('.add-new-list .icon').on('click', function createNewList() {
Expand Down
36 changes: 21 additions & 15 deletions themes/finna2/less/finna/mylist.less
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,6 @@
> a:not(.add-new-list) {
color: @text-color;
}
.remove-favorite-list {
border: 0;
background-color: transparent;
padding: 1px;
&:focus {
border: 1px solid @action-link-color;
border-style: dotted;
}

.icon {
margin-right: 3px;
color: @action-link-color;
font-size: 1em;
}
}
.favorite-list-holder {
height: 25px;

Expand Down Expand Up @@ -556,3 +541,24 @@ span.caret {
margin-top: 10px;
}
}

.delete-list-btn-wrapper {
&.left .dropdown-menu {
left: initial;
right: 0;
}
.dropdown-header {
color: inherit;
font-size: 14px;
}
}

.dropdown-menu .delete-list-btn-wrapper {
padding: 0 0 4px 4px;
.dropdown-menu {
border: 1px solid @gray-lighter;
border-radius: 4px;
top: 100%;
position: absolute;
}
}
14 changes: 0 additions & 14 deletions themes/finna2/less/finna/reservationlist.less
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,6 @@
}
}
}
.reservation-list-delete-wrapper {
.dropdown-menu {
top: 100%;
left: -50%;
}
&.left .dropdown-menu {
left: initial;
right: 0;
}
.dropdown-header {
color: inherit;
font-size: 14px;
}
}

#ReservationListRequest.dynamic-form {
textarea {
Expand Down
36 changes: 21 additions & 15 deletions themes/finna2/scss/finna/mylist.scss
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,6 @@
> a:not(.add-new-list) {
color: $text-color;
}
.remove-favorite-list {
border: 0;
background-color: transparent;
padding: 1px;
&:focus {
border: 1px solid $action-link-color;
border-style: dotted;
}

.icon {
margin-right: 3px;
color: $action-link-color;
font-size: 1em;
}
}
.favorite-list-holder {
height: 25px;

Expand Down Expand Up @@ -556,3 +541,24 @@ span.caret {
margin-top: 10px;
}
}

.delete-list-btn-wrapper {
&.left .dropdown-menu {
left: initial;
right: 0;
}
.dropdown-header {
color: inherit;
font-size: 14px;
}
}

.dropdown-menu .delete-list-btn-wrapper {
padding: 0 0 4px 4px;
.dropdown-menu {
border: 1px solid $gray-lighter;
border-radius: 4px;
top: 100%;
position: absolute;
}
}
14 changes: 0 additions & 14 deletions themes/finna2/scss/finna/reservationlist.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,6 @@
}
}
}
.reservation-list-delete-wrapper {
.dropdown-menu {
top: 100%;
left: -50%;
}
&.left .dropdown-menu {
left: initial;
right: 0;
}
.dropdown-header {
color: inherit;
font-size: 14px;
}
}

#ReservationListRequest.dynamic-form {
textarea {
Expand Down
17 changes: 14 additions & 3 deletions themes/finna2/templates/myresearch/mylist-navi.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,25 @@
<?=$this->icon('public') ?>
<?php endif; ?>
<div class="pull-right">(<?=$current['count']?>)</div>
<?php if ($active): ?>
<button class="pull-right remove-favorite-list remove"><?=$this->icon('list-remove') ?></button>
<?php endif; ?>
</div>
</a>
<?php if ($active): ?>
<?php $url = $this->url('list-page', ['lid' => $list->getId()], ['force_canonical' => true]) ?>
<?= $this->partial('myresearch/list-visibility.phtml', ['listUrl' => $url, 'public' => $list->isPublic()]); ?>
<span class="delete-list-btn-wrapper">
<?=
$this->component(
'confirm-button',
[
'buttonLink' => $this->url('myresearch-deletelist', [], ['query' => ['listID' => $list->getId()]]),
'buttonLabel' => 'delete_list',
'buttonClass' => 'btn btn-link',
'confirmLink' => $this->url('myresearch-deletelist', [], ['query' => ['listID' => $list->getId(), 'confirm' => 1]]),
'header' => 'confirm_delete_list_text',
]
)
?>
</span>
<?php endif; ?>
</li>
<?php endforeach; ?>
Expand Down
2 changes: 1 addition & 1 deletion themes/finna2/templates/reservationlist/displaylist.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<!-- Add order buttons if the list has not been ordered yet. -->
<a href="<?=$this->escapeHtmlAttr($this->url('reservationlist-placeorder', ['id' => $this->list->getId()]))?>" class="btn btn-primary" data-lightbox><?=$this->transEsc('ReservationList::Order List')?></a>
<?php endif; ?>
<span class="reservation-list-delete-wrapper">
<span class="delete-list-btn-wrapper">
<?=
$this->component(
'confirm-button',
Expand Down
2 changes: 1 addition & 1 deletion themes/finna2/templates/reservationlist/displaylists.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<a href="<?= $this->url('reservationlist-displaylist', ['id' => $list->getId()])?>"><?= $this->escapeHtml($list->getTitle()) ?></a>
</div>
<div class="pull-right">
<span class="reservation-list-delete-wrapper left">
<span class="delete-list-btn-wrapper left">
<?=
$this->component(
'confirm-button',
Expand Down

0 comments on commit d5889d2

Please sign in to comment.