@@ -13,21 +10,20 @@
{L_NEWS_CAT}
- [ {L_NEWS_FILTER_REMOVE} ]
+ {L_NEWS_FILTER_REMOVE}
-
+
{cat_block.NEWS_CAT}
+ {cat_block.NEWS_COUNT}
- [{cat_block.NEWS_COUNT} | {L_NEWS_ADD_NEW}]
-
- [{cat_block.NEWS_COUNT}]
-
+ {L_NEWS_ADD_NEW}
+
diff --git a/styles/prosilver/template/viewtopic_postrow.html b/styles/prosilver/template/viewtopic_postrow.html
index 1786d4b..c551e1b 100644
--- a/styles/prosilver/template/viewtopic_postrow.html
+++ b/styles/prosilver/template/viewtopic_postrow.html
@@ -1,91 +1,7 @@
-
-
-
-
style="display: none;">
- -
-
-
- {postrow.POST_AUTHOR_FULL}{postrow.POST_AUTHOR_FULL}
-
-
-
- - {postrow.RANK_TITLE}
{postrow.RANK_IMG}
-
-
- - {L_POSTS}{L_COLON} {postrow.POSTER_POSTS}
- - {L_JOINED}{L_COLON} {postrow.POSTER_JOINED}
- - {L_WARNINGS}{L_COLON} {postrow.POSTER_WARNINGS}
-
-
-
- - {postrow.PROFILE_FIELD1_NAME}{L_COLON} {postrow.PROFILE_FIELD1_VALUE}
-
-
-
-
-
- - {postrow.custom_fields.PROFILE_FIELD_NAME}{L_COLON} {postrow.custom_fields.PROFILE_FIELD_VALUE}
-
-
-
-
-
-
- -
- {L_CONTACT}{L_COLON}
-
-
{L_CONTACT}
-
-
-
-
- {% set REMAINDER = postrow.contact.S_ROW_COUNT % 4 %}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {postrow.L_POST_DELETED_MESSAGE}
- {postrow.L_POST_DISPLAY}
-
-
-
- {postrow.L_IGNORE_POST}
- {postrow.L_POST_DISPLAY}
-
-
-
-
style="display: none;">
-
-
-
+
+
+
+
+
+
+
+
-
{postrow.BUMPED_MESSAGE}
-
- {postrow.SIGNATURE}
-
-
-
-
-
-
-
+
+
+ {L_POST_REPORTED}
+
+
-
-
+
+

+
+
{postrow.MESSAGE}
+
+
+
+ -
+ {L_ATTACHMENTS}
+
+
+ - {postrow.attachment.DISPLAY_ATTACHMENT}
+
+
+
-
+
+
+
{L_NEWS_POLL}{L_COLON} {postrow.POLL_QUESTION} » {L_NEWS_POLL_GOTO}
+
+
{L_DOWNLOAD_NOTICE}
+
+
+ {postrow.DELETED_MESSAGE}
+
{L_REASON}{L_COLON} {postrow.DELETE_REASON}
+
+
+
+ {postrow.EDITED_MESSAGE}
+
{L_REASON}{L_COLON} {postrow.EDIT_REASON}
+
+
+
{postrow.BUMPED_MESSAGE}
+
+
{postrow.SIGNATURE}
+
+
+
+
diff --git a/styles/prosilver/theme/images/icon_news.gif b/styles/prosilver/theme/images/icon_news.gif
deleted file mode 100644
index 2304fbb..0000000
Binary files a/styles/prosilver/theme/images/icon_news.gif and /dev/null differ
diff --git a/styles/prosilver/theme/newspage-no-userinfo.css b/styles/prosilver/theme/newspage-no-userinfo.css
deleted file mode 100644
index cac39cc..0000000
--- a/styles/prosilver/theme/newspage-no-userinfo.css
+++ /dev/null
@@ -1,21 +0,0 @@
-dl.postprofile {
- display: none;
-}
-
-div.postbody {
- width: 100%;
-}
-
-@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) {
- dl.postprofile {
- display: block;
- }
-
- .post .postprofile {
- min-height: 0;
- }
-
- div.postbody {
- width: 74%;
- }
-}
diff --git a/styles/prosilver/theme/newspage.css b/styles/prosilver/theme/newspage.css
index 42e47a5..93bb5d1 100644
--- a/styles/prosilver/theme/newspage.css
+++ b/styles/prosilver/theme/newspage.css
@@ -1,26 +1,220 @@
-.icon-newspage {
- background-image: url("./images/icon_news.gif");
+/* News items: title, byline, text, then one footer line */
+.newspage-item {
+ background-color: #ecf3f7;
+ border-radius: 7px;
+ margin-bottom: 10px;
+ padding: 10px 14px;
}
-a.arrow-right-on-left {
- background-position: 0 60%;
+.newspage-item-header {
+ margin-bottom: 8px;
}
-a.arrow-right-on-left, a.arrow-right-on-left:active,
-a.arrow-right-on-left:visited {
- padding-left: 12px;
- padding-right: 0;
+.newspage-item .post-buttons {
+ float: right;
+ margin-left: 10px;
}
-a.arrow-right-on-left:hover {
+.newspage-item-title {
+ border-bottom: 0;
+ font-family: "Trebuchet MS", Helvetica, Arial, sans-serif;
+ font-size: 1.7em;
+ margin: 0 0 3px;
+ padding: 0;
+ text-transform: none;
+}
+
+.newspage-byline,
+.newspage-poster {
+ color: #4c5d77;
+ font-size: 1.1em;
+ line-height: 1.6;
+ margin: 0;
+}
+
+.newspage-poster {
+ font-size: 1em;
+}
+
+.newspage-poster span + span::before {
+ content: "\00B7";
+ margin: 0 0.4em;
+}
+
+.newspage-separator {
+ margin: 0 0.3em;
+}
+
+.newspage-avatar img {
+ border-radius: 50%;
+ height: 24px;
+ margin-right: 4px;
+ vertical-align: middle;
+ width: 24px;
+}
+
+.newspage-lead-image {
+ display: block;
+ margin: 4px 0 10px;
+}
+
+.newspage-lead-image img {
+ border-radius: 5px;
+ display: block;
+ max-height: 320px;
+ max-width: 100%;
+ object-fit: cover;
+}
+
+.newspage-item .content {
+ font-size: 1.3em;
+ line-height: 1.5;
+ min-height: 0;
+ padding-bottom: 0;
+}
+
+.newspage-item .signature {
+ border-top-color: #ccc;
+}
+
+.newspage-item-footer {
+ align-items: center;
+ border-top: 1px solid #cad9e5;
+ clear: both;
+ display: flex;
+ flex-wrap: wrap;
+ font-size: 1.1em;
+ gap: 6px 18px;
+ margin-top: 10px;
+ padding-top: 8px;
+}
+
+.newspage-item-footer .icon {
+ font-size: 1em;
+}
+
+.newspage-comments .icon {
+ margin-right: 3px;
+}
+
+.newspage-read-more {
+ font-weight: bold;
+}
+
+.newspage-comments {
+ color: #4c5d77;
+}
+
+.newspage-item-footer .newspage-top {
+ color: #8f8f8f;
+ font-size: 1.3em;
+ margin-left: auto;
+}
+
+@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) {
+ .newspage-item .post-buttons {
+ float: none;
+ margin: 0 0 6px;
+ }
+}
+
+/* Filter bar: forum and month as select-style buttons, then the active filters */
+.newspage-filters .newspage-dropdown {
+ margin-right: 6px;
+}
+
+.newspage-filters .newspage-filter {
+ color: #47536b;
+ font-weight: normal;
+}
+
+.newspage-filters .newspage-filter-active {
+ border-color: #105289;
+ color: #105289;
+ font-weight: bold;
+}
+
+.newspage-filters .newspage-filter .icon {
+ margin-left: 2px;
+}
+
+.newspage-dropdown .dropdown-contents {
+ min-width: 220px;
+}
+
+.newspage-dropdown .dropdown-contents li {
+ align-items: baseline;
+ display: flex;
+ gap: 6px;
+ padding: 4px 8px;
+ white-space: nowrap;
+}
+
+.newspage-dropdown .newspage-option {
+ flex: 1;
+}
+
+.newspage-dropdown .newspage-remove {
+ margin-left: auto;
+}
+
+.newspage-count {
+ background-color: #e1ebf2;
+ border-radius: 8px;
+ color: #536482;
+ font-size: 0.9em;
+ padding: 0 6px;
+}
+
+.newspage-add {
+ font-weight: bold;
+}
+
+.newspage-active-filters {
+ align-items: center;
+ color: #4c5d77;
+ display: flex;
+ flex-wrap: wrap;
+ font-size: 1.1em;
+ gap: 6px;
+ margin: 0 0 10px;
+}
+
+.newspage-chip {
+ background-color: #e1ebf2;
+ border: 1px solid #b4c3d4;
+ border-radius: 12px;
+ color: #105289;
+ padding: 1px 6px 1px 10px;
+}
+
+.newspage-chip:hover {
+ background-color: #d1dfea;
text-decoration: none;
- background-position: 3px 60%;
}
-.newspage-dropdown ul li:first-child {
- padding-left: 5px;
+.newspage-clear {
+ margin-left: 4px;
+}
+
+/* A single news item: the page heading is its title */
+.newspage-back {
+ font-size: 1.1em;
+ margin: 0 0 4px;
+}
+
+.newspage-back .icon {
+ margin-right: 3px;
+}
+
+h2.newspage-single-title {
+ margin-bottom: 10px;
+}
+
+.newspage-reply {
+ font-weight: bold;
}
-#newspage_settings .dropdown-contents ul li {
- padding: 5px;
+.newspage-reply .icon {
+ margin-right: 3px;
}
diff --git a/tests/controller/settings_test.php b/tests/controller/settings_test.php
index a0af62b..c687596 100644
--- a/tests/controller/settings_test.php
+++ b/tests/controller/settings_test.php
@@ -41,6 +41,7 @@ public function save_settings_data()
'news_attach_show' => false,
'news_cat_show' => true,
'news_archive_show' => true,
+ 'news_lead_image' => true,
),
array(
'news_char_limit' => 250,
@@ -53,6 +54,7 @@ public function save_settings_data()
'news_attach_show' => false,
'news_cat_show' => true,
'news_archive_show' => true,
+ 'news_lead_image' => true,
),
),
'limits are applied' => array(
diff --git a/tests/lead_image_test.php b/tests/lead_image_test.php
new file mode 100644
index 0000000..2069118
--- /dev/null
+++ b/tests/lead_image_test.php
@@ -0,0 +1,75 @@
+ array(
+ '
Just text.
',
+ '
Just text.
', '', '',
+ ),
+ 'smilies are not images' => array(
+ 'Hello

there',
+ 'Hello

there', '', '',
+ ),
+ 'first BBCode image' => array(
+ '
Before

After

',
+ '
Before
After

', 'https://example.com/a.png', 'Image',
+ ),
+ 'linked image loses its link' => array(
+ '

Text',
+ 'Text', 'https://example.com/a.png', 'Image',
+ ),
+ 'inline attachment block is removed' => array(
+ 'Intro

- The image
- pixel.png (69 Bytes)
Outro',
+ 'Intro Outro', './download/file.php?id=1', 'The image',
+ ),
+ 'line breaks after the image are dropped' => array(
+ '

' . "\n" . '
' . "\n" . 'Thanks to everyone.
Second line.',
+ 'Thanks to everyone.
Second line.', 'https://example.com/a.png', 'Image',
+ ),
+ 'entities in the address are decoded once' => array(
+ '

',
+ '', './download/file.php?id=1&sid=abc', 'Pic',
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider take_data
+ *
+ * @param string $html Rendered post text
+ * @param string $expected Text without the image
+ * @param string $src Image address
+ * @param string $alt Image text
+ */
+ public function test_take($html, $expected, $src, $alt)
+ {
+ $taken = (new lead_image())->take($html);
+
+ $this->assertSame($expected, $taken['html']);
+ $this->assertSame($src, $taken['src']);
+ $this->assertSame($alt, $taken['alt']);
+ }
+}