Browse Source

Allow styling entries by category in User CSS (#8397)

* Allow styling entries by category in User CSS

Since we have `data-feed`, it is useful to have `data-category` too.

Example of usage to hide titles in all entries that belong to a specific category ID:
```css
[data-category="6"] {
	.title { display: none !important }
	.summary {
		position: relative;
		bottom: 2rem;
	}
}
```

* Add `data-link` to entries in `reader.phtml`
Inverle 2 months ago
parent
commit
4739bcc62e
2 changed files with 3 additions and 0 deletions
  1. 1 0
      app/views/index/normal.phtml
  2. 2 0
      app/views/index/reader.phtml

+ 1 - 0
app/views/index/normal.phtml

@@ -79,6 +79,7 @@ $today = @strtotime('today');
 		?><?= $useKeepUnreadImportant && ($this->feed->priority() >= FreshRSS_Feed::PRIORITY_IMPORTANT) ? ' keep_unread ' : ''
 		?>" id="flux_<?= $this->entry->id()
 		?>" data-entry="<?= $this->entry->id()
+		?>" data-category="<?= $this->feed->categoryId()
 		?>" data-feed="<?= $this->feed->id()
 		?>" data-priority="<?= $this->feed->priority()
 		?>" data-link="<?= $this->entry->link()

+ 2 - 0
app/views/index/reader.phtml

@@ -37,8 +37,10 @@ $useKeepUnreadImportant = !FreshRSS_Context::isImportant() && !FreshRSS_Context:
 		?><?= $useKeepUnreadImportant && ($this->feed->priority() >= FreshRSS_Feed::PRIORITY_IMPORTANT) ? ' keep_unread ' : ''
 		?>" id="flux_<?= $this->entry->id()
 		?>" data-entry="<?= $this->entry->id()
+		?>" data-category="<?= $this->feed->categoryId()
 		?>" data-feed="<?= $this->feed->id()
 		?>" data-priority="<?= $this->feed->priority()
+		?>" data-link="<?= $this->entry->link()
 		?>"><?php $this->renderHelper('index/article'); ?>
 	</div><?php
 	endforeach;