Skip to content

Commit

Permalink
imp: Bring back the global actions on the news
Browse files Browse the repository at this point in the history
When there are several days to act on, it's sometimes better to be able
to act on all the days at once.
  • Loading branch information
marienfressinaud committed May 27, 2024
1 parent be6111b commit 1c3335d
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/assets/stylesheets/components/popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
position: relative;

display: inline-block;

text-align: left;
}

.popup__opener {
Expand Down
56 changes: 56 additions & 0 deletions src/views/news/index.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,62 @@
<?php endforeach; ?>
</section>
<?php endforeach; ?>

<div class="news__postpone">
<details
class="popup news__postpone-popup"
data-controller="popup"
data-action="toggle->popup#update click@window->popup#closeOnClickOutside keydown->popup#closeOnEscape"
>
<summary class="popup__opener">
<span class="button news__postpone-button">
<?= icon('menu') ?>
<?= _('Actions') ?>
</span>
</summary>

<nav class="popup__container popup__container--bottom" role="menu">
<div class="popup__title"><?= _('Empty the news') ?></div>

<form method="post" action="<?= url('mark collection as read', ['id' => $news->id]) ?>" role="menuitem">
<input type="hidden" name="csrf" value="<?= $csrf_token ?>" />
<input type="hidden" name="from" value="<?= url('news') ?>" />

<button class="popup__item popup__item--button">
<?= icon('check') ?>
<?= _('Mark all as read') ?>
</button>
</form>

<form method="post" action="<?= url('read collection later', ['id' => $news->id]) ?>" role="menuitem">
<input type="hidden" name="csrf" value="<?= $csrf_token ?>" />
<input type="hidden" name="from" value="<?= url('news') ?>" />

<button class="popup__item popup__item--button">
<?= icon('bookmark') ?>
<?= _('Read the links later') ?>
</button>
</form>

<div class="popup__separator"></div>

<form
method="post"
action="<?= url('never read collection', ['id' => $news->id]) ?>"
data-turbo-confirm="<?= _('You’ll remove all the news links, this action cannot be canceled. Are you sure?') ?>"
role="menuitem"
>
<input type="hidden" name="csrf" value="<?= $csrf_token ?>" />
<input type="hidden" name="from" value="<?= url('news') ?>" />

<button class="popup__item popup__item--button">
<?= icon('times') ?>
<?= _('Never see the links again') ?>
</button>
</form>
</nav>
</details>
</div>
<?php elseif ($beta_enabled): ?>
<p class="section__intro">
<?= _('Fill your news feed with the content published by the feeds that you follow.') ?>
Expand Down

0 comments on commit 1c3335d

Please sign in to comment.